mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-10-17 00:38:09 +08:00
Add menu styles.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#define FTXUI_COMPONENT_MENU
|
||||
|
||||
#include "ftxui/component/component.hpp"
|
||||
#include "ftxui/dom/elements.hpp"
|
||||
#include <functional>
|
||||
|
||||
namespace ftxui {
|
||||
@@ -16,6 +17,10 @@ class Menu : public Component {
|
||||
std::vector<std::wstring> entries = {};
|
||||
int selected = 0;
|
||||
|
||||
dom::Decorator active_style = dom::inverted;
|
||||
dom::Decorator selected_style = dom::bold;
|
||||
dom::Decorator normal_style = dom::nothing;
|
||||
|
||||
// State update callback.
|
||||
std::function<void()> on_change = [](){};
|
||||
std::function<void()> on_enter = [](){};
|
||||
|
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "ftxui/component/component.hpp"
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
namespace ftxui {
|
||||
namespace component {
|
||||
@@ -13,9 +14,8 @@ class Toggle : public Component {
|
||||
Toggle(Delegate*);
|
||||
|
||||
// State.
|
||||
bool activated = true;
|
||||
std::wstring on = L"On";
|
||||
std::wstring off = L"Off";
|
||||
size_t activated = 0;
|
||||
std::vector<std::wstring> options = {L"On", L"Off"};
|
||||
|
||||
// Callback.
|
||||
std::function<void()> on_change = [](){};
|
||||
|
Reference in New Issue
Block a user