Skip to content

Commit

Permalink
Expose what style the oUF object was created by.
Browse files Browse the repository at this point in the history
  • Loading branch information
haste committed Nov 20, 2009
1 parent 88b2ec7 commit 48ce8b1
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions ouf.lua
Expand Up @@ -252,20 +252,20 @@ local HandleUnit = function(unit, object)
end
end

local initObject = function(unit, style, ...)
local initObject = function(unit, style, styleFunc, ...)
local num = select('#', ...)
for i=1, num do
local object = select(i, ...)

object.__elements = {}

object = setmetatable(object, frame_metatable)
style(object, unit)
styleFunc(object, unit)

local mt = type(style) == 'table'
local height = object:GetAttribute'initial-height' or (mt and style['initial-height'])
local width = object:GetAttribute'initial-width' or (mt and style['initial-width'])
local scale = object:GetAttribute'initial-scale' or (mt and style['initial-scale'])
local mt = type(styleFunc) == 'table'
local height = object:GetAttribute'initial-height' or (mt and styleFunc['initial-height'])
local width = object:GetAttribute'initial-width' or (mt and styleFunc['initial-width'])
local scale = object:GetAttribute'initial-scale' or (mt and styleFunc['initial-scale'])
local suffix = object:GetAttribute'unitsuffix'

if(height) then
Expand Down Expand Up @@ -297,6 +297,8 @@ local initObject = function(unit, style, ...)
end
end

object.style = style

if(suffix and suffix:match'target' and (i ~= 1 and not showPlayer)) then
enableTargetUpdate(object)
else
Expand Down Expand Up @@ -326,9 +328,10 @@ local initObject = function(unit, style, ...)
end

local walkObject = function(object, unit)
local style = styles[object:GetParent().style] or styles[style]
local style = object:GetParent().style or style
local styleFunc = styles[style] or styles[style]

initObject(unit, style, object, object:GetChildren())
initObject(unit, style, styleFunc, object, object:GetChildren())
end

function oUF:RegisterInitCallback(func)
Expand Down

0 comments on commit 48ce8b1

Please sign in to comment.