|
NexusForce 1.0.0
A rigorously engineered full-stack C++ backend library.
|
元素树渲染器 更多...
#include <renderer.hpp>
Public 成员函数 | |
| renderer (screen &target, const theme &t, int term_w, int term_h) | |
| 构造函数 | |
| void | render (const element &tree, const vector< layout_rect > &layout, bool has_focus) |
| 渲染元素树 | |
| void | set_term_size (int w, int h) |
| 更新终端尺寸 | |
| const vector< scrollbar_hit > & | scrollbar_hits () const noexcept |
| 获取本次渲染收集的滚动条命中信息 | |
| void | render_text_block (int x, int y, int w, int h, const string &text, const tui::style &style, style::wrap_mode wm, int *out_end_x=nullptr, int *out_end_y=nullptr) |
| 渲染文本块 | |
| void | apply_border (int x, int y, int w, int h, enum style::border border, const _NEFORCE color &c) |
| 绘制边框 | |
| void | apply_style_to_cell (cell &cell, const style &style) |
| 将样式字段应用到 cell | |
| void | render_button (int x, int y, int w, int h, const string &label, const style &style, const tui::theme &theme, style::variant variant) |
| 渲染按钮 | |
| void | render_checkbox (int x, int y, int w, int h, const string &label, bool checked, const style &style) |
| 渲染复选框 | |
| void | render_separator (int x, int y, int w) |
| 渲染分隔线 | |
| void | apply_clear (int x, int y, int w, int h) |
| 清除指定区域 | |
| void | apply_text (int x, int y, const string &text, const style &style) |
| 写入文本 | |
| void | apply_text (int x, int y, const string &text, const style &style, int max_x) |
| 写入文本 | |
| void | clear_element_area (const element &el, const vector< layout_rect > &layout, int &idx) |
| 清除元素树中所有叶子元素区域 | |
构造函数
| target | 渲染目标 screen |
| t | 主题 |
| term_w | 终端宽度 |
| term_h | 终端高度 |
| void neforce::tui::renderer::apply_border | ( | int | x, |
| int | y, | ||
| int | w, | ||
| int | h, | ||
| enum style::border | border, | ||
| const _NEFORCE color & | c ) |
| void neforce::tui::renderer::apply_clear | ( | int | x, |
| int | y, | ||
| int | w, | ||
| int | h ) |
清除指定区域
| x | 起始列 |
| y | 起始行 |
| w | 宽度 |
| h | 高度 |
将样式字段应用到 cell
| cell | 目标 cell |
| style | 样式 |
写入文本
| x | 起始列 |
| y | 行 |
| text | 文本 |
| style | 样式 |
| void neforce::tui::renderer::apply_text | ( | int | x, |
| int | y, | ||
| const string & | text, | ||
| const style & | style, | ||
| int | max_x ) |
写入文本
| x | 起始列 |
| y | 行 |
| text | 文本 |
| style | 样式 |
| max_x | 最大列(超出则截断) |
| void neforce::tui::renderer::clear_element_area | ( | const element & | el, |
| const vector< layout_rect > & | layout, | ||
| int & | idx ) |
清除元素树中所有叶子元素区域
| el | 元素树根 |
| layout | 布局结果 |
| idx | 当前布局索引 |
| void neforce::tui::renderer::render | ( | const element & | tree, |
| const vector< layout_rect > & | layout, | ||
| bool | has_focus ) |
渲染元素树
| tree | 元素树根节点 |
| layout | 布局结果 |
| has_focus | 当前是否有焦点组件 |
| void neforce::tui::renderer::render_button | ( | int | x, |
| int | y, | ||
| int | w, | ||
| int | h, | ||
| const string & | label, | ||
| const style & | style, | ||
| const tui::theme & | theme, | ||
| style::variant | variant ) |
渲染按钮
| x | 起始列 |
| y | 起始行 |
| w | 宽度 |
| h | 高度 |
| label | 按钮文本 |
| style | 样式 |
| theme | 主题 |
| variant | 按钮变体 |
| void neforce::tui::renderer::render_checkbox | ( | int | x, |
| int | y, | ||
| int | w, | ||
| int | h, | ||
| const string & | label, | ||
| bool | checked, | ||
| const style & | style ) |
渲染复选框
| x | 起始列 |
| y | 起始行 |
| w | 宽度 |
| h | 高度 |
| label | 标签文本 |
| checked | 是否选中 |
| style | 样式 |
| void neforce::tui::renderer::render_separator | ( | int | x, |
| int | y, | ||
| int | w ) |
渲染分隔线
| x | 起始列 |
| y | 行 |
| w | 宽度 |
| void neforce::tui::renderer::render_text_block | ( | int | x, |
| int | y, | ||
| int | w, | ||
| int | h, | ||
| const string & | text, | ||
| const tui::style & | style, | ||
| style::wrap_mode | wm, | ||
| int * | out_end_x = nullptr, | ||
| int * | out_end_y = nullptr ) |
渲染文本块
| x | 起始列 |
| y | 起始行 |
| w | 宽度约束 |
| h | 高度约束 |
| text | 文本内容 |
| style | 样式 |
| wm | 换行模式 |
| out_end_x | 输出结束列 |
| out_end_y | 输出结束行 |
|
inlinenodiscardnoexcept |
|
inline |