#include <memory>
#include <string>
#include <vector>
int main() {
std::vector<std::string> toggle_1_entries = {
"On",
"Off",
};
std::vector<std::string> toggle_2_entries = {
"Enabled",
"Disabled",
};
std::vector<std::string> toggle_3_entries = {
"10€",
"0€",
};
std::vector<std::string> toggle_4_entries = {
"Nothing",
"One element",
"Several elements",
};
int toggle_1_selected = 0;
int toggle_2_selected = 0;
int toggle_3_selected = 0;
int toggle_4_selected = 0;
toggle_1,
toggle_2,
toggle_3,
toggle_4,
});
auto renderer =
Renderer(container, [&] {
text(
"Choose your options:"),
hbox(
text(
" * Poweroff on startup : "), toggle_1->Render()),
hbox(
text(
" * Out of process : "), toggle_2->Render()),
hbox(
text(
" * Price of the information : "), toggle_3->Render()),
hbox(
text(
" * Number of elements : "), toggle_4->Render()),
});
});
screen.Loop(renderer);
}
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...
std::shared_ptr< ComponentBase > Component
Component Toggle(ConstStringListRef entries, int *selected)
An horizontal list of elements. The user can navigate through them.
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.
Element vbox(Elements)
A container displaying elements vertically one by one.