|
FTXUI 7.0.3
C++ functional terminal UI.
|
請查看 ftxui/component 模組的教學。
Functions | |
| FTXUI_EXPORT (COMPONENT) void RequestAnimationFrame() | |
| RequestAnimationFrame 是一個函式,它請求在下一個動畫週期中繪製新畫面。 | |
| class | FTXUI_EXPORT (COMPONENT) ComponentBase = {}) |
| 它將自己實作為 ftxui::Element 進行渲染。它透過回應 ftxui::Event 來實現鍵盤導航。 | |
| Component | Button (ButtonOption option) |
| 繪製一個按鈕。點擊時執行一個函式。 | |
| Component | Button (ConstStringRef label, std::function< void()> on_click, ButtonOption option) |
| 繪製一個按鈕。點擊時執行一個函式。 | |
| Component | CatchEvent (Component child, std::function< bool(Event event)> on_event) |
| 傳回一個元件,使用 |on_event| 來攔截事件。此函式 在事件已被處理時必須回傳 true,否則回傳 false。 | |
| ComponentDecorator | CatchEvent (std::function< bool(Event)> on_event) |
| 裝飾一個元件,使用 |on_event| 來攔截事件。此函式 在事件已被處理時必須回傳 true,否則回傳 false。 | |
| Component | Checkbox (CheckboxOption option) |
| 繪製可勾選的元素。 | |
| Component | Checkbox (ConstStringRef label, bool *checked, CheckboxOption option) |
| 繪製可勾選的元素。 | |
| Component | Vertical (Components children) |
| 一個元件列表,垂直地一個接一個繪製,並使用上/下箭頭鍵或 'j'/'k' 鍵進行垂直導航。 | |
| Component | Vertical (Components children, int *selector) |
| 一個元件清單,垂直逐一繪製,並使用上下方向鍵 或 'j'/'k' 鍵進行垂直導覽。 這對於實作選單(Menu)非常有用。 | |
| Component | Horizontal (Components children) |
| 一個元件清單,水平逐一繪製,並使用左右方向鍵 或 'h'/'l' 鍵進行水平導覽。 | |
| Component | Horizontal (Components children, int *selector) |
| 一個元件列表,水平地一個接一個繪製,並使用左/右箭頭鍵或 'h'/'l' 鍵進行水平導航。 | |
| Component | Tab (Components children, int *selector) |
| 一個元件列表,一次只繪製一個並與之互動。|selector| 給出所選元件的索引。這對於實作分頁很有用。 | |
| Component | Stacked (Components children) |
| 一個元件列表,將彼此堆疊。 事件會傳播到第一個元件,如果未處理則傳播到第二個,依此類推。 元件以給定的相反順序繪製。 當一個元件獲得焦點時,它會被放到最前面,而不改變其他元素的相對順序。 | |
| Component | Dropdown (ConstStringListRef entries, int *selected) |
| 下拉式選單。 | |
| Component | Dropdown (DropdownOption option) |
| 下拉式選單。 | |
| Component | Hoverable (Component component, bool *hover) |
| 包裝一個元件。提供能力以判斷滑鼠是否懸停在其上方。 | |
| Component | Hoverable (Component component, std::function< void()> on_enter, std::function< void()> on_leave) |
| 包裝一個元件。使用回呼函數。 | |
| ComponentDecorator | Hoverable (bool *hover) |
| 包裝一個元件。提供能力以判斷滑鼠是否懸停在其上方。 | |
| ComponentDecorator | Hoverable (std::function< void()> on_enter, std::function< void()> on_leave) |
| 包裝一個元件。提供能力以判斷滑鼠是否懸停在其上方。 | |
| Component | Hoverable (Component component, std::function< void(bool)> on_change) |
| 包裝一個元件。提供能力以判斷滑鼠是否懸停在其上方。 | |
| ComponentDecorator | Hoverable (std::function< void(bool)> on_change) |
| 包裝一個元件。提供能力以判斷滑鼠是否懸停在其上方。 | |
| Component | Input (InputOption option) |
| 用於編輯文字的輸入框。 | |
| Component | Input (StringRef content, InputOption option) |
| 用於編輯文字的輸入框。 | |
| Component | Input (StringRef content, StringRef placeholder, InputOption option) |
| 用於編輯文字的輸入框。 | |
| Component | Maybe (Component child, std::function< bool()> show) |
| 裝飾一個組件 |child|。它只在 |show| 返回 true 時顯示。 | |
| ComponentDecorator | Maybe (std::function< bool()> show) |
| 裝飾一個組件。它只在 |show| 函數返回 true 時顯示。 | |
| Component | Maybe (Component child, const bool *show) |
| 裝飾一個組件 |child|。它只在 |show| 為 true 時顯示。 | |
| ComponentDecorator | Maybe (const bool *show) |
| 裝飾一個組件。它只在 |show| 為 true 時顯示。 | |
| Component | Menu (MenuOption option) |
| 一份文字清單。取得焦點的元素會被選取。 | |
| Component | Menu (ConstStringListRef entries, int *selected, MenuOption option) |
| 一份文字清單。取得焦點的元素會被選取。 | |
| Component | Toggle (ConstStringListRef entries, int *selected) |
| 元素的水平列表。使用者可以在其中導航。 | |
| Component | MenuEntry (ConstStringRef label, MenuEntryOption option) |
| 一個特定的選單項目。可以將它們放入 Container::Vertical 以 組成一個選單。 | |
| Component | MenuEntry (MenuEntryOption option) |
| 一個特定的選單項目。可以將它們放入 Container::Vertical 以 組成一個選單。 | |
| FTXUI_EXPORT(COMPONENT) ComponentDecorator Maybe(std Component | Modal (Component main, Component modal, const bool *show_modal) |
| ComponentDecorator | Modal (Component modal, const bool *show_modal) |
| Component | Radiobox (RadioboxOption option) |
| 一份元素清單,只能選取其中一個。 | |
| Component | Radiobox (ConstStringListRef entries, int *selected, RadioboxOption option) |
| 一份元素清單,只能選取其中一個。 | |
| Component | Renderer (std::function< Element()> render) |
| 傳回一個元件,使用 |render| 來繪製其介面。 | |
| Component | Renderer (Component child, std::function< Element()> render) |
| 回傳一個新的 Component,類似 |child|,但使用 |render| 作為 Component::Render() 事件。 | |
| FTXUI_EXPORT(COMPONENT) Component Renderer(std Component | Renderer (std::function< Element(bool)> render) |
| 回傳一個可聚焦的元件,使用 |render| 來渲染其介面。 | |
| ComponentDecorator | Renderer (ElementDecorator decorator) |
| 透過裝飾元件所渲染的內容來裝飾該元件。 | |
| Component | ResizableSplitLeft (Component main, Component back, int *main_size) |
| 兩個元件之間的水平分割,可透過 滑鼠調整大小。 | |
| Component | ResizableSplitRight (Component main, Component back, int *main_size) |
| 兩個元件之間的水平分割,可透過 滑鼠調整大小。 | |
| Component | ResizableSplitTop (Component main, Component back, int *main_size) |
| 兩個元件之間的垂直分割,可透過 滑鼠調整大小。 | |
| Component | ResizableSplitBottom (Component main, Component back, int *main_size) |
| 兩個元件之間的垂直分割,可透過 滑鼠調整大小。 | |
| Component | Slider (ConstStringRef label, Ref< int > value, ConstRef< int > min, ConstRef< int > max, ConstRef< int > increment) |
| 一個水平滑桿。 | |
| Component | Window (WindowOptions option) |
| 一個可拖曳/可調整大小的視窗。要使用多個視窗,它們必須透過 Container::Stacked({...}) 元件堆疊。 | |
| class FTXUI_EXPORT | ( | COMPONENT | ) |
RequestAnimationFrame 是一個函式,它請求在下一個動畫週期中繪製新畫面。
尚未完成動畫的元件可以呼叫此函式,以請求稍後繪製新畫面。
當沒有新事件且沒有動畫要完成時,不會繪製新畫面。
此動畫步驟所代表的持續時間。
此動畫步驟所代表的持續時間。
Definition at line 22 of file animation.hpp.
| template FTXUI_EXPORT | ( | COMPONENT | ) | = {}) |
它將自己實作為 ftxui::Element 進行渲染。它透過回應 ftxui::Event 來實現鍵盤導航。
滑鼠事件。它包含滑鼠的座標、按下的按鈕 以及修飾鍵(shift、ctrl、meta)。
Loop 是一個管理元件事件迴圈的類別。
代表一個事件。它可以是按鍵事件、終端機大小調整,或更多...
Dropdown 元件的選項。
下拉式選單是開啟/關閉單選方塊的核取方塊。
傳遞給 Window 元件渲染函式的狀態。
Radiobox 元件的選項。
Input 元件的選項。
用於定義 Input 元件的樣式。
核取方塊元件的選項。
AnimatedButton 元件的選項。
Menu 元件的選項。
MenuEntry 元件的選項。
關於潛在動畫顏色的選項。
底線效果的選項。
來自 |ButtonOption|、|CheckboxOption|、 |RadioboxOption|、|MenuEntryOption|、|MenuOption| 的轉換參數。
例如:
有關 xterm 規範的有用文件: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
它負責執行元件、處理事件,以及 更新畫面。
Loop 類別設計用來與代表終端機畫面的 App 物件 一起使用。
範例
< 要顯示的標籤。
< 按鈕/核取方塊/單選框的狀態
< 該項目是否為作用中的項目。
< 該項目是否為使用者所聚焦的項目。
< 該項目的索引(若適用),否則為 -1。
項目清單。
選取項目的索引。
當選取項目改變時呼叫。
當使用者按下 Enter 鍵時呼叫。
當使用者改變狀態時呼叫。
< 輸入框是否被滑鼠懸停。
< 輸入框是否被使用者聚焦。
< 輸入框是否為空並顯示 佔位文字。
建立預設輸入樣式:
具有高邊距的黑底白字樣式:
輸入框的內容。
輸入框為空時的內容。
< 使用 '*' 遮蔽輸入內容。
< 輸入框是否可以多行輸入。
< 插入或覆寫字元模式。
當內容改變時呼叫。
當使用者按下 Enter 鍵時呼叫。
當選取項目改變時呼叫。
< 包裹在此視窗內的元素。
< 視窗的標題。
< 該視窗是否為作用中的視窗。
< 該視窗是否正在被拖曳。
< 該視窗是否正在被調整大小。
< 可調整大小的左側邊是否被懸停。
< 可調整大小的右側邊是否被懸停。
< 可調整大小的上側邊是否被懸停。
< 可調整大小的下側邊是否被懸停。
< 此視窗所包裹的元件。
< 此視窗所顯示的標題。
< 視窗的左側位置。
< 視窗的上側位置。
< 視窗的寬度。
< 視窗的高度。
< 左側邊是否可調整大小?
< 右側邊是否可調整大小?
< 上側邊是否可調整大小?
< 下側邊是否可調整大小?
一個選用的函式,用來自訂視窗的外觀:
下拉選單是開啟還是關閉:
僅支援的終端機。
僅支援的終端機。
< 要顯示的標籤。
< 按鈕/核取方塊/單選框的狀態
< 該項目是否為作用中的項目。
< 該項目是否為使用者所聚焦的項目。
< 該項目的索引(若適用),否則為 -1。
項目清單。
選取項目的索引。
當選取項目改變時呼叫。
當使用者按下 Enter 鍵時呼叫。
當使用者改變狀態時呼叫。
< 輸入框是否被滑鼠懸停。
< 輸入框是否被使用者聚焦。
< 輸入框是否為空並顯示 佔位文字。
建立預設輸入樣式:
具有高邊距的黑底白字樣式:
輸入框的內容。
輸入框為空時的內容。
< 使用 '*' 遮蔽輸入內容。
< 輸入框是否可以多行輸入。
< 插入或覆寫字元模式。
當內容改變時呼叫。
當使用者按下 Enter 鍵時呼叫。
當選取項目改變時呼叫。
< 包裹在此視窗內的元素。
< 視窗的標題。
< 該視窗是否為作用中的視窗。
< 該視窗是否正在被拖曳。
< 該視窗是否正在被調整大小。
< 可調整大小的左側邊是否被懸停。
< 可調整大小的右側邊是否被懸停。
< 可調整大小的上側邊是否被懸停。
< 可調整大小的下側邊是否被懸停。
< 此視窗所包裹的元件。
< 此視窗所顯示的標題。
< 視窗的左側位置。
< 視窗的上側位置。
< 視窗的寬度。
< 視窗的高度。
< 左側邊是否可調整大小?
< 右側邊是否可調整大小?
< 上側邊是否可調整大小?
< 下側邊是否可調整大小?
一個選用的函式,用來自訂視窗的外觀:
下拉選單是開啟還是關閉:
僅支援的終端機。
僅支援的終端機。
Definition at line 1 of file captured_mouse.hpp.
| Component Button | ( | ButtonOption | option | ) |
繪製一個按鈕。點擊時執行一個函式。
| option | 額外的可選參數。 |
Definition at line 174 of file src/ftxui/component/button.cpp.
| Component Button | ( | ConstStringRef | label, |
| std::function< void()> | on_click, | ||
| ButtonOption | option ) |
繪製一個按鈕。點擊時執行一個函式。
| label | 按鈕的標籤。 |
| on_click | 點擊時要執行的動作。 |
| option | 額外的可選參數。 |
Definition at line 202 of file src/ftxui/component/button.cpp.
傳回一個元件,使用 |on_event| 來攔截事件。此函式 在事件已被處理時必須回傳 true,否則回傳 false。
| child | 被包裝的元件。 |
| on_event | 繪製介面的函式。 |
Definition at line 58 of file catch_event.cpp.
| ComponentDecorator CatchEvent | ( | std::function< bool(Event)> | on_event | ) |
裝飾一個元件,使用 |on_event| 來攔截事件。此函式 在事件已被處理時必須回傳 true,否則回傳 false。
| on_event | 繪製介面的函式。 |
Definition at line 84 of file catch_event.cpp.
| Component Checkbox | ( | CheckboxOption | option | ) |
繪製可勾選的元素。
| option | 額外的可選參數。 |
Definition at line 111 of file src/ftxui/component/checkbox.cpp.
| Component Checkbox | ( | ConstStringRef | label, |
| bool * | checked, | ||
| CheckboxOption | option ) |
繪製可勾選的元素。
| label | 核取方塊的標籤。 |
| checked | 核取方塊是否被勾選。 |
| option | 額外的可選參數。 |
Definition at line 138 of file src/ftxui/component/checkbox.cpp.
| Component Vertical | ( | Components | children | ) |
一個元件列表,垂直地一個接一個繪製,並使用上/下箭頭鍵或 'j'/'k' 鍵進行垂直導航。
| children | 元件列表。 |
Definition at line 330 of file container.cpp.
| Component Vertical | ( | Components | children, |
| int * | selector ) |
一個元件清單,垂直逐一繪製,並使用上下方向鍵 或 'j'/'k' 鍵進行垂直導覽。 這對於實作選單(Menu)非常有用。
| children | 元件清單。 |
| selector | 選定子項目索引的參照。 |
Definition at line 353 of file container.cpp.
| Component Horizontal | ( | Components | children | ) |
一個元件清單,水平逐一繪製,並使用左右方向鍵 或 'h'/'l' 鍵進行水平導覽。
| children | 元件清單。 |
Definition at line 373 of file container.cpp.
| Component Horizontal | ( | Components | children, |
| int * | selector ) |
一個元件列表,水平地一個接一個繪製,並使用左/右箭頭鍵或 'h'/'l' 鍵進行水平導航。
| children | 元件列表。 |
| selector | 所選子元件索引的參考。 |
Definition at line 394 of file container.cpp.
| Component Tab | ( | Components | children, |
| int * | selector ) |
一個元件列表,一次只繪製一個並與之互動。|selector| 給出所選元件的索引。這對於實作分頁很有用。
| children | 元件列表。 |
| selector | 繪製中的子元件索引。 |
Definition at line 415 of file container.cpp.
| Component Stacked | ( | Components | children | ) |
一個元件列表,將彼此堆疊。 事件會傳播到第一個元件,如果未處理則傳播到第二個,依此類推。 元件以給定的相反順序繪製。 當一個元件獲得焦點時,它會被放到最前面,而不改變其他元素的相對順序。
這應該與 Window 元件一起使用。
| children | 元件列表。 |
Definition at line 440 of file container.cpp.
| Component Dropdown | ( | ConstStringListRef | entries, |
| int * | selected ) |
下拉式選單。
| entries | 要顯示的項目清單。 |
| selected | 選定項目的索引。 |
Definition at line 22 of file src/ftxui/component/dropdown.cpp.
| Component Dropdown | ( | DropdownOption | option | ) |
包裝一個元件。提供能力以判斷滑鼠是否懸停在其上方。
| component | 被包裝的元件。 |
| hover | 反映元件是否被懸停的值。 |
Definition at line 32 of file hoverable.cpp.
| Component Hoverable | ( | Component | component, |
| std::function< void()> | on_enter, | ||
| std::function< void()> | on_leave ) |
包裝一個元件。使用回呼函數。
| component | 被包裝的元件。 |
| on_enter | 進入時的回呼函數 |
| on_leave | 離開時的回呼函數 |
Definition at line 75 of file hoverable.cpp.
| ComponentDecorator Hoverable | ( | bool * | hover | ) |
包裝一個元件。提供能力以判斷滑鼠是否懸停在其上方。
| hover | 反映元件是否被懸停的值。 |
Definition at line 129 of file hoverable.cpp.
| ComponentDecorator Hoverable | ( | std::function< void()> | on_enter, |
| std::function< void()> | on_leave ) |
包裝一個元件。提供能力以判斷滑鼠是否懸停在其上方。
| on_enter | 當滑鼠懸停在元件上時呼叫。 |
| on_leave | 當滑鼠離開元件時呼叫。 |
Definition at line 152 of file hoverable.cpp.
包裝一個元件。提供能力以判斷滑鼠是否懸停在其上方。
| component | 被包裝的元件。 |
| on_change | 當滑鼠進入或離開元件時呼叫。 |
Definition at line 174 of file hoverable.cpp.
| ComponentDecorator Hoverable | ( | std::function< void(bool)> | on_change | ) |
包裝一個元件。提供能力以判斷滑鼠是否懸停在其上方。
| on_change | 當滑鼠進入或離開元件時呼叫。 |
Definition at line 194 of file hoverable.cpp.
| Component Input | ( | InputOption | option | ) |
用於編輯文字的輸入框。
| option | 額外的可選參數。 |
Definition at line 590 of file src/ftxui/component/input.cpp.
| Component Input | ( | StringRef | content, |
| InputOption | option ) |
用於編輯文字的輸入框。
| content | 可編輯的內容。 |
| option | 額外的可選參數。 |
Definition at line 618 of file src/ftxui/component/input.cpp.
| Component Input | ( | StringRef | content, |
| StringRef | placeholder, | ||
| InputOption | option ) |
用於編輯文字的輸入框。
| content | 可編輯的內容。 |
| placeholder | 佔位符文字。 |
| option | 額外的可選參數。 |
Definition at line 645 of file src/ftxui/component/input.cpp.
裝飾一個組件 |child|。它只在 |show| 返回 true 時顯示。
| child | 要裝飾的組件。 |
| show | 一個函數,返回是否應顯示 |child|。 |
Definition at line 20 of file src/ftxui/component/maybe.cpp.
| ComponentDecorator Maybe | ( | std::function< bool()> | show | ) |
裝飾一個組件。它只在 |show| 函數返回 true 時顯示。
| show | 一個函數,返回是否應顯示被裝飾的組件。 |
Definition at line 54 of file src/ftxui/component/maybe.cpp.
裝飾一個組件 |child|。它只在 |show| 為 true 時顯示。
| child | 要裝飾的組件。 |
| show | 一個布林值。當 |show| 為 true 時,顯示 |child|。 |
Definition at line 71 of file src/ftxui/component/maybe.cpp.
| ComponentDecorator Maybe | ( | const bool * | show | ) |
| Component Menu | ( | MenuOption | option | ) |
一份文字清單。取得焦點的元素會被選取。
| option | 包含所有參數的結構。 |
Definition at line 505 of file src/ftxui/component/menu.cpp.
| Component Menu | ( | ConstStringListRef | entries, |
| int * | selected, | ||
| MenuOption | option ) |
一份文字清單。取得焦點的元素會被選取。
| entries | 選單中的項目清單。 |
| selected | 目前選定元素的索引。 |
| option | 額外的可選參數。 |
Definition at line 536 of file src/ftxui/component/menu.cpp.
| Component Toggle | ( | ConstStringListRef | entries, |
| int * | selected ) |
元素的水平列表。使用者可以在其中導航。
| entries | 要顯示的可選條目列表。 |
| selected | 參考選定的條目。 另請參閱 |Menu|。 |
Definition at line 547 of file src/ftxui/component/menu.cpp.
| Component MenuEntry | ( | ConstStringRef | label, |
| MenuEntryOption | option ) |
一個特定的選單項目。可以將它們放入 Container::Vertical 以 組成一個選單。
| label | 代表此元素所繪製的文字。 |
| option | 額外的可選參數。 |
Definition at line 577 of file src/ftxui/component/menu.cpp.
| Component MenuEntry | ( | MenuEntryOption | option | ) |
一個特定的選單項目。可以將它們放入 Container::Vertical 以 組成一個選單。
| option | 參數。 |
Definition at line 607 of file src/ftxui/component/menu.cpp.
| ComponentDecorator Modal | ( | Component | modal, |
| const bool * | show_modal ) |
| Component Radiobox | ( | RadioboxOption | option | ) |
一份元素清單,只能選取其中一個。
| option | 參數 |
NOLINTNEXTLINE
Definition at line 204 of file src/ftxui/component/radiobox.cpp.
| Component Radiobox | ( | ConstStringListRef | entries, |
| int * | selected, | ||
| RadioboxOption | option ) |
一份元素清單,只能選取其中一個。
| entries | 清單中的項目清單。 |
| selected | 目前選定元素的索引。 |
| option | 額外的可選參數。 |
Definition at line 236 of file src/ftxui/component/radiobox.cpp.
傳回一個元件,使用 |render| 來繪製其介面。
| render | 繪製介面的函式。 |
Definition at line 29 of file src/ftxui/component/renderer.cpp.
回傳一個新的 Component,類似 |child|,但使用 |render| 作為 Component::Render() 事件。
| child | 用來轉發事件的元件。 |
| render | 繪製介面的函式。 |
Definition at line 61 of file src/ftxui/component/renderer.cpp.
回傳一個可聚焦的元件,使用 |render| 來渲染其介面。
| render | 繪製介面的函式,接受一個布林值來表示 元件是否已聚焦。 |
Definition at line 84 of file src/ftxui/component/renderer.cpp.
| ComponentDecorator Renderer | ( | ElementDecorator | decorator | ) |
兩個元件之間的水平分割,可透過 滑鼠調整大小。
| main | 大小為 |main_size| 的主元件,位於左側。 |
| back | 佔用剩餘空間的次元件,位於右側。 |
| main_size | |main| 元件的大小。 |
Definition at line 199 of file src/ftxui/component/resizable_split.cpp.
兩個元件之間的水平分割,可透過 滑鼠調整大小。
| main | 大小為 |main_size| 的主元件,位於右側。 |
| back | 佔用剩餘空間的次元件,位於左側。 |
| main_size | |main| 元件的大小。 |
Definition at line 233 of file src/ftxui/component/resizable_split.cpp.
兩個元件之間的垂直分割,可透過 滑鼠調整大小。
| main | 大小為 |main_size| 的主元件,位於上方。 |
| back | 佔用剩餘空間的次元件,位於下方。 |
| main_size | |main| 元件的大小。 |
Definition at line 267 of file src/ftxui/component/resizable_split.cpp.
兩個元件之間的垂直分割,可透過 滑鼠調整大小。
| main | 大小為 |main_size| 的主元件,位於下方。 |
| back | 佔用剩餘空間的次元件,位於上方。 |
| main_size | |main| 元件的大小。 |
Definition at line 301 of file src/ftxui/component/resizable_split.cpp.
| Component Slider | ( | ConstStringRef | label, |
| Ref< int > | value, | ||
| ConstRef< int > | min, | ||
| ConstRef< int > | max, | ||
| ConstRef< int > | increment ) |
一個水平滑桿。
| label | 滑桿的名稱。 |
| value | 滑桿目前的值。 |
| min | 最小值。 |
| max | 最大值。 |
| increment | 游標使用時的增量。 |
Definition at line 258 of file src/ftxui/component/slider.cpp.
| Component Window | ( | WindowOptions | option | ) |
一個可拖曳/可調整大小的視窗。要使用多個視窗,它們必須透過 Container::Stacked({...}) 元件堆疊。
| option | 包含所有參數的結構。 |
Definition at line 312 of file src/ftxui/component/window.cpp.