Add options for checkbox.

This commit is contained in:
ArthurSonzogni
2021-07-07 22:37:50 +02:00
committed by Arthur Sonzogni
parent 359100ca73
commit 2b7daf061f
4 changed files with 36 additions and 24 deletions

View File

@@ -1,6 +1,8 @@
#ifndef FTXUI_COMPONENT_COMPONENT_OPTIONS_HPP
#define FTXUI_COMPONENT_COMPONENT_OPTIONS_HPP
#include <ftxui/dom/elements.hpp>
namespace ftxui {
struct MenuOption {
@@ -18,6 +20,17 @@ struct ButtonOption {
bool border = true;
};
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 = []() {};
};
}; // namespace ftxui
#endif /* end of include guard: FTXUI_COMPONENT_COMPONENT_OPTIONS_HPP */