Mercurial > wow > reaction
diff classes/Bar.lua @ 148:de1da46dadb3
moved unitwatch handling into bar
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Fri, 08 May 2009 00:06:53 +0000 |
parents | 901c91dc1bf2 |
children | d5e11e924053 |
line wrap: on
line diff
--- a/classes/Bar.lua Thu May 07 23:55:00 2009 +0000 +++ b/classes/Bar.lua Fri May 08 00:06:53 2009 +0000 @@ -269,6 +269,14 @@ function Bar:SetConfigMode(mode) self:ShowControls(mode) + if self.unitwatch then + if mode then + UnregisterUnitWatch(self:GetFrame()) + self:GetFrame():Show() + else + RegisterUnitWatch(self:GetFrame()) + end + end for b in self:IterateButtons() do b:ShowGridTemp(mode) b:UpdateActionIDLabel(mode) @@ -276,6 +284,14 @@ end function Bar:SetKeybindMode(mode) + if self.unitwatch then + if mode then + UnregisterUnitWatch(self:GetFrame()) + self:GetFrame():Show() + else + RegisterUnitWatch(self:GetFrame()) + end + end for b in self:IterateButtons() do b:SetKeybindMode(mode) end @@ -300,3 +316,20 @@ function Bar:SkinButton() -- does nothing by default end + +-- pass unit=nil to set up the unit elsewhere, if you want something more complex +function Bar:RegisterUnitWatch( unit, enable ) + local f = self:GetFrame() + if unit then + f:SetAttribute("unit",unit) + end + if not ReAction:GetConfigMode() then + if enable then + RegisterUnitWatch(f) + elseif self.unitwatch then + UnregisterUnitWatch(f) + end + end + self.unitwatch = enable +end +