19 std::function<
void()> exit) {
20 auto component = Container::Vertical({
27 text(
"Main component"),
41 std::function<
void()> hide_modal) {
42 auto component = Container::Vertical({
49 text(
"Modal component "),
59int main(
int argc,
const char* argv[]) {
60 auto screen = App::TerminalOutput();
63 bool modal_shown =
false;
66 auto show_modal = [&] { modal_shown =
true; };
67 auto hide_modal = [&] { modal_shown =
false; };
68 auto exit = screen.ExitLoopClosure();
69 auto do_nothing = [&] {};
77 main_component |=
Modal(modal_component, &modal_shown);
79 screen.Loop(main_component);
Component Button(ConstStringRef label, std::function< void()> on_click, ButtonOption options=ButtonOption::Simple())
クリックすると関数を実行するボタンを描画します。
FTXUI_EXPORT(COMPONENT) ComponentDecorator Maybe(std Component Modal(Component main, Component modal, const bool *show_modal)
Component Renderer(Component child, std::function< Element()>)
|child| に似た、|render| をComponent::Render()イベントとして 使用する新しいComponentを返します。
Element text(std::string_view text)
UTF8エンコードされたユニコードテキストを表示します。
Decorator size(WidthOrHeight direction, Constraint constraint, int value)
要素のサイズに制約を適用する。
Element center(Element child)
要素を水平方向および垂直方向に中央揃えします。
Element border(Element child)
要素の周囲にボーダーを描画します。
Element vbox(Elements children)
要素を縦に一つずつ表示するコンテナ。
Component ModalComponent(std::function< void()> do_nothing, std::function< void()> hide_modal)
Component MainComponent(std::function< void()> show_modal, std::function< void()> exit)
std::shared_ptr< Node > Element
std::shared_ptr< ComponentBase > Component