Mercurial > wow > reaction
diff classes/Button.lua @ 129:28b430de5875
More fixes for new action button
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Fri, 06 Mar 2009 23:44:33 +0000 |
parents | 729232aeeb5e |
children | e39d80bb0b7a |
line wrap: on
line diff
--- a/classes/Button.lua Thu Mar 05 01:28:48 2009 +0000 +++ b/classes/Button.lua Fri Mar 06 23:44:33 2009 +0000 @@ -30,7 +30,7 @@ ReAction.Button = Button -- export to ReAction -function Button:New( name, barConfig, bar, idx, inherits, buttonType ) +function Button:New( name, config, bar, idx, inherits, buttonType ) buttonType = buttonType or "CheckButton" -- create new self @@ -38,8 +38,7 @@ { bar = bar, idx = idx, - barConfig = barConfig, - config = barConfig.buttons[idx], + config = config, name = name, }, { __index = self } ) @@ -101,12 +100,6 @@ return self.config end -function Button:GetBarConfig() - -- this is the per-bar Button config structure, - -- not the config structure of the bar itself - return self.barConfig -end - function Button:GetActionID() -- derived classes should override this return nil @@ -179,7 +172,8 @@ end function Button:Refresh() - self.bar:PlaceButton( self, self.frame:GetWidth(), self.frame:GetHeight() ) + local f = self:GetFrame() + self.bar:PlaceButton( self, f:GetWidth(), f:GetHeight() ) end function Button:SetKeybindMode( mode ) @@ -210,7 +204,7 @@ function Button:UpdateHotkey( hotkey ) hotkey = hotkey or self.hotkey if not hotkey then - hotkey = _G[format("%sHotKey", tostring(self:GetName()))] + hotkey = _G[self:GetName().."HotKey"] self.hotkey = hotkey end if hotkey then @@ -225,7 +219,7 @@ end function Button:GetActionIDLabel( create ) - local f = self.frame + local f = self:GetFrame() if not f.actionIDLabel and create then local label = f:CreateFontString(nil,"OVERLAY","GameFontNormalLarge") label:SetAllPoints() @@ -254,17 +248,17 @@ function Button:SetNormalVertexColor( r, g, b, a ) if LBF then - LBF:SetNormalVertexColor(self.frame, r, g, b, a) + LBF:SetNormalVertexColor(self:GetFrame(), r, g, b, a) else - self.frame:GetNormalTexture():SetVertexColor(r,g,b,a) + self:GetFrame():GetNormalTexture():SetVertexColor(r,g,b,a) end end function Button:GetNormalVertexColor() if LBF then - return LBF:GetNormalVertexColor(self.frame) + return LBF:GetNormalVertexColor(self:GetFrame()) else - return self.frame:GetNormalTexture():GetVertexColor() + return self:GetFrame():GetNormalTexture():GetVertexColor() end end