3#ifndef FTXUI_COMPONENT_HPP
4#define FTXUI_COMPONENT_HPP
23struct MenuEntryOption;
25template <
class T,
class... Args>
26std::shared_ptr<T>
Make(Args&&... args) {
27 return std::make_shared<T>(std::forward<Args>(args)...);
49 std::function<
void()> on_click,
60 StringRef placeholder,
61 InputOption options = {});
73 RadioboxOption options = {});
129 std::function<
void()> on_enter,
130 std::function<
void()> on_leave);
132 std::function<
void(
bool)> on_change);
135 std::function<
void()> on_leave);
一個適配器。擁有或引用一個常數字串。為方便起見,此類別將多個不可變字串轉換為共享表示。
static CheckboxOption Simple()
標準Checkbox的選項。
static ButtonOption Simple()
創建一個 ButtonOption,在聚焦時反轉。
static MenuOption Vertical()
垂直選單的標準選項。 這對於實現一個可選項目列表很有用。
Component Horizontal(Components children)
一個元件列表,水平地一個接一個繪製,並使用左/右箭頭鍵或 'h'/'l' 鍵進行水平導航。
Component Maybe(Component, const bool *show)
裝飾一個組件 |child|。它只在 |show| 為 true 時顯示。
Component ResizableSplitTop(Component main, Component back, int *main_size)
兩個元件之間的垂直分割,可透過滑鼠設定。
Component Checkbox(CheckboxOption options)
Component Menu(MenuOption options)
文字列表。選定的元素會被聚焦。
Component MenuEntry(MenuEntryOption options)
一個特定的菜單條目。它們可以放入 Container::Vertical 中以形成菜單。
Component Toggle(ConstStringListRef entries, int *selected)
元素的水平列表。使用者可以在其中導航。
Component Radiobox(RadioboxOption options)
元素清單,只能選擇一個。
Component Button(ButtonOption options)
繪製一個按鈕。點擊時執行一個函數。
Component Modal(Component main, Component modal, const bool *show_modal)
Component Renderer(Component child, std::function< Element()>)
回傳一個新的元件,類似於 |child|,但使用 |render| 作為 Component::Render() 事件。
Component Hoverable(Component component, bool *hover)
包裝一個元件。提供能力以判斷滑鼠是否懸停在其上方。
Component Window(WindowOptions option)
一個可拖曳/可調整大小的視窗。要使用多個視窗,它們必須透過 Container::Stacked({...}) 元件堆疊。
Component Vertical(Components children)
一個元件列表,垂直地一個接一個繪製,並使用上/下箭頭鍵或 'j'/'k' 鍵進行垂直導航。
Component Input(InputOption options={})
用於編輯文字的輸入框。
Component ResizableSplitRight(Component main, Component back, int *main_size)
兩個元件之間的水平分割,可透過滑鼠設定。
Component Dropdown(ConstStringListRef entries, int *selected)
下拉式選單。
Component Stacked(Components children)
一個元件列表,將彼此堆疊。 事件會傳播到第一個元件,如果未處理則傳播到第二個,依此類推。 元件以給定的相反順序繪製。 當一個元件獲得焦點時,它會被放到最前面,而不改變其他元素的相對順序。
Component ResizableSplitBottom(Component main, Component back, int *main_size)
兩個元件之間的垂直分割,可透過滑鼠設定。
Component ResizableSplitLeft(Component main, Component back, int *main_size)
兩個元件之間的水平分割,可透過滑鼠設定。
Component Tab(Components children, int *selector)
一個元件列表,一次只繪製一個並與之互動。|selector| 給出所選元件的索引。這對於實作分頁很有用。
代表一個事件。它可以是按鍵事件、終端機大小調整,或更多...
FTXUI ftxui::Container:: 命名空間
std::shared_ptr< T > Make(Args &&... args)
std::shared_ptr< Node > Element
std::function< Element(Element)> ElementDecorator
std::vector< Component > Components
Component ResizableSplit(ResizableSplitOption options)
兩個元件之間的分隔。
Component operator|(Component component, ComponentDecorator decorator)
Component Collapsible(ConstStringRef label, Component child, Ref< bool > show=false)
可折疊元件。它顯示一個帶有箭頭的核取方塊。一旦啟用,子元件就會顯示。
Component Slider(SliderOption< T > options)
Component & operator|=(Component &component, ComponentDecorator decorator)
std::function< Component(Component)> ComponentDecorator
std::shared_ptr< ComponentBase > Component
Component CatchEvent(Component child, std::function< bool(Event)>)