slider.lzx
<library>
<include href="base/baseslider.lzx"/>
<class name="slider" extends="baseslider">
<slidertrack/>
<state applied="${this.classroot.showrange}">
<text y="${classroot.track.y + classroot.track.height + 2}" text="${classroot.presentAttribute('minvalue', classroot.type)}" fgcolor="${classroot.style ? classroot.style.textcolor : this.fgcolor}"/>
<text y="${this.classroot.track.y + this.classroot.track.height + 2}" resize="true" x="${classroot.track.x+classroot.track.width-width}" text="${classroot.presentAttribute('maxvalue', classroot.type)}" fgcolor="${classroot.style ? classroot.style.textcolor : this.fgcolor}"/>
</state>
<method name="_applystyle" args="s">
track.setAttribute('bgcolor', s.bordercolor);
track.background.setAttribute('bgcolor', s.basecolor);
track.filled.setAttribute('bgcolor', s.selectedcolor);
</method>
<doc>
<tag name="shortdesc"><text>
A slider.
</text></tag>
<text>
<p>
The <tagname>slider</tagname> tag creates a slider which allows
for easy selection of a single value between a provided range.
Options exist for setting the range, showing the range values,
showing the selected value while dragged, and showing a fill bar.
</p>
<example>
<canvas height="60">
<slider x="20" y="20" width="300" value="50"/>
</canvas>
</example>
</text>
</doc>
</class>
<class name="slidertrack" extends="baseslidertrack">
<attribute name="showfill" value="${parent.showfill}" type="number"/>
<view name="background" bgcolor="red" height="${parent.height-(2*parent.classroot.bordersize)}" width="${parent.width-(2*parent.classroot.bordersize)}" x="${ parent.classroot.bordersize }" y="${ (parent.height-height)/2 }"/>
<view name="filled" bgcolor="0xff9933" opacity=".8" visible="${classroot.showfill}" height="${parent.height-(2*parent.classroot.bordersize)}" width="${Math.max(0,Math.min(classroot.thumb.x+classroot.thumb.width,parent.width)-(2*parent.classroot.bordersize))}" y="${ (parent.height-height)/2 }" x="${ parent.classroot.bordersize }"/>
<sliderthumb name="thumb"/>
</class>
<class name="sliderthumb" extends="basesliderthumb">
<doc>
<tag name="shortdesc"><text>
A slider.
</text></tag>
<text>
<p>The <tagname>slider</tagname> tag creates a slider which allows for
easy selection of a single value between a provided range. Options
exist for setting the range, showing the range values, showing the
selected value while dragged, and showing a fill bar.
</p>
<example>
<canvas height="60">
<slider x="20" y="20" width="300" value="50"/>
</canvas>
</example>
</text>
</doc>
</class>
</library>
Cross References
Includes
Classes
- <class name="slider" extends="baseslider">
- <class name="slidertrack" extends="baseslidertrack">
- <class name="sliderthumb" extends="basesliderthumb">