#include <functional>
#include <memory>
#include <string>
#include <vector>
int main() {
auto screen = ScreenInteractive::TerminalOutput();
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%",
};
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);
Component container = Container::Horizontal({
left_menu_,
right_menu_,
});
auto renderer = Renderer(container, [&] {
int sum = left_menu_selected * 10 + right_menu_selected;
return vbox({
hbox({
vbox({
hcenter(bold(text("Percentage by 10%"))),
separator(),
left_menu_->Render(),
}),
separator(),
vbox({
hcenter(bold(text("Percentage by 1%"))),
separator(),
right_menu_->Render(),
}),
separator(),
}),
separator(),
vbox({
hbox({
text(" gauge : "),
gauge(sum / 100.0),
}),
hbox({
text(" text : "),
text(std::to_string(sum) + " %"),
}),
}),
}) |
border;
});
screen.Loop(renderer);
}
std::shared_ptr< ComponentBase > Component