NexusForce 1.0.0
A rigorously engineered full-stack C++ backend library.
载入中...
搜索中...
未找到
TUI

NexusForce TUI 框架 更多...

TUI 的协作图:

专题

 用户组件
 用户组件集合

命名空间

namespace  neforce::tui::easing
 缓动函数命名空间

class  neforce::tui::application
 TUI应用程序入口 更多...
class  neforce::tui::animator
 动画状态机 更多...
struct  neforce::tui::empty_props
 空属性标签 更多...
class  neforce::tui::component_base
 组件基类 更多...
class  neforce::tui::component< P >
 组件模板 更多...
class  neforce::tui::element
 虚拟UI元素 更多...
struct  neforce::tui::layout_rect
 布局矩形 更多...
struct  neforce::tui::linear_gradient
 线性渐变配置 更多...
class  neforce::tui::ref< T >
 可变引用适配器 更多...
class  neforce::tui::const_ref< T >
 只读引用适配器 更多...
class  neforce::tui::string_ref
 字符串可变引用适配器 更多...
class  neforce::tui::const_string_ref
 字符串只读引用适配器 更多...
class  neforce::tui::state< T >
 响应式状态变量 更多...
struct  neforce::tui::style
 样式 更多...
struct  neforce::tui::box_props
 布局容器属性 更多...
struct  neforce::tui::theme
 主题 更多...
class  neforce::tui::table
 声明式表格构建器 更多...
class  neforce::tui::event_dispatcher
 事件分发器 更多...
struct  neforce::tui::key_event
 键盘事件 更多...
struct  neforce::tui::mouse_event
 鼠标事件 更多...
struct  neforce::tui::resize_event
 终端尺寸变化事件 更多...
class  neforce::tui::focus_manager
 焦点管理器 更多...
class  neforce::tui::input_driver
 终端输入驱动 更多...
class  neforce::tui::reconciler
 差分渲染引擎 更多...
struct  neforce::tui::scrollbar_hit
 滚动条命中信息 更多...
class  neforce::tui::renderer
 元素树渲染器 更多...
struct  neforce::tui::dimensions
 终端尺寸 更多...
struct  neforce::tui::cell
 像素/字符单元 更多...
struct  neforce::tui::cursor
 光标状态 更多...
class  neforce::tui::surface
 像素网格基类 更多...
class  neforce::tui::screen
 终端屏幕帧缓冲 更多...

类型定义

using neforce::tui::decorator = function<element(element)>
 元素装饰器
using neforce::tui::elements = vector<element>
 元素列表类型
using neforce::tui::graph_function = function<vector<int>(int width, int height)>
 折线图函数类型

枚举

enum class  neforce::tui::gauge_direction : uint8_t { gauge_direction::right , gauge_direction::left , gauge_direction::up , gauge_direction::down }
 进度方向 更多...
enum class  neforce::tui::key_modifier : uint8_t { key_modifier::none = 0 , key_modifier::ctrl = 1 , key_modifier::alt = 2 , key_modifier::shift = 4 }
 修饰键位掩码 更多...
enum class  neforce::tui::mouse_button : uint8_t {
  mouse_button::left , mouse_button::middle , mouse_button::right , mouse_button::wheelup ,
  mouse_button::wheeldown , mouse_button::none
}
 鼠标按钮枚举 更多...
enum class  neforce::tui::mouse_action : uint8_t { mouse_action::press , mouse_action::release , mouse_action::move , mouse_action::wheel }
 鼠标动作枚举 更多...

函数

element neforce::tui::operator| (element e, const decorator &d)
 将装饰器应用于元素
elementneforce::tui::operator|= (element &e, const decorator &d)
 就地装饰元素
vector< elementneforce::tui::operator| (const vector< element > &es, const decorator &d)
 为元素列表的每个元素应用装饰器
decorator neforce::tui::operator| (decorator a, decorator b)
 组合两个装饰器
decorator neforce::tui::bold ()
 粗体装饰器
decorator neforce::tui::dim ()
 暗色装饰器
