Mercurial > wow > reaction
comparison modules/State.lua @ 239:2669f737d9d7
Fold Action page state options into state.lua
author | Flick |
---|---|
date | Fri, 25 Mar 2011 16:28:25 -0700 |
parents | b4c100011c75 |
children |
comparison
equal
deleted
inserted
replaced
238:8bde290d300c | 239:2669f737d9d7 |
---|---|
235 args = { | 235 args = { |
236 desc = { | 236 desc = { |
237 name = L["Set the properties for the bar when in this state"], | 237 name = L["Set the properties for the bar when in this state"], |
238 order = 1, | 238 order = 1, |
239 type = "description" | 239 type = "description" |
240 }, | |
241 page = { | |
242 name = L["Show Page #"], | |
243 order = 11, | |
244 type = "select", | |
245 width = "half", | |
246 disabled = "IsPageDisabled", | |
247 hidden = "IsPageHidden", | |
248 values = "GetPageValues", | |
249 set = "SetProp", | |
250 get = "GetPage", | |
240 }, | 251 }, |
241 hide = { | 252 hide = { |
242 name = L["Hide Bar"], | 253 name = L["Hide Bar"], |
243 order = 90, | 254 order = 90, |
244 type = "toggle", | 255 type = "toggle", |
647 | 658 |
648 function StateHandler:GetAnchorDisabled() | 659 function StateHandler:GetAnchorDisabled() |
649 return not GetProperty(self.bar, self:GetName(), "anchorEnable") | 660 return not GetProperty(self.bar, self:GetName(), "anchorEnable") |
650 end | 661 end |
651 | 662 |
663 function StateHandler:IsPageDisabled() | |
664 local n = self.bar:GetConfig().nPages or 1 | |
665 return not (n > 1) | |
666 end | |
667 | |
668 function StateHandler:IsPageHidden() | |
669 return not self.bar:GetConfig().nPages | |
670 end | |
671 | |
672 function StateHandler:GetPageValues() | |
673 if not self._pagevalues then | |
674 self._pagevalues = { } | |
675 end | |
676 local n = self.bar:GetConfig().nPages | |
677 -- cache the results | |
678 if self._npages ~= n then | |
679 self._npages = n | |
680 wipe(self._pagevalues) | |
681 for i = 1, n do | |
682 self._pagevalues["page"..i] = i | |
683 end | |
684 end | |
685 return self._pagevalues | |
686 end | |
687 | |
688 function StateHandler:GetPage(info) | |
689 return self:GetProp(info) or 1 | |
690 end | |
691 | |
652 function StateHandler:GetAnchorFrames(info) | 692 function StateHandler:GetAnchorFrames(info) |
653 self._anchorframes = self._anchorframes or { } | 693 self._anchorframes = self._anchorframes or { } |
654 table.wipe(self._anchorframes) | 694 table.wipe(self._anchorframes) |
655 | 695 |
656 table.insert(self._anchorframes, "UIParent") | 696 table.insert(self._anchorframes, "UIParent") |