Mercurial > wow > reaction
diff classes/Bar.lua @ 242:b56cff349bd6
Move non-option stuff out of State.lua
Remove unused callbacks
author | Flick |
---|---|
date | Fri, 25 Mar 2011 17:06:56 -0700 |
parents | 09c8e9baa35a |
children |
line wrap: on
line diff
--- a/classes/Bar.lua Fri Mar 25 16:50:43 2011 -0700 +++ b/classes/Bar.lua Fri Mar 25 17:06:56 2011 -0700 @@ -8,6 +8,7 @@ local fmod = math.fmod local format = string.format local tfetch = addonTable.tfetch +local tbuild = addonTable.tbuild local fieldsort = addonTable.fieldsort local LSG = LibStub("ReAction-LibShowActionGrid-1.0") @@ -228,12 +229,14 @@ ReAction.RegisterCallback(self, "OnConfigModeChanged") buttonClass:SetupBar(self) + self:ApplyStates() return self end function Bar:Destroy() local f = self:GetFrame() + self:CleanupStates() for idx, b in self:IterateButtons() do b:Destroy() end @@ -322,7 +325,6 @@ c.x = x or c.x c.y = y or c.y self:ApplyAnchor() - ReAction:RefreshBar(self) end function Bar:GetSize() @@ -350,7 +352,6 @@ self.config.btnWidth = w self.config.btnHeight = h end - ReAction:RefreshBar(self) end function Bar:GetNumButtons() @@ -374,7 +375,6 @@ cfg.spacing = s end self.buttonClass:SetupBar(self) - ReAction:RefreshBar(self) end function Bar:GetAlpha() @@ -385,7 +385,6 @@ self.config.alpha = value self:GetFrame():SetAlpha(value or 1.0) self:UpdateDefaultStateAlpha() - ReAction:RefreshBar(self) end function Bar:IterateButtons() @@ -535,11 +534,24 @@ end function Bar:GetStateProperty(state, propname) - -- override in modules/State.lua for now + return tfetch(self:GetConfig(), "states", state, propname) end function Bar:SetStateProperty(state, propname, value) - -- override in modules/State.lua for now + local s = tbuild(self:GetConfig(), "states", state) + s[propname] = value + self:SetSecureStateData(state, propname, value) +end + +function Bar:ApplyStates() + local states = tfetch(self:GetConfig(), "states") + if states then + self:SetStateDriver(states) + end +end + +function Bar:CleanupStates() + self:SetStateDriver(nil) end function Bar:RefreshSecureState()