15 using namespace ftxui;
16 auto screen = ScreenInteractive::TerminalOutput();
22 std::string rating =
"3/5 stars";
25 auto button_rate_ftxui = Button(
"Rate FTXUI", [&] { depth = 1; });
26 auto button_quit = Button(
"Quit", screen.ExitLoopClosure());
28 auto depth_0_container = Container::Horizontal({
32 auto depth_0_renderer = Renderer(depth_0_container, [&] {
34 text(
"Modal dialog example"),
36 text(
"☆☆☆ FTXUI:" + rating +
" ☆☆☆") | bold,
39 button_rate_ftxui->Render(),
41 button_quit->Render(),
44 border | size(HEIGHT, GREATER_THAN, 18) | center;
48 std::vector<std::string> rating_labels = {
49 "1/5 stars",
"2/5 stars",
"3/5 stars",
"4/5 stars",
"5/5 stars",
51 auto on_rating = [&](std::string new_rating) {
55 auto depth_1_container = Container::Horizontal({
56 Button(&rating_labels[0], [&] { on_rating(rating_labels[0]); }),
57 Button(&rating_labels[1], [&] { on_rating(rating_labels[1]); }),
58 Button(&rating_labels[2], [&] { on_rating(rating_labels[2]); }),
59 Button(&rating_labels[3], [&] { on_rating(rating_labels[3]); }),
60 Button(&rating_labels[4], [&] { on_rating(rating_labels[4]); }),
63 auto depth_1_renderer = Renderer(depth_1_container, [&] {
65 text(
"Do you like FTXUI?"),
67 hbox(depth_1_container->Render()),
72 auto main_container = Container::Tab(
79 auto main_renderer = Renderer(main_container, [&] {
80 Element document = depth_0_renderer->Render();
85 depth_1_renderer->Render() | clear_under | center,
91 screen.Loop(main_renderer);