class fltk::Valuator
Class Hierarchy
fltk::Widget
|
+----fltk::Valuator
|
+----fltk::Dial, fltk::Roller,
fltk::Slider, fltk::ValueInput
Include Files
#include <fltk/Valuator.h>
Description
The fltk::Valuator 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.
There are probably more of these classes in FLTK than any others:

In the above diagram each box surrounds an actual subclass. These
are further differentiated by setting the
type() of the widget to the symbolic value labeling the
widget. The ones labelled "0" are the default versions with a
type(0). For consistency the symbol fltk::VERTICAL is
defined as zero.
Methods
Creates a new fltk::Valuator widget using the given position,
size, and label string. The default boxtype is fltk::NO_BOX.
Destroys the valuator.
Get or set the current value. The new value is stored
unchanged, even if it is outside the range or not a multiple of
step().
Sets the minimum and maximum values for the valuator. For most
subclasses the user cannot move the value outside this range if it
starts inside this range.
These values should be multiples of the step() to
avoid ambiguity and possible implementation changes.
For most subclasses, 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 filled.
You probably need to redraw() the widget after changing
the range.
Get or set the step value. As the user moves the mouse the value is
rounded to a multiple of this. fltk::Slider is very intelligent and tries
to round to a power of 10 times 1, 2, or 5 times this, so you may want
to try setting a very small step like .0001.
If this is zero (the default) then all rounding is disabled. This
results in the smoothest controller movement but this is not
recommended if you want to present the resulting numbers to the user
as text, because they will have useless extra digits of precision.
For some widgets like fltk::Roller this is also the distance the value
moves when the user drags the mouse 1 pixel. In these cases if step()
is zero then it acts like it is .01.
Negative values produce undocumented results.
The linesize is the amount the valuator moves in response to an arrow
key, or the user clicking an up/down button. The default value is 1.
Negative values and values that are not a multiple of step() produce
undocumented results.
The pagesize is the amount the valuator moves in response to a page
up/down key, or shift-arrow key, or shift+clicking an up/down
button. The default value is 10. Negative values and values that are
not a multiple of linesize() produce undocumented results.
Format the passed value to show enough digits for the current step value. If the step has been set to zero then it
does a %g format. If step is greater or equal to 1 it does
%d format. The characters are written into the passed buffer
(which must be long enough, 40 characters is safe).
The default handler turns arrow and page up/down keystrokes, and
movements of the mouse wheel, into movements of the value. It is up to
the subclass to filter out events it does not want to respond to
before calling this.
Value saved when handle_push() was last called.
Subclasses should call this when the user starts to change the value.
Subclasses should call this as the user moves the value. The passed
value is clamped to the range if previous_value() is inside the range,
and then it is rounded to the nearest multiple of step(), and then
stored. This may call the callback if the new value is different than
the old one.
Subclasses should call this when the user stops moving the value. It may call
the callback.
Callback whenever value changes.
Change the value() without calling value_damage().