comparison classes/ReAction.lua @ 8:c05fd3e18b4f

Version 0.31
author Flick <flickerstreak@gmail.com>
date Tue, 20 Mar 2007 21:33:59 +0000
parents f920db5fc6b1
children f3a7bfebc283
comparison
equal deleted inserted replaced
7:f920db5fc6b1 8:c05fd3e18b4f
74 SetupDisplay = "function", -- SetupDisplay(buttonName), one-time setup 74 SetupDisplay = "function", -- SetupDisplay(buttonName), one-time setup
75 UpdateDisplay = "function", -- UpdateDisplay(), general display state should be refreshed 75 UpdateDisplay = "function", -- UpdateDisplay(), general display state should be refreshed
76 TempShow = "function", -- TempShow(visible), calls to this can be nested so keep track. 76 TempShow = "function", -- TempShow(visible), calls to this can be nested so keep track.
77 GetActionFrame = "function", -- f = GetActionFrame(), return a frame derived from SecureActionButtonTemplate (note: this is inherited unimplemented from ReBar.IButton) 77 GetActionFrame = "function", -- f = GetActionFrame(), return a frame derived from SecureActionButtonTemplate (note: this is inherited unimplemented from ReBar.IButton)
78 GetBaseButtonSize = "function", -- sz = GetBaseButtonSize(), return size in pixels of the nominal button (square) 78 GetBaseButtonSize = "function", -- sz = GetBaseButtonSize(), return size in pixels of the nominal button (square)
79 DisplayID = "function", -- DisplayID(id), show the action ID (or equivalent). Pass nil to hide. 79 DisplayID = "function", -- DisplayID(show), true/false to show/hide the action ID (or equivalent)
80 DisplayHotkey = "function", -- DisplayHotkey(keyText), set the hotkey display text 80 DisplayHotkey = "function", -- DisplayHotkey(keyText), set the hotkey display text
81 } 81 }
82 82
83 83
84 ---------------------------- 84 ----------------------------
144 end 144 end
145 end 145 end
146 146
147 if id == nil then return nil end -- all action ids are in use 147 if id == nil then return nil end -- all action ids are in use
148 148
149 -- if a hint is given, see if that one is free instead 149 -- if a hint is given, see if that one is free instead, as long as it's < maxIDs
150 if hint and (t[hint] == nil or t[hint].inUse == false) then 150 if hint and hint > 0 and hint <= maxIDs and (t[hint] == nil or t[hint].inUse == false) then
151 id = hint 151 id = hint
152 end 152 end
153 153
154 if t[id] == nil then 154 if t[id] == nil then
155 t[id] = { } 155 t[id] = { }
212 212
213 function ReAction:ShowAllIds() 213 function ReAction:ShowAllIds()
214 for _, t in pairs(self.buttonTypes) do 214 for _, t in pairs(self.buttonTypes) do
215 if t.subtype._idTbl then 215 if t.subtype._idTbl then
216 for _, tbl in pairs(t.subtype._idTbl) do 216 for _, tbl in pairs(t.subtype._idTbl) do
217 if tbl.button then tbl.button:DisplayID(tbl.button:GetID()) end 217 if tbl.button then tbl.button:DisplayID(true) end
218 end 218 end
219 end 219 end
220 end 220 end
221 self.showIDs_ = true 221 self.showIDs_ = true
222 end 222 end
223 223
224 function ReAction:HideAllIds() 224 function ReAction:HideAllIds()
225 for _, t in pairs(self.buttonTypes) do 225 for _, t in pairs(self.buttonTypes) do
226 if t.subtype._idTbl then 226 if t.subtype._idTbl then
227 for _, tbl in pairs(t.subtype._idTbl) do 227 for _, tbl in pairs(t.subtype._idTbl) do
228 if tbl.button then tbl.button:DisplayID(nil) end 228 if tbl.button then tbl.button:DisplayID(false) end
229 end 229 end
230 end 230 end
231 end 231 end
232 self.showIDs_ = false 232 self.showIDs_ = false
233 end 233 end
246 246
247 -- ReBar.IButton interface 247 -- ReBar.IButton interface
248 248
249 function ReAction.prototype:BarUnlocked() 249 function ReAction.prototype:BarUnlocked()
250 self:TempShow(true) 250 self:TempShow(true)
251 self:DisplayID(true)
251 end 252 end
252 253
253 function ReAction.prototype:BarLocked() 254 function ReAction.prototype:BarLocked()
254 self:TempShow(false) 255 self:TempShow(false)
256 self:DisplayID(false)
255 end 257 end
256 258
257 function ReAction.prototype:PlaceButton(parent, point, x, y, sz) 259 function ReAction.prototype:PlaceButton(parent, point, x, y, sz)
258 local b = self:GetActionFrame() 260 local b = self:GetActionFrame()
259 local baseSize = self:GetBaseButtonSize() 261 local baseSize = self:GetBaseButtonSize()