Mercurial > wow > reaction
comparison classes/Bar.lua @ 148:de1da46dadb3
moved unitwatch handling into bar
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Fri, 08 May 2009 00:06:53 +0000 |
parents | 901c91dc1bf2 |
children | d5e11e924053 |
comparison
equal
deleted
inserted
replaced
147:901c91dc1bf2 | 148:de1da46dadb3 |
---|---|
267 return pairs(self.buttons) | 267 return pairs(self.buttons) |
268 end | 268 end |
269 | 269 |
270 function Bar:SetConfigMode(mode) | 270 function Bar:SetConfigMode(mode) |
271 self:ShowControls(mode) | 271 self:ShowControls(mode) |
272 if self.unitwatch then | |
273 if mode then | |
274 UnregisterUnitWatch(self:GetFrame()) | |
275 self:GetFrame():Show() | |
276 else | |
277 RegisterUnitWatch(self:GetFrame()) | |
278 end | |
279 end | |
272 for b in self:IterateButtons() do | 280 for b in self:IterateButtons() do |
273 b:ShowGridTemp(mode) | 281 b:ShowGridTemp(mode) |
274 b:UpdateActionIDLabel(mode) | 282 b:UpdateActionIDLabel(mode) |
275 end | 283 end |
276 end | 284 end |
277 | 285 |
278 function Bar:SetKeybindMode(mode) | 286 function Bar:SetKeybindMode(mode) |
287 if self.unitwatch then | |
288 if mode then | |
289 UnregisterUnitWatch(self:GetFrame()) | |
290 self:GetFrame():Show() | |
291 else | |
292 RegisterUnitWatch(self:GetFrame()) | |
293 end | |
294 end | |
279 for b in self:IterateButtons() do | 295 for b in self:IterateButtons() do |
280 b:SetKeybindMode(mode) | 296 b:SetKeybindMode(mode) |
281 end | 297 end |
282 end | 298 end |
283 | 299 |
298 end | 314 end |
299 | 315 |
300 function Bar:SkinButton() | 316 function Bar:SkinButton() |
301 -- does nothing by default | 317 -- does nothing by default |
302 end | 318 end |
319 | |
320 -- pass unit=nil to set up the unit elsewhere, if you want something more complex | |
321 function Bar:RegisterUnitWatch( unit, enable ) | |
322 local f = self:GetFrame() | |
323 if unit then | |
324 f:SetAttribute("unit",unit) | |
325 end | |
326 if not ReAction:GetConfigMode() then | |
327 if enable then | |
328 RegisterUnitWatch(f) | |
329 elseif self.unitwatch then | |
330 UnregisterUnitWatch(f) | |
331 end | |
332 end | |
333 self.unitwatch = enable | |
334 end | |
335 |