#include <string>
return vbox({
text("FTXUI: A powerful library for building user interfaces."),
text("Enjoy a rich set of components and a declarative style."),
text("Create beautiful and responsive UIs with minimal effort."),
text("Join the community and experience the power of FTXUI."),
});
}
int main() {
auto screen = ScreenInteractive::TerminalOutput();
auto quit =
Button("Quit", screen.ExitLoopClosure(), ButtonOption::Animated());
int selection_change_counter = 0;
std::string selection_content = "";
screen.SelectionChange([&] {
selection_change_counter++;
selection_content = screen.GetSelection();
});
text(
"Select changed: " + std::to_string(selection_change_counter) +
" times"),
text(
"Currently selected: "),
LoremIpsum(),
LoremIpsum(),
LoremIpsum(),
})),
LoremIpsum(),
LoremIpsum(),
LoremIpsum(),
})),
LoremIpsum(),
LoremIpsum()
}),
}),
LoremIpsum(),
}),
})),
quit->Render(),
});
});
screen.Loop(renderer);
}
Element window(Element title, Element content, BorderStyle border=ROUNDED)
Draw window with a title and a border around the element.
Element vscroll_indicator(Element)
Display a vertical scrollbar to the right. colors.
Decorator size(WidthOrHeight, Constraint, int value)
Apply a constraint on the size of an element.
std::shared_ptr< Node > Element
Decorator selectionStyle(std::function< void(Pixel &)> style)
Set the style of an element when selected.
Component Renderer(Component child, std::function< Element()>)
Return a new Component, similar to |child|, but using |render| as the Component::Render() event.
Element hbox(Elements)
A container displaying elements horizontally one by one.
Decorator selectionBackgroundColor(Color foreground)
Set the background color of an element when selected. Note that the style is applied on top of the ex...
Element text(std::wstring text)
Display a piece of unicode text.
Decorator selectionColor(Color foreground)
Set the color of an element when selected.
Element selectionStyleReset(Element)
Reset the selection style of an element.
Element separator()
Draw a vertical or horizontal separation in between two other elements.
Elements paragraph(std::wstring text)
Element frame(Element)
Allow an element to be displayed inside a 'virtual' area. It size can be larger than its container....
Element border(Element)
Draw a border around the element.
Element vbox(Elements)
A container displaying elements vertically one by one.
A Unicode character and its associated style.