Skip to content

Boilerplate Template

freebaser edited this page Feb 1, 2011 · 4 revisions

The following is a simple boilerplate for oUF layouts.

local UnitSpecific = {
	player = function(self)
		-- Player specific layout code.
	end,
        
        party = function(self)
		-- Party specific layout code.         
        end,
}

local Shared = function(self, unit)
	-- Shared layout code.

	if(UnitSpecific[unit]) then
		return UnitSpecific[unit](self)
	end
end

oUF:RegisterStyle("MyLayout", Shared)
oUF:Factory(function(self)

     self:SetActiveStyle("MyLayout")

     self:Spawn("player"):SetPoint("CENTER")

     -- oUF:SpawnHeader(overrideName, overrideTemplate, visibility, attributes ...)
     local party = self:SpawnHeader(nil, nil, 'raid,party,solo',
          -- http://wowprogramming.com/docs/secure_template/Group_Headers
          -- Set header attributes
          'showParty', true, 
          'showPlayer', true, 
          'yOffset', -20
     )
     party:SetPoint("TOPLEFT", 30, -30)
end)
Clone this wiki locally