diff Bar.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 da8ba8783924
children 5b7fd67a28ea
line wrap: on
line diff
--- a/Bar.lua	Tue Jun 24 23:47:27 2008 +0000
+++ b/Bar.lua	Wed Jun 25 21:07:18 2008 +0000
@@ -265,7 +265,7 @@
   end
 end
 
--- Set an attribute on the frame (or buttonFrame if 'buttonFrame' = true)
+-- Set an attribute on the frame (or each button if 'doButtons' = true)
 -- Either or both 'map' and 'default' can be passed:
 --   - If 'map' is omitted, then 'default' is set to the attribute.
 --   - If 'map' is provided, then it is interpreted as an unordered
@@ -274,8 +274,7 @@
 --     string, e.g. "<state1>:<value1>;<state2>:<value2>". If 'default'
 --     is also provided, then its value will be converted to a string
 --     and appended.
-function Bar:SetStateAttribute( attribute, map, default, buttonFrame )
-  local f = buttonFrame and self:GetButtonFrame() or self:GetFrame()
+function Bar:SetStateAttribute( attribute, map, default, doButtons )
   local value = default
   if map then
     local tmp = { }
@@ -287,6 +286,12 @@
     end
     value = table.concat(tmp,";")
   end
-  f:SetAttribute(attribute, value)
-  SecureStateHeader_Refresh(f)
+  if doButtons then
+    for b in self:IterateButtons() do
+      b:GetFrame():SetAttribute(attribute,value)
+    end
+  else
+    self:GetFrame():SetAttribute(attribute, value)
+  end
+  SecureStateHeader_Refresh(self:GetFrame())
 end