diff Templates.lua @ 121:1f68c46bc4de

BuffFrame: - Added interface framework for selectively hiding certain buff's auxiliary values.
author Nenue
date Mon, 17 Jul 2017 11:51:31 -0400
parents 8c94bee4fdfc
children ea2c616a3b4f
line wrap: on
line diff
--- a/Templates.lua	Sun Jun 04 18:20:40 2017 -0400
+++ b/Templates.lua	Mon Jul 17 11:51:31 2017 -0400
@@ -22,6 +22,9 @@
 Veneer.ConfigLayerBase = ConfigLayer
 Veneer.AnimationBase = Animation
 
+local ANCHOR_BUTTON_TYPES = {
+  'TOPLEFT', 'TOP', 'TOPRIGHT', 'RIGHT', 'LEFT', 'CENTER', 'BOTTOMLEFT', 'BOTTOM', 'BOTTOMRIGHT'
+}
 
 function ConfigLayer:OnLoad()
   local handler = self:GetParent()
@@ -30,6 +33,43 @@
   for i, region in ipairs(handler.ConfigLayers) do
     region:SetShown(Veneer.ConfigMode)
   end
+  self.handler = handler
+end
+
+function ConfigLayer:OnShow()
+  self:Update()
+end
+
+function ConfigLayer:Update()
+  if not self.anchorButtons then
+    self.anchorButtons = {}
+    for _, anchorPoint in ipairs(ANCHOR_BUTTON_TYPES) do
+      local button = CreateFrame('Button', nil, self, 'VeneerAnchorButtonTemplate')
+      button.anchorPoint = anchorPoint
+      button:SetScript('OnMouseDown', function() end)
+      button:SetScript('OnMouseUp', function() end)
+      button:SetPoint(anchorPoint)
+      button:SetSize(16,16)
+
+      self.anchorButtons[anchorPoint] = button
+    end
+  end
+
+  for anchorPoint, button in pairs(self.anchorButtons) do
+    if anchorPoint == self.handler.anchorPoint then
+      button:GetNormalTexture():SetColorTexture(0,1,0,1)
+    else
+      button:GetNormalTexture():SetColorTexture(0.5,0.5,0.5,1)
+    end
+  end
+
+  self:RegisterForDrag('LeftButton')
+end
+
+function ConfigLayer:OnDragStart()
+
+end
+function ConfigLayer:OnDragStop()
 
 end