Mercurial > wow > reaction
comparison classes/PetActionButton.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 |
comparison
equal
deleted
inserted
replaced
| 233:9b9f5fc84d34 | 234:0e20f65375d5 |
|---|---|
| 76 { __index = Super } ) | 76 { __index = Super } ) |
| 77 | 77 |
| 78 ReAction.Button.PetAction = Pet | 78 ReAction.Button.PetAction = Pet |
| 79 ReAction:RegisterBarType(Pet) | 79 ReAction:RegisterBarType(Pet) |
| 80 | 80 |
| 81 function Pet:New( idx, config, bar, idHint ) | 81 function Pet:New( config, bar, idx, idHint ) |
| 82 local name = format("ReAction_%s_PetAction_%d",bar:GetName(),idx) | 82 local name = format("ReAction_%s_PetAction_%d",bar:GetName(),idx) |
| 83 | 83 |
| 84 self = Super.New(self, name, config, bar, idx, "SecureActionButtonTemplate, ActionButtonTemplate" ) | 84 self = Super.New(self, name, config, bar, idx, "SecureActionButtonTemplate, ActionButtonTemplate" ) |
| 85 | 85 |
| 86 local f = self:GetFrame() | 86 local f = self:GetFrame() |
| 158 f:Show() | 158 f:Show() |
| 159 | 159 |
| 160 return self | 160 return self |
| 161 end | 161 end |
| 162 | 162 |
| 163 function Pet:SetupBar(bar) | |
| 164 Super.SetupBar(self,bar) | |
| 165 | |
| 166 -- auto show/hide when pet exists | |
| 167 bar:RegisterUnitWatch("pet",true) | |
| 168 | |
| 169 self:UpdateButtonLock(bar) | |
| 170 end | |
| 171 | |
| 172 function Pet:UpdateButtonLock(bar) | |
| 173 local f = bar:GetFrame() | |
| 174 f:SetAttribute("lockbuttons",bar.config.lockButtons) | |
| 175 f:SetAttribute("lockbuttonscombat",bar.config.lockButtonsCombat) | |
| 176 f:Execute( | |
| 177 [[ | |
| 178 lockButtons = self:GetAttribute("lockbuttons") | |
| 179 lockButtonsCombat = self:GetAttribute("lockbuttonscombat") | |
| 180 ]]) | |
| 181 end | |
| 182 | |
| 163 function Pet:Refresh() | 183 function Pet:Refresh() |
| 164 Super.Refresh(self) | 184 Super.Refresh(self) |
| 165 self:Update() | 185 self:Update() |
| 166 self:UpdateHotkey() | 186 self:UpdateHotkey() |
| 167 end | 187 end |
