Mercurial > wow > reaction
diff classes/Bar.lua @ 154:df67685b340e
Fixed some bar/overlay encapsulation
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Fri, 08 May 2009 17:30:22 +0000 |
parents | d5e11e924053 |
children | 806a61b331a0 |
line wrap: on
line diff
--- a/classes/Bar.lua Fri May 08 17:14:36 2009 +0000 +++ b/classes/Bar.lua Fri May 08 17:30:22 2009 +0000 @@ -122,7 +122,9 @@ -- context will desync the bar list in the ReAction class. function Bar:SetName(name) self.name = name - self:SetLabel(self.name) -- Bar:SetLabel() defined in Overlay.lua + if self.overlay then + self.overlay:SetLabel(self.name) + end end function Bar:GetFrame() @@ -329,6 +331,35 @@ -- does nothing by default end +function Bar:ShowControls(show) + local f = self.overlay + if show then + if not f then + f = Bar.Overlay:New(self) -- see Overlay.lua + self.overlay = f + end + f:Show() + elseif f then + f:Hide() + end +end + +function Bar:RefreshControls() + if self.overlay and self.overlay:IsShown() then + self.overlay:RefreshControls() + end +end + +function Bar:SetLabelSubtext(text) + if self.overlay then + self.overlay:SetLabelSubtext(text) + end +end + +-- +-- Secure state functions +-- + -- pass unit=nil to set up the unit elsewhere, if you want something more complex function Bar:RegisterUnitWatch( unit, enable ) local f = self:GetFrame()