#include <iostream>
#include <memory>
#include <string>
return special_style;
}
int main(int argc, const char* argv[]) {
auto screen = ScreenInteractive::TerminalOutput();
int selected = 0;
auto menu = Container::Vertical(
{
MenuEntry(" 1. improve"),
MenuEntry(" 2. tolerant"),
MenuEntry(" 3. career"),
MenuEntry(" 4. cast"),
MenuEntry(" 5. question"),
Renderer([] { return separator(); }),
MenuEntry(
" 7. drown", Colored(Color::Yellow)),
MenuEntry(
" 8. nail", Colored(Color::Green)),
MenuEntry(
"10. decorative", Colored(Color::Blue)),
},
&selected);
menu->Render() |
frame |
size(HEIGHT, LESS_THAN, 10),
}) |
border;
});
screen.Loop(renderer);
std::cout << "Selected element = " << selected << std::endl;
}
A class representing terminal colors.
std::function< Element(Element)> Decorator
Decorator style_focused
Style when focused.
Component Renderer(Component child, std::function< Element()>)
Return a new Component, similar to |child|, but using |render| as the Component::Render() event.
Element hbox(Elements)
A container displaying elements horizontally one by one.
Element text(std::wstring text)
Display a piece of unicode text.
Decorator style_selected_focused
Style when selected and focused.
Decorator style_selected
Style when selected.
Component MenuEntry(ConstStringRef label, Ref< MenuEntryOption >={})
Element frame(Element)
Allow an element to be displayed inside a 'virtual' area. It size can be larger than its container....
Decorator size(Direction, Constraint, int value)
Apply a constraint on the size of an element.
Decorator style_normal
style.
Element vbox(Elements)
A container displaying elements vertically one by one.