Mercurial > wow > reaction
comparison classes/ActionButton.lua @ 138:1f36187a94cf
Fixed paged actions
| author | Flick <flickerstreak@gmail.com> |
|---|---|
| date | Fri, 10 Apr 2009 23:22:10 +0000 |
| parents | 16048f516f5e |
| children | 8b35239339c5 |
comparison
equal
deleted
inserted
replaced
| 137:4c1b85ec40d2 | 138:1f36187a94cf |
|---|---|
| 50 action = 120 + idx | 50 action = 120 + idx |
| 51 else | 51 else |
| 52 action = 0 | 52 action = 0 |
| 53 end | 53 end |
| 54 elseif page and state and page[state] then | 54 elseif page and state and page[state] then |
| 55 action = self:GetAttribute("action-page"..page[state]) | 55 action = self:GetAttribute("action-"..page[state]) |
| 56 else | 56 end |
| 57 if action == nil then | |
| 57 action = self:GetAttribute("default-action") | 58 action = self:GetAttribute("default-action") |
| 58 end | 59 end |
| 59 | 60 |
| 60 self:SetAttribute("action",action) | 61 self:SetAttribute("action",action) |
| 61 | 62 |
| 184 f:SetAttribute("bar-idx",idx) | 185 f:SetAttribute("bar-idx",idx) |
| 185 f:SetAttribute("showgrid-temp",0) | 186 f:SetAttribute("showgrid-temp",0) |
| 186 f:SetAttribute("showgrid-event",0) | 187 f:SetAttribute("showgrid-event",0) |
| 187 f:SetAttribute("showgrid",not self:GetBarConfig().hideEmpty) | 188 f:SetAttribute("showgrid",not self:GetBarConfig().hideEmpty) |
| 188 | 189 |
| 189 self:RefreshHasActionAttributes() | 190 self:Refresh() |
| 191 | |
| 192 -- attach to skinner | |
| 193 bar:SkinButton(self) | |
| 194 | |
| 195 -- initial display | |
| 196 if ReAction:GetConfigMode() then | |
| 197 self:ShowGridTemp(true) | |
| 198 end | |
| 190 | 199 |
| 191 -- non secure scripts | 200 -- non secure scripts |
| 192 f:SetScript("OnEvent", function(frame, ...) self:OnEvent(...) end) | 201 f:SetScript("OnEvent", function(frame, ...) self:OnEvent(...) end) |
| 193 f:SetScript("OnEnter", function(frame) self:OnEnter() end) | 202 f:SetScript("OnEnter", function(frame) self:OnEnter() end) |
| 194 f:SetScript("OnLeave", function(frame) self:OnLeave() end) | 203 f:SetScript("OnLeave", function(frame) self:OnLeave() end) |
| 196 f:SetScript("PostClick", function(frame, ...) self:PostClick(...) end) | 205 f:SetScript("PostClick", function(frame, ...) self:PostClick(...) end) |
| 197 f:SetScript("OnUpdate", function(frame, elapsed) self:OnUpdate(elapsed) end) | 206 f:SetScript("OnUpdate", function(frame, elapsed) self:OnUpdate(elapsed) end) |
| 198 f:SetScript("OnDragStart", function(frame) self:OnDragStart() end) | 207 f:SetScript("OnDragStart", function(frame) self:OnDragStart() end) |
| 199 f:SetScript("OnReceiveDrag", function(frame) self:OnReceiveDrag() end) | 208 f:SetScript("OnReceiveDrag", function(frame) self:OnReceiveDrag() end) |
| 200 | 209 |
| 201 -- secure handlers | |
| 202 f:SetAttribute("_childupdate", _childupdate) | |
| 203 f:SetAttribute("_childupdate-showgrid",_childupdate_showgrid) | |
| 204 barFrame:WrapScript(f, "OnDragStart", _onDragStart) | |
| 205 barFrame:WrapScript(f, "OnReceiveDrag", _onReceiveDrag) | |
| 206 | |
| 207 -- event registration | 210 -- event registration |
| 208 f:EnableMouse(true) | 211 f:EnableMouse(true) |
| 209 f:RegisterForDrag("LeftButton", "RightButton") | 212 f:RegisterForDrag("LeftButton", "RightButton") |
| 210 f:RegisterForClicks("AnyUp") | 213 f:RegisterForClicks("AnyUp") |
| 211 for _, evt in pairs(eventList) do | 214 for _, evt in pairs(eventList) do |
| 212 f:RegisterEvent(evt) | 215 f:RegisterEvent(evt) |
| 213 end | 216 end |
| 214 | 217 |
| 215 -- attach to skinner | 218 -- secure handlers |
| 216 bar:SkinButton(self) | 219 f:SetAttribute("_childupdate", _childupdate) |
| 217 | 220 f:SetAttribute("_childupdate-showgrid",_childupdate_showgrid) |
| 218 -- initial display | 221 barFrame:WrapScript(f, "OnDragStart", _onDragStart) |
| 219 if ReAction:GetConfigMode() then | 222 barFrame:WrapScript(f, "OnReceiveDrag", _onReceiveDrag) |
| 220 self:ShowGridTemp(true) | |
| 221 end | |
| 222 | |
| 223 self:Refresh() | |
| 224 | 223 |
| 225 return self | 224 return self |
| 226 end | 225 end |
| 227 | 226 |
| 228 function Action:Destroy() | 227 function Action:Destroy() |
| 248 return self.barConfig | 247 return self.barConfig |
| 249 end | 248 end |
| 250 | 249 |
| 251 function Action:Refresh() | 250 function Action:Refresh() |
| 252 Super.Refresh(self) | 251 Super.Refresh(self) |
| 252 self:RefreshHasActionAttributes() | |
| 253 self:RefreshPages() | 253 self:RefreshPages() |
| 254 self:InstallVehicle() | 254 self:InstallVehicle() |
| 255 self:ShowGrid(not self:GetBarConfig().hideEmpty) | 255 self:ShowGrid(not self:GetBarConfig().hideEmpty) |
| 256 self:UpdateAction() | 256 self:UpdateAction() |
| 257 end | 257 end |
