FTXUI/include/ftxui/component/component_options.hpp

63 lines
1.6 KiB
C++
Raw Normal View History

#ifndef FTXUI_COMPONENT_COMPONENT_OPTIONS_HPP
#define FTXUI_COMPONENT_COMPONENT_OPTIONS_HPP
2021-07-08 04:37:50 +08:00
#include <ftxui/dom/elements.hpp>
namespace ftxui {
struct MenuOption {
Decorator normal_style = nothing;
Decorator focused_style = inverted;
Decorator selected_style = bold;
Decorator selected_focused_style = focused_style | selected_style;
// State update callback.
std::function<void()> on_change = []() {};
std::function<void()> on_enter = []() {};
};
2021-07-08 04:23:07 +08:00
struct ButtonOption {
bool border = true;
};
2021-07-08 04:37:50 +08:00
struct CheckboxOption {
std::wstring checked = L""; /// Prefix for a "checked" state.
std::wstring unchecked = L""; /// Prefix for a "unchecked" state.
Decorator focused_style = inverted; /// Decorator used when focused.
Decorator unfocused_style = nothing; /// Decorator used when unfocused.
/// Called when the user change the state.
std::function<void()> on_change = []() {};
};
2021-07-08 06:01:42 +08:00
struct InputOption {
std::function<void()> on_change = [] {};
std::function<void()> on_enter = [] {};
};
2021-07-10 16:50:25 +08:00
struct RadioboxOption {
std::wstring checked = L"";
std::wstring unchecked = L"";
Decorator focused_style = inverted;
Decorator unfocused_style = nothing;
std::function<void()> on_change = []() {};
};
2021-07-10 17:03:01 +08:00
struct ToggleOption {
Decorator normal_style = dim;
Decorator focused_style = inverted;
Decorator selected_style = bold;
Decorator selected_focused_style = focused_style | selected_style;
// Callback.
std::function<void()> on_change = []() {};
std::function<void()> on_enter = []() {};
};
2021-07-08 04:23:07 +08:00
}; // namespace ftxui
#endif /* end of include guard: FTXUI_COMPONENT_COMPONENT_OPTIONS_HPP */