comparison State.lua @ 81:57f8151ea0f0

- Fixed some snafus with creating bars - Added support for opening the bar editor to a particular path - Creating bars/states now selects the new bar/state in the config editor - moved Bar:SetStateAttribute() back to working optionally on buttons rather than buttonFrame container
author Flick <flickerstreak@gmail.com>
date Wed, 25 Jun 2008 21:07:18 +0000
parents 42ec2938d65a
children 1ad208c25618
comparison
equal deleted inserted replaced
80:42ec2938d65a 81:57f8151ea0f0
149 for state, config in pairs(states) do 149 for state, config in pairs(states) do
150 if config.hide then 150 if config.hide then
151 table.insert(hs, state) 151 table.insert(hs, state)
152 end 152 end
153 end 153 end
154 bar:SetStateAttribute("hidestates", nil, table.concat(hs,","), true) -- pass to buttons 154 bar:GetButtonFrame():SetAttribute("hidestates", table.concat(hs,","))
155 end, 155 end,
156 156
157 keybindstate = function( bar, states ) 157 keybindstate = function( bar, states )
158 local map = { } 158 local map = { }
159 for state, config in pairs(states) do 159 for state, config in pairs(states) do
498 order = 1, 498 order = 1,
499 type = "description" 499 type = "description"
500 }, 500 },
501 hide = { 501 hide = {
502 name = L["Hide Bar"], 502 name = L["Hide Bar"],
503 order = 91, 503 order = 90,
504 type = "toggle", 504 type = "toggle",
505 set = "SetProp", 505 set = "SetProp",
506 get = "GetProp", 506 get = "GetProp",
507 }, 507 },
508 keybindstate = { 508 keybindstate = {
509 name = L["Override Keybinds"], 509 name = L["Override Keybinds"],
510 desc = L["Set this state to maintain its own set of keybinds which override the defaults when active"], 510 desc = L["Set this state to maintain its own set of keybinds which override the defaults when active"],
511 order = 92, 511 order = 91,
512 type = "toggle", 512 type = "toggle",
513 set = "SetProp", 513 set = "SetProp",
514 get = "GetProp", 514 get = "GetProp",
515 }, 515 },
516 position = { 516 position = {
517 name = L["Position"], 517 name = L["Position"],
518 order = 93, 518 order = 92,
519 type = "group", 519 type = "group",
520 inline = true, 520 inline = true,
521 args = { 521 args = {
522 enableAnchor = { 522 enableAnchor = {
523 name = L["Set New Position"], 523 name = L["Set New Position"],
572 }, 572 },
573 }, 573 },
574 }, 574 },
575 scale = { 575 scale = {
576 name = L["Scale"], 576 name = L["Scale"],
577 order = 94, 577 order = 93,
578 type = "group", 578 type = "group",
579 inline = true, 579 inline = true,
580 args = { 580 args = {
581 enableScale = { 581 enableScale = {
582 name = L["Set New Scale"], 582 name = L["Set New Scale"],
1007 ReAction:UserError(format(L["State named '%s' already exists"],name)) 1007 ReAction:UserError(format(L["State named '%s' already exists"],name))
1008 else 1008 else
1009 -- TODO: select default state options and pass as final argument 1009 -- TODO: select default state options and pass as final argument
1010 states[name] = { } 1010 states[name] = { }
1011 optionMap[bar].args[name] = CreateStateOptions(bar,name) 1011 optionMap[bar].args[name] = CreateStateOptions(bar,name)
1012 ReAction:ShowEditor(bar, moduleID, name)
1012 private.newstatename = "" 1013 private.newstatename = ""
1013 end 1014 end
1014 end, 1015 end,
1015 disabled = function() 1016 disabled = function()
1016 local name = private.newstatename or "" 1017 local name = private.newstatename or ""
1038 -- propertyImplFunc( bar, stateTable ) 1039 -- propertyImplFunc( bar, stateTable )
1039 -- where stateTable is a { ["statename"] = { state config } } table. 1040 -- where stateTable is a { ["statename"] = { state config } } table.
1040 -- 1041 --
1041 -- The options table is static, i.e. not bar-specific and should only reference handler method 1042 -- The options table is static, i.e. not bar-specific and should only reference handler method
1042 -- strings (either existing ones or those added via optHandler). The existing options are ordered 1043 -- strings (either existing ones or those added via optHandler). The existing options are ordered
1043 -- 91-100. Order #1 is reserved for the heading. 1044 -- 90-99. Order #1 is reserved for the heading.
1044 -- 1045 --
1045 -- The contents of optHandler, if provided, will be added to the existing StateHandler metatable. 1046 -- The contents of optHandler, if provided, will be added to the existing StateHandler metatable.
1046 -- See above, for existing API. In particular see the properties set up in the New method: self.bar, 1047 -- See above, for existing API. In particular see the properties set up in the New method: self.bar,
1047 -- self.states, and self:GetName(), and the generic property handlers self:GetProp() and self:SetProp(). 1048 -- self.states, and self:GetName(), and the generic property handlers self:GetProp() and self:SetProp().
1048 -- 1049 --