Mercurial > wow > reaction
diff classes/Bar.lua @ 213:8ba8ab8bf6dd
Demodularize LBF
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Thu, 18 Nov 2010 20:07:48 -0800 |
parents | c24ac8ee1e45 |
children | 0e20f65375d5 |
line wrap: on
line diff
--- a/classes/Bar.lua Thu Nov 18 13:12:16 2010 -0800 +++ b/classes/Bar.lua Thu Nov 18 20:07:48 2010 -0800 @@ -246,6 +246,19 @@ self:SetConfigMode(ReAction:GetConfigMode()) self:SetKeybindMode(ReAction:GetKeybindMode()) + if ReAction.LBF then + local g = ReAction.LBF:Group(L["ReAction"], self.name) + self.config.ButtonFacade = self.config.ButtonFacade or { + skinID = "Blizzard", + backdrop = true, + gloss = 0, + colors = {}, + } + local c = self.config.ButtonFacade + g:Skin(c.skinID, c.gloss, c.backdrop, c.colors) + self.LBFGroup = g + end + ReAction.RegisterCallback(self, "OnConfigModeChanged") return self @@ -257,6 +270,9 @@ self:ShowControls(false) ReAction.UnregisterAllCallbacks(self) LKB.UnregisterAllCallbacks(self) + if self.LBFGroup then + self.LBFGroup:Delete(true) + end LSG:RemoveFrame(f) f:SetParent(UIParent) f:ClearAllPoints() @@ -282,6 +298,18 @@ -- only ReAction:RenameBar() should call this function. Calling from any other -- context will desync the bar list in the ReAction class. function Bar:SetName(name) + if self.LBFGroup then + -- LBF doesn't offer a method of renaming a group, so delete and remake the group. + local c = self.config.ButtonFacade + local g = ReAction.LBF:Group(L["ReAction"], name) + for b in self:IterateButtons() do + self.LBFGroup:RemoveButton(b:GetFrame(), true) + g:AddButton(b:GetFrame()) + end + self.LBFGroup:Delete(true) + self.LBFGroup = g + self.LBFGroup:Skin(c.skinID, c.gloss, c.backdrop, c.colors) + end self.name = name if self.overlay then self.overlay:SetLabel(self.name) @@ -451,6 +479,8 @@ -- Store a properly wrapped reference to the child frame as an attribute -- (accessible via "frameref-btn#") f:SetFrameRef(format("btn%d",idx), button:GetFrame()) + + -- button constructors are responsible for calling SkinButton end function Bar:RemoveButton(button) @@ -459,6 +489,9 @@ self:GetFrame():SetAttribute(format("frameref-btn%d",idx),nil) self.buttons[button] = nil end + if self.LBFGroup then + self.LBFGroup:RemoveButton(button:GetFrame(),true) + end end function Bar:PlaceButton(button, baseW, baseH) @@ -477,8 +510,10 @@ end end -function Bar:SkinButton() - -- does nothing by default +function Bar:SkinButton( button, data ) + if self.LBFGroup then + self.LBFGroup:AddButton(button:GetFrame(), data) + end end function Bar:UpdateShowGrid()