#include <functional>
#include <memory>
#include <string>
#include <vector>
int main() {
std::vector<std::string> left_menu_entries = {
"0%", "10%", "20%", "30%", "40%", "50%", "60%", "70%", "80%", "90%",
};
std::vector<std::string> right_menu_entries = {
"0%", "1%", "2%", "3%", "4%", "5%", "6%", "7%", "8%", "9%", "10%",
};
auto menu_option = MenuOption();
menu_option.on_enter = screen.ExitLoopClosure();
int left_menu_selected = 0;
int right_menu_selected = 0;
Menu(&left_menu_entries, &left_menu_selected, menu_option);
Menu(&right_menu_entries, &right_menu_selected, menu_option);
left_menu_,
right_menu_,
});
auto renderer =
Renderer(container, [&] {
int sum = left_menu_selected * 10 + right_menu_selected;
left_menu_->Render(),
}),
right_menu_->Render(),
}),
}),
}),
}),
}),
}) |
});
screen.Loop(renderer);
}
static ScreenInteractive TerminalOutput()
Component Horizontal(Components children)
A list of components, drawn one by one horizontally and navigated horizontally using left/right arrow...
Component Menu(MenuOption options)
A list of text. The focused element is selected.
std::shared_ptr< ComponentBase > Component
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.
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 gauge(float progress)
Draw a high definition progress bar.
Element border(Element)
Draw a border around the element.
Element hcenter(Element)
Center an element horizontally.
Element vbox(Elements)
A container displaying elements vertically one by one.