#include <cstdlib>
#include <iostream>
#include <memory>
#include <string>
auto screen = ScreenInteractive::Fullscreen();
auto btn_run = Button(
"Ejecutar con E/S restaurada",
screen.WithRestoredIO([] {
std::cout << "Este es un programa hijo usando stdin/stdout." << std::endl;
for (int i = 0; i < 10; ++i) {
std::cout << "Por favor, introduce 10 cadenas (" << i << "/10)" << std::flush;
std::string input;
std::getline(std::cin, input);
}
}));
auto btn_quit = Button(
"Salir",
screen.ExitLoopClosure());
auto layout = Container::Horizontal({
btn_run,
btn_quit,
});
auto renderer = Renderer(layout, [&] {
auto explanation = paragraph(
"Después de hacer clic en este botón, ScreenInteractive se "
"suspenderá y el acceso a stdin/stdout se restaurará temporalmente "
"para ejecutar una función.");
explanation | borderEmpty,
btn_run->Render(),
filler(),
btn_quit->Render(),
}),
});
element = element | borderEmpty | border |
size(WIDTH, LESS_THAN, 80) |
size(HEIGHT, LESS_THAN, 20) | center;
return element;
});
return EXIT_SUCCESS;
}
Element vbox(Elements children)
Un contenedor que muestra elementos verticalmente uno por uno.
return dimx size(HEIGHT, EQUAL, dimy)
return hbox({ text(std::to_string(int(progress *100))+"% ")|size(WIDTH, EQUAL, 5), gauge(progress), })
El espacio de nombres ftxui:: de FTXUI.