Improve mouse support for menu and toggle.

This commit is contained in:
ArthurSonzogni
2021-04-24 18:16:13 +02:00
parent 890a41a64c
commit 8037a5fa5f
14 changed files with 124 additions and 36 deletions

View File

@@ -16,12 +16,14 @@ class Toggle : public Component {
~Toggle() override = default;
// State.
int selected = 0;
std::vector<std::wstring> entries = {L"On", L"Off"};
int selected = 0;
int focused = 0;
Decorator normal_style = dim;
Decorator focused_style = inverted;
Decorator selected_style = bold;
Decorator normal_style = dim;
Decorator selected_focused_style = focused_style | selected_style;
// Callback.
std::function<void()> on_change = []() {};