examples/component/nested_screen.cpp

    //Copyright2020ArthurSonzogni.Allrightsreserved.
    //UseofthissourcecodeisgovernedbytheMITlicensethatcanbefoundin
    //theLICENSEfile.
    #include<memory>//forallocator,shared_ptr,__shared_ptr_access
    #include<string>//foroperator+,string,char_traits,basic_string

    #include"ftxui/component/captured_mouse.hpp"//forftxui
    #include"ftxui/component/component.hpp"//forButton,Vertical,Renderer
    #include"ftxui/component/component_base.hpp"//forComponentBase
    #include"ftxui/component/screen_interactive.hpp"//forScreenInteractive
    #include"ftxui/dom/elements.hpp"//forseparator,text,Element,operator|,vbox,border

    usingnamespaceftxui;

    voidNested(std::stringpath){
    autoscreen=ScreenInteractive::FitComponent();
    autoback_button=Button("Back",screen.ExitLoopClosure());
    autogoto_1=Button("Goto/1",[path]{Nested(path+"/1");});
    autogoto_2=Button("Goto/2",[path]{Nested(path+"/2");});
    autogoto_3=Button("Goto/3",[path]{Nested(path+"/3");});
    autolayout=Container::Vertical({
    back_button,
    goto_1,
    goto_2,
    goto_3,
    });
    autorenderer=Renderer(layout,[&]{
    returnvbox({
    text("path:"+path),
    separator(),
    back_button->Render(),
    goto_1->Render(),
    goto_2->Render(),
    goto_3->Render(),
    })|
    border;
    });
    screen.Loop(renderer);
    }

    intmain(){
    autoscreen=ScreenInteractive::FitComponent();
    autobutton_quit=Button("Quit",screen.ExitLoopClosure());
    autobutton_nested=Button("Nested",[]{Nested("");});
    screen.Loop(Container::Vertical({
    button_quit,
    button_nested,
    }));
    return0;
    }