#include <cstdlib>
#include <iostream>
#include <memory>
#include <string>
int main() {
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());
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;
}
static ScreenInteractive Fullscreen()
Component Horizontal(Components children)
A list of components, drawn one by one horizontally and navigated horizontally using left/right arrow...
Decorator size(WidthOrHeight, Constraint, int value)
Apply a constraint on the size of an element.
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 hbox(Elements)
A container displaying elements horizontally one by one.
Element center(Element)
Center an element horizontally and vertically.
Elements paragraph(std::wstring text)
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.