组件基类
更多...
#include <component.hpp>
组件基类
在文件 component.hpp 第 36 行定义.
◆ active()
| bool neforce::tui::component_base::active |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
◆ active_child() [1/2]
| const component_base * neforce::tui::component_base::active_child |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
◆ active_child() [2/2]
◆ add_child()
◆ child_at()
◆ child_count()
| size_t neforce::tui::component_base::child_count |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
◆ cleanup()
| virtual void neforce::tui::component_base::cleanup |
( |
| ) |
|
|
inlinevirtualnoexcept |
◆ context()
template<typename Ctx>
| const Ctx & neforce::tui::component_base::context |
( |
| ) |
const |
|
inlinenodiscard |
◆ detach()
◆ focusable()
| virtual bool neforce::tui::component_base::focusable |
( |
| ) |
const |
|
inlinenodiscardvirtual |
◆ focused()
| bool neforce::tui::component_base::focused |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
◆ has_focus()
| bool neforce::tui::component_base::has_focus |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
◆ index()
| int neforce::tui::component_base::index |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
◆ on_animation()
| virtual void neforce::tui::component_base::on_animation |
( |
int64_t | delta | ) |
|
|
inlinevirtual |
◆ on_key()
| virtual bool neforce::tui::component_base::on_key |
( |
const key_event & | e | ) |
|
|
inlinevirtual |
◆ on_mouse()
| virtual bool neforce::tui::component_base::on_mouse |
( |
const mouse_event & | e | ) |
|
|
inlinevirtual |
◆ on_mouse_leave()
| virtual void neforce::tui::component_base::on_mouse_leave |
( |
| ) |
|
|
inlinevirtual |
◆ parent()
◆ pass_through()
| bool neforce::tui::component_base::pass_through |
( |
| ) |
const |
|
inlinenodiscardnoexcept |
◆ provide_context()
template<typename Ctx>
| void neforce::tui::component_base::provide_context |
( |
Ctx | value | ) |
|
|
inline |
◆ remove_child()
◆ render()
| virtual element neforce::tui::component_base::render |
( |
| ) |
|
|
pure virtual |
声明式渲染
- 返回
- 虚拟元素树
Reconciler 每次 flush 时调用此方法获取最新 UI 描述。 实现必须是纯函数——仅构建 element 树,禁止终端 I/O。
- 注解
- 禁止在 render() 中修改 State。
◆ schedule_render()
| void neforce::tui::component_base::schedule_render |
( |
| ) |
|
|
inline |
◆ set_active_child()
| void neforce::tui::component_base::set_active_child |
( |
component_base * | child | ) |
|
|
inlinenoexcept |
◆ set_has_focus()
| void neforce::tui::component_base::set_has_focus |
( |
bool | v | ) |
|
|
inlinenoexcept |
◆ set_pass_through()
| void neforce::tui::component_base::set_pass_through |
( |
bool | v | ) |
|
|
inlinenoexcept |
◆ setup()
| virtual void neforce::tui::component_base::setup |
( |
| ) |
|
|
inlinevirtual |
◆ should_update()
| virtual bool neforce::tui::component_base::should_update |
( |
| ) |
|
|
inlinevirtual |
是否需要更新
- 返回
- true 表示需要重新 render,false 跳过本次渲染
性能优化钩子。reconciler 在每次 flush 前检查此方法, 返回 false 则复用上次的 element 树。
在文件 component.hpp 第 132 行定义.
该类的文档由以下文件生成: