#include <memory>
#include <string>
void Nested(std::string path) {
auto screen = ScreenInteractive::FitComponent();
auto back_button = Button(
"Retour",
screen.ExitLoopClosure());
auto goto_1 = Button(
"Aller à /1", [path] {
Nested(path +
"/1"); });
auto goto_2 = Button(
"Aller à /2", [path] {
Nested(path +
"/2"); });
auto goto_3 = Button(
"Aller à /3", [path] {
Nested(path +
"/3"); });
auto layout = Container::Vertical({
back_button,
goto_1,
goto_2,
goto_3,
});
auto renderer = Renderer(layout, [&] {
return vbox({
text("chemin: " + path),
separator(),
back_button->Render(),
goto_1->Render(),
goto_2->Render(),
goto_3->Render(),
}) |
border;
});
}
auto screen = ScreenInteractive::FitComponent();
auto button_quit = Button(
"Quitter",
screen.ExitLoopClosure());
auto button_nested = Button(
"Imbriqué", [] {
Nested(
""); });
screen.Loop(Container::Vertical({
button_quit,
button_nested,
}));
return 0;
}
L'espace de noms FTXUI ftxui::
void Nested(std::string path)