comparison classes/ActionButton.lua @ 234:0e20f65375d5

Reworked button creation to not use goofy event driven semantics.
author Flick
date Tue, 22 Mar 2011 17:05:51 -0700
parents 158c9299185b
children 704f4a05a1d7
comparison
equal deleted inserted replaced
233:9b9f5fc84d34 234:0e20f65375d5
190 { __index = Super } ) 190 { __index = Super } )
191 191
192 ReAction.Button.Action = Action 192 ReAction.Button.Action = Action
193 ReAction:RegisterBarType(Action, true) 193 ReAction:RegisterBarType(Action, true)
194 194
195 function Action:New( idx, barConfig, bar, idHint ) 195 function Action:New( config, bar, idx, idHint )
196 local name = format("ReAction_%s_Action_%d",bar:GetName(),idx) 196 local name = format("ReAction_%s_Action_%d",bar:GetName(),idx)
197 197
198 self = Super.New(self, name, barConfig.buttons[idx], bar, idx, "SecureActionButtonTemplate, ActionButtonTemplate" ) 198 self = Super.New(self, name, config, bar, idx, "SecureActionButtonTemplate, ActionButtonTemplate" )
199 self.barConfig = barConfig 199 self.barConfig = bar:GetConfig()
200 200
201 local f = self:GetFrame() 201 local f = self:GetFrame()
202 local barFrame = bar:GetFrame() 202 local barFrame = bar:GetFrame()
203 local config = self:GetConfig()
204 203
205 self.rangeTimer = TOOLTIP_UPDATE_TIME 204 self.rangeTimer = TOOLTIP_UPDATE_TIME
206 205
207 -- set up the base action ID 206 -- set up the base action ID
208 self:SetActionIDPool("action",120) 207 self:SetActionIDPool("action",120)
627 end 626 end
628 self.nPages = nPages 627 self.nPages = nPages
629 end 628 end
630 end 629 end
631 630
632 function Action.SetupBarHeader( bar, config ) -- call this as a static method 631 function Action:SetupBar( bar )
632 Super.SetupBar(self,bar)
633
633 local f = bar:GetFrame() 634 local f = bar:GetFrame()
635 local config = bar:GetConfig()
634 f:SetAttribute("mindcontrol",config.mindcontrol) 636 f:SetAttribute("mindcontrol",config.mindcontrol)
635 f:SetAttribute("vehicle",config.vehicle) 637 f:SetAttribute("vehicle",config.vehicle)
636 f:Execute( 638 f:Execute(
637 [[ 639 [[
638 doMindControl = self:GetAttribute("mindcontrol") 640 doMindControl = self:GetAttribute("mindcontrol")