#include <functional>
#include <memory>
std::function<void()> exit) {
auto component = Container::Vertical({
});
component |= Renderer([&](
Element inner) {
text("Main component"),
separator(),
inner,
})
|
size(WIDTH, GREATER_THAN, 15)
|
size(HEIGHT, GREATER_THAN, 15)
| border
| center;
});
return component;
}
std::function<void()> hide_modal) {
auto component = Container::Vertical({
});
component |= Renderer([&](
Element inner) {
text("Modal component "),
separator(),
inner,
})
|
size(WIDTH, GREATER_THAN, 30)
| border;
});
return component;
}
int main(
int argc,
const char* argv[]) {
auto screen = ScreenInteractive::TerminalOutput();
bool modal_shown = false;
auto show_modal = [&] { modal_shown = true; };
auto hide_modal = [&] { modal_shown = false; };
auto exit =
screen.ExitLoopClosure();
auto do_nothing = [&] {};
main_component |= Modal(modal_component, &modal_shown);
return 0;
}
Element vbox(Elements children)
Un contenedor que muestra elementos verticalmente uno por uno.
return dimx size(HEIGHT, EQUAL, dimy)
Component ModalComponent(std::function< void()> do_nothing, std::function< void()> hide_modal)
Component MainComponent(std::function< void()> show_modal, std::function< void()> exit)
El espacio de nombres ftxui:: de FTXUI.
std::shared_ptr< Node > Element
std::shared_ptr< ComponentBase > Component