#include <cstdlib>
#include <iostream>
#include <memory>
#include <string>
int main() {
auto screen = ScreenInteractive::Fullscreen();
auto btn_run = Button("Execute with restored IO", screen.WithRestoredIO([] {
std::cout << "This is a child program using stdin/stdout." << std::endl;
for (int i = 0; i < 10; ++i) {
std::cout << "Please enter 10 strings (" << i << "/10)" << std::flush;
std::string input;
std::getline(std::cin, input);
}
}));
auto btn_quit = Button("Quit", screen.ExitLoopClosure());
auto layout = Container::Horizontal({
btn_run,
btn_quit,
});
"After clicking this button, the ScreenInteractive will be "
"suspended and access to stdin/stdout will temporarilly be "
"restore for running a function.");
btn_run->Render(),
btn_quit->Render(),
}),
});
return element;
});
screen.Loop(renderer);
return EXIT_SUCCESS;
}
Decorator size(WidthOrHeight, Constraint, int value)
Apply a constraint on the size of an element.
Component Renderer(Component child, std::function< Element()>)
Return a new Component, similar to |child|, but using |render| as the Component::Render() event.
Element hbox(Elements)
A container displaying elements horizontally one by one.
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.
Elements paragraph(std::wstring text)
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.