Skip to main content

SpinBox

#include "toolkit/spin_box.hpp"

A numeric input with up/down step buttons and a typable, editable text field. Inherits Widget.

SpinBox screenshot

Example​

auto spin = std::make_unique<toolkit::SpinBox>(50, 0, 100, 5);
spin->on_change = [](int value, toolkit::SpinBox &) { /* ... */ };

Construction​

explicit SpinBox(int value = 0, int min_val = 0, int max_val = 100, int step = 1);

API​

MemberDescription
value() / set_value(int)Current value (clamped to range)
set_range(int min, int max)Update the allowed range
set_step(int)Increment applied by the up/down buttons

Callbacks​

CallbackDescription
on_change — std::function<void(int value, SpinBox&)>Fired when the value changes