mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-28 16:29:34 +08:00
Add option for Toggle.
This commit is contained in:

committed by
Arthur Sonzogni

parent
ae6473363d
commit
fac373494d
@@ -21,21 +21,14 @@ class ToggleBase : public ComponentBase {
|
||||
static ToggleBase* From(Component component);
|
||||
|
||||
// Constructor.
|
||||
ToggleBase(const std::vector<std::wstring>* entries, int* selected);
|
||||
ToggleBase(const std::vector<std::wstring>* entries,
|
||||
int* selected,
|
||||
ConstRef<ToggleOption> option = {});
|
||||
~ToggleBase() override = default;
|
||||
|
||||
// State.
|
||||
int focused = 0;
|
||||
|
||||
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 = []() {};
|
||||
|
||||
// Component implementation.
|
||||
Element Render() override;
|
||||
bool OnEvent(Event) override;
|
||||
@@ -46,6 +39,7 @@ class ToggleBase : public ComponentBase {
|
||||
|
||||
bool OnMouseEvent(Event event);
|
||||
std::vector<Box> boxes_;
|
||||
ConstRef<ToggleOption> option_;
|
||||
};
|
||||
|
||||
} // namespace ftxui
|
||||
|
Reference in New Issue
Block a user