fltk.valuator

FLTK Valuator Base Class

This module provides the Valuator class, an abstract base class for all valuator widgets such as sliders, dials, counters, and scrollbars.

Valuator provides common functionality for widgets that control a single floating-point value within a defined range, with optional step increments.

Authors

Dejan Lekić

License

BSD-3-Clause

Types 2

Valuator orientation constants.

These values define whether a valuator widget operates vertically or horizontally.

VERTICAL = 0The valuator operates vertically
HORIZONTAL = 1The valuator operates horizontally

Abstract base class for all valuator widgets.

Valuator controls a single floating-point value and provides a consistent interface to set the value, range, and step. All valuator-derived widgets (Slider, Dial, Counter, Scrollbar, etc.) inherit these capabilities.

The value is always clamped to the range minimum, maximum after rounding to the nearest step value.

Example:

// Valuator is typically used through derived classes like Slider
auto slider = new Slider(10, 10, 200, 25, "Value");
slider.range(0.0, 100.0);
slider.step(1.0);
slider.value = 50.0;

Methods
double value() const nothrow @nogcGets the current value of the valuator.
bool value(double val) nothrow @nogcSets the current value of the valuator.
double minimum() const nothrow @nogcGets the minimum value of the range.
void minimum(double val) nothrow @nogcSets the minimum value of the range.
double maximum() const nothrow @nogcGets the maximum value of the range.
void maximum(double val) nothrow @nogcSets the maximum value of the range.
void range(double min, double max) nothrow @nogcSets the minimum and maximum values of the range.
void bounds(double min, double max) nothrow @nogcSets the minimum and maximum values of the range (alias for range).
double step() const nothrow @nogcGets the step value.
void step(double val) nothrow @nogcSets the step value.
void stepFraction(double a, int b) nothrow @nogcSets the step value as a fraction A/B.
void precision(int digits) nothrow @nogcSets the precision (number of decimal digits).
double roundValue(double val) const nothrow @nogcRounds a value to the nearest step multiple.
double clamp(double val) const nothrow @nogcClamps a value to the valuator's range.
double increment(double val, int n) const nothrow @nogcIncrements a value by n steps.
int formatValue(char[] buffer) const nothrow @nogcFormats the current value as a string.
Constructors
this(WidgetPtr handle, bool ownsHandle = false)Creates a Valuator wrapper around an existing widget handle.