Rect

From TrillWiki

Revision as of 03:12, 12 March 2006 by Tometheus (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

Rect code is used all over the place in Trillian. From backgrounds to colors, etc, nothing can be done without the faithful <rect> code, so this is probably one of the most important things to learn. (Fortunately it's fairly simple.)

Contents

[edit] Standard rect code

<rect>
<left num="0" width="0"/>
<right num="0" width="1"/>
<top num="0" height="0"/>
<bottom num="0" height="1"/>
</rect>
Attribute Priority Description, Possible Values
<left>

<right>
<top>
<bottom>

Required Defines which side is being affected
num Required number of pixels from the edge that this area starts or ends
width Required* 0 - measure from the left

1 - measure from the right

height Required* 0 - measure from the top

1 - measure from the bottom

* height is only used for top and bottom tags, width is only used for right and left tags. Take a look at the SkinTutorial for a better description of widths and heights.

[edit] Caveats

Occasionally you will leave out one of the directions for things like drawers to allow Trillian to have freedom with it.

[edit] Relative rect code

Also, there is alternate code for use with <rect>s that are relative to anchors.

<rect>
<top orientation="" source="">
</rect>
Attribute Priority Description, Possible Values
orientation Required Above or Below for a northsouth anchor with <top>, <bottom>

Left or Right for an eastwest anchor with <left>, <right>.

source Required Name of the anchor which controls this boundary


[edit] Using a &rect; entity

Tip from Risen

Rect code which covers an entire window from edge to edge (as above) is used in a large number of situations. It is a good idea to store this code in a separate file (or entity). Then you only need to refer to it as &rect; or whatever you decide.

Put the following in your DTD file (usually Trillian.dtd), then you can use &rect; anywhere that calls for the edge-to-edge rect code.

<!ENTITY rect '
<rect>
<left num="0" width="0"/>
<right num="0" width="1"/>
<top num="0" height="0"/>
<bottom num="0" height="1"/>
</rect>
'>
Personal tools