XML:Tile

From XfireWiki

Jump to: navigation, search

The Tile is the basic element of every window. It provides a reference to the component to be displayed, and specifies attributes that affect the way the component is affected


Contents

Example Code

An example of a tile with no child tiles

<Tile Name="FileMenu" X="0" Y="0" Z="-2" ResizeX="100" ResizeY="100" OutdentLeft="5" OutdentRight="5" OutdentTop="3" OutdentBottom="1" Component="FileMenu" />

An example of a tile with a child tile (the child tile has no children)

<Tile Name="HelpMenuText" X="ToolsMenuText.RIGHT+10" Y="3" Z="10" Component="HelpMenuText">

<Tile Name="HelpMenu" X="0" Y="0" Z="-2" ResizeX="100" ResizeY="100" OutdentLeft="5" OutdentRight="5" OutdentTop="3" OutdentBottom="1" Component="HelpMenu" />

</Tile>


Attribute definitions

Name: The name used to reference the tiles position and size from another tile. The name must be unique to the window. The name can contain numbers but must start with a letter. The name is case sensitive.
X: The x co-ordinate of the top left corner of the tile. This co-ordinate is relative to the parent tile, for example setting x to 5 would place the tile 5 pixels to the right of the top left corner of its parent tile.
Y: The y co-ordinate of the top left corner of the tile. This co-ordinate is relative to the parent tile, for example setting y to 5 would place the tile 5 pixels below the top of the top left corner of its parent tile.
Z: The layer number (default is 0). Used to place a tile on top of another tile even when it is not a child of the tile it is on top of (see #Layers).
ResizeX: The percentage of the available space that the width of the component will be resized to.
ResizeY: The percentage of the available space that the height of the component will be resized to.
IndentLeft: The number of pixels the left edge of the tile is to be indented from the X co-ordinate. This does not move the tile, rather it makes the available space available for the tile less.
IndentRight: The number of pixels the right edge of the tile is to be indented. This does not move the tile, rather it makes the available space available for the tile less.
IndentTop: The number of pixels the top edge of the tile is to be indented from the Y co-ordinate. This does not move the tile, rather it makes the available space available for the tile less.
IndentBottom: The number of pixels the bottom edge of the tile is to be indented. This does not move the tile, rather it makes the available space available for the tile less.
OutdentLeft: The number of pixels the left edge is to be outdented from the X co-ordinate. This is the same as specifying a negative IndentLeft value.
OutdentRight: The same as specifying a negative value for IndentRight.
OutdentTop: The same as specifying a negative value for OutdentTop.
OutdentBottom: The same as specifying a negative value for OutdentBottom.
JustX: The Justification of the tile in the X direction. This can be Left, Center or Right (default is left). This has no effect if the width of the available space is the same as the width of the tile (eg. JustX has no effect if ResizeX is 100).
JustY: The Justification of the tile in the Y direction. This can be Top, Center or Bottom (default is top). This has no effect if the height of the available space is the same as the height of the tile (eg. JustY has no effect if ResizeY is 100).
Component: The name of the component to be displayed in this tile (see one of the pages under classes).

Unknown Attributes

There are some attributes specified within the XML DTD specification. Their usage and effect are currently unknown.
They are Width, Height, Top, Left, Bottom, Right, AlignX, AlignY, MinWidth, MinHeight, DefaultWidth, DefaultHeight, BindX, BindY.

Many of these attributes are the same as ones defined in the components, so they may simply be left overs from the development process of the XML system.


Children

Like any XML file, Tiles can have children. Every tile except the first (defining the window) is a child tile. A child tile will be drawn on top of the parent tile unless a specific Z value is specified (see #Layers). The X/Y co-ordinates of child windows reference a position within the immediate parent tile, not the window.

Eg., a child tile with an X co-ordinate of 0 will be drawn at the left edge of its parent tile.

For more details on the X/Y co-ordinates see #Referencing.


Layers

Xfire XML skins have a very powerful layering system. Each tile can be given a Z co-ordinate which determines its position in the stack of drawn tiles (an analogy can be drawn between tiles and paper. If it helps, imagine that each tile is a piece of paper in a collage).

There are three specifics to working with Layers:
The higher the Z value, the higher the tile is in the stack.
If two tiles have the same Z value, the first tile in the XML document will be drawn at the bottom of the stack. Child tiles inherit their parents Z value. If a child tile also has a Z value specified then the child's Z value is the sum of the parents Z value and the Childs Z value (eg. a parent Z value of 4 and a child Z value of 2 will give the child a Z value of 6).
Z values can be negative (this allows child tiles to have a lower Z value than their parent which is often used when creating a highlight effect with menu's).


Referencing

A tile's position and size can be referenced from other tiles through the use of tile referencing. The syntax for referencing is similar to that used with objects in many programming languages (like Java).

References may be used in any Indent and Outdent attributes as well as the X and Y attributes. These attributes can contain multiple references and numbers seperated by + or - signs (the entire attribute value is like a mathematical expression, see the examples below).

The referencing sytax is the tile name followed by a period (.) and either width, height, top, bottom, left or right.
Eg. "tile21.width" would give the width of tile with the name "tile21".
Eg. To place a tile 2 pixels to the right of tile21 you would set the X attribute to "tile21.right+2".
Eg. If tile21 was the right edge of the window and you wanted your tile to stretch to tile21's left edge you would set the IndentRight attribute of your tile to "tile21.width".

The Tile name section of the reference is case sensitive. The section after the period is not. You may use WIDTH, width or Width, but for code readability it is recommended that you stick to one format.

Personal tools