Add menu styles.

This commit is contained in:
Arthur Sonzogni
2019-01-03 00:35:59 +01:00
parent 13e04176a4
commit 178feaa6a9
20 changed files with 241 additions and 46 deletions

View File

@@ -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 = [](){};

View File

@@ -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 = [](){};