examples/component/maybe.cpp

    //Copyright2020ArthurSonzogni.Allrightsreserved.
    //UseofthissourcecodeisgovernedbytheMITlicensethatcanbefoundin
    //theLICENSEfile.
    #include<string>//forstring,allocator,basic_string
    #include<vector>//forvector

    #include"ftxui/component/captured_mouse.hpp"//forftxui
    #include"ftxui/component/component.hpp"//foroperator|,Maybe,Checkbox,Radiobox,Renderer,Vertical
    #include"ftxui/component/component_base.hpp"//forComponent
    #include"ftxui/component/screen_interactive.hpp"//forScreenInteractive
    #include"ftxui/dom/elements.hpp"//forElement,border,color,operator|,text
    #include"ftxui/screen/color.hpp"//forColor,Color::Red

    usingnamespaceftxui;

    intmain(){
    std::vector<std::string>entries={
    "entry1",
    "entry2",
    "entry3",
    };
    intmenu_1_selected=0;
    intmenu_2_selected=0;

    boolmenu_1_show=false;
    boolmenu_2_show=false;

    autolayout=Container::Vertical({
    Checkbox("Showmenu_1",&menu_1_show),
    Radiobox(&entries,&menu_1_selected)|border|Maybe(&menu_1_show),
    Checkbox("Showmenu_2",&menu_2_show),
    Radiobox(&entries,&menu_2_selected)|border|Maybe(&menu_2_show),

    Renderer([]{
    returntext("Youfoundthesecretcombinaison!")|color(Color::Red);
    })|Maybe([&]{returnmenu_1_selected==1&&menu_2_selected==2;}),
    });

    autoscreen=ScreenInteractive::TerminalOutput();
    screen.Loop(layout);
    }