decorator neforce::tui::italic ()
 斜体装饰器
decorator neforce::tui::underlined ()
 单下划线装饰器
decorator neforce::tui::underlined_double ()
 双下划线装饰器
decorator neforce::tui::blink ()
 闪烁装饰器
decorator neforce::tui::strikethrough ()
 删除线装饰器
decorator neforce::tui::inverted ()
 反色装饰器
decorator neforce::tui::color (color c)
 前景色装饰器
decorator neforce::tui::bgcolor (_NEFORCE color c)
 背景色装饰器
decorator neforce::tui::border (enum style::border b)
 边框装饰器
decorator neforce::tui::flex_grow_el (float factor)
 弹性增长装饰器
decorator neforce::tui::flex_shrink_el (float factor)
 弹性收缩装饰器
decorator neforce::tui::flex_el (float grow, float shrink)
 弹性装饰器
decorator neforce::tui::text_wrap (style::wrap_mode wm)
 文本换行装饰器
element neforce::tui::gauge (float progress, int width=20)
 创建水平进度条
element neforce::tui::gauge_direction (float progress, enum gauge_direction direction, int size=20)
 创建方向化进度条
element neforce::tui::graph (const vector< int > &data_points, int width=40, int height=10)
 创建折线图元素
element neforce::tui::graph (graph_function fn, int width=40, int height=10)
 创建函数式折线图
vector< layout_rectneforce::tui::compute_layout (const element &element, int constraint_w, int constraint_h)
 Flexbox 布局计算
element neforce::tui::paragraph (string content, int max_width=0)
 创建居左对齐段落
element neforce::tui::paragraph_align_center (string content, int max_width=0)
 创建居中对齐段落
element neforce::tui::paragraph_align_right (string content, int max_width=0)
 创建居右对齐段落
element neforce::tui::vscroll_indicator (int total, int visible, int offset, int height)
 创建垂直滚动指示器
element neforce::tui::hscroll_indicator (int total, int visible, int offset, int width)
 创建水平滚动指示器
element neforce::tui::spinner (int charset_index, size_t image_index)
 创建加载旋转动画
const elementneforce::tui::find_element_at (const vector< layout_rect > &layout, const element &tree, int mx, int my, int &idx)
 在元素树中查找可点击元素
component_baseneforce::tui::hit_test_at (const vector< layout_rect > &layout, const element &tree, int mx, int my, int &idx, component_base *fallback)
 命中测试

变量

constexpr theme neforce::tui::dark_theme
 预置暗色主题

详细描述

NexusForce TUI 框架

类型定义说明

◆ decorator

元素装饰器

接收一个元素并返回包装后的元素。可通过 operator| 链式组合。

在文件 element.hpp202 行定义.

◆ graph_function

using neforce::tui::graph_function = function<vector<int>(int width, int height)>

折线图函数类型

输入 x 坐标(0 到 width-1),返回 y 值。 y 值将被归一化到 [0, height-1] 范围。

在文件 graph.hpp26 行定义.

枚举类型说明

◆ gauge_direction

进度方向

枚举值
right 

向右增长

left 

向左增长

up 

向上增长

down 

向下增长

在文件 gauge.hpp23 行定义.

◆ key_modifier

enum class neforce::tui::key_modifier : uint8_t
strong

修饰键位掩码

枚举值
none 

无修饰键

ctrl 

Ctrl 键

alt 

Alt 键

shift 

Shift 键

在文件 events.hpp23 行定义.

◆ mouse_action

enum class neforce::tui::mouse_action : uint8_t
strong

鼠标动作枚举

枚举值
press 

按下

release 

释放

move 

移动

wheel 

滚轮

在文件 events.hpp121 行定义.

◆ mouse_button

enum class neforce::tui::mouse_button : uint8_t
strong

鼠标按钮枚举

枚举值
left 

左键

middle 

中键

right 

右键

wheelup 

滚轮上滚

wheeldown 

滚轮下滚

none 

无按钮

在文件 events.hpp109 行定义.

