From 60b9e491dbbfa7c47fad6f6245cb47703dce57f5 Mon Sep 17 00:00:00 2001 From: Arthur Sonzogni Date: Thu, 22 Dec 2022 21:15:54 +0100 Subject: [PATCH] Add all the Slider implementations. (#532) This resolves: https://github.com/ArthurSonzogni/FTXUI/issues/524 --- include/ftxui/component/component.hpp | 9 ++++++--- src/ftxui/component/slider.cpp | 15 ++++++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/include/ftxui/component/component.hpp b/include/ftxui/component/component.hpp index 7eb33bc..679cd1b 100644 --- a/include/ftxui/component/component.hpp +++ b/include/ftxui/component/component.hpp @@ -67,6 +67,12 @@ Component Radiobox(ConstStringListRef entries, Ref option = {}); Component Toggle(ConstStringListRef entries, int* selected); + +// General slider constructor: +template +Component Slider(SliderOption options = {}); + +// Shorthand without the `SliderOption` constructor: Component Slider(ConstStringRef label, Ref value, ConstRef min = 0, @@ -82,9 +88,6 @@ Component Slider(ConstStringRef label, ConstRef min = 0l, ConstRef max = 100l, ConstRef increment = 5l); -// General slider type without support for a `label`. -template // T = {int, float, long} -Component Slider(SliderOption options = {}); Component ResizableSplitLeft(Component main, Component back, int* main_size); Component ResizableSplitRight(Component main, Component back, int* main_size); diff --git a/src/ftxui/component/slider.cpp b/src/ftxui/component/slider.cpp index 45d16e4..13daee0 100644 --- a/src/ftxui/component/slider.cpp +++ b/src/ftxui/component/slider.cpp @@ -325,9 +325,18 @@ template Component Slider(SliderOption options) { return Make>(options); } -template Component Slider(SliderOption options); -template Component Slider(SliderOption options); -template Component Slider(SliderOption options); +template Component Slider(SliderOption); +template Component Slider(SliderOption); +template Component Slider(SliderOption); +template Component Slider(SliderOption); + +template Component Slider(SliderOption); +template Component Slider(SliderOption); +template Component Slider(SliderOption); +template Component Slider(SliderOption); + +template Component Slider(SliderOption); +template Component Slider(SliderOption); } // namespace ftxui