→Inheritance
(Fixed some typos and punctuation.) |
|||
| Line 1: | Line 1: | ||
__NOTOC__ | |||
==Inheritance== | |||
Derived from: <[[XML/LayoutFrame|LayoutFrame]]> | |||
Contained in: <Frames>, <[[XML/Ui|Ui]]> | |||
Runtime object: [[UIOBJECT_Frame]] | |||
==Elements== | |||
* <[[XML/TitleRegion|TitleRegion]] /> | |||
* <ResizeBounds> | |||
** <[[XML/Dimension|minResize]]> | |||
** <[[XML/Dimension|maxResize]]> | |||
* </ResizeBounds> | |||
* <[[XML/BackDrop|BackDrop]]> | |||
* <[[XML/Types/Inset|BackgroundInsets]]> | |||
* <[[XML/Types/Inset|HitRectInsets]]> | |||
* <Layers> | |||
** <[[XML/Layer|Layer]]>... | |||
* </Layers> | |||
* <Frames> | |||
** <[[XML/Frame|Frame]]>... | |||
* </Frame> | |||
* <Scripts> | |||
** (see [[Widget handlers]]) | |||
* </Scripts> | |||
==Attributes== | |||
;alpha | |||
:([[XML attribute types|float]]) The opacity of the frame, where 1.0 is opaque and 0.0 is fully transparent. | |||
;parent | |||
:([[XML attribute types|string]]) | |||
;toplevel | |||
:([[XML attribute types|boolean]]) Whether or not the frame should be displayed on top of all the other frames in its strata (see '''frameStrata'''). | |||
;movable | |||
:([[XML attribute types|boolean]]) Whether the frame can be moved by the user. | |||
;resizable | |||
:([[XML attribute types|boolean]]) Whether the frame can be resized by the user. | |||
;frameStrata | |||
:([[XML attribute types|string]]) Which layer your frame should be on. Some words of caution: if you set your frameStrata to "BACKGROUND" it will be blocked from receiving mouse events unless you set '''frameLevel''' to 1 or more. Same goes for "TOOLTIP" regardless of '''frameLevel'''. Possible values are, from highest to lowest: | |||
:* TOOLTIP | |||
:* FULLSCREEN_DIALOG | |||
:* FULLSCREEN | |||
:* DIALOG | |||
:* HIGH | |||
:* MEDIUM | |||
:* LOW | |||
:* BACKGROUND | |||
;frameLevel | |||
:([[XML attribute types|int]]) What level your frame is on, in the strata. Normally decided by parent-child relationships and better left untouched - also, see [[#What is the difference between frameLevel and frameStrata?|the difference between frameLevel and frameStrata]] below. | |||
;id | |||
:([[XML attribute types|string]]) | |||
;enableMouse | |||
:([[XML attribute types|boolean]]) Whether mouse events are sent to the frame. | |||
;enableKeyboard | |||
:([[XML attribute types|boolean]]) Whether keystroke events are sent to the frame. | |||
;clampedToScreen | |||
:([[XML attribute types|boolean]]) Whether the frame is kept inside the screen boundaries. | |||
;protected | |||
:([[XML attribute types|boolean]]) Whether the frame is allowed to run protected code (only allowed in Blizzard code). | |||
;jumpNavigateEnabled | |||
:([[XML attribute types|boolean]]) | |||
;jumpNavigateStart | |||
:([[XML attribute types|boolean]]) | |||
;parentKey | |||
:([[XML attribute types|string]]) Defines a name for a key in the parent element, which will reference this element at runtime. | |||
:Example: | |||
<Frame name="MyFrame"> | |||
<Frames> | |||
<Frame name="$parentChild" parentKey="child" /> | |||
</Frames> | |||
</Frame> | |||
: At runtime, you can refer to the child frame as either <tt>MyFrameChild</tt> or <tt>MyFrame.child</tt> . | |||
Inherited from <[[XML/LayoutFrame|LayoutFrame]]>: | |||
;name | |||
:([[XML attribute types|string]]) Defines the name of the element. This gets registered in the LUA global variables. Using the ''$parent'' tag here refers to the parent's name - or the parent's parent's name, if the parent is unnamed, or even further up. | |||
;inherits | |||
:([[XML attribute types|string]]) Instantiates the element using a ''virtual'' element as a template. | |||
;virtual | |||
:([[XML attribute types|boolean]]) Defines the element as template, to be inherited from. The element itself is not created. | |||
;setAllPoints | |||
:([[XML attribute types|boolean]]) Automatically anchors the TOPLEFT, TOPRIGHT, BOTTOMLEFT and BOTTOMRIGHT points to the parent. | |||
;hidden | |||
:([[XML attribute types|boolean]]) Makes the element hidden by default. | |||
==Description== | |||
Frames are the building blocks of the visual components of the user interface. All of the various visual elements of the UI are types of Frame, and inherit most if not all of the basic frame properties, in addition to adding some more. Frames are defined in the various <tt>.xml</tt> files in the <tt>Interface</tt> directory (except for the <tt>Bindings.xml</tt> files, which provide key bindings). | Frames are the building blocks of the visual components of the user interface. All of the various visual elements of the UI are types of Frame, and inherit most if not all of the basic frame properties, in addition to adding some more. Frames are defined in the various <tt>.xml</tt> files in the <tt>Interface</tt> directory (except for the <tt>Bindings.xml</tt> files, which provide key bindings). | ||
| Line 26: | Line 113: | ||
== Frame Levels == | == Frame Levels == | ||
Frame levels are that which determines what frame will be on top of other frame. Each frame has a frame level value. If frame A is placed in the same area as frame B, then the frame with the highest frame level will be on top of the other frame. | Frame levels are that which determines what frame will be on top of other frame. Each frame has a frame level value. If frame A is placed in the same area as frame B, then the frame with the highest frame level will be on top of the other frame. | ||
Instead of going around and specifying that frame A should have frame level 12, and frame B frame level 15, Blizzard uses a set of predefined "groups" of frame levels called frameStrata. The valid values for frameStrata are "PARENT", "BACKGROUND", "LOW", "MEDIUM", "HIGH", "DIALOG", "FULLSCREEN_DIALOG" and "TOOLTIP" (there may be more). For the values "BACKGROUND" through "TOOLTIP" the values are listed in their assumed ascendancy (i.e. it is assumed that "BACKGROUND" will be below "LOW"). The default value is "PARENT" if no frameStrata is specified. | Instead of going around and specifying that frame A should have frame level 12, and frame B frame level 15, Blizzard uses a set of predefined "groups" of frame levels called frameStrata. The valid values for frameStrata are "PARENT", "BACKGROUND", "LOW", "MEDIUM", "HIGH", "DIALOG", "FULLSCREEN_DIALOG" and "TOOLTIP" (there may be more). For the values "BACKGROUND" through "TOOLTIP" the values are listed in their assumed ascendancy (i.e. it is assumed that "BACKGROUND" will be below "LOW"). The default value is "PARENT" if no frameStrata is specified. | ||
There is also a special attribute called toplevel - this means (hopefully) that the frame should be on top of any other frame (or, possibly, on top of any other frame in the same [[frameStrata]]). | There is also a special attribute called toplevel - this means (hopefully) that the frame should be on top of any other frame (or, possibly, on top of any other frame in the same [[frameStrata]]). | ||
==What is the difference between frameLevel and frameStrata?== | |||
Well first off, though you can set frameLevel in your <Frame> tag, frameLevel is dictated by XML nesting. Check this example out: | |||
<Frame name="MyFrame" frameStrata="DIALOG" parent="UIParent"> | |||
<Frames> | |||
<Button name="MyButton"> | |||
</Button> | |||
</Frames> | |||
</Frame> | |||
Since UIParent's frameLevel is 1, the frame we created here should be frameLevel 2 and the Button should be frameLevel 3. | |||
You can check a frame's level with Frame:GetFrameLevel() and you can set it with Frame:SetFrameLevel(). However, setting a frame's level is ill-advised. It is given its level automatically and it's best to leave it that way. If you need to change a frame's level in your own code, best thing to do is just nest your code differently. | |||
Note: If the parent of a frame is changed by your code, the frame levels are not adjusted to compensate. You may need to adjust the frame's level to fix the way the frame displays. | |||
;Possible Values: | |||
* 0 - No parent | |||
* 1 - Parent is UIParent | |||
* 2 and higher... | |||
The maximum value seems to be 129. If you call SetFrameLevel with a value greater than 129, the value passed will be ignored, and the frame level will be set to 129. | |||
In my experimentation, and with my WoW client (Windows), it seems higher values will stick, and be honored, if you call SetFrameLevel twice in a row. This is probably unreliable. If you find that you are having to set frame levels greater than 129, see if you can use a hierarchical set of parent frames instead. | |||
A more complete explanation of how frame levels are used is found at [[How the user interface is rendered]]. | |||
[[Category:XML elements]] | |||
[[Category:Interface customization]] | [[Category:Interface customization]] | ||