Mercurial > wow > kbf
comparison KBF.lua @ 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 |
comparison
equal
deleted
inserted
replaced
39:0aeebc3f4fe9 | 40:5def7d061738 |
---|---|
5 local kbf = LibStub("AceAddon-3.0"):NewAddon(kbf, "KBF", "AceEvent-3.0", "AceConsole-3.0") | 5 local kbf = LibStub("AceAddon-3.0"):NewAddon(kbf, "KBF", "AceEvent-3.0", "AceConsole-3.0") |
6 | 6 |
7 | 7 |
8 function kbf:OnInitialize() | 8 function kbf:OnInitialize() |
9 self.debuffFrames = {} | 9 self.debuffFrames = {} |
10 local defaultSettings = { | |
11 -- global bar settings | |
12 -- overrides for buffs | |
13 -- overrides for debuffs | |
14 } | |
10 self:RegisterEvent("UNIT_AURA") | 15 self:RegisterEvent("UNIT_AURA") |
11 self:RegisterEvent("UNIT_ENTERING_VEHICLE", "PollForVehicleChange") | 16 self:RegisterEvent("UNIT_ENTERING_VEHICLE", "PollForVehicleChange") |
12 self:RegisterEvent("UNIT_EXITING_VEHICLE", "PollForVehicleChange") | 17 self:RegisterEvent("UNIT_EXITING_VEHICLE", "PollForVehicleChange") |
13 self:RegisterChatCommand("kbf", "ToggleAnchor") | 18 self:RegisterChatCommand("kbf", "ToggleAnchor") |
14 end | 19 end |
392 anchor:Hide() | 397 anchor:Hide() |
393 -- this is the parent & host for the secure aura buttons. | 398 -- this is the parent & host for the secure aura buttons. |
394 | 399 |
395 local secureHeader = CreateFrame("FRAME", "KBFBuffFrame", UIParent, "SecureAuraHeaderTemplate") | 400 local secureHeader = CreateFrame("FRAME", "KBFBuffFrame", UIParent, "SecureAuraHeaderTemplate") |
396 self:SetCommonSecureHeaderAttributes(secureHeader) | 401 self:SetCommonSecureHeaderAttributes(secureHeader) |
397 secureHeader:SetAttribute("consolidateTo", 1) | 402 secureHeader:SetAttribute("consolidateTo", 99) |
398 secureHeader:SetPoint("TOP", anchor, "TOP", 0, 0) | 403 secureHeader:SetPoint("TOP", anchor, "TOP", 0, 0) |
399 | 404 |
400 -- this is the "button" in the aura flow that represents the consolidated buffs. | 405 -- this is the "button" in the aura flow that represents the consolidated buffs. |
401 -- pre-creating it here in order to perform customization | 406 -- pre-creating it here in order to perform customization |
402 --local consolidateProxy = self:ConstructBar() | 407 local consolidateProxy = CreateFrame("BUTTON", nil, UIParent, "SecureHandlerClickTemplate") |
403 local consolidateProxy = CreateFrame("BUTTON", nil, UIParent, "SecureActionButtonTemplate") | |
404 consolidateProxy:SetNormalTexture("Interface\\TargetingFrame\\UI-StatusBar") | 408 consolidateProxy:SetNormalTexture("Interface\\TargetingFrame\\UI-StatusBar") |
405 consolidateProxy:SetWidth(200 +16) | 409 consolidateProxy:SetWidth(200 +16) |
406 consolidateProxy:SetHeight(16) | 410 consolidateProxy:SetHeight(16) |
407 secureHeader:SetAttribute("consolidateProxy", consolidateProxy) | 411 secureHeader:SetAttribute("consolidateProxy", consolidateProxy) |
408 secureHeader:SetAttribute("frameref-proxy", GetFrameHandle(consolidateProxy)) | 412 --secureHeader:SetFrameRef("proxy", consolidateProxy) |
413 | |
414 | |
409 -- this is the equivilent of the secureHeader for the consolidated buffs | 415 -- this is the equivilent of the secureHeader for the consolidated buffs |
410 -- pre-creating again, so we can customize/size/position it | 416 -- pre-creating again, so we can customize/size/position it |
411 local consolidateHeader = CreateFrame("FRAME", "KBFConsolidatedAnchorFrame", consolidateProxy) | 417 local consolidateHeader = CreateFrame("FRAME", "KBFConsolidatedAnchorFrame", consolidateProxy) |
412 | |
413 self:SetCommonSecureHeaderAttributes(consolidateHeader) | 418 self:SetCommonSecureHeaderAttributes(consolidateHeader) |
414 secureHeader:SetAttribute("consolidateHeader", consolidateHeader) | 419 secureHeader:SetAttribute("consolidateHeader", consolidateHeader) |
415 consolidateProxy:SetAttribute("header", consolidateHeader); | 420 consolidateProxy:SetAttribute("header", consolidateHeader); |
416 consolidateProxy:SetAttribute("frameref-header", GetFrameHandle(consolidateHeader)) | 421 consolidateProxy:SetFrameRef("header", consolidateHeader) |
422 | |
423 consolidateProxy:SetAttribute("_onclick", [[ | |
424 local frame = self:GetFrameRef("header") | |
425 if frame:IsShown() then frame:Hide() else frame:Show() end | |
426 ]]) | |
427 consolidateProxy:EnableMouse(true) | |
428 consolidateProxy:RegisterForClicks("AnyUp") | |
417 | 429 |
418 -- position it relative to the proxy, so it can appear where we want it | 430 -- position it relative to the proxy, so it can appear where we want it |
419 consolidateHeader:SetPoint("TOPRIGHT", consolidateProxy, "TOPLEFT", 0, 0) | 431 consolidateHeader:SetPoint("TOPRIGHT", anchor, "TOPLEFT", 0, 0) |
420 consolidateHeader:SetWidth(200 +16) | 432 consolidateHeader:SetWidth(200 +16) |
421 consolidateHeader:SetHeight(16) | 433 consolidateHeader:SetHeight(16) |
422 consolidateHeader:Show() | 434 consolidateHeader:Show() |
423 | |
424 consolidateProxy:SetAttribute("type", consolidateHeader.Show) | |
425 | |
426 RegisterStateDriver(consolidateHeader, "visibility", "show") | |
427 | 435 |
428 return anchor, secureHeader, consolidateHeader, consolidateProxy | 436 return anchor, secureHeader, consolidateHeader, consolidateProxy |
429 end | 437 end |
430 | 438 |
431 --- sets the attributes needed by all the headers | 439 --- sets the attributes needed by all the headers |