Slider
#include "toolkit/slider.hpp"
A draggable horizontal or vertical slider over a float range. Inherits
Widget.
- macOS
- Material
- Windows 11
- Windows 95
- Plasma 6
- GNOME
Example
auto slider = std::make_unique<toolkit::Slider>();
slider->set_range(0.0f, 1.0f);
slider->on_change = [](toolkit::Slider &, float v) { /* ... */ };
Construction
explicit Slider(Orientation orientation = Orientation::Horizontal);
Orientation is Horizontal | Vertical (types.hpp).
API
| Member | Description |
|---|---|
value() / set_value(float) | Current value |
minimum() / set_minimum(float) | Range lower bound |
maximum() / set_maximum(float) | Range upper bound |
set_range(float min, float max) | Set both bounds at once |
Callbacks
| Callback | Description |
|---|---|
on_change — std::function<void(Slider&, float)> | Fired as the value changes; also settable via set_on_change(fn) |