XML/LayoutFrame

From Warcraft Wiki
< XML
Jump to navigation Jump to search

<LayoutFrame> abstracts tags and attributes common to most widgets.

<LayoutFrame name="" parentKey= "" parentArray="" inherits="" mixin="" secureMixin="" virtual="" setAllPoints="" hidden="">
	<Size />
	<Anchors />
	<KeyValues />
	<Animations />
</LayoutFrame>

Attributes

References
name (xs:string?Optional. Could be nil.) - Adds a reference to _G, substituting $parent with a parent's name.
parentKey (xs:string?Optional. Could be nil.) - Adds a reference to the widget's parent.
parentArray ((xs:string?Optional. Could be nil.) - Inserts a reference to an array in the widget's parent.
Templates
inherits (xs:string?Optional. Could be nil.) - Inherits a comma-separated list of XML virtual templates.
virtual (xs:boolean?Optional. Could be nil.) - Creates an XML virtual template instead of a widget (requires name).
mixin (xs:string?Optional. Could be nil.) - Inherits a comma-separated list of Lua mixins.
secureMixin (xs:string?Optional. Could be nil.) - Inherits a comma-separated list of Lua mixins, wrapping inherited functions to force secure execution.
Position & Visibility
setAllPoints (xs:boolean?Optional. Could be nil.) - Sets the top-left and bottom-right anchors to match the parent widget.
hidden (xs:boolean?Optional. Could be nil.) - Controls the frame's initial visibility.

Children

<Anchors> defines a widget's anchors by enclosing <Anchor> tags.

<Anchor> defines a single point to align a <LayoutFrame>.

point (ui:FRAMEPOINT) - Point to align.
relativeTo (xs:string?Optional. Could be nil.) - Another widget to align against (in _G).
relativeKey (string?Optional. Could be nil.) - Another widget to align against (sibling).
relativePoint (ui:FRAMEPOINT?Optional) - Point on the other widget to align against (defaults to the same as point)
x (xs:float?Optional. Could be nil.) - Horizontal offset.
y (xs:float?Optional. Could be nil.) - Vertical offset.

<Size> (inherits from <Dimension>) sets the width and height.

<KeyValues> defines additional properties by enclosing <KeyValue> tags.

<KeyValue> assigns a single key/value pair to the widget's runtime table.

key (xs:string) - Key in the widget's table.
value (xs:string) - Value to be assigned.
keyType (ui:KEYVALUETYPE) - nil, boolean, number, string (default) or global
type (ui:KEYVALUETYPE) - nil, boolean, number, string (default) or global

<Animations> encloses one or more <AnimationGroup> tags.

Example

The following example uses <Frame> to demonstrate <LayoutFrame>'s utility

  • Creating (virtual) and using (inherits) XML virtual templates
  • Extending a parent's name (name = "$parent____")
<Frame name="ContainerChildTemplate" virtual="true">
	<!-- insert stuff here -->
</Frame>
 
<Frame name="Container">
	<Frames>
		<Frame name="$parentChild1" inherits="ContainerChildTemplate" />  <!-- name="ContainerChild1" -->
		<Frame name="$parentChild2" inherits="ContainerChildTemplate" />  <!-- name="ContainerChild2" -->
	</Frames>
</Frame>

Extending the example, two more frames could be added to "Container" during runtime using Lua:

CreateFrame("Frame", "ContainerChild3", "Container", "ContainerChildTemplate");
CreateFrame("Frame", "ContainerChild4", "Container", "ContainerChildTemplate");

See also