NexusForce 1.0.0
A rigorously engineered full-stack C++ backend library.
载入中...
搜索中...
未找到
reconciler.hpp
浏览该文件的文档.
1#ifndef NEFORCE_TUI_RECONCILER_HPP__
2#define NEFORCE_TUI_RECONCILER_HPP__
3
12
20NEFORCE_BEGIN_NAMESPACE__
21NEFORCE_BEGIN_TUI__
22
27
34class NEFORCE_API reconciler {
35public:
43
45
46 reconciler(const reconciler&) = delete;
47 reconciler& operator=(const reconciler&) = delete;
48 reconciler(reconciler&&) = delete;
49 reconciler& operator=(reconciler&&) = delete;
50
57 void mount(component_base* root);
58
64
68 void mark_dirty();
69
75 bool dispatch_key(const key_event& e);
76
83
87 void flush();
88
93 NEFORCE_NODISCARD bool is_dirty() const noexcept { return dirty_; }
94
99
104 void set_theme(const theme& t);
105
106private:
107 sys_console& console_;
108 strand& strand_;
109 io_context& ctx_;
110 component_base* root_ = nullptr;
111
112 int term_w_ = 80;
113 int term_h_ = 24;
114 theme theme_{dark_theme};
115
116 screen current_screen_{80, 24};
117 screen prev_screen_{80, 24};
118
119 focus_manager focus_mgr_;
120 event_dispatcher event_dispatcher_;
121 renderer renderer_;
122
123 element prev_tree_;
124 vector<layout_rect> prev_layout_;
125 bool dirty_ = true;
126 bool mounted_ = false;
127 bool update_pending_ = false;
128 bool rendering_ = false;
129
130 void refresh_term_size();
131 void setup_tree(component_base* comp);
132};
133 // TUI
135
136NEFORCE_END_TUI__
137NEFORCE_END_NAMESPACE__
138#endif // NEFORCE_TUI_RECONCILER_HPP__
函数包装器主模板声明
统一异步操作核心
串行化执行器
系统控制台单例类
bool dispatch_mouse(const mouse_event &e)
分发鼠标事件
bool is_dirty() const noexcept
是否有待渲染的脏标记
void flush()
有脏标记则执行渲染管线
reconciler(sys_console &console, strand &s, io_context &ctx)
构造函数
function< void(component_base *)> schedule_render_callback()
获取组件调度回调
void mark_dirty()
强制全量重绘
bool dispatch_key(const key_event &e)
分发键盘事件到焦点组件
void mount(component_base *root)
挂载根组件
void schedule_update(component_base *comp)
调度组件更新
void set_theme(const theme &t)
应用主题
终端屏幕帧缓冲
TUI组件基类
控制台输入输出工具
事件分发器
焦点管理器
sys_console & console
全局控制台实例
constexpr theme dark_theme
预置暗色主题
Flexbox布局引擎
元素树渲染器
终端帧缓冲抽象