I was wondering about this too a few days ago so I took a look at Grid and SecureTemplates.lua. To create and configure a header in Lua only you'd do:
local header = CreateFrame("Frame","Header",UIParent,"SecureGroupHeaderTemplate")
Then you set the attributes, which are all documented in SecureTemplates.lua
showRaid = [BOOLEAN] -- true if the header should be shown while in a raid
showParty = [BOOLEAN] -- true if the header should be shown while in a party and not in a raid
showPlayer = [BOOLEAN] -- true if the header should show the player when not in a raid
showSolo = [BOOLEAN] -- true if the header should be shown while not in a group (implies showPlayer)
nameList = [STRING] -- a comma separated list of player names (not used if 'groupFilter' is set)
groupFilter = [1-8, STRING] -- a comma seperated list of raid group numbers and/or uppercase class names and/or uppercase roles
strictFiltering = [BOOLEAN] - if true, then characters must match both a group and a class from the groupFilter list
point = [STRING] -- a valid XML anchoring point (Default: "TOP")
xOffset = [NUMBER] -- the x-Offset to use when anchoring the unit buttons (Default: 0)
yOffset = [NUMBER] -- the y-Offset to use when anchoring the unit buttons (Default: 0)
sortMethod = ["INDEX", "NAME"] -- defines how the group is sorted (Default: "INDEX")
sortDir = ["ASC", "DESC"] -- defines the sort order (Default: "ASC")
template = [STRING] -- the XML template to use for the unit buttons
templateType = [STRING] - specifies the frame type of the managed subframes (Default: "Button")
groupBy = [nil, "GROUP", "CLASS", "ROLE"] - specifies a "grouping" type to apply before regular sorting (Default: nil)
groupingOrder = [STRING] - specifies the order of the groupings (ie. "1,2,3,4,5,6,7,8")
maxColumns = [NUMBER] - maximum number of columns the header will create (Default: 1)
unitsPerColumn = [NUMBER or nil] - maximum units that will be displayed in a singe column, nil is infinate (Default: nil)
startingIndex = [NUMBER] - the index in the final sorted unit list at which to start displaying units (Default: 1)
columnSpacing = [NUMBER] - the ammount of space between the rows/columns (Default: 0)
columnAnchorPoint = [STRING] - the anchor point of each new column (ie. use LEFT for the columns to grow to the right)
Now you have to specify how the children are configured. You add a 'initialConfigFunction' field to the header
header:SetAttribute("template","SecureUnitButtonTemplate")
local initialConfigFunction(child)
...
-- manipulate child here
...
end
header.initialConfigFunction = initialConfigFunction
Also, you'll have to register all the events you want (health, power..etc.) for each child in the function. You get the unitd by calling child:GetAttribute("unit").
The rest (set pointing, creation, ..etc.) is automatically done by SecureTemplates.lua. I'd recommend looking at GridFrame.lua and GridLayout.lua.
Then you set the attributes, which are all documented in SecureTemplates.lua
Now you have to specify how the children are configured. You add a 'initialConfigFunction' field to the header
Also, you'll have to register all the events you want (health, power..etc.) for each child in the function. You get the unitd by calling child:GetAttribute("unit").
The rest (set pointing, creation, ..etc.) is automatically done by SecureTemplates.lua. I'd recommend looking at GridFrame.lua and GridLayout.lua.