swatchview.lzx
<library>
<class name="swatchview" extends="view">
<attribute name="ctransform" value="null
"/>
<attribute name="color" value="0xffffff
"/>
<method name="construct" args="parent, args">
super.construct( parent, args );
// We _do_ support colortransform, independent of the
// platform's support
this.capabilities = new LzInheritedHash(this.capabilities);
this.capabilities.colortransform = true;
if ( args['width'] == null ){
args['width'] = this.immediateparent.width;
}
if ( args['height'] == null ){
args['height'] = this.immediateparent.height;
}
if ( args['fgcolor'] == null && args['bgcolor'] == null){
args['fgcolor'] = 0xFFFFFF;
}
</method>
<setter name="fgcolor" args="c">
this.setAttribute('bgcolor', c);
</setter>
<setter name="bgcolor" args="c">
this.color = c;
if (this['ctransform'] != null) {
c = LzColorUtils.applyTransform(c, ctransform);
}
super.setAttribute('bgcolor', c);
</setter>
<setter name="colortransform" args="o">
this.ctransform = o;
this.setAttribute('bgcolor', this.color);
</setter>
<doc>
<tag name="shortdesc"><text>A simple space-filling colored view.</text></tag>
<text>
<p>
A simple view that is filled with a single color.
Either 'fgcolor' and 'bgcolor' may be used to set the color of the view.
By default it fills the space of the parent with white.
</p>
<p>
Unlike with other views, setColorTransform will affect the bgcolor of the view.
</p>
</text>
</doc>
</class>
</library>