FTXUI 7.0.3
C++ functional terminal UI.
Loading...
Searching...
No Matches
component.hpp File Reference

Go to the source code of this file.

Namespaces

namespace  ftxui
 FTXUI ftxui:: 命名空間
 
namespace  ftxui::Container
 

Typedefs

using ComponentDecorator = std::function<Component(Component)>
 
using ElementDecorator = std::function<Element(Element)>
 

Functions

template<class T , class... Args>
std::shared_ptr< T > Make (Args &&... args)
 
Component operator| (Component component, ComponentDecorator decorator)
 
Component operator| (Component component, ElementDecorator decorator)
 
Component & operator|= (Component &component, ComponentDecorator decorator)
 
Component & operator|= (Component &component, ElementDecorator decorator)
 
 FTXUI_EXPORT (COMPONENT) Component Vertical(Components children)
 
Component Horizontal (Components children, int *selector)
 一個元件列表,水平地一個接一個繪製,並使用左/右箭頭鍵或 'h'/'l' 鍵進行水平導航。
 
class FTXUI_EXPORT (COMPONENT) ComponentBase = {})
 它將自己實作為 ftxui::Element 進行渲染。它透過回應 ftxui::Event 來實現鍵盤導航。
 
Component Button (ConstStringRef label, std::function< void()> on_click, ButtonOption option)
 繪製一個按鈕。點擊時執行一個函式。
 
Component Checkbox (ConstStringRef label, bool *checked, CheckboxOption option)
 繪製可勾選的元素。
 
Component Input (StringRef content, InputOption option)
 用於編輯文字的輸入框。
 
Component Input (StringRef content, StringRef placeholder, InputOption option)
 用於編輯文字的輸入框。
 
Component Menu (ConstStringListRef entries, int *selected, MenuOption option)
 一份文字清單。取得焦點的元素會被選取。
 
Component MenuEntry (ConstStringRef label, MenuEntryOption option)
 一個特定的選單項目。可以將它們放入 Container::Vertical 以 組成一個選單。
 
Component Radiobox (ConstStringListRef entries, int *selected, RadioboxOption option)
 一份元素清單,只能選取其中一個。
 
Component Dropdown (ConstStringListRef entries, int *selected)
 下拉式選單。
 
Component Toggle (ConstStringListRef entries, int *selected)
 元素的水平列表。使用者可以在其中導航。
 
template<typename T >
Component Slider (SliderOption< T > options)
 任意方向的滑桿。
 
Component Slider (ConstStringRef label, Ref< int > value, ConstRef< int > min, ConstRef< int > max, ConstRef< int > increment)
 一個水平滑桿。
 
Component Slider (ConstStringRef label, Ref< float > value, ConstRef< float > min=0.f, ConstRef< float > max=100.f, ConstRef< float > increment=5.f)
 
Component Slider (ConstStringRef label, Ref< long > value, ConstRef< long > min=0L, ConstRef< long > max=100L, ConstRef< long > increment=5L)
 
Component ResizableSplit (ResizableSplitOption options)
 兩個元件之間的分隔。
 
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 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| 來渲染其介面。
 
Component CatchEvent (Component child, std::function< bool(Event)>)
 
ComponentDecorator CatchEvent (std::function< bool(Event)> on_event)
 裝飾一個元件,使用 |on_event| 來攔截事件。此函式 在事件已被處理時必須回傳 true,否則回傳 false。
 
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 Collapsible (ConstStringRef label, Component child, Ref< bool > show)
 可折疊元件。它顯示一個帶有箭頭的核取方塊。一旦啟用,子元件就會顯示。
 
Component Hoverable (Component component, bool *hover)
 包裝一個元件。提供能力以判斷滑鼠是否懸停在其上方。
 
Component Hoverable (Component component, 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()> on_enter, std::function< void()> on_leave)
 包裝一個元件。提供能力以判斷滑鼠是否懸停在其上方。
 
ComponentDecorator Hoverable (std::function< void(bool)> on_change)
 包裝一個元件。提供能力以判斷滑鼠是否懸停在其上方。
 

Variables

int * selector
 
const bool * show