mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-21 19:48:16 +08:00
Feature: Slider in any directions. (#468)
Add the `SliderOption` option supporting: ```cpp { Ref<T> value; ConstRef<T> min = T(0); ConstRef<T> max = T(100); ConstRef<T> increment = (max() - min()) / 20; GaugeDirection direction = GaugeDirection::Right; Color color_active = Color::White; Color color_inactive = Color::GrayDark; }; ``` In particular, this supports multiple direction. This resolves: https://github.com/ArthurSonzogni/FTXUI/issues/467 This one do not support adding a label. The old constructors can still be used to have a label.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include <algorithm> // for copy, max, min
|
||||
#include <algorithm> // for min
|
||||
#include <array> // for array
|
||||
#include <chrono> // for operator-, milliseconds, duration, operator>=, time_point, common_type<>::type
|
||||
#include <chrono> // for operator-, milliseconds, duration, operator<=>, time_point, common_type<>::type
|
||||
#include <compare> // for operator>=, strong_ordering
|
||||
#include <csignal> // for signal, raise, SIGTSTP, SIGABRT, SIGFPE, SIGILL, SIGINT, SIGSEGV, SIGTERM, SIGWINCH
|
||||
#include <cstdio> // for fileno, size_t, stdin
|
||||
#include <ftxui/component/task.hpp> // for Task, Closure, AnimationTask
|
||||
@@ -136,14 +137,14 @@ void EventListener(std::atomic<bool>* quit, Sender<Task> out) {
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
EMSCRIPTEN_KEEPALIVE
|
||||
void ftxui_on_resize(int columns, int rows) {
|
||||
Terminal::SetFallbackSize({
|
||||
columns,
|
||||
rows,
|
||||
});
|
||||
std::raise(SIGWINCH);
|
||||
}
|
||||
EMSCRIPTEN_KEEPALIVE
|
||||
void ftxui_on_resize(int columns, int rows) {
|
||||
Terminal::SetFallbackSize({
|
||||
columns,
|
||||
rows,
|
||||
});
|
||||
std::raise(SIGWINCH);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
Reference in New Issue
Block a user