formatfontcolor.lzx
<library>
<include href="colorsquare.lzx"/>
<dataset name="fontcolors">
<clr value="0x000000"/>
<clr value="0x555555"/>
<clr value="0x333399"/>
<clr value="0x339999"/>
<clr value="0x339966"/>
<clr value="0xcccc33"/>
<clr value="0xcc9933"/>
<clr value="0xcc3300"/>
</dataset>
<class name="colorswatch" extends="lzcombobox_item">
<colorsquare swatchcolor="$path{'@value'}" drawsquare="true" x="6" y="3"/>
</class>
<class name="formatfontcolor" extends="lzcombobox" width="48" shownitems="8" style="sidebarbutton_style" itemclassname="colorswatch" itemdatapath="fontcolors:/clr" focusable="false" listwidth="${this.bkgnd.mid.width}">
<attribute name="editor" value="$once{this.parent.editor}"/>
<attribute name="toolbar" value="$once{this.parent}"/>
<tooltip>Choose font color</tooltip>
<method name="init">
super.init();
toolbar.registerTool(this,"color");
</method>
<handler name="oneditor" args="e">
this.setValue(this.editor.defaultfontcolor, true);
this.csq.setAttribute('fgcolor', this.editor.defaultfontcolor);
</handler>
<method name="construct" args="parent, args">
super.construct(parent, args);
</method>
<handler name="onselect">
var color = this.value;
this.csq.setAttribute('fgcolor', color);
//------------------------------------------------------------
// make sure that we call into editor if this combobox has
// changed, i.e., it contains an initial value. -pk
//------------------------------------------------------------
if (this.changed && this.toolbar._passthruchanges) {
this.editor.setFormatAttribute("color", this.getValue());
this.editor.delegateRestoreSelection();
}
</handler>
<method name="reset">
rollback();
</method>
<method name="setState" args="state">
this.setValue(state);
</method>
<handler name="onmouseover">
this.editor.saveSelectionRegion();
</handler>
<colorsquare x="11" y="3" name="csq" drawsquare="true">
<setter name="fgcolor" args="color">
this.setAttribute('visible', color != null );
if (this.visible) {
this.setAttribute('swatchcolor', color);
}
</setter>
</colorsquare>
</class>
</library>
Cross References
Includes
Classes
Named Instances