Drawer

From TrillWiki

Jump to: navigation, search

Drawers are hideable windows that attach to a main window.

Contents

[edit] XML Tree

<trillian>
<component>
<drawer />
</component>
</trillian>

Note that a <drawer> can only be used in a top-most <component> that is used in a <window>. (i.e. it can't be used in <component> used in a <frame>.)

[edit] Code

<drawer [atributes]="[values]" >
<!-- basic rect code... negative values will probably be useful
(i.e. if you want to position the drawer slightly under the edge of the window.)
Also, leaving off the element with the same name as the "attach" might work best.
i.e. if you're attaching to the bottom, leave off the <bottom> -->
</drawer>
Attribute Priority Description
source Required The name of the component* you want to attach as a drawer
name Required What you want to call this drawer
attach Required Where on the main window you want the drawer attached.

left, right, top, bottom

visible Optional Does the drawer show,

1=yes
0=no

[edit] Example drawer code

Negative drawer positioning in Trillian Cordillera
Negative drawer positioning in Trillian Cordillera

If your window has a curve to it, you might want to position the drawer slightly under the main window. You do this by using a negative value for the opposite rect element to your attach value. (i.e. if you're attaching to the right, set the <left> to a negative value.) For an example, see how Kid's Trillian Cordillera slid the drawer under the window by 10 pixels.

<drawer source="comContactsDR" name="drawer" attach="right" visible="1">
<rect>
<top num="27" height="0"/>
<bottom num="32" height="1"/>
<left num="-10" width="0"/>
<!-- Note there's no <right> -->
</rect>
</drawer>

[edit] Components for drawers

See the component page for basic component reference. There are, however, some special attributes for components that will be used as drawers.

<component <atributes>="<values>" >
<!-- other basic component code -->
</component>
Attribute Priority Description, Possible values
name Required What you want to name this component
min Optional Drawer's minimum size when closed
max Optional Drawer's maximum size when opened
default Required Drawer's default size when first opened
threshold Optional Drawer size at which icontrols vanish
selfAdjust Optional Drawer size at which the drawer automatically closes

Also, you will want to include a Button control either in the component or on the main window with the following:

<action name="toggleDrawer" value="[name of your drawer component]>