17 std::vector<std::string> entries = {
22 int menu_1_selected = 0;
23 int menu_2_selected = 0;
25 bool menu_1_show =
false;
26 bool menu_2_show =
false;
28 auto layout = Container::Vertical({
29 Checkbox(
"Show menu_1", &menu_1_show),
30 Radiobox(&entries, &menu_1_selected) | border |
Maybe(&menu_1_show),
31 Checkbox(
"Show menu_2", &menu_2_show),
32 Radiobox(&entries, &menu_2_selected) | border |
Maybe(&menu_2_show),
35 return text(
"You found the secret combination!") |
color(Color::Red);
36 }) |
Maybe([&] {
return menu_1_selected == 1 && menu_2_selected == 2; }),
39 auto screen = App::TerminalOutput();
Component Renderer(Component child, std::function< Element()>)
Return a new Component, similar to |child|, but using |render| as the Component::Render() event.
Component Checkbox(ConstStringRef label, bool *checked, CheckboxOption options=CheckboxOption::Simple())
Draw checkable element.
Component Maybe(Component child, std::function< bool()> show)
Decorate a component |child|. It is shown only when |show| returns true.
Component Radiobox(ConstStringListRef entries, int *selected_, RadioboxOption options={})
A list of element, where only one can be selected.
Element text(std::string_view text)
Display a piece of UTF8 encoded unicode text.
Element color(Color color, Element child)
Set the foreground color of an element.
The FTXUI ftxui:: namespace.