#include <functional>
#include <iostream>
#include <memory>
#include <string>
MenuEntryOption option;
option.transform = [c](EntryState state) {
state.label = (state.active ? "> " : " ") + state.label;
if (state.focused)
if (state.active)
return e;
};
return option;
}
int main() {
int selected = 0;
{
},
&selected);
}) |
});
screen.Loop(renderer);
std::cout << "Selected element = " << selected << std::endl;
}
A class representing terminal colors.
static ScreenInteractive TerminalOutput()
Component Vertical(Components children)
A list of components, drawn one by one vertically and navigated vertically using up/down arrow key or...
Decorator size(WidthOrHeight, Constraint, int value)
Apply a constraint on the size of an element.
std::shared_ptr< Node > Element
Component MenuEntry(MenuEntryOption options)
A specific menu entry. They can be put into a Container::Vertical to form a menu.
Element bold(Element)
Use a bold font, for elements with more emphasis.
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 inverted(Element)
Add a filter that will invert the foreground and the background colors.
std::string to_string(const std::wstring &s)
Convert a UTF8 std::string into a std::wstring.
Element text(std::wstring text)
Display a piece of unicode text.
Element separator()
Draw a vertical or horizontal separation in between two other elements.
Element frame(Element)
Allow an element to be displayed inside a 'virtual' area. It size can be larger than its container....
Element border(Element)
Draw a border around the element.
Decorator color(Color)
Decorate using a foreground color.
Element vbox(Elements)
A container displaying elements vertically one by one.