16 using namespace ftxui;
18 auto screen = ScreenInteractive::Fullscreen();
23 auto btn_run = Button(
"Execute with restored IO", screen.WithRestoredIO([] {
24 std::cout <<
"This is a child program using stdin/stdout." << std::endl;
25 for (int i = 0; i < 10; ++i) {
26 std::cout <<
"Please enter 10 strings (" << i <<
"/10)" << std::flush;
28 std::getline(std::cin, input);
32 auto btn_quit =
Button(
"Quit", screen.ExitLoopClosure());
34 auto layout = Container::Horizontal({
39 auto renderer =
Renderer(layout, [&] {
41 "After clicking this button, the ScreenInteractive will be "
42 "suspended and access to stdin/stdout will temporarilly be "
43 "restore for running a function.");
58 screen.Loop(renderer);
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.
Decorator size(WidthOrHeight, Constraint, int value)
Apply a constraint on the size of an element.
Element center(Element)
Center an element horizontally and vertically.
Element filler()
An element that will take expand proportionally to the space left in a container.
Element border(Element)
Draw a border around the element.
Element borderEmpty(Element)
Draw an empty border around the element.
Element vbox(Elements)
A container displaying elements vertically one by one.
The FTXUI ftxui:: namespace.
Element hbox(Elements)
A container displaying elements horizontally one by one.
Elements paragraph(std::wstring text)