Add SliderWithCallback component

I wanted to do some actions in real time when the slider value changes, not only update the reference value, so I made a little `SliderWithCallback` component

Signed-off-by: Mikołaj Lubiak <lubiak@proton.me>
This commit is contained in:
Mikołaj Lubiak
2024-10-18 14:14:07 +02:00
parent 1d40687a40
commit 2887beff5b
2 changed files with 199 additions and 0 deletions

View File

@@ -230,6 +230,20 @@ struct SliderOption {
Color color_inactive = Color::GrayDark;
};
// @brief Option for the `SliderWithCallback` component.
// @ingroup component
template <typename T>
struct SliderWithCallbackOption {
std::function<void(T)> callback;
Ref<T> value;
ConstRef<T> min = T(0);
ConstRef<T> max = T(100);
ConstRef<T> increment = (max() - min()) / 20;
Direction direction = Direction::Right;
Color color_active = Color::White;
Color color_inactive = Color::GrayDark;
};
// Parameter pack used by `WindowOptions::render`.
struct WindowRenderState {
Element inner; ///< The element wrapped inside this window.