Mercurial > wow > reaction
comparison 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 |
comparison
equal
deleted
inserted
replaced
80:42ec2938d65a | 81:57f8151ea0f0 |
---|---|
263 UnregisterStateDriver(f, name) | 263 UnregisterStateDriver(f, name) |
264 self.statedrivers[name] = nil | 264 self.statedrivers[name] = nil |
265 end | 265 end |
266 end | 266 end |
267 | 267 |
268 -- Set an attribute on the frame (or buttonFrame if 'buttonFrame' = true) | 268 -- Set an attribute on the frame (or each button if 'doButtons' = true) |
269 -- Either or both 'map' and 'default' can be passed: | 269 -- Either or both 'map' and 'default' can be passed: |
270 -- - If 'map' is omitted, then 'default' is set to the attribute. | 270 -- - If 'map' is omitted, then 'default' is set to the attribute. |
271 -- - If 'map' is provided, then it is interpreted as an unordered | 271 -- - If 'map' is provided, then it is interpreted as an unordered |
272 -- table of the form { ["statename"] = ["value"] }, and will be | 272 -- table of the form { ["statename"] = ["value"] }, and will be |
273 -- converted into a SecureStateHeaderTemplate style state-parsed | 273 -- converted into a SecureStateHeaderTemplate style state-parsed |
274 -- string, e.g. "<state1>:<value1>;<state2>:<value2>". If 'default' | 274 -- string, e.g. "<state1>:<value1>;<state2>:<value2>". If 'default' |
275 -- is also provided, then its value will be converted to a string | 275 -- is also provided, then its value will be converted to a string |
276 -- and appended. | 276 -- and appended. |
277 function Bar:SetStateAttribute( attribute, map, default, buttonFrame ) | 277 function Bar:SetStateAttribute( attribute, map, default, doButtons ) |
278 local f = buttonFrame and self:GetButtonFrame() or self:GetFrame() | |
279 local value = default | 278 local value = default |
280 if map then | 279 if map then |
281 local tmp = { } | 280 local tmp = { } |
282 for state, value in pairs(map) do | 281 for state, value in pairs(map) do |
283 table.insert(tmp, format("%s:%s",tostring(state),tostring(value))) | 282 table.insert(tmp, format("%s:%s",tostring(state),tostring(value))) |
285 if default then | 284 if default then |
286 table.insert(tmp, tostring(default)) | 285 table.insert(tmp, tostring(default)) |
287 end | 286 end |
288 value = table.concat(tmp,";") | 287 value = table.concat(tmp,";") |
289 end | 288 end |
290 f:SetAttribute(attribute, value) | 289 if doButtons then |
291 SecureStateHeader_Refresh(f) | 290 for b in self:IterateButtons() do |
292 end | 291 b:GetFrame():SetAttribute(attribute,value) |
292 end | |
293 else | |
294 self:GetFrame():SetAttribute(attribute, value) | |
295 end | |
296 SecureStateHeader_Refresh(self:GetFrame()) | |
297 end |