|
guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
|
An interval [low, high] kept inside a range, with a callback run when it changes. More...
#include <headers/guillaume/components/range.hpp>


Public Types | |
| using | Handler = std::function<void(float, float)> |
| Callback receiving the new low and high ends, in that order. | |
Public Member Functions | |
| Range (void)=default | |
| Create the interval 0 to 1 in the range 0 to 1, without snapping. | |
| ~Range (void)=default | |
| Default destructor for the Range component. | |
| float | getMin (void) const |
| Get the lower bound of the range. | |
| Range & | setMin (float min) |
| Set the lower bound of the range. | |
| float | getMax (void) const |
| Get the upper bound of the range. | |
| Range & | setMax (float max) |
| Set the upper bound of the range. | |
| float | getLow (void) const |
| Get the low end of the interval. | |
| Range & | setLow (float low) |
| Set the low end of the interval. | |
| float | getHigh (void) const |
| Get the high end of the interval. | |
| Range & | setHigh (float high) |
| Set the high end of the interval. | |
| float | getStep (void) const |
| Get the snapping step. | |
| Range & | setStep (float step) |
| Set the snapping step. | |
| Range & | setOnChangedHandler (const Handler &handler) |
| Set the callback run when the interval changes. | |
| Handler | getOnChangedHandler (void) const |
| Get the callback run when the interval changes. | |
| Public Member Functions inherited from guillaume::ecs::Component | |
| bool | hasChanged (void) const |
| Tell whether a value of the component changed since the flags were last reset (the end of the previous frame). | |
| void | setHasChanged (bool hasChanged) |
| Raise or lower the changed flag. | |
| Component (void)=default | |
| Create a component that is not marked as changed. | |
| virtual | ~Component (void)=default |
| Virtual destructor, so components can be destroyed through the base class. | |
An interval [low, high] kept inside a range, with a callback run when it changes.
It is the two-ended counterpart of components::Value, meant for controls with two handles such as a range slider. Both ends always lie within [min, max] (0 to 1 by default), are snapped to a multiple of step above min when step is strictly positive, and are kept ordered: if a new low end passes the high end, the two are swapped. No system of the library reads it; it is a building block for application widgets.
Watch out:
| using guillaume::components::Range::Handler = std::function<void(float, float)> |
| float guillaume::components::Range::getHigh | ( | void | ) | const |
| float guillaume::components::Range::getLow | ( | void | ) | const |
| float guillaume::components::Range::getMax | ( | void | ) | const |
| float guillaume::components::Range::getMin | ( | void | ) | const |
| Range::Handler guillaume::components::Range::getOnChangedHandler | ( | void | ) | const |
| float guillaume::components::Range::getStep | ( | void | ) | const |
| Range & guillaume::components::Range::setHigh | ( | float | high | ) |
Set the high end of the interval.
The value is clamped and snapped first. If it ends up below the low end, the two ends are swapped. When the interval changes, marks the component changed and calls the handler.
| high | The requested high end, in the unit of the range. |
Definition at line 78 of file range.cpp.

| Range & guillaume::components::Range::setLow | ( | float | low | ) |
Set the low end of the interval.
The value is clamped and snapped first. If it ends up above the high end, the two ends are swapped. When the interval changes, marks the component changed and calls the handler.
| low | The requested low end, in the unit of the range. |
Definition at line 67 of file range.cpp.

| Range & guillaume::components::Range::setMax | ( | float | max | ) |
Set the upper bound of the range.
When the bound differs, marks the component changed, then clamps and snaps both ends again, which runs the handler if one moves.
| max | The new maximum; it must not be below the minimum. |
Definition at line 51 of file range.cpp.

| Range & guillaume::components::Range::setMin | ( | float | min | ) |
Set the lower bound of the range.
When the bound differs, marks the component changed, then clamps and snaps both ends again, which runs the handler if one moves.
| min | The new minimum; it must not exceed the maximum. |
Definition at line 35 of file range.cpp.

Set the callback run when the interval changes.
Replaces the previous handler. Does not mark the component changed.
| handler | The callback, or an empty one to remove it; it receives the new low and high ends. |
Definition at line 99 of file range.cpp.

| Range & guillaume::components::Range::setStep | ( | float | step | ) |
Set the snapping step.
Marks the component changed when the step differs. The interval is not snapped again until one of its ends or a bound is set.
| step | The distance between two allowed values, counted from the minimum; 0 or less disables snapping. |
Definition at line 89 of file range.cpp.
