tabelement.lzx
<library>
<include href="utils/layouts/resizelayout.lzx"/>
<include href="../base/basebutton.lzx"/>
<include href="../base/basetabelement.lzx"/>
<resource name="tabrsrc">
<frame src="resources/tabslider/tab_slider_up.swf"/>
<frame src="resources/tabslider/tab_slider_mo.swf"/>
<frame src="resources/tabslider/tab_slider_dn.swf"/>
</resource>
<resource name="tabshadow" src="resources/tabslider/tab_element_shdw.swf"/>
<class name="tabelement" extends="basetabelement" styleable="true">
<attribute name="defaultplacement" value="content
" type="string"/>
<attribute name="inset_top" value="${parent.inset_top}"/>
<attribute name="inset_right" value="${parent.inset_right}"/>
<attribute name="inset_bottom" value="${parent.inset_bottom}"/>
<attribute name="inset_left" value="${parent.inset_left}"/>
<attribute name="text_x" value="4
"/>
<attribute name="text_y" value="${this.top.header.height/2 - this.top.header.txt.height/2}"/>
<attribute name="shadowheight" value="4
"/>
<attribute name="shadowvisible" value="true
"/>
<attribute name="contentopacity" value="0.5
"/>
<attribute name="_mdoffset" value="2
"/>
<attribute name="headerpadding" value="0
"/>
<view name="top" width="100%" height="${parent.headerheight}" oninit="this.bringToFront()">
<basebutton name="bkgnd" resource="tabrsrc" styleable="true" x="${classroot.headerpadding}" width="${parent.width - 2*classroot.headerpadding}" height="100%" stretches="both">
<handler name="onmousedown">
classroot.container.shdw.setAttribute('visible', false);
parent.header.setAttribute('y', classroot._mdoffset);
</handler>
<handler name="onmouseup">
classroot.container.shdw.setAttribute('visible', classroot.shadowvisible);
parent.header.setAttribute('y', 0);
</handler>
<handler name="onclick">
classroot.parent.select(classroot);
lz.Focus.setFocus( this.classroot , false );
</handler>
</basebutton>
<view name="header" width="100%" height="100%">
<text name="txt" x="${classroot.text_x}" y="${classroot.text_y}" text="${classroot.text}" resize="true"/>
</view>
</view>
<view name="container" options="releasetolayout" width="100%">
<view name="content" x="${classroot.inset_left}" y="${classroot.inset_top}" bgcolor="${classroot.bgcolor}" width="${ Math.max(parent.width - classroot.inset_left - classroot.inset_right, 0 ) }" height="${ Math.max(parent.height - classroot.inset_top - classroot.inset_bottom, 0) }" clip="true" visible="${classroot.contentvisible}"/>
<view name="shdw" resource="tabshadow" stretches="both" width="100%" height="$once{classroot.shadowheight}" visible="$once{classroot.shadowvisible}" opacity=".3"/>
</view>
<resizelayout axis="y"/>
<method name="setHilite" args="dohilite">
top.header.txt.setAttribute('fgcolor',
dohilite ? style.texthilitecolor : style.textcolor);
if (dohilite)
top.bkgnd.onmouseover.sendEvent(top.bkgnd);
else
top.bkgnd.onmouseout.sendEvent(top.bkgnd);
</method>
<method name="_applystyle" args="s">
if (this.style != null) {
super._applystyle(s);
this.top.header.txt.setAttribute("fgcolor", s.textcolor);
if (this.bgcolor == null) {
this.container.setAttribute("bgcolor", s.bgcolor);
}
this.top.setAttribute('bgcolor', s.bordercolor);
}
</method>
<method name="doSpaceDown">
this.top.bkgnd.doSpaceDown();
</method>
<method name="doSpaceUp">
this.top.bkgnd.doSpaceUp();
</method>
<doc>
<tag name="shortdesc"><text>
A tab element view that is opened and closed in conjunction with a tabslider.
</text></tag>
<text>
<p>
<classname>tabelement</classname> is a non-visual view contained within a
<xref linkend="lz.tabslider"/> that opens and closes when directed by a tabslider.
In practice, the <classname>tabelement</classname> class can be extended to
create whatever look and feel is desired. The following example demonstrates how
that is done.
</p>
<example>
<canvas height="200">
<include href="lz/tabslider.lzx" />
<!-- Custom tabelement -->
<class name="mytabelement" extends="tabelement" bgcolor="blue">
<!-- classroot.parent = reference to tabslider -->
<view placement="header" bgcolor="red" height="100%" width="100%">
<text name="title" x="2" y="1" text="${classroot.text}"/>
</view>
</class>
<!-- Use custom tabelement -->
<tabslider bgcolor="yellow" width="100" height="200" spacing="2">
<mytabelement text="Tab 1">
<view bgcolor="white" width="30" height="30"/>
</mytabelement>
<mytabelement text="Tab 2"/>
<mytabelement text="Tab 3"/>
</tabslider>
</canvas>
</example>
</text>
</doc>
</class>
</library>
Cross References
Includes
Resources
Classes
- <class name="tabelement" extends="basetabelement">