WoW:XML/Layer: Difference between revisions

From AddOn Studio
< XML
Jump to navigation Jump to search
(Created page with "{{uixmltype}} < Layers A Layer is a fundamental UI building block for defining visible UI elements of Frames. A Layer is an element...")
 
m (→‎Details: Escaped the pointy brackets, so the wiki doesn't treat <Layer> as for its consumption.)
Line 18: Line 18:


=== Example ===
=== Example ===
  <[[XML/Frame|Frame]] name="MyFrame">
  &lt;[[XML/Frame|Frame]] name="MyFrame"&gt;
   <Layers>
   &lt;Layers&gt;
     <Layer>
     &lt;Layer&gt;
       <[[XML/Texture|Texture]]>
       &lt;[[XML/Texture|Texture]]&gt;
         <Size x="100" y="100" />
         &lt;Size x="100" y="100" /&gt;
         <HitRectInsets>
         &lt;HitRectInsets&gt;
           <[[XML/AbsInset|AbsInset]] left="0" right="-100" top="0" bottom="0"/>
           &lt;[[XML/AbsInset|AbsInset]] left="0" right="-100" top="0" bottom="0"/&gt;
         </HitRectInsets>
         &lt;/HitRectInsets&gt;
         <Color a="1" r="1" g="1" b="1" />
         &lt;Color a="1" r="1" g="1" b="1" /&gt;
       </Texture>
       &lt;/Texture&gt;
       <Texture>
       &lt;Texture&gt;
         <Size x="100" y="100" />
         &lt;Size x="100" y="100" /&gt;
         <Color a="1" r="1" g="1" b="1" />
         &lt;Color a="1" r="1" g="1" b="1" /&gt;
       </Texture>
       &lt;/Texture&gt;
     </Layer>
     &lt;/Layer&gt;
   </Layers>
   &lt;/Layers&gt;
  </Frame>
  &lt;/Frame&gt;


This example will show a frame with a single default layer, displaying two textures.
This example will show a frame with a single default layer, displaying two textures.
Line 55: Line 55:
''Note: The above are capitalized for a reason. See example:''<BR />
''Note: The above are capitalized for a reason. See example:''<BR />


  <Layers>
  &lt;Layers&gt;
   <Layer level="BACKGROUND">
   &lt;Layer level="BACKGROUND"&gt;
     ...
     ...
   </Layer>
   &lt;/Layer&gt;
   <Layer level="ARTWORK">
   &lt;Layer level="ARTWORK"&gt;
     ...
     ...
   </Layer>
   &lt;/Layer&gt;
   <Layer level="OVERLAY">
   &lt;Layer level="OVERLAY"&gt;
     ...
     ...
   </Layer>
   &lt;/Layer&gt;
  </Layers>
  &lt;/Layers&gt;

Revision as of 23:46, 11 November 2017

XML UI ← XML types < Layer < Layers

A Layer is a fundamental UI building block for defining visible UI elements of Frames. A Layer is an element of an Layers array defined in a Frame. Layer XML elements, as a part of Layers array, can be defined on any Frame, which includes elements like Buttons and CheckButtons.

Inheritance

Inherited by: none, Inherits: none, Defined in: Frame > Layers

Elements

  • Texture ... - 0 or more Textures to be rendered in the Layer
  • FonstString ... - 0 or more FonstStrings to be rendered in the Layer

Attributes

  • level (DRAWLAYER) - Layer level in 'Z order'. Default is 'ARTWORK'.
  • textureSubLevel (int) - Additional sub-leveling of 'level'. Range of -8 .. 7. Default is '0'.

Summary

An Layer is a fundemental UI construct for defining visible renderable elements of Frames. An Layer is an element of an Layers array defined in a Frame. Layer XML elements, as a part of Layers array, can be defined on any Frame, which also includes Buttons and CheckButtons.

Example

<Frame name="MyFrame">
  <Layers>
    <Layer>
      <Texture>
        <Size x="100" y="100" />
        <HitRectInsets>
          <AbsInset left="0" right="-100" top="0" bottom="0"/>
        </HitRectInsets>
        <Color a="1" r="1" g="1" b="1" />
      </Texture>
      <Texture>
        <Size x="100" y="100" />
        <Color a="1" r="1" g="1" b="1" />
      </Texture>
    </Layer>
  </Layers>
</Frame>

This example will show a frame with a single default layer, displaying two textures.

Details

There are 3 levels of layers: BACKGROUND is in the back, ARTWORK is in the middle and OVERLAY is in front. If you want to be sure that a object is before another, you must specify the level where you want to place it.

BACKGROUND - Level 0. Place the background of your frame here.
BORDER - Level 1. Place the artwork of your frame here .
ARTWORK - Level 2. Place the artwork of your frame here.
OVERLAY - Level 3. Place your text, objects, and buttons in this level.
HIGHLIGHT - Level 4. Place your text, objects, and buttons in this level.

  • Elements in the HIGHLIGHT Layer are automatically shown or hidden when the mouse enters or leaves.
  • For Highlighting to work you need enableMouse="true" in your <Frame> attributes.

Layer can be set on creation using the <i><Layers></i> tag in XML, or the "layer" parameter in Frame:CreateTexture(). To change the layer after creation, use the LayeredRegion:SetDrawLayer() function.

Note: The above are capitalized for a reason. See example:

<Layers>
  <Layer level="BACKGROUND">
    ...
  </Layer>
  <Layer level="ARTWORK">
    ...
  </Layer>
  <Layer level="OVERLAY">
    ...
  </Layer>
</Layers>