1999-01-13 22:28:54 +03:00
|
|
|
<HTML><BODY>
|
2001-11-28 21:00:17 +03:00
|
|
|
<!-- NEW PAGE -->
|
1999-01-13 22:28:54 +03:00
|
|
|
<H2><A name=Fl_Valuator>class Fl_Valuator</A></H2>
|
|
|
|
<HR>
|
|
|
|
<H3>Class Hierarchy</H3>
|
|
|
|
<UL>
|
|
|
|
<PRE>
|
|
|
|
<A href=Fl_Widget.html#Fl_Widget>Fl_Widget</A>
|
1998-12-29 17:21:17 +03:00
|
|
|
|
|
1999-01-13 22:28:54 +03:00
|
|
|
+----<B>Fl_Valuator</B>
|
1998-12-29 17:21:17 +03:00
|
|
|
|
|
1999-01-13 22:28:54 +03:00
|
|
|
+----<A href=Fl_Adjuster.html#Fl_Adjuster>Fl_Adjuster</A>, <A href=Fl_Counter.html#Fl_Counter>Fl_Counter</A>, <A href=Fl_Dial.html#Fl_Dial>Fl_Dial</A>, <A href=Fl_Roller.html#Fl_Roller>Fl_Roller</A>,
|
|
|
|
<A href=Fl_Slider.html#Fl_Slider>Fl_Slider</A>, <A href=Fl_Value_Input.html#Fl_Value_Input>Fl_Value_Input</A>, <A href=Fl_Value_Output.html#Fl_Value_Output>Fl_Value_Output</A>,
|
|
|
|
</PRE>
|
|
|
|
</UL>
|
|
|
|
<H3>Include Files</H3>
|
|
|
|
<UL>
|
|
|
|
<PRE>
|
|
|
|
#include <FL/Fl_Valuator.H>
|
|
|
|
</PRE>
|
|
|
|
</UL>
|
|
|
|
<H3>Description</H3>
|
2001-11-29 22:24:00 +03:00
|
|
|
The <TT>Fl_Valuator</TT> class controls a single floating-point value
|
|
|
|
and provides a consistent interface to set the value, range, and step,
|
|
|
|
and insures that callbacks are done the same for every object.
|
1999-01-27 17:24:00 +03:00
|
|
|
<P>There are probably more of these classes in FLTK than any others: </P>
|
2001-05-06 20:25:05 +04:00
|
|
|
<P ALIGN=CENTER><IMG src="valuators.gif" ALT="Fl_Valuator widgets."></P>
|
2001-11-29 22:24:00 +03:00
|
|
|
<P>In the above diagram each box surrounds an actual subclass. These
|
2001-10-01 00:25:36 +04:00
|
|
|
are further differentiated by setting the <A href=Fl_Widget.html#Fl_Widget.type><TT>
|
2001-11-29 22:24:00 +03:00
|
|
|
type()</TT></A> of the widget to the symbolic value labeling the
|
1999-01-13 22:28:54 +03:00
|
|
|
widget. The ones labelled "0" are the default versions with a <TT>
|
2001-11-29 22:24:00 +03:00
|
|
|
type(0)</TT>. For consistency the symbol <TT>FL_VERTICAL</TT> is
|
1999-01-15 01:14:01 +03:00
|
|
|
defined as zero.</P>
|
1999-01-13 22:28:54 +03:00
|
|
|
<H3>Methods</H3>
|
|
|
|
<CENTER>
|
2001-05-06 20:25:05 +04:00
|
|
|
<TABLE width=90% summary="Fl_Valuator methods.">
|
1999-01-13 22:28:54 +03:00
|
|
|
<TR><TD align=left valign=top>
|
|
|
|
<UL>
|
|
|
|
<LI><A href=#Fl_Valuator.Fl_Valuator>Fl_Valuator</A></LI>
|
|
|
|
<LI><A href=#Fl_Valuator.~Fl_Valuator>~Fl_Valuator</A></LI>
|
|
|
|
<LI><A href=#Fl_Valuator.changed>changed</A></LI>
|
|
|
|
</UL>
|
|
|
|
</TD><TD align=left valign=top>
|
|
|
|
<UL>
|
|
|
|
<LI><A href=#Fl_Valuator.clamp>clamp</A></LI>
|
|
|
|
<LI><A href=#Fl_Valuator.clear_changed>clear_changed</A></LI>
|
|
|
|
<LI><A href=#Fl_Valuator.format>format</A></LI>
|
|
|
|
</UL>
|
|
|
|
</TD><TD align=left valign=top>
|
|
|
|
<UL>
|
|
|
|
<LI><A href=#Fl_Valuator.increment>increment</A></LI>
|
|
|
|
<LI><A href=#Fl_Valuator.maximum>maximum</A></LI>
|
|
|
|
<LI><A href=#Fl_Valuator.minimum>minimum</A></LI>
|
|
|
|
</UL>
|
|
|
|
</TD><TD align=left valign=top>
|
|
|
|
<UL>
|
|
|
|
<LI><A href=#Fl_Valuator.range>range</A></LI>
|
|
|
|
<LI><A href=#Fl_Valuator.round>round</A></LI>
|
|
|
|
<LI><A href=#Fl_Valuator.set_changed>set_changed</A></LI>
|
|
|
|
</UL>
|
|
|
|
</TD><TD align=left valign=top>
|
|
|
|
<UL>
|
|
|
|
<LI><A href=#Fl_Valuator.step>step</A></LI>
|
|
|
|
<LI><A href=#Fl_Valuator.value>value</A></LI>
|
|
|
|
</UL>
|
|
|
|
</TD></TR>
|
|
|
|
</TABLE>
|
|
|
|
</CENTER>
|
2001-11-29 22:24:00 +03:00
|
|
|
<H4><A name=Fl_Valuator.Fl_Valuator>Fl_Valuator::Fl_Valuator(int x, int
|
1999-01-13 22:28:54 +03:00
|
|
|
y, int w, int h, const char *label = 0)</A></H4>
|
2001-11-29 22:24:00 +03:00
|
|
|
Creates a new <TT>Fl_Valuator</TT> widget using the given position,
|
|
|
|
size, and label string. The default boxtype is <TT>FL_NO_BOX</TT>.
|
1999-01-13 22:28:54 +03:00
|
|
|
<H4><A name=Fl_Valuator.~Fl_Valuator>virtual Fl_Valuator::~Fl_Valuator()</A>
|
|
|
|
</H4>
|
2001-11-29 22:24:00 +03:00
|
|
|
Destroys the valuator.
|
1999-01-13 22:28:54 +03:00
|
|
|
<H4><A name=Fl_Valuator.value>double Fl_Valuator::value() const
|
|
|
|
<BR> int Fl_Valuator::value(double)</A></H4>
|
2001-11-29 22:24:00 +03:00
|
|
|
Get or set the current value. The new value is <I>not</I> clamped or
|
1999-01-13 22:28:54 +03:00
|
|
|
otherwise changed before storing it. Use <TT>clamp()</TT> or <TT>round()</TT>
|
2001-11-29 22:24:00 +03:00
|
|
|
to modify the value before calling this if you want. If the new value
|
|
|
|
is different than the current one the object is redrawn. The initial
|
|
|
|
value is zero.
|
1999-01-13 22:28:54 +03:00
|
|
|
<H4><A name=Fl_Valuator.minimum>double Fl_Valuator::minimum() const
|
|
|
|
<BR> void Fl_Valuator::minimum(double)</A></H4>
|
2001-11-29 22:24:00 +03:00
|
|
|
Gets or sets the minimum value for the valuator.
|
1999-01-13 22:28:54 +03:00
|
|
|
<H4><A name=Fl_Valuator.maximum>double Fl_Valuator::maximum() const
|
|
|
|
<BR> void Fl_Valuator::maximum(double)</A></H4>
|
2001-11-29 22:24:00 +03:00
|
|
|
Gets or sets the maximum value for the valuator.
|
|
|
|
<H4><A name=Fl_Valuator.range>void Fl_Valuator::range(double min,
|
1999-01-13 22:28:54 +03:00
|
|
|
double max);</A></H4>
|
2001-11-29 22:24:00 +03:00
|
|
|
Sets the minimum and maximum values for the valuator. When the user
|
|
|
|
manipulates the widget, the value is limited to this range. This
|
|
|
|
clamping is done <I>after</I> rounding to the step value (this makes a
|
|
|
|
difference if the range is not a multiple of the step).
|
|
|
|
<P>The minimum may be greater than the maximum. This has the effect of
|
|
|
|
"reversing" the object so the larger values are in the opposite
|
|
|
|
direction. This also switches which end of the filled sliders is
|
1999-01-13 22:28:54 +03:00
|
|
|
filled. </P>
|
2001-11-29 22:24:00 +03:00
|
|
|
<P>Some widgets consider this a "soft" range. This means they will
|
|
|
|
stop at the range, but if the user releases and grabs the control again
|
1999-01-13 22:28:54 +03:00
|
|
|
and tries to move it further, it is allowed. </P>
|
2001-11-29 22:24:00 +03:00
|
|
|
<P>The range may affect the display. You must <TT>redraw()</TT> the
|
1999-01-13 22:28:54 +03:00
|
|
|
widget after changing the range. </P>
|
|
|
|
<H4><A name=Fl_Valuator.step>double Fl_Valuator::step() const
|
|
|
|
<BR> void Fl_Valuator::step(double)
|
|
|
|
<BR> void Fl_Valuator::step(int A, int B)</A></H4>
|
2001-11-29 22:24:00 +03:00
|
|
|
Get or set the step value. As the user moves the mouse the value is
|
1999-01-13 22:28:54 +03:00
|
|
|
rounded to the nearest multiple of the step value. This is done <I>
|
2001-11-29 22:24:00 +03:00
|
|
|
before</I> clamping it to the range. For most objects the default step
|
|
|
|
is zero.
|
|
|
|
<P>For precision the step is stored as the ratio of two integers, A/B.
|
|
|
|
You can set these integers directly. Currently setting a floating
|
1999-01-13 22:28:54 +03:00
|
|
|
point value sets the nearest A/1 or 1/B value possible. </P>
|
1999-03-09 21:42:05 +03:00
|
|
|
<H4><A name=Fl_Valuator.format>int Fl_Valuator::format(char *)</A>
|
1999-01-13 22:28:54 +03:00
|
|
|
</H4>
|
2001-11-29 22:24:00 +03:00
|
|
|
Format the passed value to show enough digits so that for the current
|
1999-01-13 22:28:54 +03:00
|
|
|
step value. If the step has been set to zero then it does a <TT>%g</TT>
|
2001-11-29 22:24:00 +03:00
|
|
|
format. The characters are written into the passed buffer.
|
1999-01-13 22:28:54 +03:00
|
|
|
<H4><A name=Fl_Valuator.round>double Fl_Valuator::round(double)</A></H4>
|
2001-11-29 22:24:00 +03:00
|
|
|
Round the passed value to the nearest step increment. Does nothing if
|
|
|
|
step is zero.
|
1999-01-13 22:28:54 +03:00
|
|
|
<H4><A name=Fl_Valuator.clamp>double Fl_Valuator::clamp(double)</A></H4>
|
2001-11-29 22:24:00 +03:00
|
|
|
Clamp the passed value to the valuator range.
|
|
|
|
<H4><A name=Fl_Valuator.increment>double
|
1999-01-13 22:28:54 +03:00
|
|
|
Fl_Valuator::increment(double,int n)</A></H4>
|
2001-11-29 22:24:00 +03:00
|
|
|
Adds <TT>n</TT> times the step value to the passed value. If step was
|
|
|
|
set to zero it uses <TT>fabs(maximum() - minimum()) / 100</TT>.
|
1999-01-13 22:28:54 +03:00
|
|
|
<H4><A name=Fl_Valuator.changed>int Fl_Widget::changed() const</A></H4>
|
2001-11-29 22:24:00 +03:00
|
|
|
This value is true if the user has moved the slider. It is turned off
|
|
|
|
by <TT>value(x)</TT> and just before doing a callback (the callback can
|
|
|
|
turn it back on if desired).
|
1999-01-13 22:28:54 +03:00
|
|
|
<H4><A name=Fl_Valuator.set_changed>void Fl_Widget::set_changed()</A></H4>
|
1999-01-27 11:45:11 +03:00
|
|
|
Sets the <TT>changed()</TT> flag.
|
1999-01-13 22:28:54 +03:00
|
|
|
<H4><A name=Fl_Valuator.clear_changed>void Fl_Widget::clear_changed()</A>
|
|
|
|
</H4>
|
1999-01-15 01:14:01 +03:00
|
|
|
Clears the <TT>changed()</TT> flag. </BODY></HTML>
|