Mercurial > wow > reaction
diff classes/ActionButton.lua @ 123:943eed2c7def
Fixes for new ActionButton implementation
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Mon, 23 Feb 2009 19:41:11 +0000 |
parents | a2d2f23137c8 |
children | 0c5017f6062d |
line wrap: on
line diff
--- a/classes/ActionButton.lua Mon Feb 23 18:56:57 2009 +0000 +++ b/classes/ActionButton.lua Mon Feb 23 19:41:11 2009 +0000 @@ -155,13 +155,9 @@ ReAction.Button.Action = Action function Action:New( idx, config, bar, idHint ) - self = Super.New( - self, - format("ReAction_%s_Action_%d",bar:GetName(),idx), - config, - bar, - idx, - "ActionButtonTemplate, SecureActionButtonTemplate" ) + local name = format("ReAction_%s_Action_%d",bar:GetName(),idx) + + self = Super.New(self, name, config, bar, idx, "ActionButtonTemplate, SecureActionButtonTemplate" ) local f = self:GetFrame() local barFrame = bar:GetFrame() @@ -207,7 +203,7 @@ f:SetScript("PostClick", function(frame, ...) self:PostClick(...) end) f:SetScript("OnUpdate", function(frame, elapsed) self:OnUpdate(elapsed) end) f:SetScript("OnDragStart", function(frame) self:OnDragStart() end) - f:SetScript("OnReceiveDrag", function(frame), self:OnReceiveDrag() end) + f:SetScript("OnReceiveDrag", function(frame) self:OnReceiveDrag() end) -- secure handlers f:SetAttribute("_childupate", _childupdate) @@ -234,12 +230,16 @@ bar:SkinButton(self) -- initial display - self:ShowGrid(not barFrame:GetConfig().hideEmpty) + self:ShowGrid(not bar:GetConfig().hideEmpty) if ReAction:GetConfigMode() then self:ShowGrid(true) end + f:Show() + self:Refresh() + + return self end function Action:Destroy() @@ -299,8 +299,10 @@ -- so that the showgrid secure handler can make decisions accordingly local f = self:GetFrame() f:SetAttribute("hasaction-"..self.config.actionID, HasAction(self.config.actionID)) - for i = 1, self.nPages do - f:SetAttribute("hasaction-"..self.config.pageactions[i], HasAction(self.config.pageactions[i]) + if self.config.pageactions then + for i = 1, self.nPages do + f:SetAttribute("hasaction-"..self.config.pageactions[i], HasAction(self.config.pageactions[i])) + end end -- the following is an out-of-combat show/hide to supplement the secure -- handling and clean up after it when it guesses @@ -330,7 +332,6 @@ self.rangeTimer = nil f:SetNormalTexture("Interface\\Buttons\\UI-Quickslot") hotkey:SetVertexColor(0.6, 0.6, 0.6) - end end end @@ -455,7 +456,7 @@ else self:UpdateUsable() end - frame.rangeTimer = TOOLTIP_UPDATE_TIME + self.rangeTimer = TOOLTIP_UPDATE_TIME end end end @@ -526,7 +527,7 @@ end end -function Action:SetupBarHeader( bar ) -- call this as a static method +function Action.SetupBarHeader( bar ) -- call this as a static method local f = bar:GetFrame() local c = bar:GetConfig() f:SetAttribute("mindcontrol",c.mindcontrol) @@ -551,6 +552,18 @@ end +function Action.SetButtonLock( bar, lock, lockCombat ) -- call this as a static method + local f = bar:GetFrame() + f:SetAttribute("lockbuttons",lock) + f:SetAttribute("lockbuttonscombat",lockCombat) + f:Execute( + [[ + lockButtons = self:GetAttribute("lockbuttons") + lockButtonsCombat = self:GetAttribute("lockbuttonscombat") + ]]) +end + + function Action:ShowVehicleExit(show) local f = self:GetFrame() local tx = f.vehicleExitTexture