函数说明

◆ bgcolor()

decorator neforce::tui::bgcolor ( _NEFORCE color c)
inline

背景色装饰器

参数
c颜色

在文件 element.hpp339 行定义.

引用了 neforce::tui::style::bg, bgcolor(), color() , 以及 neforce::move().

被这些函数引用 bgcolor().

◆ border()

decorator neforce::tui::border ( enum style::border b)
inline

边框装饰器

参数
b边框样式

在文件 element.hpp349 行定义.

引用了 border().

被这些函数引用 neforce::tui::renderer::apply_border() , 以及 border().

◆ color()

◆ compute_layout()

vector< layout_rect > neforce::tui::compute_layout ( const element & element,
int constraint_w,
int constraint_h )

Flexbox 布局计算

参数
element元素树根节点
constraint_w可用宽度
constraint_h可用高度
返回
每个叶子节点的布局矩形
注解
布局结果会缓存到元素树节点中

引用了 compute_layout().

被这些函数引用 compute_layout().

◆ find_element_at()

const element * neforce::tui::find_element_at ( const vector< layout_rect > & layout,
const element & tree,
int mx,
int my,
int & idx )
nodiscard

在元素树中查找可点击元素

参数
layout布局结果
tree元素树
mx鼠标列坐标
my鼠标行坐标
idx当前布局索引
返回
命中的元素指针,未命中返回 nullptr

引用了 find_element_at().

被这些函数引用 find_element_at().

◆ flex_el()

decorator neforce::tui::flex_el ( float grow,
float shrink )
inline

弹性装饰器

参数
grow增长权重
shrink收缩权重

在文件 element.hpp380 行定义.

引用了 flex_el(), neforce::tui::style::flex_grow , 以及 neforce::tui::style::flex_shrink.

被这些函数引用 flex_el().

◆ flex_grow_el()

decorator neforce::tui::flex_grow_el ( float factor)
inline

弹性增长装饰器

参数
factor增长权重

在文件 element.hpp359 行定义.

引用了 neforce::tui::style::flex_grow , 以及 flex_grow_el().

被这些函数引用 flex_grow_el().

◆ flex_shrink_el()

decorator neforce::tui::flex_shrink_el ( float factor)
inline

弹性收缩装饰器

参数
factor收缩权重

在文件 element.hpp369 行定义.

引用了 neforce::tui::style::flex_shrink , 以及 flex_shrink_el().

被这些函数引用 flex_shrink_el().

◆ gauge()

element neforce::tui::gauge ( float progress,
int width = 20 )

创建水平进度条

参数
progress进度值 (0.0-1.0)
width进度条宽度
返回
Gauge 元素

引用了 gauge().

被这些函数引用 gauge().

◆ gauge_direction()

element neforce::tui::gauge_direction ( float progress,
enum gauge_direction direction,
int size = 20 )

创建方向化进度条

参数
progress进度值 (0.0-1.0)
direction增长方向
size长度
返回
Gauge 元素

引用了 neforce::size().

◆ graph() [1/2]

element neforce::tui::graph ( const vector< int > & data_points,
int width = 40,
int height = 10 )

创建折线图元素

参数
data_points数据点列表
width图表宽度
height图表高度
返回
Graph 元素

引用了 graph().

被这些函数引用 graph() , 以及 graph().

◆ graph() [2/2]

element neforce::tui::graph ( graph_function fn,
int width = 40,
int height = 10 )

创建函数式折线图

参数
fn图表函数
width图表宽度
height图表高度
返回
Graph 元素

引用了 graph().

◆ hit_test_at()

component_base * neforce::tui::hit_test_at ( const vector< layout_rect > & layout,
const element & tree,
int mx,
int my,
int & idx,
component_base * fallback )
nodiscard

命中测试

参数
layout布局结果
tree元素树
mx鼠标列坐标
my鼠标行坐标
idx当前布局索引
fallback无 owner 时的回退组件
返回
命中的组件指针,未命中返回 nullptr

找到鼠标坐标下的组件

