3#ifndef FTXUI_COMPONENT_BASE_HPP
4#define FTXUI_COMPONENT_BASE_HPP
96 bool in_render =
false;
virtual bool Focusable() const
當組件包含可聚焦元素時返回 true。 使用鍵盤導航時,不可聚焦的組件將被跳過。
bool Focused() const
返回元素是否被使用者聚焦。 當 ComponentBase 被使用者聚焦時返回 true。當一個元素及其所有祖先都是其父項的 ActiveChild() 並且它是 Focusable() 時,該元素被聚...
CapturedMouse CaptureMouse(const Event &event)
如果可用,則取得 CapturedMouse。它們只有一個組件。它代表一個優先於其他組件的組件。
void Add(Component children)
新增一個子項。 @param child 要附加的子項。
Element Render()
繪製組件。 建構一個 ftxui::Element,用於在表示此 ftxui::ComponentBase 的 ftxui::Screen 上繪製。請覆寫 OnRender() 以修改渲染。
void TakeFocus()
配置所有祖先以將焦點給予此組件。
bool Active() const
返回該元素是否為其父項的目前活躍子項。
virtual Component ActiveChild()
返回目前活躍的子項。
void DetachAllChildren()
移除所有子項。
virtual void SetActiveChild(ComponentBase *child)
使 |child| 成為「活躍」的子項。
int Index() const
返回組件在其父項中的索引。如果沒有父項則返回 -1。
size_t ChildCount() const
返回子項的數量。
ComponentBase(ComponentBase &&)=delete
ComponentBase & operator=(ComponentBase &&)=delete
ComponentBase * Parent() const
返回父 ComponentBase,如果沒有則返回空。
virtual Element OnRender()
繪製組件。 建構一個 ftxui::Element,用於在表示此 ftxui::ComponentBase 的 ftxi::Screen 上繪製。此函數旨在被覆寫。
virtual bool OnEvent(Event)
回應事件時呼叫。
void Detach()
將此子項從其父項中分離。
ComponentBase(const ComponentBase &)=delete
ComponentBase & operator=(const ComponentBase &)=delete
Component & ChildAt(size_t i)
存取索引 i 處的子項。
ComponentBase(Components children)
virtual void OnAnimation(animation::Params ¶ms)
回應動畫事件時呼叫。
它將自己實作為 ftxui::Element 進行渲染。它透過回應 ftxui::Event 來實現鍵盤導航。
代表一個事件。它可以是按鍵事件、終端機大小調整,或更多...
FTXUI 的 ftxui::animation:: 命名空間
std::unique_ptr< CapturedMouseInterface > CapturedMouse
std::shared_ptr< Node > Element
std::vector< Component > Components
std::shared_ptr< ComponentBase > Component