mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-18 00:48:09 +08:00
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:
@@ -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.
|
||||
|
Reference in New Issue
Block a user