引用了 hit_test_at().

被这些函数引用 hit_test_at().

◆ hscroll_indicator()

element neforce::tui::hscroll_indicator ( int total,
int visible,
int offset,
int width )

创建水平滚动指示器

参数
total总列数
visible可见列数
offset当前滚动偏移列数
width指示器宽度
返回
水平滚动条元素

引用了 hscroll_indicator().

被这些函数引用 hscroll_indicator().

◆ operator|() [1/3]

vector< element > neforce::tui::operator| ( const vector< element > & es,
const decorator & d )
inline

为元素列表的每个元素应用装饰器

参数
es元素列表
d装饰器
返回
装饰后的元素列表

在文件 element.hpp235 行定义.

引用了 operator|(), neforce::vector< T, Alloc >::push_back(), neforce::vector< T, Alloc >::reserve() , 以及 neforce::vector< T, Alloc >::size().

◆ operator|() [2/3]

decorator neforce::tui::operator| ( decorator a,
decorator b )
inline

组合两个装饰器

参数
a外层装饰器
b内层装饰器
返回
组合装饰器

在文件 element.hpp250 行定义.

引用了 neforce::move() , 以及 operator|().

◆ operator|() [3/3]

element neforce::tui::operator| ( element e,
const decorator & d )
inline

将装饰器应用于元素

参数
e源元素
d装饰器
返回
装饰后的元素

在文件 element.hpp216 行定义.

引用了 neforce::move() , 以及 operator|().

被这些函数引用 operator|(), operator|() , 以及 operator|().

◆ operator|=()

element & neforce::tui::operator|= ( element & e,
const decorator & d )
inline

就地装饰元素

参数
e源元素引用
d装饰器
返回
元素引用

在文件 element.hpp224 行定义.

引用了 neforce::move() , 以及 operator|=().

被这些函数引用 operator|=().

◆ paragraph()

element neforce::tui::paragraph ( string content,
int max_width = 0 )

创建居左对齐段落

参数
content文本内容
max_width最大宽度(0 表示自动)
返回
段落元素

引用了 paragraph().

被这些函数引用 paragraph().

◆ paragraph_align_center()

element neforce::tui::paragraph_align_center ( string content,
int max_width = 0 )

创建居中对齐段落

参数
content文本内容
max_width最大宽度(0 表示自动)
返回
段落元素

引用了 paragraph_align_center().

被这些函数引用 paragraph_align_center().

◆ paragraph_align_right()

element neforce::tui::paragraph_align_right ( string content,
int max_width = 0 )

创建居右对齐段落

参数
content文本内容
max_width最大宽度(0 表示自动)
返回
段落元素

引用了 paragraph_align_right().

被这些函数引用 paragraph_align_right().

◆ spinner()

element neforce::tui::spinner ( int charset_index,
size_t image_index )

创建加载旋转动画

参数
charset_index字符集索引(0-3)
image_index当前帧索引
返回
Spinner 元素

字符集:

  • 0: │ / ─ \ (单线)
  • 1: ⠁ ⠂ ⠄ ⡀ ⠈ ⠐ ⠠ ⢀ (braille)
  • 2: ◷ ◶ ◵ ◴ (时钟)
  • 3: ⣷ ⣯ ⣟ ⡿ ⢿ ⣻ ⣽ ⣾ (dots)

引用了 spinner().

被这些函数引用 spinner().

◆ text_wrap()

decorator neforce::tui::text_wrap ( style::wrap_mode wm)
inline

文本换行装饰器

参数
wm换行模式

在文件 element.hpp391 行定义.

引用了 neforce::tui::style::text_wrap , 以及 text_wrap().

被这些函数引用 text_wrap().

◆ vscroll_indicator()

element neforce::tui::vscroll_indicator ( int total,
int visible,
int offset,
int height )

创建垂直滚动指示器

参数
total总行数
visible可见行数
offset当前滚动偏移行数
height指示器高度
返回
垂直滚动条元素

引用了 vscroll_indicator().

被这些函数引用 vscroll_indicator().