changeset 40:5def7d061738

Finally have the consolidated buff toggle stuff worked out
author Chris Mellon <arkanes@gmail.com>
date Tue, 11 Jan 2011 18:09:33 -0600
parents 0aeebc3f4fe9
children 15a0ceebbd83
files KBF.lua
diffstat 1 files changed, 19 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/KBF.lua	Fri Jan 07 09:04:46 2011 -0600
+++ b/KBF.lua	Tue Jan 11 18:09:33 2011 -0600
@@ -7,6 +7,11 @@
 
 function kbf:OnInitialize()
     self.debuffFrames = {}
+   	local defaultSettings = {
+		-- global bar settings
+		-- overrides for buffs
+		-- overrides for debuffs
+   	}
     self:RegisterEvent("UNIT_AURA")
     self:RegisterEvent("UNIT_ENTERING_VEHICLE", "PollForVehicleChange")
     self:RegisterEvent("UNIT_EXITING_VEHICLE", "PollForVehicleChange")
@@ -394,36 +399,39 @@
     
 	local secureHeader = CreateFrame("FRAME", "KBFBuffFrame", UIParent, "SecureAuraHeaderTemplate")
 	self:SetCommonSecureHeaderAttributes(secureHeader)
-    secureHeader:SetAttribute("consolidateTo", 1)
+    secureHeader:SetAttribute("consolidateTo", 99)
     secureHeader:SetPoint("TOP", anchor, "TOP", 0, 0)
     
     -- this is the "button" in the aura flow that represents the consolidated buffs.
     -- pre-creating it here in order to perform customization
-    --local consolidateProxy = self:ConstructBar()
-    local consolidateProxy = CreateFrame("BUTTON", nil, UIParent, "SecureActionButtonTemplate")
+    local consolidateProxy = CreateFrame("BUTTON", nil, UIParent, "SecureHandlerClickTemplate")
     consolidateProxy:SetNormalTexture("Interface\\TargetingFrame\\UI-StatusBar")
     consolidateProxy:SetWidth(200 +16)
 	consolidateProxy:SetHeight(16)
     secureHeader:SetAttribute("consolidateProxy", consolidateProxy)
-    secureHeader:SetAttribute("frameref-proxy", GetFrameHandle(consolidateProxy))
+    --secureHeader:SetFrameRef("proxy", consolidateProxy)
+
+    
     -- this is the equivilent of the secureHeader for the consolidated buffs
     -- pre-creating again, so we can customize/size/position it
     local consolidateHeader = CreateFrame("FRAME", "KBFConsolidatedAnchorFrame", consolidateProxy)
-    
     self:SetCommonSecureHeaderAttributes(consolidateHeader)
     secureHeader:SetAttribute("consolidateHeader", consolidateHeader)
 	consolidateProxy:SetAttribute("header", consolidateHeader);
-	consolidateProxy:SetAttribute("frameref-header", GetFrameHandle(consolidateHeader))
+	consolidateProxy:SetFrameRef("header", consolidateHeader)
+	
+	consolidateProxy:SetAttribute("_onclick", [[
+    	local frame = self:GetFrameRef("header")
+    	if frame:IsShown() then frame:Hide() else frame:Show() end
+    ]])
+    consolidateProxy:EnableMouse(true)
+    consolidateProxy:RegisterForClicks("AnyUp")
 	
 	-- position it relative to the proxy, so it can appear where we want it
-    consolidateHeader:SetPoint("TOPRIGHT", consolidateProxy, "TOPLEFT", 0, 0)
+    consolidateHeader:SetPoint("TOPRIGHT", anchor, "TOPLEFT", 0, 0)
 	consolidateHeader:SetWidth(200 +16)
 	consolidateHeader:SetHeight(16)
 	consolidateHeader:Show()
-
-	consolidateProxy:SetAttribute("type", consolidateHeader.Show)
-	
-	RegisterStateDriver(consolidateHeader, "visibility", "show")
 	
     return anchor, secureHeader, consolidateHeader, consolidateProxy
 end