17 "FTXUI: A powerful library for building user interfaces.\n"
18 "Enjoy a rich set of components and a declarative style.\n"
19 "Create beautiful and responsive UIs with minimal effort.\n"
20 "Join the community and experience the power of FTXUI.");
24 auto screen = App::TerminalOutput();
27 Button(
"Quit", screen.ExitLoopClosure(), ButtonOption::Animated());
29 int selection_change_counter = 0;
30 std::string selection_content =
"";
31 screen.SelectionChange([&] {
32 selection_change_counter++;
33 selection_content = screen.GetSelection();
39 text(
"Select changed: " + std::to_string(selection_change_counter) +
41 text(
"Currently selected: "),
42 paragraph(selection_content) | vscroll_indicator | frame | border |
58 window(
text(
"Grid split with different style"),
75 pixel.underlined_double =
true;
85 screen.Loop(renderer);
Component Button(ConstStringRef label, std::function< void()> on_click, ButtonOption options=ButtonOption::Simple())
繪製一個按鈕。點擊時執行一個函式。
Component Renderer(Component child, std::function< Element()>)
回傳一個新的 Component,類似 |child|,但使用 |render| 作為 Component::Render() 事件。
Element window(Element title, Element content, BorderStyle border=ROUNDED)
繪製帶有標題和邊框的視窗。
Element text(std::string_view text)
顯示一段 UTF8 編碼的 Unicode 文字。
Decorator size(WidthOrHeight direction, Constraint constraint, int value)
對元素的大小套用限制。
Element paragraph(std::string_view the_text)
回傳一個在多行上繪製段落的元素。
Element separator()
在兩個元素之間繪製垂直或水平分隔線。
Element vbox(Elements children)
一個垂直一個接一個顯示元素的容器。
std::shared_ptr< Node > Element
Element hbox(Elements children)
一個逐一水平顯示元素的容器。
Decorator selectionBackgroundColor(Color foreground)
設定元素被選取時的背景顏色。 請注意,此樣式會應用在現有樣式之上。
Decorator selectionColor(Color foreground)
設定元素被選取時的顏色。
Element selectionStyleReset(Element child)
重設元素的選取樣式。
Decorator selectionStyle(std::function< void(Cell &)> style)
設定元素被選取時的樣式。