textlistitem.lzx
<library>
<include href="lz/listitem.lzx"/>
<class name="textlistitem" extends="listitem">
<attribute name="text_x" value="4
"/>
<attribute name="text_y" value="${this.height/2 - this._title.height/2}"/>
<text name="_title" x="${classroot.text_x}" y="${classroot.text_y}" width="100%" text="${parent.text}"/>
<method name="_applystyle" args="s">
// TODO [20090814 anba] I wonder why 'this.style'
// is used instead of 's'
var style = this['style'];
if (style != null) {
super._applystyle(s);
// set text color
var textcolor;
if (this._enabled) {
if (this.hilited) {
textcolor = style.texthilitecolor;
} else if (this.selected) {
textcolor = style.textselectedcolor;
} else {
textcolor = style.textcolor;
}
} else {
textcolor = style.textdisabledcolor;
}
if (this._title) this._title.setAttribute('fgcolor', textcolor);
}
</method>
<method name="_showEnabled">
super._showEnabled();
if (_initcomplete) {
_applystyle(this.style);
}
</method>
<doc>
<tag name="shortdesc"><text>
a textlistitem extends listitem and provides text display
</text></tag>
<text>
<p>A <classname>textlistitem</classname> is a
<sgmltag class="element" role="lz.listitem"><listitem></sgmltag> which displays text. This is the most
common form of a <sgmltag class="element" role="lz.listitem"><listitem></sgmltag>, and is the default
listitem for <sgmltag class="element" role="lz.combobox"><combobox></sgmltag>s,
<sgmltag class="element" role="lz.menu"><menu></sgmltag>s, <sgmltag class="element" role="lz.list"><list></sgmltag>s, and
<sgmltag class="element" role="lz.floatinglist"><floatinglist></sgmltag>s.
</p>
<example>
<canvas height="100">
<list>
<textlistitem text="item 1" value="1" selected="true"/>
<textlistitem text="item 2" value="2"/>
</list>
</canvas>
</example>
</text>
</doc>
</class>
</library>
Cross References
Includes
Classes