#include <memory>
#include <string>
void Nested(std::string path) {
auto back_button =
Button(
"Back", screen.ExitLoopClosure());
auto goto_1 =
Button(
"Goto /1", [path] { Nested(path +
"/1"); });
auto goto_2 =
Button(
"Goto /2", [path] { Nested(path +
"/2"); });
auto goto_3 =
Button(
"Goto /3", [path] { Nested(path +
"/3"); });
back_button,
goto_1,
goto_2,
goto_3,
});
back_button->Render(),
goto_1->Render(),
goto_2->Render(),
goto_3->Render(),
}) |
});
screen.Loop(renderer);
}
int main() {
auto button_quit =
Button(
"Quit", screen.ExitLoopClosure());
auto button_nested =
Button(
"Nested", [] { Nested(
""); });
button_quit,
button_nested,
}));
return 0;
}
static ScreenInteractive FitComponent()
Component Vertical(Components children)
A list of components, drawn one by one vertically and navigated vertically using up/down arrow key or...
Component Button(ButtonOption options)
Draw a button. Execute a function when clicked.
Component Renderer(Component child, std::function< Element()>)
Return a new Component, similar to |child|, but using |render| as the Component::Render() event.
Element text(std::wstring text)
Display a piece of unicode text.
Element separator()
Draw a vertical or horizontal separation in between two other elements.
Element border(Element)
Draw a border around the element.
Element vbox(Elements)
A container displaying elements vertically one by one.