4#ifndef FTXUI_DOM_ELEMENTS_HPP
5#define FTXUI_DOM_ELEMENTS_HPP
68 Color unselected_color,
69 Color selected_color);
73 Color unselected_color,
74 Color selected_color);
86 std::vector<std::string> charset,
111Element canvas(
int width,
int height, std::function<
void(Canvas&)>);
235#include "ftxui/dom/take_any_args.hpp"
#define FTXUI_EXPORT(component)
Element window(Element title, Element content, BorderStyle border=ROUNDED)
繪製帶有標題和邊框的視窗。
Element borderDouble(Element child)
在元素周圍繪製雙線邊框。
Element text(std::string_view text)
顯示一段 UTF8 編碼的 Unicode 文字。
Element focusCursorBarBlinking(Element child)
與 focus 相同,但將游標形狀設置為閃爍條狀。
Element xflex(Element)
在 X 軸上盡可能擴展/在需要時最小化。
Element gaugeDirection(float progress, Direction direction)
繪製一個指定方向的高解析度進度條。
Decorator focusPositionRelative(float x, float y)
在 frame 內部使用,這會強制視圖滾動到給定位置。該位置以請求大小的比例表示。
Element separatorStyled(BorderStyle style)
在兩個元素之間繪製垂直或水平分隔線。
Element xflex_grow(Element)
在 X 軸上盡可能擴展。
Element underlinedDouble(Element child)
對文字應用雙底線。
Element clear_under(Element element)
在繪製 |child| 之前,先清除底下的儲存格。這在 搭配 dbox 使用時很有用。
Element borderDashed(Element child)
在元素周圍繪製虛線邊框。
Element separatorEmpty()
使用 EMPTY 樣式在兩個元素之間繪製垂直或水平分隔線。
Element vscroll_indicator(Element child)
在右側顯示一個垂直捲軸。 顏色與內容一致。
Element nothing(Element element)
一個什麼都不做的裝飾器。
Element paragraphAlignLeft(std::string_view the_text)
回傳一個在多行上繪製段落並靠左對齊的元素。
Decorator size(WidthOrHeight direction, Constraint constraint, int value)
對元素的大小套用限制。
Element flex(Element child)
讓子元素依比例擴展以填滿容器中剩餘的空間。
Element hyperlink(std::string_view link, Element child)
使渲染區域可點擊並使用網路瀏覽器開啟。 當用戶點擊時,連結將被開啟。 此功能僅在有限的終端模擬器中受支援。 List: https://github.com/Alhadis/OSC8-Adoption/
Element gaugeRight(float progress)
繪製一個從左到右進展的高解析度進度條。
Element focusCursorUnderlineBlinking(Element child)
與 focus 相同,但將游標形狀設置為閃爍底線。
Element bold(Element child)
使用粗體字型,用於需要更多強調的元素。
Element separatorLight()
使用 LIGHT 樣式在兩個元素之間繪製垂直或水平分隔線。
Element spinner(int charset_index, size_t image_index)
用於表示時間和/或事件的效果。這將顯示 一個 ASCII 藝術「影片」。
Element borderRounded(Element child)
在元素周圍繪製圓角邊框。
Element yflex(Element)
在 Y 軸上盡可能擴展/在需要時最小化。
Element flex_shrink(Element child)
在需要時最小化。
Element focusCursorBar(Element child)
與 focus 相同,但將游標形狀設置為靜止條狀。
Element focusCursorBlock(Element child)
與 focus 相同,但將游標形狀設置為靜止條狀。
Element vtext(std::string_view text)
垂直顯示一段 Unicode 文字。
BorderStyle
BorderStyle 是一個列舉,表示可以應用於終端機 UI 元素的不同邊框樣式。
Element underlined(Element child)
為給定元素加上底線。
Element center(Element child)
水平與垂直置中一個元素。
Element paragraphAlignJustify(std::string_view the_text)
回傳一個在多行上繪製段落並使用左右對齊的元素。
Direction
Direction 是一個列舉,表示四個主要方向。
Element focusCursorUnderline(Element child)
與 focus 相同,但將游標形狀設置為靜止底線。
Element borderHeavy(Element child)
在元素周圍繪製粗邊框。
Element inverted(Element child)
添加一個濾鏡,它將反轉前景和背景 顏色。
Element gaugeUp(float progress)
繪製一個從下到上進展的高解析度進度條。
Element gaugeCharset(float progress, std::vector< std::string > charset, Direction direction=Direction::Right)
使用自訂字元集繪製高解析度進度條。
Element align_right(Element child)
將元素靠右對齊。
Decorator focusPosition(int x, int y)
在 frame 內部使用,這會強制視圖滾動到給定位置。該位置以單元格數表示。
Element yflex_grow(Element)
在 Y 軸上盡可能擴展。
Element hscroll_indicator(Element child)
在底部顯示一個水平捲軸。 顏色與內容一致。
Element flex_grow(Element child)
盡可能擴展。
Element separatorDashed()
使用 DASHED 樣式在兩個元素之間繪製垂直或水平分隔線。
Element notflex(Element child)
使元素不可伸縮。
Element strikethrough(Element child)
對文字應用刪除線。
Element italic(Element child)
對文字應用雙底線。
Element dbox(Elements children_)
將多個元素堆疊在一起。
Element xflex_shrink(Element)
在 X 軸上在需要時最小化。
Decorator borderWith(const Cell &pixel)
與 border 相同,但周圍使用固定的 Cell。
Element gaugeLeft(float progress)
繪製一個從右到左進展的高解析度進度條。
Element paragraphAlignCenter(std::string_view the_text)
回傳一個在多行上繪製段落並置中對齊的元素。
Element borderLight(Element child)
在元素周圍繪製細邊框。
Element focus(Element child)
將 child 設置為其同級元素中被聚焦的元素。
Element paragraph(std::string_view the_text)
回傳一個在多行上繪製段落的元素。
Element bgcolor(Color color, Element child)
設定元素的背景顏色。
Decorator borderStyled(BorderStyle style)
與 border 相同,但具有不同的樣式。
Element paragraphAlignRight(std::string_view the_text)
回傳一個在多行上繪製段落並靠右對齊的元素。
Element separator()
在兩個元素之間繪製垂直或水平分隔線。
Element filler()
一個會依照容器中剩餘空間 按比例擴展的元素。
Element dim(Element child)
使用淺色字體,適用於不那麼強調的元素。
Element automerge(Element child)
啟用字符自動與附近其他字符合併。
Element separatorCharacter(std::string_view value)
在兩個元素之間繪製垂直或水平分隔線。
Element blink(Element child)
繪製的文字在可見和隱藏之間交替。
Element vcenter(Element child)
垂直置中一個元素。
Element separatorDouble()
使用 DOUBLE 樣式在兩個元素之間繪製垂直或水平分隔線。
Element focusCursorBlockBlinking(Element child)
與 focus 相同,但將游標形狀設置為閃爍方塊。
Element color(Color color, Element child)
設定元素的前景顏色。
Element gauge(float progress)
繪製一個高解析度進度條。
Element border(Element child)
在元素周圍繪製邊框。
Element separatorHeavy()
使用 HEAVY 樣式在兩個元素之間繪製垂直或水平分隔線。
Element borderEmpty(Element child)
在元素周圍繪製空邊框。
Element yflex_shrink(Element)
在 Y 軸上在需要時最小化。
Element hcenter(Element child)
水平置中一個元素。
Element vbox(Elements children)
一個垂直一個接一個顯示元素的容器。
Element gaugeDown(float progress)
繪製一個從上到下進展的高解析度進度條。
FTXUI 的 ftxui::Dimension:: 命名空間
bool extend_beyond_screen
Element flexbox(Elements, FlexboxConfig config=FlexboxConfig())
一個容器,用於在行/列中顯示元素,並在滿時能夠換行到下一列/行。
Element separatorVSelector(float up, float down, Color unselected_color, Color selected_color)
繪製一個垂直條,其中上方/下方之間的區域以不同顏色顯示。
Decorator yflex_shrink_factor(int shrink)
std::shared_ptr< Node > Element
Element xframe(Element child)
與 frame 相同,但僅限於 x 軸。
Decorator xflex_grow_factor(int grow)
FTXUI_EXPORT(DOM) Element gridbox(std Element hflow(Elements)
一個容器,用於從左到右在行中顯示元素。當填滿時,它會在下方的新行開始。
Decorator yflex_grow_factor(int grow)
FTXUI_EXPORT(DOM) Element separatorCharacter(std Element separatorHSelector(float left, float right, Color unselected_color, Color selected_color)
繪製一個水平條,其中左右兩側之間的區域以不同顏色顯示。
Element hbox(Elements children)
一個逐一水平顯示元素的容器。
std::vector< Element > Elements
Decorator selectionForegroundColor(Color foreground)
設定元素被選取時的前景顏色。 請注意,此樣式會應用在現有樣式之上。
Decorator yflex_factor(int grow, int shrink)
Component operator|(Component component, ComponentDecorator decorator)
Decorator selectionBackgroundColor(Color foreground)
設定元素被選取時的背景顏色。 請注意,此樣式會應用在現有樣式之上。
std::function< Element(Element)> Decorator
Decorator flex_shrink_factor(int shrink)
Element yframe(Element child)
與 frame 相同,但僅限於 y 軸。
Decorator flex_grow_factor(int grow)
Decorator selectionColor(Color foreground)
設定元素被選取時的顏色。
Element selectionStyleReset(Element child)
重設元素的選取樣式。
Decorator reflect(Box &box)
std::function< std::vector< int >(int, int)> GraphFunction
Decorator xflex_shrink_factor(int shrink)
Decorator xflex_factor(int grow, int shrink)
Decorator flex_factor(int grow, int shrink)
Element gridbox(std::vector< Elements > lines)
A container displaying a grid of elements.
Element canvas(int width, int height, std::function< void(Canvas &)>)
從指定大小的畫布中產生一個繪製畫布的元素。
Element frame(Element child)
允許元素顯示在「虛擬」區域內。其大小可以大於其容器。在這種情況下,只會顯示較小的一部分。視圖可滾動以使聚焦元素可見。
Component & operator|=(Component &component, ComponentDecorator decorator)
Element select(Element e)
將 child 設為其兄弟元素中被聚焦的那一個。
Decorator selectionStyle(std::function< void(Cell &)> style)
設定元素被選取時的樣式。
Element vflow(Elements)
一個容器,用於從上到下在行中顯示元素。當填滿時,它會在右側的新列開始。 filled, it starts on a new row. is full, it starts a new row.
Element graph(GraphFunction graph_function)
使用 GraphFunction 繪製圖形。