mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-11-22 18:59:59 +08:00
Execute clang tidy. (#477)
This commit is contained in:
parent
c8ec151154
commit
fab74f745d
@ -181,11 +181,13 @@ ButtonOption ButtonOption::Animated(Color color) {
|
|||||||
/// @brief Create a ButtonOption, using animated colors.
|
/// @brief Create a ButtonOption, using animated colors.
|
||||||
// static
|
// static
|
||||||
ButtonOption ButtonOption::Animated(Color background, Color foreground) {
|
ButtonOption ButtonOption::Animated(Color background, Color foreground) {
|
||||||
|
// NOLINTBEGIN
|
||||||
return ButtonOption::Animated(
|
return ButtonOption::Animated(
|
||||||
/*bakground=*/background,
|
/*bakground=*/background,
|
||||||
/*foreground=*/foreground,
|
/*foreground=*/foreground,
|
||||||
/*background_active=*/foreground,
|
/*background_active=*/foreground,
|
||||||
/*foreground_active=*/background);
|
/*foreground_active=*/background);
|
||||||
|
// NOLINTEND
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Create a ButtonOption, using animated colors.
|
/// @brief Create a ButtonOption, using animated colors.
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include <iostream> // for cout, ostream, basic_ostream, operator<<, endl, flush
|
#include <iostream> // for cout, ostream, basic_ostream, operator<<, endl, flush
|
||||||
#include <stack> // for stack
|
#include <stack> // for stack
|
||||||
#include <thread> // for thread, sleep_for
|
#include <thread> // for thread, sleep_for
|
||||||
|
#include <tuple>
|
||||||
#include <type_traits> // for decay_t
|
#include <type_traits> // for decay_t
|
||||||
#include <utility> // for move, swap
|
#include <utility> // for move, swap
|
||||||
#include <variant> // for visit
|
#include <variant> // for visit
|
||||||
@ -240,7 +241,8 @@ void OnExit(int signal) {
|
|||||||
|
|
||||||
const auto install_signal_handler = [](int sig, SignalHandler handler) {
|
const auto install_signal_handler = [](int sig, SignalHandler handler) {
|
||||||
auto old_signal_handler = std::signal(sig, handler);
|
auto old_signal_handler = std::signal(sig, handler);
|
||||||
on_exit_functions.push([=] { std::signal(sig, old_signal_handler); });
|
on_exit_functions.push(
|
||||||
|
[=] { std::ignore = std::signal(sig, old_signal_handler); });
|
||||||
};
|
};
|
||||||
|
|
||||||
Closure g_on_resize = [] {}; // NOLINT
|
Closure g_on_resize = [] {}; // NOLINT
|
||||||
@ -289,22 +291,42 @@ ScreenInteractive::ScreenInteractive(int dimx,
|
|||||||
|
|
||||||
// static
|
// static
|
||||||
ScreenInteractive ScreenInteractive::FixedSize(int dimx, int dimy) {
|
ScreenInteractive ScreenInteractive::FixedSize(int dimx, int dimy) {
|
||||||
return ScreenInteractive(dimx, dimy, Dimension::Fixed, false);
|
return {
|
||||||
|
dimx,
|
||||||
|
dimy,
|
||||||
|
Dimension::Fixed,
|
||||||
|
false,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
ScreenInteractive ScreenInteractive::Fullscreen() {
|
ScreenInteractive ScreenInteractive::Fullscreen() {
|
||||||
return ScreenInteractive(0, 0, Dimension::Fullscreen, true);
|
return {
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
Dimension::Fullscreen,
|
||||||
|
true,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
ScreenInteractive ScreenInteractive::TerminalOutput() {
|
ScreenInteractive ScreenInteractive::TerminalOutput() {
|
||||||
return ScreenInteractive(0, 0, Dimension::TerminalOutput, false);
|
return {
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
Dimension::TerminalOutput,
|
||||||
|
false,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
ScreenInteractive ScreenInteractive::FitComponent() {
|
ScreenInteractive ScreenInteractive::FitComponent() {
|
||||||
return ScreenInteractive(0, 0, Dimension::FitComponent, false);
|
return {
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
Dimension::FitComponent,
|
||||||
|
false,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenInteractive::Post(Task task) {
|
void ScreenInteractive::Post(Task task) {
|
||||||
@ -684,7 +706,7 @@ void ScreenInteractive::SigStop() {
|
|||||||
dimx_ = 0;
|
dimx_ = 0;
|
||||||
dimy_ = 0;
|
dimy_ = 0;
|
||||||
Flush();
|
Flush();
|
||||||
std::raise(SIGTSTP);
|
std::ignore = std::raise(SIGTSTP);
|
||||||
Install();
|
Install();
|
||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
|
@ -33,7 +33,7 @@ Decorator flexDirection(GaugeDirection direction) {
|
|||||||
template <class T>
|
template <class T>
|
||||||
class SliderBase : public ComponentBase {
|
class SliderBase : public ComponentBase {
|
||||||
public:
|
public:
|
||||||
SliderBase(Ref<SliderOption<T>> options)
|
explicit SliderBase(Ref<SliderOption<T>> options)
|
||||||
: value_(options->value),
|
: value_(options->value),
|
||||||
min_(options->min),
|
min_(options->min),
|
||||||
max_(options->max),
|
max_(options->max),
|
||||||
@ -125,8 +125,9 @@ class SliderBase : public ComponentBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
value_() = util::clamp(value_(), min_(), max_());
|
value_() = util::clamp(value_(), min_(), max_());
|
||||||
if (old_value != value_())
|
if (old_value != value_()) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return ComponentBase::OnEvent(event);
|
return ComponentBase::OnEvent(event);
|
||||||
}
|
}
|
||||||
@ -196,15 +197,17 @@ class SliderBase : public ComponentBase {
|
|||||||
|
|
||||||
class SliderWithLabel : public ComponentBase {
|
class SliderWithLabel : public ComponentBase {
|
||||||
public:
|
public:
|
||||||
SliderWithLabel(ConstStringRef label, Component inner) : label_(label) {
|
SliderWithLabel(ConstStringRef label, Component inner)
|
||||||
Add(inner);
|
: label_(std::move(label)) {
|
||||||
SetActiveChild(inner);
|
Add(std::move(inner));
|
||||||
|
SetActiveChild(ChildAt(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool OnEvent(Event event) final {
|
bool OnEvent(Event event) final {
|
||||||
if (ComponentBase::OnEvent(event))
|
if (ComponentBase::OnEvent(event)) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!event.is_mouse()) {
|
if (!event.is_mouse()) {
|
||||||
return false;
|
return false;
|
||||||
@ -272,7 +275,7 @@ Component Slider(ConstStringRef label,
|
|||||||
option.max = max;
|
option.max = max;
|
||||||
option.increment = increment;
|
option.increment = increment;
|
||||||
auto slider = Make<SliderBase<int>>(option);
|
auto slider = Make<SliderBase<int>>(option);
|
||||||
return Make<SliderWithLabel>(label, slider);
|
return Make<SliderWithLabel>(std::move(label), slider);
|
||||||
}
|
}
|
||||||
|
|
||||||
Component Slider(ConstStringRef label,
|
Component Slider(ConstStringRef label,
|
||||||
@ -286,7 +289,7 @@ Component Slider(ConstStringRef label,
|
|||||||
option.max = max;
|
option.max = max;
|
||||||
option.increment = increment;
|
option.increment = increment;
|
||||||
auto slider = Make<SliderBase<float>>(option);
|
auto slider = Make<SliderBase<float>>(option);
|
||||||
return Make<SliderWithLabel>(label, slider);
|
return Make<SliderWithLabel>(std::move(label), slider);
|
||||||
}
|
}
|
||||||
Component Slider(ConstStringRef label,
|
Component Slider(ConstStringRef label,
|
||||||
Ref<long> value,
|
Ref<long> value,
|
||||||
@ -299,7 +302,7 @@ Component Slider(ConstStringRef label,
|
|||||||
option.max = max;
|
option.max = max;
|
||||||
option.increment = increment;
|
option.increment = increment;
|
||||||
auto slider = Make<SliderBase<long>>(option);
|
auto slider = Make<SliderBase<long>>(option);
|
||||||
return Make<SliderWithLabel>(label, slider);
|
return Make<SliderWithLabel>(std::move(label), slider);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief A slider in any direction.
|
/// @brief A slider in any direction.
|
||||||
|
Loading…
Reference in New Issue
Block a user