#include <cstdlib>
#include <iostream>
#include <memory>
#include <string>
auto screen = ScreenInteractive::Fullscreen();
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,
});
auto explanation = paragraph(
"单击此按钮后,ScreenInteractive 将被 "
"暂停,并且对 stdin/stdout 的访问将暂时 "
"恢复以运行函数。");
auto element = vbox({
hbox({
btn_run->Render(),
filler(),
}),
});
element = element | borderEmpty | border | size(WIDTH, LESS_THAN, 80) |
size(HEIGHT, LESS_THAN, 20) | center;
return element;
});
}
Element borderEmpty(Element child)
在元素周围绘制一个空边框。
#include "ftxui/component/component_base.hpp" // 用于 ComponentBase