Add all the Slider implementations. (#532)

This resolves:
https://github.com/ArthurSonzogni/FTXUI/issues/524
This commit is contained in:
Arthur Sonzogni 2022-12-22 21:15:54 +01:00 committed by GitHub
parent 6cea410eaa
commit 60b9e491db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 6 deletions

View File

@ -67,6 +67,12 @@ Component Radiobox(ConstStringListRef entries,
Ref<RadioboxOption> option = {});
Component Toggle(ConstStringListRef entries, int* selected);
// General slider constructor:
template <typename T>
Component Slider(SliderOption<T> options = {});
// Shorthand without the `SliderOption` constructor:
Component Slider(ConstStringRef label,
Ref<int> value,
ConstRef<int> min = 0,
@ -82,9 +88,6 @@ Component Slider(ConstStringRef label,
ConstRef<long> min = 0l,
ConstRef<long> max = 100l,
ConstRef<long> increment = 5l);
// General slider type without support for a `label`.
template <typename T> // T = {int, float, long}
Component Slider(SliderOption<T> options = {});
Component ResizableSplitLeft(Component main, Component back, int* main_size);
Component ResizableSplitRight(Component main, Component back, int* main_size);

View File

@ -325,9 +325,18 @@ template <typename T>
Component Slider(SliderOption<T> options) {
return Make<SliderBase<T>>(options);
}
template Component Slider(SliderOption<int> options);
template Component Slider(SliderOption<float> options);
template Component Slider(SliderOption<long> options);
template Component Slider(SliderOption<int8_t>);
template Component Slider(SliderOption<int16_t>);
template Component Slider(SliderOption<int32_t>);
template Component Slider(SliderOption<int64_t>);
template Component Slider(SliderOption<uint8_t>);
template Component Slider(SliderOption<uint16_t>);
template Component Slider(SliderOption<uint32_t>);
template Component Slider(SliderOption<uint64_t>);
template Component Slider(SliderOption<float>);
template Component Slider(SliderOption<double>);
} // namespace ftxui