Extend SliderOption instead of duplicating code

This commit is contained in:
Mikołaj Lubiak
2024-10-21 23:38:12 +02:00
parent 528c508584
commit 27388d456f
2 changed files with 59 additions and 245 deletions

View File

@@ -222,20 +222,7 @@ struct ResizableSplitOption {
template <typename T>
struct SliderOption {
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;
};
// @brief Option for the `SliderWithCallback` component.
// @ingroup component
template <typename T>
struct SliderWithCallbackOption {
std::function<void(T)> callback;
Ref<T> value;
std::function<void(T)> callback = nullptr;
ConstRef<T> min = T(0);
ConstRef<T> max = T(100);
ConstRef<T> increment = (max() - min()) / 20;