MainRegion

From TrillWiki

Jump to: navigation, search

Mainregion code tells Trillian what shape the window / control is.

[edit] Use Bitmap / Use Source

Mainregion can be used to read the transparent colo(u)rs from the background code and make those areas transparent.

<mainregion usebitmap="1"></mainregion>

To build non-rectangular IControls, a component is defined using background code and the above type of mainregion code. The Mainregion of the control then uses the region defined in "usesource". To call region code from another component we use:

<mainregion usesource="<name of component>"></mainregion>

We call this regionmapping, and more info can be found here

[edit] Manual Definition

Manual definition of regions. This is by far the most complex, and is now mostly unnecessary.

<mainregion>
<region type="<type>" combinetype="<combinetype>">
<!-- standard rect code -->
<!-- The following are also necessary for type="roundrect" -->
<extra name="widthellipse" value=""/>
<extra name="heightellipse" value=""/>
</region>
</mainregion>
Mainregion demonstration

The type can be elliptic, rectangle or roundrect, which are shown in the file transfer window illustrated here. The manually defined buttons were created by using <color> code and the mainregion code above. (The usebitmap button uses an image of course.)

The combinetype can be or, and, or xor. Basically: an "OR" type will combine the all of the region with all of the region defined above. "AND" will only combine those bit's which overlap on the two regions, and "XOR" (eXclusive OR) will only combine the bits that don't overlap. The first combine type doesn't matter, as it's not combining with anything.

For type="roundrect", the two pieces of <extra> code tell Trillian how to round off the corners. For example, in the illustration to the right, I've used widthellipse=10 and heightellipse=10.

[edit] See also