19 std::function<
void()> exit) {
27 text(
"Main component"),
41 std::function<
void()> hide_modal) {
49 text(
"Modal component "),
59int main(
int argc,
const char* argv[]) {
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 = [&] {};
78 main_component |=
Modal(modal_component, &modal_shown);
80 screen.Loop(main_component);
static ButtonOption Animated()
Create a ButtonOption, using animated colors.
static ScreenInteractive TerminalOutput()
Component Button(ButtonOption options)
Draw a button. Execute a function when clicked.
Component Modal(Component main, Component modal, const bool *show_modal)
Component Renderer(Component child, std::function< Element()>)
Return a new Component, similar to |child|, but using |render| as the Component::Render() event.
Component Vertical(Components children)
A list of components, drawn one by one vertically and navigated vertically using up/down arrow key or...
Decorator size(WidthOrHeight, Constraint, int value)
Apply a constraint on the size of an element.
Element center(Element)
Center an element horizontally and vertically.
Element text(std::wstring text)
Display a piece of unicode text.
Element separator()
Draw a vertical or horizontal separation in between two other elements.
Element border(Element)
Draw a border around the element.
Element vbox(Elements)
A container displaying elements vertically one by one.
Component ModalComponent(std::function< void()> do_nothing, std::function< void()> hide_modal)
Component MainComponent(std::function< void()> show_modal, std::function< void()> exit)
The FTXUI ftxui:: namespace.
std::shared_ptr< Node > Element
std::shared_ptr< ComponentBase > Component