FTXUI 6.1.9
C++ functional terminal UI.
载入中...
搜索中...
未找到
ftxui/dom

详细描述

请查看 ftxui/dom 模块的 教程

struct  Canvas
 Canvas 是一个与绘图操作相关的可绘制缓冲区。 更多...
 
struct  FlexboxConfig
 FlexboxConfig 是一个配置结构体,定义了弹性盒子容器的布局属性。 更多...
 
struct  LinearGradient
 一个表示线性渐变颜色效果设置的类。 更多...
 
class  Node
 Node 是 DOM 树中所有元素的基类。 更多...
 
struct  Requirement
 Requirement 是一个结构体,用于定义终端用户界面中 Node 的布局要求。 更多...
 
class  Selection
 代表终端用户界面中的选择。 更多...
 
class  Table
 Table 是一个绘制表格的实用工具。 更多...
 

枚举

enum class  Direction {
  Up = 0 ,
  Down = 1 ,
  Left = 2 ,
  Right = 3
}
 Direction 是一个枚举,表示四个基本方向。 更多...
 
enum  BorderStyle {
  LIGHT ,
  DASHED ,
  HEAVY ,
  DOUBLE ,
  ROUNDED ,
  EMPTY
}
 BorderStyle 是一个枚举,表示可应用于终端 UI 中元素的不同边框样式。 更多...
 

函数

Element automerge (Element child)
 启用字符自动与附近的其它字符合并。
 
Element blink (Element child)
 绘制的文本在可见和隐藏之间交替。
 
Element bold (Element child)
 使用粗体字体,用于强调元素。
 
Element border (Element child)
 在元素周围绘制边框。
 
Decorator borderWith (const Pixel &pixel)
 与 border 相同,但在元素周围使用一个常量像素。
 
Decorator borderStyled (BorderStyle style)
 与 border 相同,但具有不同的样式。
 
Decorator borderStyled (Color foreground_color)
 与 border 相同,但具有前景色。
 
Decorator borderStyled (BorderStyle style, Color foreground_color)
 与 border 相同,但具有前景色和不同的样式。
 
Element borderDashed (Element child)
 在元素周围绘制虚线边框。
 
Element borderLight (Element child)
 在元素周围绘制细边框。
 
Element borderHeavy (Element child)
 在元素周围绘制粗边框。
 
Element borderDouble (Element child)
 在元素周围绘制双线边框。
 
Element borderRounded (Element child)
 在元素周围绘制圆角边框。
 
Element borderEmpty (Element child)
 在元素周围绘制一个空边框。
 
Element window (Element title, Element content, BorderStyle border)
 绘制带有标题和边框的窗口。
 
Element clear_under (Element element)
 在绘制 |child| 之前,清除下方的像素。这与 dbox 结合使用很有用。
 
Element color (Color color, Element child)
 设置元素的前景颜色。
 
Element bgcolor (Color color, Element child)
 设置元素的背景颜色。
 
Decorator color (Color c)
 使用前景色进行装饰。
 
Decorator bgcolor (Color color)
 使用背景色进行装饰。
 
Element hcenter (Element child)
 水平居中一个元素。
 
Element vcenter (Element child)
 垂直居中一个元素。
 
Element center (Element child)
 水平并垂直居中一个元素。
 
Element align_right (Element child)
 将元素右对齐。
 
Element dbox (Elements children_)
 将多个元素堆叠在一起。
 
Element dim (Element child)
 使用浅色字体,用于不那么重要的元素。
 
Element filler ()
 一个元素,它将按比例扩展以填充容器中剩余的空间。
 
Element flex (Element child)
 使子元素按比例扩展以填充容器中剩余的空间。
 
Element xflex (Element child)
 在 X 轴上尽可能地扩展/收缩。
 
Element yflex (Element child)
 在 Y 轴上尽可能地扩展/收缩。
 
Element flex_grow (Element child)
 如果可能,进行扩展。
 
Element xflex_grow (Element child)
 如果可能,在 X 轴上进行扩展。
 
Element yflex_grow (Element child)
 如果可能,在 Y 轴上进行扩展。
 
Element flex_shrink (Element child)
 如果需要,进行收缩。
 
Element xflex_shrink (Element child)
 如果需要,在 X 轴上进行收缩。
 
Element yflex_shrink (Element child)
 如果需要,在 Y 轴上进行收缩。
 
Element notflex (Element child)
 使元素不可伸缩。
 
Decorator focusPositionRelative (float x, float y)
 frame 内部使用,这会强制视图滚动到给定位置。位置以请求大小的比例表示。
 
Decorator focusPosition (int x, int y)
 frame 内部使用,这会强制视图滚动到给定位置。位置以单元格数量表示。
 
Element focus (Element child)
 child 设置为其同级元素中获得焦点的元素。
 
Element focusCursorBlockBlinking (Element child)
 focus 相同,但将光标形状设置为闪烁块。
 
Element focusCursorBar (Element child)
 focus 相同,但将光标形状设置为静态竖线。
 
Element focusCursorBarBlinking (Element child)
 focus 相同,但将光标形状设置为闪烁竖线。
 
Element focusCursorUnderline (Element child)
 focus 相同,但将光标形状设置为静态下划线。
 
Element focusCursorUnderlineBlinking (Element child)
 focus 相同,但将光标形状设置为闪烁下划线。
 
Element gaugeDirection (float progress, Direction direction)
 绘制一个向指定方向推进的高清进度条。
 
Element hyperlink (std::string link, Element child)
 使渲染区域可通过网络浏览器点击。 当用户点击时,链接将被打开。 这仅在有限的终端模拟器中受支持。 列表:https://github.com/Alhadis/OSC8-Adoption/
 
Decorator hyperlink (std::string link)
 使用超链接进行装饰。 当用户点击时,链接将被打开。 这仅在有限的终端模拟器中受支持。 列表:https://github.com/Alhadis/OSC8-Adoption/
 
Element inverted (Element child)
 添加一个过滤器,用于反转前景色和背景色。
 
Element italic (Element child)
 对文本应用双下划线。
 
Element color (const LinearGradient &gradient, Element child)
 使用线性渐变效果设置元素的前景色。
 
Element bgcolor (const LinearGradient &gradient, Element child)
 使用线性渐变效果设置元素的背景色。
 
Decorator color (const LinearGradient &gradient)
 使用线性渐变效果装饰前景色。
 
Decorator bgcolor (const LinearGradient &gradient)
 使用线性渐变效果装饰背景色。
 
void Render (Screen &screen, const Element &element)
 ftxui::Screen 上显示元素。
 
void Render (Screen &screen, Node *node)
 ftxui::Screen 上显示元素。
 
Element paragraph (const std::string &the_text)
 返回一个在多行上绘制段落的元素。
 
Element paragraphAlignLeft (const std::string &the_text)
 返回一个在多行上绘制段落并左对齐的元素。
 
Element paragraphAlignRight (const std::string &the_text)
 返回一个在多行上绘制段落并右对齐的元素。
 
Element paragraphAlignCenter (const std::string &the_text)
 返回一个在多行上绘制段落并居中对齐的元素。
 
Element paragraphAlignJustify (const std::string &the_text)
 返回一个在多行上绘制段落并使用两端对齐方式的元素。 居中对齐。
 
Element vscroll_indicator (Element child)
 在右侧显示一个垂直滚动条。 颜色跟随内容。
 
Element hscroll_indicator (Element child)
 在底部显示一个水平滚动条。 颜色跟随内容。
 
Element separator ()
 在两个其他元素之间绘制垂直或水平分隔线。
 
Element separatorStyled (BorderStyle style)
 在两个其他元素之间绘制垂直或水平分隔线。
 
Element separatorLight ()
 使用 LIGHT 样式在两个其他元素之间绘制垂直或水平分隔线。
 
Element separatorDashed ()
 使用 DASHED 样式在两个其他元素之间绘制垂直或水平分隔线。
 
Element separatorHeavy ()
 使用 HEAVY 样式在两个其他元素之间绘制垂直或水平分隔线。
 
Element separatorDouble ()
 使用 DOUBLE 样式在两个其他元素之间绘制垂直或水平分隔线。
 
Element separatorEmpty ()
 使用 EMPTY 样式在两个其他元素之间绘制垂直或水平分隔线。
 
Element separatorCharacter (std::string value)
 在两个其他元素之间绘制垂直或水平分隔线。
 
Element separator (Pixel pixel)
 在两个元素之间绘制用给定像素填充的分隔线。
 
Decorator size (WidthOrHeight direction, Constraint constraint, int value)
 对元素大小应用约束。
 
Element spinner (int charset_index, size_t image_index)
 用于表示时间或事件的效果。这显示了一个 ASCII 艺术“视频”。
 
Element strikethrough (Element child)
 对文本应用删除线。
 
Element text (std::string text)
 显示一段UTF8编码的Unicode文本。
 
Element text (std::wstring text)
 显示一段Unicode文本。
 
Element vtext (std::string text)
 垂直显示一段Unicode文本。
 
Element vtext (std::wstring text)
 垂直显示一段Unicode文本。
 
Element underlined (Element child)
 给定元素加下划线。
 
Element underlinedDouble (Element child)
 对文本应用双下划线。
 
Element nothing (Element element)
 一个什么都不做的装饰器。
 
Decorator operator| (Decorator a, Decorator b)
 将两个装饰器组合成一个。
 
Elements operator| (Elements elements, Decorator decorator)
 从一组元素中,对每个元素应用一个装饰器。
 
Element operator| (Element element, Decorator decorator)
 从一个元素中,应用一个装饰器。
 
Elementoperator|= (Element &e, Decorator d)
 对元素应用一个装饰器。
 
Element emptyElement ()
 
Element vbox (Elements children)
 垂直一个接一个显示元素的容器。
 
void SetColorSupport (Color color)
 在自动检测失败时覆盖终端颜色支持
 

类说明

◆ ftxui::Canvas

struct ftxui::Canvas

Canvas 是一个与绘图操作相关的可绘制缓冲区。

Canvas 是一个可绘制区域,可用于创建复杂的图形。它 支持使用点、线、圆、椭圆、文本和图像进行绘制,使用 盲文、块或普通字符。

注意:终端包含单元格。一个单元格是以下单位:

  • 2x4 盲文字符(1x1 像素)
  • 2x2 块字符(2x2 像素)
  • 2x4 普通字符(2x4 像素)

您需要将 x 坐标乘以 2,将 y 坐标乘以 4,以 获取终端中的正确位置。

示例
examples/component/canvas_animated.cpp , 以及 examples/dom/canvas.cpp.

在文件 canvas.hpp38 行定义.

Public 类型

using Stylizer = std::function<void(Pixel&)>
 

Public 成员函数

 Canvas ()=default
 
 Canvas (int width, int height)
 构造函数。
 
int width () const
 
int height () const
 
Pixel GetPixel (int x, int y) const
 获取单元格的内容。
 
void DrawPointOn (int x, int y)
 绘制一个盲文点。
 
void DrawPointOff (int x, int y)
 擦除一个盲文点。
 
void DrawPointToggle (int x, int y)
 切换盲文点。已填充的将被擦除,另一个将被绘制。
 
void DrawPoint (int x, int y, bool value)
 绘制一个盲文点。
 
void DrawPoint (int x, int y, bool value, const Stylizer &s)
 绘制一个盲文点。
 
void DrawPoint (int x, int y, bool value, const Color &color)
 绘制一个盲文点。
 
void DrawPointLine (int x1, int y1, int x2, int y2)
 绘制由盲文点组成的线条。
 
void DrawPointLine (int x1, int y1, int x2, int y2, const Stylizer &s)
 绘制由盲文点组成的线条。
 
void DrawPointLine (int x1, int y1, int x2, int y2, const Color &color)
 绘制由盲文点组成的线条。
 
void DrawPointCircle (int x, int y, int radius)
 绘制由盲文点组成的圆。
 
void DrawPointCircle (int x, int y, int radius, const Stylizer &s)
 绘制由盲文点组成的圆。
 
void DrawPointCircle (int x, int y, int radius, const Color &color)
 绘制由盲文点组成的圆。
 
void DrawPointCircleFilled (int x, int y, int radius)
 绘制由盲文点组成的实心圆。
 
void DrawPointCircleFilled (int x, int y, int radius, const Stylizer &s)
 绘制由盲文点组成的实心圆。
 
void DrawPointCircleFilled (int x, int y, int radius, const Color &color)
 绘制由盲文点组成的实心圆。
 
void DrawPointEllipse (int x, int y, int r1, int r2)
 绘制由盲文点组成的椭圆。
 
void DrawPointEllipse (int x, int y, int r1, int r2, const Color &color)
 绘制由盲文点组成的椭圆。
 
void DrawPointEllipse (int x, int y, int r1, int r2, const Stylizer &s)
 绘制由盲文点组成的椭圆。
 
void DrawPointEllipseFilled (int x, int y, int r1, int r2)
 绘制由盲文点组成的实心椭圆。
 
void DrawPointEllipseFilled (int x, int y, int r1, int r2, const Color &color)
 绘制由盲文点组成的实心椭圆。
 
void DrawPointEllipseFilled (int x, int y, int r1, int r2, const Stylizer &s)
 绘制由盲文点组成的实心椭圆。
 
void DrawBlockOn (int x, int y)
 绘制一个块。
 
void DrawBlockOff (int x, int y)
 擦除一个块。
 
void DrawBlockToggle (int x, int y)
 切换一个块。如果已填充,则擦除。如果为空, 将被填充。
 
void DrawBlock (int x, int y, bool value)
 绘制一个块。
 
void DrawBlock (int x, int y, bool value, const Stylizer &s)
 绘制一个块。
 
void DrawBlock (int x, int y, bool value, const Color &color)
 绘制一个块。
 
void DrawBlockLine (int x1, int y1, int x2, int y2)
 绘制由块字符组成的线条。
 
void DrawBlockLine (int x1, int y1, int x2, int y2, const Stylizer &s)
 绘制由块字符组成的线条。
 
void DrawBlockLine (int x1, int y1, int x2, int y2, const Color &color)
 绘制由块字符组成的线条。
 
void DrawBlockCircle (int x1, int y1, int radius)
 绘制由块字符组成的圆。
 
void DrawBlockCircle (int x1, int y1, int radius, const Stylizer &s)
 绘制由块字符组成的圆。
 
void DrawBlockCircle (int x1, int y1, int radius, const Color &color)
 绘制由块字符组成的圆。
 
void DrawBlockCircleFilled (int x1, int y1, int radius)
 绘制由块字符组成的实心圆。
 
void DrawBlockCircleFilled (int x1, int y1, int radius, const Stylizer &s)
 绘制由块字符组成的实心圆。
 
void DrawBlockCircleFilled (int x1, int y1, int radius, const Color &color)
 绘制由块字符组成的实心圆。
 
void DrawBlockEllipse (int x1, int y1, int r1, int r2)
 绘制由块字符组成的椭圆。
 
void DrawBlockEllipse (int x1, int y1, int r1, int r2, const Stylizer &s)
 绘制由块字符组成的椭圆。
 
void DrawBlockEllipse (int x1, int y1, int r1, int r2, const Color &color)
 绘制由块字符组成的椭圆。
 
void DrawBlockEllipseFilled (int x1, int y1, int r1, int r2)
 绘制由块字符组成的实心椭圆。
 
void DrawBlockEllipseFilled (int x1, int y1, int r1, int r2, const Stylizer &s)
 绘制由块字符组成的实心椭圆。
 
void DrawBlockEllipseFilled (int x1, int y1, int r1, int r2, const Color &color)
 绘制由块字符组成的实心椭圆。
 
void DrawText (int x, int y, const std::string &value)
 绘制一段文本。
 
void DrawText (int x, int y, const std::string &value, const Color &color)
 绘制一段文本。
 
void DrawText (int x, int y, const std::string &value, const Stylizer &style)
 绘制一段文本。
 
void DrawPixel (int x, int y, const Pixel &)
 在给定坐标处直接绘制预定义像素
 
void DrawImage (int x, int y, const Image &)
 在给定坐标处绘制预定义图像,左上角位于该坐标 您可以提供负坐标来随意对齐图像 - 只会绘制“可见”部分
 
void Style (int x, int y, const Stylizer &style)
 修改给定位置的像素。
 

成员类型定义说明

◆ Stylizer

using Stylizer = std::function<void(Pixel&)>

在文件 canvas.hpp48 行定义.

构造及析构函数说明

◆ Canvas() [1/2]

Canvas ( )
default

◆ Canvas() [2/2]

Canvas ( int width,
int height )

构造函数。

参数
width画布的宽度。一个单元格是2x4盲文点。
height画布的高度。一个单元格是2x4盲文点。

在文件 src/ftxui/dom/canvas.cpp90 行定义.

成员函数说明

◆ width()

int width ( ) const
inline

在文件 canvas.hpp44 行定义.

◆ height()

int height ( ) const
inline

在文件 canvas.hpp45 行定义.

◆ GetPixel()

Pixel GetPixel ( int x,
int y ) const

获取单元格的内容。

参数
x单元格的x坐标。
y单元格的y坐标。

在文件 src/ftxui/dom/canvas.cpp98 行定义.

◆ DrawPointOn()

void DrawPointOn ( int x,
int y )

绘制一个盲文点。

参数
x盲文点的x坐标。
y盲文点的y坐标。

在文件 src/ftxui/dom/canvas.cpp137 行定义.

◆ DrawPointOff()

void DrawPointOff ( int x,
int y )

擦除一个盲文点。

参数
x盲文点的x坐标。
y盲文点的y坐标。

在文件 src/ftxui/dom/canvas.cpp154 行定义.

◆ DrawPointToggle()

void DrawPointToggle ( int x,
int y )

切换盲文点。已填充的将被擦除,另一个将被绘制。

参数
x盲文点的x坐标。
y盲文点的y坐标。

在文件 src/ftxui/dom/canvas.cpp171 行定义.

◆ DrawPoint() [1/3]

void DrawPoint ( int x,
int y,
bool value )

绘制一个盲文点。

参数
x盲文点的x坐标。
y盲文点的y坐标。
value盲文点是否填充。

在文件 src/ftxui/dom/canvas.cpp107 行定义.

◆ DrawPoint() [2/3]

void DrawPoint ( int x,
int y,
bool value,
const Stylizer & style )

绘制一个盲文点。

参数
x盲文点的x坐标。
y盲文点的y坐标。
value盲文点是否填充。
style单元格的样式。

在文件 src/ftxui/dom/canvas.cpp125 行定义.

◆ DrawPoint() [3/3]

void DrawPoint ( int x,
int y,
bool value,
const Color & color )

绘制一个盲文点。

参数
x盲文点的x坐标。
y盲文点的y坐标。
value盲文点是否填充。
color盲文点的颜色。

在文件 src/ftxui/dom/canvas.cpp116 行定义.

◆ DrawPointLine() [1/3]

void DrawPointLine ( int x1,
int y1,
int x2,
int y2 )

绘制由盲文点组成的线条。

参数
x1第一个盲文点的x坐标。
y1第一个盲文点的y坐标。
x2第二个盲文点的x坐标。
y2第二个盲文点的y坐标。

在文件 src/ftxui/dom/canvas.cpp190 行定义.

◆ DrawPointLine() [2/3]

void DrawPointLine ( int x1,
int y1,
int x2,
int y2,
const Stylizer & style )

绘制由盲文点组成的线条。

参数
x1第一个盲文点的x坐标。
y1第一个盲文点的y坐标。
x2第二个盲文点的x坐标。
y2第二个盲文点的y坐标。
style线条的样式。

在文件 src/ftxui/dom/canvas.cpp211 行定义.

◆ DrawPointLine() [3/3]

void DrawPointLine ( int x1,
int y1,
int x2,
int y2,
const Color & color )

绘制由盲文点组成的线条。

参数
x1第一个盲文点的x坐标。
y1第一个盲文点的y坐标。
x2第二个盲文点的x坐标。
y2第二个盲文点的y坐标。
color线条的颜色。

在文件 src/ftxui/dom/canvas.cpp200 行定义.

◆ DrawPointCircle() [1/3]

void DrawPointCircle ( int x,
int y,
int radius )

绘制由盲文点组成的圆。

参数
x圆心的x坐标。
y圆心的y坐标。
radius圆的半径。

在文件 src/ftxui/dom/canvas.cpp248 行定义.

◆ DrawPointCircle() [2/3]

void DrawPointCircle ( int x,
int y,
int radius,
const Stylizer & style )

绘制由盲文点组成的圆。

参数
x圆心的x坐标。
y圆心的y坐标。
radius圆的半径。
style圆的样式。

在文件 src/ftxui/dom/canvas.cpp267 行定义.

◆ DrawPointCircle() [3/3]

void DrawPointCircle ( int x,
int y,
int radius,
const Color & color )

绘制由盲文点组成的圆。

参数
x圆心的x坐标。
y圆心的y坐标。
radius圆的半径。
color圆的颜色。

在文件 src/ftxui/dom/canvas.cpp257 行定义.

◆ DrawPointCircleFilled() [1/3]

void DrawPointCircleFilled ( int x,
int y,
int radius )

绘制由盲文点组成的实心圆。

参数
x圆心的x坐标。
y圆心的y坐标。
radius圆的半径。

在文件 src/ftxui/dom/canvas.cpp275 行定义.

◆ DrawPointCircleFilled() [2/3]

void DrawPointCircleFilled ( int x,
int y,
int radius,
const Stylizer & style )

绘制由盲文点组成的实心圆。

参数
x圆心的x坐标。
y圆心的y坐标。
radius圆的半径。
style圆的样式。

在文件 src/ftxui/dom/canvas.cpp297 行定义.

◆ DrawPointCircleFilled() [3/3]

void DrawPointCircleFilled ( int x,
int y,
int radius,
const Color & color )

绘制由盲文点组成的实心圆。

参数
x圆心的x坐标。
y圆心的y坐标。
radius圆的半径。
color圆的颜色。

在文件 src/ftxui/dom/canvas.cpp284 行定义.

◆ DrawPointEllipse() [1/3]

void DrawPointEllipse ( int x,
int y,
int r1,
int r2 )

绘制由盲文点组成的椭圆。

参数
x椭圆中心的x坐标。
y椭圆中心的y坐标。
r1椭圆沿x轴的半径。
r2椭圆沿y轴的半径。

在文件 src/ftxui/dom/canvas.cpp309 行定义.

◆ DrawPointEllipse() [2/3]

void DrawPointEllipse ( int x,
int y,
int r1,
int r2,
const Color & color )

绘制由盲文点组成的椭圆。

参数
x椭圆中心的x坐标。
y椭圆中心的y坐标。
r1椭圆沿x轴的半径。
r2椭圆沿y轴的半径。
color椭圆的颜色。

在文件 src/ftxui/dom/canvas.cpp319 行定义.

◆ DrawPointEllipse() [3/3]

void DrawPointEllipse ( int x1,
int y1,
int r1,
int r2,
const Stylizer & s )

绘制由盲文点组成的椭圆。

参数
x1椭圆中心的x坐标。
y1椭圆中心的y坐标。
r1椭圆沿x轴的半径。
r2椭圆沿y轴的半径。
s椭圆的样式。

在文件 src/ftxui/dom/canvas.cpp334 行定义.

◆ DrawPointEllipseFilled() [1/3]

void DrawPointEllipseFilled ( int x1,
int y1,
int r1,
int r2 )

绘制由盲文点组成的实心椭圆。

参数
x1椭圆中心的x坐标。
y1椭圆中心的y坐标。
r1椭圆沿x轴的半径。
r2椭圆沿y轴的半径。

在文件 src/ftxui/dom/canvas.cpp373 行定义.

◆ DrawPointEllipseFilled() [2/3]

void DrawPointEllipseFilled ( int x1,
int y1,
int r1,
int r2,
const Color & color )

绘制由盲文点组成的实心椭圆。

参数
x1椭圆中心的x坐标。
y1椭圆中心的y坐标。
r1椭圆沿x轴的半径。
r2椭圆沿y轴的半径。
color椭圆的颜色。

在文件 src/ftxui/dom/canvas.cpp383 行定义.

◆ DrawPointEllipseFilled() [3/3]

void DrawPointEllipseFilled ( int x1,
int y1,
int r1,
int r2,
const Stylizer & s )

绘制由盲文点组成的实心椭圆。

参数
x1椭圆中心的x坐标。
y1椭圆中心的y坐标。
r1椭圆沿x轴的半径。
r2椭圆沿y轴的半径。
s椭圆的样式。

在文件 src/ftxui/dom/canvas.cpp398 行定义.

◆ DrawBlockOn()

void DrawBlockOn ( int x,
int y )

绘制一个块。

参数
x块的x坐标。
y块的y坐标。

在文件 src/ftxui/dom/canvas.cpp467 行定义.

◆ DrawBlockOff()

void DrawBlockOff ( int x,
int y )

擦除一个块。

参数
x块的x坐标。
y块的y坐标。

在文件 src/ftxui/dom/canvas.cpp487 行定义.

◆ DrawBlockToggle()

void DrawBlockToggle ( int x,
int y )

切换一个块。如果已填充,则擦除。如果为空, 将被填充。

参数
x块的x坐标。
y块的y坐标。

在文件 src/ftxui/dom/canvas.cpp508 行定义.

◆ DrawBlock() [1/3]

void DrawBlock ( int x,
int y,
bool value )

绘制一个块。

参数
x块的x坐标。
y块的y坐标。
value块是否填充。

在文件 src/ftxui/dom/canvas.cpp437 行定义.

◆ DrawBlock() [2/3]

void DrawBlock ( int x,
int y,
bool value,
const Stylizer & style )

绘制一个块。

参数
x块的x坐标。
y块的y坐标。
value块是否填充。
style块的样式。

在文件 src/ftxui/dom/canvas.cpp455 行定义.

◆ DrawBlock() [3/3]

void DrawBlock ( int x,
int y,
bool value,
const Color & color )

绘制一个块。

参数
x块的x坐标。
y块的y坐标。
value块是否填充。
color块的颜色。

在文件 src/ftxui/dom/canvas.cpp446 行定义.

◆ DrawBlockLine() [1/3]

void DrawBlockLine ( int x1,
int y1,
int x2,
int y2 )

绘制由块字符组成的线条。

参数
x1线条第一个点的x坐标。
y1线条第一个点的y坐标。
x2线条第二个点的x坐标。
y2线条第二个点的y坐标。

在文件 src/ftxui/dom/canvas.cpp530 行定义.

◆ DrawBlockLine() [2/3]

void DrawBlockLine ( int x1,
int y1,
int x2,
int y2,
const Stylizer & style )

绘制由块字符组成的线条。

参数
x1线条第一个点的x坐标。
y1线条第一个点的y坐标。
x2线条第二个点的x坐标。
y2线条第二个点的y坐标。
style线条的样式。

在文件 src/ftxui/dom/canvas.cpp551 行定义.

◆ DrawBlockLine() [3/3]

void DrawBlockLine ( int x1,
int y1,
int x2,
int y2,
const Color & color )

绘制由块字符组成的线条。

参数
x1线条第一个点的x坐标。
y1线条第一个点的y坐标。
x2线条第二个点的x坐标。
y2线条第二个点的y坐标。
color线条的颜色。

在文件 src/ftxui/dom/canvas.cpp540 行定义.

◆ DrawBlockCircle() [1/3]

void DrawBlockCircle ( int x,
int y,
int radius )

绘制由块字符组成的圆。

参数
x圆心的x坐标。
y圆心的y坐标。
radius圆的半径。

在文件 src/ftxui/dom/canvas.cpp591 行定义.

◆ DrawBlockCircle() [2/3]

void DrawBlockCircle ( int x,
int y,
int radius,
const Stylizer & style )

绘制由块字符组成的圆。

参数
x圆心的x坐标。
y圆心的y坐标。
radius圆的半径。
style圆的样式。

在文件 src/ftxui/dom/canvas.cpp610 行定义.

◆ DrawBlockCircle() [3/3]

void DrawBlockCircle ( int x,
int y,
int radius,
const Color & color )

绘制由块字符组成的圆。

参数
x圆心的x坐标。
y圆心的y坐标。
radius圆的半径。
color圆的颜色。

在文件 src/ftxui/dom/canvas.cpp600 行定义.

◆ DrawBlockCircleFilled() [1/3]

void DrawBlockCircleFilled ( int x,
int y,
int radius )

绘制由块字符组成的实心圆。

参数
x圆心的x坐标。
y圆心的y坐标。
radius圆的半径。

在文件 src/ftxui/dom/canvas.cpp618 行定义.

◆ DrawBlockCircleFilled() [2/3]

void DrawBlockCircleFilled ( int x,
int y,
int radius,
const Stylizer & s )

绘制由块字符组成的实心圆。

参数
x圆心的x坐标。
y圆心的y坐标。
radius圆的半径。
s圆的样式。

在文件 src/ftxui/dom/canvas.cpp640 行定义.

◆ DrawBlockCircleFilled() [3/3]

void DrawBlockCircleFilled ( int x,
int y,
int radius,
const Color & color )

绘制由块字符组成的实心圆。

参数
x圆心的x坐标。
y圆心的y坐标。
radius圆的半径。
color圆的颜色。

在文件 src/ftxui/dom/canvas.cpp627 行定义.

◆ DrawBlockEllipse() [1/3]

void DrawBlockEllipse ( int x,
int y,
int r1,
int r2 )

绘制由块字符组成的椭圆。

参数
x椭圆中心的x坐标。
y椭圆中心的y坐标。
r1椭圆沿x轴的半径。
r2椭圆沿y轴的半径。

在文件 src/ftxui/dom/canvas.cpp652 行定义.

◆ DrawBlockEllipse() [2/3]

void DrawBlockEllipse ( int x1,
int y1,
int r1,
int r2,
const Stylizer & s )

绘制由块字符组成的椭圆。

参数
x1椭圆中心的x坐标。
y1椭圆中心的y坐标。
r1椭圆沿x轴的半径。
r2椭圆沿y轴的半径。
s椭圆的样式。

在文件 src/ftxui/dom/canvas.cpp677 行定义.

◆ DrawBlockEllipse() [3/3]

void DrawBlockEllipse ( int x,
int y,
int r1,
int r2,
const Color & color )

绘制由块字符组成的椭圆。

参数
x椭圆中心的x坐标。
y椭圆中心的y坐标。
r1椭圆沿x轴的半径。
r2椭圆沿y轴的半径。
color椭圆的颜色。

在文件 src/ftxui/dom/canvas.cpp662 行定义.

◆ DrawBlockEllipseFilled() [1/3]

void DrawBlockEllipseFilled ( int x,
int y,
int r1,
int r2 )

绘制由块字符组成的实心椭圆。

参数
x椭圆中心的x坐标。
y椭圆中心的y坐标。
r1椭圆沿x轴的半径。
r2椭圆沿y轴的半径。

在文件 src/ftxui/dom/canvas.cpp718 行定义.

◆ DrawBlockEllipseFilled() [2/3]

void DrawBlockEllipseFilled ( int x1,
int y1,
int r1,
int r2,
const Stylizer & s )

绘制由块字符组成的实心椭圆。

参数
x1椭圆中心的x坐标。
y1椭圆中心的y坐标。
r1椭圆沿x轴的半径。
r2椭圆沿y轴的半径。
s椭圆的样式。

在文件 src/ftxui/dom/canvas.cpp743 行定义.

◆ DrawBlockEllipseFilled() [3/3]

void DrawBlockEllipseFilled ( int x,
int y,
int r1,
int r2,
const Color & color )

绘制由块字符组成的实心椭圆。

参数
x椭圆中心的x坐标。
y椭圆中心的y坐标。
r1椭圆沿x轴的半径。
r2椭圆沿y轴的半径。
color椭圆的颜色。

在文件 src/ftxui/dom/canvas.cpp728 行定义.

◆ DrawText() [1/3]

void DrawText ( int x,
int y,
const std::string & value )

绘制一段文本。

参数
x文本的x坐标。
y文本的y坐标。
value要绘制的文本。

在文件 src/ftxui/dom/canvas.cpp784 行定义.

◆ DrawText() [2/3]

void DrawText ( int x,
int y,
const std::string & value,
const Color & color )

绘制一段文本。

参数
x文本的x坐标。
y文本的y坐标。
value要绘制的文本。
color文本的颜色。

在文件 src/ftxui/dom/canvas.cpp793 行定义.

◆ DrawText() [3/3]

void DrawText ( int x,
int y,
const std::string & value,
const Stylizer & style )

绘制一段文本。

参数
x文本的x坐标。
y文本的y坐标。
value要绘制的文本。
style文本的样式。

在文件 src/ftxui/dom/canvas.cpp805 行定义.

◆ DrawPixel()

void DrawPixel ( int x,
int y,
const Pixel & p )

在给定坐标处直接绘制预定义像素

参数
x像素的x坐标。
y像素的y坐标。
p要绘制的像素。

在文件 src/ftxui/dom/canvas.cpp826 行定义.

◆ DrawImage()

void DrawImage ( int x,
int y,
const Image & image )

在给定坐标处绘制预定义图像,左上角位于该坐标 您可以提供负坐标来随意对齐图像 - 只会绘制“可见”部分

参数
x图像左上角对应的x坐标。
y图像左上角对应的y坐标。
image要绘制的图像。

在文件 src/ftxui/dom/canvas.cpp838 行定义.

◆ Style()

void Style ( int x,
int y,
const Stylizer & style )

修改给定位置的像素。

参数
style修改像素的函数。

在文件 src/ftxui/dom/canvas.cpp860 行定义.

◆ ftxui::FlexboxConfig

struct ftxui::FlexboxConfig

FlexboxConfig 是一个配置结构体,定义了弹性盒子容器的布局属性。

它允许您指定弹性项目的方向、是否应该换行、它们在主轴上如何对齐,以及它们在交叉轴上如何对齐。 它还包括弹性项目在主轴和交叉轴上间距的属性。 该结构体用于配置终端用户界面中弹性盒子容器的布局行为。

示例
examples/component/flexbox_gallery.cpp , 以及 examples/component/homescreen.cpp.

在文件 flexbox_config.hpp26 行定义.

Public 类型

enum class  Direction {
  Row ,
  RowInversed ,
  Column ,
  ColumnInversed
}
 
enum class  Wrap {
  NoWrap ,
  Wrap ,
  WrapInversed
}
 默认情况下,弹性项目将全部尝试适应一行。您可以通过此属性更改它,并允许项目根据需要换行。 更多...
 
enum class  JustifyContent {
  FlexStart ,
  FlexEnd ,
  Center ,
  Stretch ,
  SpaceBetween ,
  SpaceAround ,
  SpaceEvenly
}
 
enum class  AlignItems {
  FlexStart ,
  FlexEnd ,
  Center ,
  Stretch
}
 
enum class  AlignContent {
  FlexStart ,
  FlexEnd ,
  Center ,
  Stretch ,
  SpaceBetween ,
  SpaceAround ,
  SpaceEvenly
}
 

Public 成员函数

FlexboxConfigSet (FlexboxConfig::Direction)
 设置 flexbox 方向。
 
FlexboxConfigSet (FlexboxConfig::Wrap)
 设置 flexbox 换行。
 
FlexboxConfigSet (FlexboxConfig::JustifyContent)
 设置 flexbox justify content。
 
FlexboxConfigSet (FlexboxConfig::AlignItems)
 设置 flexbox align items。
 
FlexboxConfigSet (FlexboxConfig::AlignContent)
 设置 flexbox align content。
 
FlexboxConfigSetGap (int gap_x, int gap_y)
 设置 flexbox flex direction。
 

Public 属性

Direction direction = Direction::Row
 
Wrap wrap = Wrap::Wrap
 
JustifyContent justify_content = JustifyContent::FlexStart
 
AlignItems align_items = AlignItems::FlexStart
 
AlignContent align_content = AlignContent::FlexStart
 
int gap_x = 0
 
int gap_y = 0
 

成员枚举类型说明

◆ Direction

enum class Direction
strong

这建立了主轴,从而定义了弹性项目在弹性容器中的放置方向。弹性盒子(除了换行)是单方向的 布局概念。可以将弹性项目主要视为水平行或垂直列的布局。

枚举值
Row 

弹性项目按行排列。

RowInversed 

弹性项目按行反向排列。

Column 

弹性项目按列排列。

ColumnInversed 

弹性项目按列反向排列。 序。

在文件 flexbox_config.hpp29 行定义.

◆ Wrap

enum class Wrap
strong

默认情况下,弹性项目将全部尝试适应一行。您可以通过此属性更改它,并允许项目根据需要换行。

枚举值
NoWrap 

弹性项目将全部尝试适应一行。

Wrap 

弹性项目将换行到多行。

WrapInversed 

弹性项目将换行到多行,但顺序相反。 order.

在文件 flexbox_config.hpp39 行定义.

◆ JustifyContent

enum class JustifyContent
strong

这定义了沿主轴的对齐方式。当一行上的所有弹性项目都是不可伸缩的, 或者它们是可伸缩的但已达到其最大大小时,它有助于分配剩余的额外可用空间。 它还对项目溢出线时的对齐方式施加一些控制。

枚举值
FlexStart 

项目与弹性盒子方向的起始对齐。

FlexEnd 

项目与弹性盒子方向的末尾对齐。

Center 

项目沿线居中。

Stretch 

项目拉伸以填充该行。

SpaceBetween 

项目在线上均匀分布;第一个项目在起始线,最后一个项目在结束线

SpaceAround 

项目在线上均匀分布,周围有相等的空间。 请注意,视觉上空间不相等,因为所有项目两侧都有相等的空间。 第一个项目与容器边缘之间有一个单位的空间,但与下一个项目之间有两个单位的空间, 因为下一个项目有其自己的间距。

SpaceEvenly 

项目分布使得任意两个项目之间(以及到边缘的空间)的间距相等。

在文件 flexbox_config.hpp50 行定义.

◆ AlignItems

enum class AlignItems
strong

这定义了弹性项目在当前行上沿交叉轴的默认布局行为。 可以将其视为交叉轴(垂直于主轴)的 justify-content 版本。

枚举值
FlexStart 

项目放置在交叉轴的起始位置。

FlexEnd 

项目放置在交叉轴的结束位置。

Center 

项目沿交叉轴居中。

Stretch 

项目拉伸以填充交叉轴。

在文件 flexbox_config.hpp74 行定义.

◆ AlignContent

enum class AlignContent
strong
枚举值
FlexStart 

项目放置在交叉轴的起始位置。

FlexEnd 

项目放置在交叉轴的结束位置。

Center 

项目沿交叉轴居中。

Stretch 

项目拉伸以填充交叉轴。

SpaceBetween 

项目在交叉轴上均匀分布。

SpaceAround 

项目均匀分布,每行周围有相等的空间。 line.

SpaceEvenly 

项目在交叉轴上均匀分布,周围有相等的空间。 space around them.

在文件 flexbox_config.hpp84 行定义.

成员函数说明

◆ Set() [1/5]

设置 flexbox 方向。

示例
examples/component/flexbox_gallery.cpp.

在文件 flexbox_config.cpp9 行定义.

◆ Set() [2/5]

设置 flexbox 换行。

在文件 flexbox_config.cpp15 行定义.

◆ Set() [3/5]

设置 flexbox justify content。

在文件 flexbox_config.cpp21 行定义.

◆ Set() [4/5]

设置 flexbox align items。

在文件 flexbox_config.cpp27 行定义.

◆ Set() [5/5]

设置 flexbox align content。

在文件 flexbox_config.cpp33 行定义.

◆ SetGap()

FlexboxConfig & SetGap ( int gap_x,
int gap_y )

设置 flexbox flex direction。

示例
examples/component/homescreen.cpp.

在文件 flexbox_config.cpp39 行定义.

类成员变量说明

◆ direction

◆ wrap

◆ justify_content

◆ align_items

◆ align_content

◆ gap_x

int gap_x = 0

在文件 flexbox_config.hpp97 行定义.

◆ gap_y

int gap_y = 0

在文件 flexbox_config.hpp98 行定义.

◆ ftxui::LinearGradient

struct ftxui::LinearGradient

一个表示线性渐变颜色效果设置的类。

示例:

.Angle(45)
.Stop(Color::Blue, 1.0);
LinearGradient & Stop(Color color, float position)
LinearGradient & Angle(float angle)
设置渐变角度。
一个表示线性渐变颜色效果设置的类。

也有简写构造函数:

示例
examples/component/input_style.cpp, examples/component/linear_gradient_gallery.cpp, examples/dom/linear_gradient.cpp , 以及 examples/dom/style_color.cpp.

在文件 linear_gradient.hpp32 行定义.

Public 成员函数

LinearGradientAngle (float angle)
 设置渐变角度。
 
LinearGradientStop (Color color, float position)
 
LinearGradientStop (Color color)
 

Public 属性

float angle = 0.f
 
std::vector< Stopstops
 

成员函数说明

◆ Angle()

LinearGradient & Angle ( float a)

设置渐变角度。

参数
a渐变角度。
返回
渐变。

在文件 src/ftxui/dom/linear_gradient.cpp206 行定义.

◆ Stop() [1/2]

LinearGradient & Stop ( Color color,
float position )

◆ Stop() [2/2]

LinearGradient & Stop ( Color color)

类成员变量说明

◆ angle

float angle = 0.f

在文件 linear_gradient.hpp33 行定义.

◆ stops

std::vector<Stop> stops

在文件 linear_gradient.hpp43 行定义.

◆ ftxui::Node

class ftxui::Node

Node 是 DOM 树中所有元素的基类。

它代表文档对象模型 (DOM) 中的单个节点,并提供布局和渲染的基本结构。 它包含用于计算布局要求、设置盒子尺寸、选择内容、渲染到屏幕以及检查布局状态的方法。 它通常包含子元素,这些子元素也是 Node 的实例。

用户应从该类派生以创建自定义元素。

内置元素的列表可在 elements.hpp 文件中找到。

在文件 node.hpp33 行定义.

+ 类 Node 继承关系图:

Public 成员函数

 Node ()
 
 Node (Elements children)
 
 Node (const Node &)=delete
 
 Node (const Node &&)=delete
 
Nodeoperator= (const Node &)=delete
 
Nodeoperator= (const Node &&)=delete
 
virtual ~Node ()
 
virtual void ComputeRequirement ()
 计算元素所需的空间。
 
Requirement requirement ()
 
virtual void SetBox (Box box)
 为绘图元素分配位置和尺寸。
 
virtual void Select (Selection &selection)
 计算元素的选区。
 
virtual void Render (Screen &screen)
 ftxui::Screen 上显示元素。
 
virtual std::string GetSelectedContent (Selection &selection)
 
virtual void Check (Status *status)
 

Protected 属性

Elements children_
 
Requirement requirement_
 
Box box_
 

构造及析构函数说明

◆ Node() [1/4]

Node ( )
default

◆ Node() [2/4]

Node ( Elements children)
explicit

在文件 node.cpp16 行定义.

◆ Node() [3/4]

Node ( const Node & )
delete

◆ Node() [4/4]

Node ( const Node && )
delete

◆ ~Node()

~Node ( )
virtualdefault

成员函数说明

◆ operator=() [1/2]

Node & operator= ( const Node & )
delete

◆ operator=() [2/2]

Node & operator= ( const Node && )
delete

◆ ComputeRequirement()

void ComputeRequirement ( )
virtual

计算元素所需的空间。

NodeDecorator 重载.

在文件 node.cpp20 行定义.

◆ requirement()

Requirement requirement ( )
inline

在文件 node.hpp47 行定义.

◆ SetBox()

void SetBox ( Box box)
virtual

为绘图元素分配位置和尺寸。

NodeDecorator 重载.

在文件 node.cpp41 行定义.

◆ Select()

void Select ( Selection & selection)
virtual

计算元素的选区。

在文件 node.cpp46 行定义.

◆ Render()

void Render ( Screen & screen)
virtual

ftxui::Screen 上显示元素。

在文件 node.cpp59 行定义.

◆ GetSelectedContent()

std::string GetSelectedContent ( Selection & selection)
virtual

在文件 node.cpp72 行定义.

◆ Check()

void Check ( Status * status)
virtual

在文件 node.cpp65 行定义.

类成员变量说明

◆ children_

Elements children_
protected

在文件 node.hpp73 行定义.

◆ requirement_

Requirement requirement_
protected

在文件 node.hpp74 行定义.

◆ box_

Box box_
protected

在文件 node.hpp75 行定义.

◆ ftxui::Requirement

struct ftxui::Requirement

Requirement 是一个结构体,用于定义终端用户界面中 Node 的布局要求。

它指定了完整绘制元素所需的最小尺寸,

在文件 requirement.hpp17 行定义.

Public 属性

int min_x = 0
 
int min_y = 0
 
int flex_grow_x = 0
 
int flex_grow_y = 0
 
int flex_shrink_x = 0
 
int flex_shrink_y = 0
 
Focused focused
 

类成员变量说明

◆ min_x

int min_x = 0

在文件 requirement.hpp19 行定义.

◆ min_y

int min_y = 0

在文件 requirement.hpp20 行定义.

◆ flex_grow_x

int flex_grow_x = 0

在文件 requirement.hpp23 行定义.

◆ flex_grow_y

int flex_grow_y = 0

在文件 requirement.hpp24 行定义.

◆ flex_shrink_x

int flex_shrink_x = 0

在文件 requirement.hpp25 行定义.

◆ flex_shrink_y

int flex_shrink_y = 0

在文件 requirement.hpp26 行定义.

◆ focused

Focused focused

在文件 requirement.hpp50 行定义.

◆ ftxui::Selection

class ftxui::Selection

代表终端用户界面中的选择。

Selection 是一个类,代表终端用户界面中选择的两个端点。

在文件 selection.hpp20 行定义.

Public 成员函数

 Selection ()
 创建一个空选择。
 
 Selection (int start_x, int start_y, int end_x, int end_y)
 创建一个选择。
 
const BoxGetBox () const
 获取选择框。
 
Selection SaturateHorizontal (Box box)
 将选择饱和到框内。 这由 hbox 调用,以将选择传播到其子级。
 
Selection SaturateVertical (Box box)
 将选择饱和到框内。 这由 vbox 调用,以将选择传播到其子级。
 
bool IsEmpty () const
 
void AddPart (const std::string &part, int y, int left, int right)
 
std::string GetParts ()
 

构造及析构函数说明

◆ Selection() [1/2]

Selection ( )
default

创建一个空选择。

◆ Selection() [2/2]

Selection ( int start_x,
int start_y,
int end_x,
int end_y )

创建一个选择。

参数
start_x选择起始的x坐标。
start_y选择起始的y坐标。
end_x选择结束的x坐标。
end_y选择结束的y坐标。

在文件 src/ftxui/dom/selection.cpp33 行定义.

成员函数说明

◆ GetBox()

const Box & GetBox ( ) const

获取选择框。

返回
选择框。

在文件 src/ftxui/dom/selection.cpp66 行定义.

◆ SaturateHorizontal()

Selection SaturateHorizontal ( Box box)

将选择饱和到框内。 这由 hbox 调用,以将选择传播到其子级。

参数
box用于饱和选择的框。
返回
饱和后的选择。

在文件 src/ftxui/dom/selection.cpp74 行定义.

◆ SaturateVertical()

Selection SaturateVertical ( Box box)

将选择饱和到框内。 这由 vbox 调用,以将选择传播到其子级。

参数
box用于饱和选择的框。
返回
饱和后的选择。

在文件 src/ftxui/dom/selection.cpp112 行定义.

◆ IsEmpty()

bool IsEmpty ( ) const
inline

在文件 selection.hpp29 行定义.

◆ AddPart()

void AddPart ( const std::string & part,
int y,
int left,
int right )

在文件 src/ftxui/dom/selection.cpp145 行定义.

◆ GetParts()

std::string GetParts ( )
inline

在文件 selection.hpp32 行定义.

◆ ftxui::Table

class ftxui::Table

Table 是一个绘制表格的实用工具。

示例

auto table = Table({
{"X", "Y"},
{"-1", "1"},
{"+0", "0"},
{"+1", "1"},
});
table.SelectAll().Border(LIGHT);
table.SelectRow(1).Border(DOUBLE);
table.SelectRow(1).SeparatorInternal(LIGHT);
std::move(table).Render();
Table()
创建一个空表格。
示例
examples/dom/table.cpp.

在文件 table.hpp35 行定义.

Public 成员函数

 Table ()
 创建一个空表格。
 
 Table (std::vector< std::vector< std::string > >)
 从字符串向量的向量创建表格。
 
 Table (std::vector< std::vector< Element > >)
 从 Element 向量的向量创建表格
 
 Table (std::initializer_list< std::vector< std::string > > init)
 
TableSelection SelectAll ()
 选择整个表格。
 
TableSelection SelectCell (int column, int row)
 选择表格的一个单元格。
 
TableSelection SelectRow (int row_index)
 选择表格的一行。
 
TableSelection SelectRows (int row_min, int row_max)
 选择表格的行范围。
 
TableSelection SelectColumn (int column_index)
 选择表格的一列。
 
TableSelection SelectColumns (int column_min, int column_max)
 选择表格的列范围。
 
TableSelection SelectRectangle (int column_min, int column_max, int row_min, int row_max)
 选择表格的一个矩形区域。
 
Element Render ()
 渲染表格。
 

构造及析构函数说明

◆ Table() [1/4]

Table ( )

创建一个空表格。

在文件 src/ftxui/dom/table.cpp47 行定义.

◆ Table() [2/4]

Table ( std::vector< std::vector< std::string > > input)
explicit

从字符串向量的向量创建表格。

参数
input输入数据。

在文件 src/ftxui/dom/table.cpp53 行定义.

◆ Table() [3/4]

Table ( std::vector< std::vector< Element > > input)
explicit

从 Element 向量的向量创建表格

参数
input输入元素。

在文件 src/ftxui/dom/table.cpp69 行定义.

◆ Table() [4/4]

Table ( std::initializer_list< std::vector< std::string > > init)

在文件 src/ftxui/dom/table.cpp75 行定义.

成员函数说明

◆ SelectAll()

TableSelection SelectAll ( )

选择整个表格。

示例
examples/dom/table.cpp.

在文件 src/ftxui/dom/table.cpp200 行定义.

◆ SelectCell()

TableSelection SelectCell ( int column,
int row )

选择表格的一个单元格。

参数
column要选择的单元格的列。
row要选择的单元格的行。
注解
您可以使用负索引从末尾选择。

在文件 src/ftxui/dom/table.cpp169 行定义.

◆ SelectRow()

TableSelection SelectRow ( int index)

选择表格的一行。

参数
index要选择的行的索引。
注解
您可以使用负索引从末尾选择。

在文件 src/ftxui/dom/table.cpp138 行定义.

◆ SelectRows()

TableSelection SelectRows ( int row_min,
int row_max )

选择表格的行范围。

参数
row_min要选择的第一行。
row_max要选择的最后一行。
注解
您可以使用负索引从末尾选择。

在文件 src/ftxui/dom/table.cpp146 行定义.

◆ SelectColumn()

TableSelection SelectColumn ( int index)

选择表格的一列。

参数
index要选择的列的索引。
注解
您可以使用负索引从末尾选择。

在文件 src/ftxui/dom/table.cpp153 行定义.

◆ SelectColumns()

TableSelection SelectColumns ( int column_min,
int column_max )

选择表格的列范围。

参数
column_min要选择的第一列。
column_max要选择的最后一列。
注解
您可以使用负索引从末尾选择。

在文件 src/ftxui/dom/table.cpp161 行定义.

◆ SelectRectangle()

TableSelection SelectRectangle ( int column_min,
int column_max,
int row_min,
int row_max )

选择表格的一个矩形区域。

参数
column_min要选择的第一列。
column_max要选择的最后一列。
row_min要选择的第一行。
row_max要选择的最后一行。
注解
您可以使用负索引从末尾选择。

在文件 src/ftxui/dom/table.cpp179 行定义.

◆ Render()

Element Render ( )

渲染表格。

返回
渲染的表格。这是一个您可以绘制的元素。

在文件 src/ftxui/dom/table.cpp212 行定义.

枚举类型说明

◆ Direction

enum class Direction
strong

Direction 是一个枚举,表示四个基本方向。

枚举值
Up 
Down 
Left 
Right 

在文件 direction.hpp11 行定义.

◆ BorderStyle

BorderStyle 是一个枚举,表示可应用于终端 UI 中元素的不同边框样式。

BorderStyle 是一个枚举,表示可应用于终端 UI 中元素的不同边框样式。 它用于定义元素周围边框的视觉外观, 例如窗口、框架或分隔符。

枚举值
LIGHT 
DASHED 
HEAVY 
DOUBLE 
ROUNDED 
EMPTY 

在文件 elements.hpp33 行定义.

函数说明

◆ automerge()

Element automerge ( Element child)

启用字符自动与附近的其它字符合并。

在文件 automerge.cpp16 行定义.

◆ blink()

Element blink ( Element child)

绘制的文本在可见和隐藏之间交替。

在文件 blink.cpp33 行定义.

◆ bold()

Element bold ( Element child)

使用粗体字体,用于强调元素。

在文件 bold.cpp33 行定义.

◆ border()

Element border ( Element child)

在元素周围绘制边框。

参见
border
borderLight
borderDashed
borderDouble
borderHeavy
borderEmpty
borderRounded
borderStyled
borderWith

在元素周围添加边框

示例

// 将 'border' 作为函数使用...
Element document = border(text("The element"));
// ...或作为 '管道' 使用。
Element document = text("The element") | border;
Element border(Element child)
在元素周围绘制边框。

输出

┌───────────┐
│The element│
└───────────┘
示例
examples/component/checkbox_in_frame.cpp, examples/component/flexbox_gallery.cpp, examples/component/gallery.cpp, examples/component/input_style.cpp, examples/component/menu_in_frame.cpp, examples/component/menu_style.cpp, examples/component/modal_dialog.cpp, examples/component/print_key_press.cpp, examples/component/radiobox_in_frame.cpp, examples/component/renderer.cpp, examples/component/resizable_split.cpp, examples/dom/canvas.cpp, examples/dom/graph.cpp, examples/dom/gridbox.cpp, examples/dom/html_like.cpp , 以及 examples/dom/spinner.cpp.

在文件 src/ftxui/dom/border.cpp225 行定义.

◆ borderWith()

Decorator borderWith ( const Pixel & pixel)

与 border 相同,但在元素周围使用一个常量像素。

参见
border

在文件 src/ftxui/dom/border.cpp232 行定义.

◆ borderStyled() [1/3]

Decorator borderStyled ( BorderStyle style)

与 border 相同,但具有不同的样式。

参见
border
示例
examples/dom/border_colored.cpp.

在文件 src/ftxui/dom/border.cpp241 行定义.

◆ borderStyled() [2/3]

Decorator borderStyled ( Color foreground_color)

与 border 相同,但具有前景色。

参见
border

在文件 src/ftxui/dom/border.cpp250 行定义.

◆ borderStyled() [3/3]

Decorator borderStyled ( BorderStyle style,
Color foreground_color )

与 border 相同,但具有前景色和不同的样式。

参见
border
border

在文件 src/ftxui/dom/border.cpp262 行定义.

◆ borderDashed()

Element borderDashed ( Element child)

在元素周围绘制虚线边框。

参见
border
borderLight
borderDashed
borderDouble
borderHeavy
borderRounded
borderEmpty
borderStyled
borderWith

在元素周围添加边框

示例

// 将 'borderDash' 作为函数使用...
Element document = borderDash(text("The element"));
// ...或作为 '管道' 使用。
Element document = text("The element") | borderDAsh;

输出

┏╍╍╍╍╍╍╍╍╍╍╍╍╍╍┓
╏The element ╏
┗╍╍╍╍╍╍╍╍╍╍╍╍╍╍┛
示例
examples/dom/border_style.cpp.

在文件 src/ftxui/dom/border.cpp300 行定义.

◆ borderLight()

Element borderLight ( Element child)

在元素周围绘制细边框。

参见
border
borderLight
borderDashed
borderDouble
borderHeavy
borderRounded
borderEmpty
borderStyled
borderWith

在元素周围添加边框

示例

// 将 'borderLight' 作为函数使用...
Element document = borderLight(text("The element"));
// ...或作为 '管道' 使用。
Element document = text("The element") | borderLight;
Element borderLight(Element child)
在元素周围绘制细边框。

输出

┌──────────────┐
│The element │
└──────────────┘
示例
examples/dom/border_style.cpp.

在文件 src/ftxui/dom/border.cpp335 行定义.

◆ borderHeavy()

Element borderHeavy ( Element child)

在元素周围绘制粗边框。

参见
border
borderLight
borderDashed
borderDouble
borderHeavy
borderRounded
borderEmpty
borderStyled
borderWith

在元素周围添加边框

示例

// 将 'borderHeavy' 作为函数使用...
Element document = borderHeavy(text("The element"));
// ...或作为 '管道' 使用。
Element document = text("The element") | borderHeavy;
Element borderHeavy(Element child)
在元素周围绘制粗边框。

输出

┏━━━━━━━━━━━━━━┓
┃The element ┃
┗━━━━━━━━━━━━━━┛
示例
examples/dom/border_style.cpp.

在文件 src/ftxui/dom/border.cpp370 行定义.

◆ borderDouble()

Element borderDouble ( Element child)

在元素周围绘制双线边框。

参见
border
borderLight
borderDashed
borderDouble
borderHeavy
borderRounded
borderEmpty
borderStyled
borderWith

在元素周围添加边框

示例

// 将 'borderDouble' 作为函数使用...
Element document = borderDouble(text("The element"));
// ...或作为 '管道' 使用。
Element document = text("The element") | borderDouble;
Element borderDouble(Element child)
在元素周围绘制双线边框。

输出

╔══════════════╗
║The element ║
╚══════════════╝
示例
examples/component/input_style.cpp, examples/component/menu_style.cpp , 以及 examples/dom/border_style.cpp.

在文件 src/ftxui/dom/border.cpp405 行定义.

◆ borderRounded()

Element borderRounded ( Element child)

在元素周围绘制圆角边框。

参见
border
borderLight
borderDashed
borderDouble
borderHeavy
borderRounded
borderEmpty
borderStyled
borderWith

在元素周围添加边框

示例

// 将 'borderRounded' 作为函数使用...
Element document = borderRounded(text("The element"));
// ...或作为 '管道' 使用。
Element document = text("The element") | borderRounded;
Element borderRounded(Element child)
在元素周围绘制圆角边框。

输出

╭──────────────╮
│The element │
╰──────────────╯
示例
examples/component/input_style.cpp , 以及 examples/dom/border_style.cpp.

在文件 src/ftxui/dom/border.cpp440 行定义.

◆ borderEmpty()

Element borderEmpty ( Element child)

在元素周围绘制一个空边框。

参见
border
borderLight
borderDashed
borderDouble
borderHeavy
borderRounded
borderEmpty
borderStyled
borderWith

在元素周围添加边框

示例

// 将 'borderRounded' 作为函数使用...
Element document = borderRounded(text("The element"));
// ...或作为 '管道' 使用。
Element document = text("The element") | borderRounded;

输出

The element
示例
examples/component/dropdown_custom.cpp, examples/component/input_style.cpp, examples/component/menu_underline_animated_gallery.cpp , 以及 examples/component/with_restored_io.cpp.

在文件 src/ftxui/dom/border.cpp475 行定义.

◆ window()

Element window ( Element title,
Element content,
BorderStyle border )

绘制带有标题和边框的窗口。

参数
title窗口的标题。
content要包装的元素。
border边框的样式。默认为 ROUNDED。
参见
border

示例

Element document = window(text("Title"),
text("content")
);
// 指定边框样式
Element document = window(text("Title"),
text("content"),
ROUNDED
);
Element window(Element title, Element content, BorderStyle border)
绘制带有标题和边框的窗口。

输出

┌Title──┐
│content│
└───────┘
示例
examples/component/flexbox_gallery.cpp, examples/component/homescreen.cpp, examples/component/menu_multiple.cpp, examples/component/resizable_split_clamp.cpp, examples/component/selection.cpp, examples/dom/color_truecolor_RGB.cpp, examples/dom/hflow.cpp, examples/dom/package_manager.cpp, examples/dom/size.cpp , 以及 examples/dom/vflow.cpp.

在文件 src/ftxui/dom/border.cpp507 行定义.

◆ clear_under()

Element clear_under ( Element element)

在绘制 |child| 之前,清除下方的像素。这与 dbox 结合使用很有用。

参见
ftxui::dbox

在文件 clear_under.cpp37 行定义.

◆ color() [1/4]

Element color ( Color color,
Element child )

设置元素的前景颜色。

参数
color输出元素的颜色。
child输入元素。
返回
着色的输出元素。

示例

Element document = color(Color::Green, text("Success")),
Element text(std::wstring text)
显示一段Unicode文本。
Decorator color(Color)
使用前景色进行装饰。
std::shared_ptr< Node > Element

在文件 dom/color.cpp81 行定义.

◆ bgcolor() [1/4]

Element bgcolor ( Color color,
Element child )

设置元素的背景颜色。

参数
color输出元素的颜色。
child输入元素。
返回
着色的输出元素。

示例

Element document = bgcolor(Color::Green, text("Success")),
Decorator bgcolor(Color)
使用背景色进行装饰。

在文件 dom/color.cpp96 行定义.

◆ color() [2/4]

Decorator color ( Color c)

使用前景色进行装饰。

参数
c要应用的前景色。
返回
应用颜色的装饰器。

示例

Element document = text("red") | color(Color::Red);

在文件 dom/color.cpp110 行定义.

◆ bgcolor() [2/4]

Decorator bgcolor ( Color color)

使用背景色进行装饰。

参数
color要应用的背景颜色。
返回
应用颜色的装饰器。

示例

Element document = text("red") | bgcolor(Color::Red);

在文件 dom/color.cpp124 行定义.

◆ hcenter()

Element hcenter ( Element child)

水平居中一个元素。

参数
child被装饰的元素。
返回
居中的元素。

在文件 composite_decorator.cpp14 行定义.

◆ vcenter()

Element vcenter ( Element child)

垂直居中一个元素。

参数
child被装饰的元素。
返回
居中的元素。

在文件 composite_decorator.cpp22 行定义.

◆ center()

Element center ( Element child)

水平并垂直居中一个元素。

参数
child被装饰的元素。
返回
居中的元素。

在文件 composite_decorator.cpp30 行定义.

◆ align_right()

Element align_right ( Element child)

将元素右对齐。

参数
child被装饰的元素。
返回
右对齐的元素。

在文件 composite_decorator.cpp38 行定义.

◆ dbox()

Element dbox ( Elements children_)

将多个元素堆叠在一起。

参数
children_输入元素。
返回
右对齐的元素。

在文件 src/ftxui/dom/dbox.cpp55 行定义.

◆ dim()

Element dim ( Element child)

使用浅色字体,用于不那么重要的元素。

在文件 dim.cpp32 行定义.

◆ filler()

Element filler ( )

一个元素,它将按比例扩展以填充容器中剩余的空间。

在文件 flex.cpp96 行定义.

◆ flex()

Element flex ( Element child)

使子元素按比例扩展以填充容器中剩余的空间。

示例:

text("left") | border ,
text("middle") | border | flex,
text("right") | border,
});
Element flex(Element)
使子元素按比例扩展以填充容器中剩余的空间。
Element hbox(Elements)
一个按水平顺序逐一显示元素的容器。
Element border(Element)

输出:

┌────┐┌─────────────────────────────────────────────────────────┐┌─────┐
│left││middle ││right│
└────┘└─────────────────────────────────────────────────────────┘└─────┘

在文件 flex.cpp120 行定义.

◆ xflex()

Element xflex ( Element child)

在 X 轴上尽可能地扩展/收缩。

在文件 flex.cpp126 行定义.

◆ yflex()

Element yflex ( Element child)

在 Y 轴上尽可能地扩展/收缩。

在文件 flex.cpp132 行定义.

◆ flex_grow()

Element flex_grow ( Element child)

如果可能,进行扩展。

在文件 flex.cpp138 行定义.

◆ xflex_grow()

Element xflex_grow ( Element child)

如果可能,在 X 轴上进行扩展。

在文件 flex.cpp144 行定义.

◆ yflex_grow()

Element yflex_grow ( Element child)

如果可能,在 Y 轴上进行扩展。

在文件 flex.cpp150 行定义.

◆ flex_shrink()

Element flex_shrink ( Element child)

如果需要,进行收缩。

在文件 flex.cpp156 行定义.

◆ xflex_shrink()

Element xflex_shrink ( Element child)

如果需要,在 X 轴上进行收缩。

在文件 flex.cpp162 行定义.

◆ yflex_shrink()

Element yflex_shrink ( Element child)

如果需要,在 Y 轴上进行收缩。

在文件 flex.cpp168 行定义.

◆ notflex()

Element notflex ( Element child)

使元素不可伸缩。

在文件 flex.cpp174 行定义.

◆ focusPositionRelative()

Decorator focusPositionRelative ( float x,
float y )

frame 内部使用,这会强制视图滚动到给定位置。位置以请求大小的比例表示。

例如:

  • (0, 0) 表示视图滚动到左上角。
  • (1, 0) 表示视图滚动到右上角。
  • (0, 1) 表示视图滚动到左下角。

示例

Element document = huge_document()
| frame;
Decorator focusPositionRelative(float x, float y)
在 frame 内部使用,这会强制视图滚动到给定位置。位置以请求大小的比例表示。
Element frame(Element)
允许元素显示在“虚拟”区域内。其大小可以 大于其容器。在这种情况下,只显示较小的部分。 视图是可滚动的,以使获得焦点的元素可见。

在文件 src/ftxui/dom/focus.cpp28 行定义.

◆ focusPosition()

Decorator focusPosition ( int x,
int y )

frame 内部使用,这会强制视图滚动到给定位置。位置以单元格数量表示。

示例

Element document = huge_document()
| focusPosition(10, 10)
| frame;
Decorator focusPosition(int x, int y)
在 frame 内部使用,这会强制视图滚动到给定位置。位置以单元格数量表示。

在文件 src/ftxui/dom/focus.cpp65 行定义.

◆ focus()

Element focus ( Element child)

child 设置为其同级元素中获得焦点的元素。

参数
child要获得焦点的元素。

在文件 frame.cpp100 行定义.

◆ focusCursorBlockBlinking()

Element focusCursorBlockBlinking ( Element child)

focus 相同,但将光标形状设置为闪烁块。

参见
focus
focusCursorBlock
focusCursorBlockBlinking
focusCursorBar
focusCursorBarBlinking
focusCursorUnderline
focusCursorUnderlineBlinking

在文件 frame.cpp159 行定义.

◆ focusCursorBar()

Element focusCursorBar ( Element child)

focus 相同,但将光标形状设置为静态竖线。

参见
focus
focusCursorBlock
focusCursorBlockBlinking
focusCursorBar
focusCursorBarBlinking
focusCursorUnderline
focusCursorUnderlineBlinking

在文件 frame.cpp173 行定义.

◆ focusCursorBarBlinking()

Element focusCursorBarBlinking ( Element child)

focus 相同,但将光标形状设置为闪烁竖线。

参见
focus
focusCursorBlock
focusCursorBlockBlinking
focusCursorBar
focusCursorBarBlinking
focusCursorUnderline
focusCursorUnderlineBlinking

在文件 frame.cpp187 行定义.

◆ focusCursorUnderline()

Element focusCursorUnderline ( Element child)

focus 相同,但将光标形状设置为静态下划线。

参见
focus
focusCursorBlock
focusCursorBlockBlinking
focusCursorBar
focusCursorBarBlinking
focusCursorUnderline
focusCursorUnderlineBlinking

在文件 frame.cpp201 行定义.

◆ focusCursorUnderlineBlinking()

Element focusCursorUnderlineBlinking ( Element child)

focus 相同,但将光标形状设置为闪烁下划线。

参见
focus
focusCursorBlock
focusCursorBlockBlinking
focusCursorBar
focusCursorBarBlinking
focusCursorUnderline
focusCursorUnderlineBlinking

在文件 frame.cpp215 行定义.

◆ gaugeDirection()

Element gaugeDirection ( float progress,
Direction direction )

绘制一个向指定方向推进的高清进度条。

参数
progress要填充区域的比例。范围在 [0,1] 之间。
direction进度条的推进方向。

在文件 src/ftxui/dom/gauge.cpp165 行定义.

◆ hyperlink() [1/2]

Element hyperlink ( std::string link,
Element child )

使渲染区域可通过网络浏览器点击。 当用户点击时,链接将被打开。 这仅在有限的终端模拟器中受支持。 列表:https://github.com/Alhadis/OSC8-Adoption/

参数
link链接
child输入元素。
返回
带有链接的输出元素。

示例

Element document =
hyperlink("https://github.com/ArthurSonzogni/FTXUI", "link");
Decorator hyperlink(std::string link)
使用超链接进行装饰。 当用户点击时,链接将被打开。 这仅在有限的终端模拟器中受支持。 列表:https://github.com/Alhadis/OSC8-Adoption/

在文件 hyperlink.cpp50 行定义.

◆ hyperlink() [2/2]

Decorator hyperlink ( std::string link)

使用超链接进行装饰。 当用户点击时,链接将被打开。 这仅在有限的终端模拟器中受支持。 列表:https://github.com/Alhadis/OSC8-Adoption/

参数
link重定向用户到的链接。
返回
应用超链接的 Decorator。

示例

Element document =
text("red") | hyperlink("https://github.com/Arthursonzogni/FTXUI");

在文件 hyperlink.cpp69 行定义.

◆ inverted()

Element inverted ( Element child)

添加一个过滤器,用于反转前景色和背景色。

在文件 inverted.cpp33 行定义.

◆ italic()

Element italic ( Element child)

对文本应用双下划线。

在文件 italic.cpp17 行定义.

◆ color() [3/4]

Element color ( const LinearGradient & gradient,
Element child )

使用线性渐变效果设置元素的前景色。

参数
gradient应用于输出元素的渐变效果。
child输入元素。
返回
已着色的输出元素。

示例

color(LinearGradient{0, {Color::Red, Color::Blue}}, text("Hello"))
Element color(const LinearGradient &gradient, Element child)
使用线性渐变效果设置元素的前景色。
示例
examples/component/flexbox_gallery.cpp, examples/component/homescreen.cpp, examples/component/input_style.cpp, examples/component/maybe.cpp, examples/component/menu_entries.cpp, examples/component/menu_style.cpp, examples/component/renderer.cpp, examples/dom/border_colored.cpp, examples/dom/color_gallery.cpp, examples/dom/color_truecolor_HSV.cpp, examples/dom/graph.cpp, examples/dom/html_like.cpp, examples/dom/package_manager.cpp, examples/dom/style_color.cpp, examples/dom/style_gallery.cpp , 以及 examples/dom/table.cpp.

在文件 src/ftxui/dom/linear_gradient.cpp239 行定义.

◆ bgcolor() [3/4]

Element bgcolor ( const LinearGradient & gradient,
Element child )

◆ color() [4/4]

Decorator color ( const LinearGradient & gradient)

使用线性渐变效果装饰前景色。

参数
gradient应用于输出元素的渐变效果。
返回
应用颜色的装饰器。

示例

text("Hello") | color(LinearGradient{0, {Color::Red, Color::Blue}})

在文件 src/ftxui/dom/linear_gradient.cpp270 行定义.

◆ bgcolor() [4/4]

Decorator bgcolor ( const LinearGradient & gradient)

使用线性渐变效果装饰背景色。

参数
gradient应用于输出元素的渐变效果。
返回
应用颜色的装饰器。

示例

text("Hello") | color(LinearGradient{0, {Color::Red, Color::Blue}})

在文件 src/ftxui/dom/linear_gradient.cpp285 行定义.

◆ Render() [1/2]

void Render ( Screen & screen,
const Element & element )

ftxui::Screen 上显示元素。

在文件 node.cpp84 行定义.

◆ Render() [2/2]

void Render ( Screen & screen,
Node * node )

ftxui::Screen 上显示元素。

在文件 node.cpp91 行定义.

◆ paragraph()

Element paragraph ( const std::string & the_text)

返回一个在多行上绘制段落的元素。

参见
flexbox.

在文件 src/ftxui/dom/paragraph.cpp41 行定义.

◆ paragraphAlignLeft()

Element paragraphAlignLeft ( const std::string & the_text)

返回一个在多行上绘制段落并左对齐的元素。

参见
flexbox.

在文件 src/ftxui/dom/paragraph.cpp48 行定义.

◆ paragraphAlignRight()

Element paragraphAlignRight ( const std::string & the_text)

返回一个在多行上绘制段落并右对齐的元素。

参见
flexbox.

在文件 src/ftxui/dom/paragraph.cpp58 行定义.

◆ paragraphAlignCenter()

Element paragraphAlignCenter ( const std::string & the_text)

返回一个在多行上绘制段落并居中对齐的元素。

参见
flexbox.

在文件 src/ftxui/dom/paragraph.cpp69 行定义.

◆ paragraphAlignJustify()

Element paragraphAlignJustify ( const std::string & the_text)

返回一个在多行上绘制段落并使用两端对齐方式的元素。 居中对齐。

参见
flexbox.

在文件 src/ftxui/dom/paragraph.cpp81 行定义.

◆ vscroll_indicator()

Element vscroll_indicator ( Element child)

在右侧显示一个垂直滚动条。 颜色跟随内容。

在文件 scroll_indicator.cpp21 行定义.

◆ hscroll_indicator()

Element hscroll_indicator ( Element child)

在底部显示一个水平滚动条。 颜色跟随内容。

在文件 scroll_indicator.cpp76 行定义.

◆ separator() [1/2]

Element separator ( )

在两个其他元素之间绘制垂直或水平分隔线。

参见
separator
separatorLight
separatorDashed
separatorDouble
separatorHeavy
separatorEmpty
separatorRounded
separatorStyled
separatorCharacter

在两个元素之间添加视觉分隔。

示例

// 将“border”用作函数...
Element document = vbox({
text("up"),
text("down"),
});
Element separator()
在两个其他元素之间绘制垂直或水平分隔线。
Element vbox(Elements)
垂直一个接一个显示元素的容器。

输出

up
────
down

在文件 src/ftxui/dom/separator.cpp132 行定义.

◆ separatorStyled()

Element separatorStyled ( BorderStyle style)

在两个其他元素之间绘制垂直或水平分隔线。

参数
style分隔线的样式。
参见
separator
separatorLight
separatorDashed
separatorDouble
separatorHeavy
separatorEmpty
separatorRounded
separatorStyled
separatorCharacter

在两个元素之间添加视觉分隔。

示例

// 将“border”用作函数...
Element document = vbox({
text("up"),
text("down"),
});
Element separatorStyled(BorderStyle)
在两个其他元素之间绘制垂直或水平分隔线。

输出

up
════
down

在文件 src/ftxui/dom/separator.cpp169 行定义.

◆ separatorLight()

Element separatorLight ( )

使用 LIGHT 样式在两个其他元素之间绘制垂直或水平分隔线。

参见
separator
separatorLight
separatorDashed
separatorDouble
separatorHeavy
separatorEmpty
separatorRounded
separatorStyled
separatorCharacter

在两个元素之间添加视觉分隔。

示例

// 将“border”用作函数...
Element document = vbox({
text("up"),
text("down"),
});
Element separatorLight()
使用 LIGHT 样式在两个其他元素之间绘制垂直或水平分隔线。

输出

up
────
down

在文件 src/ftxui/dom/separator.cpp205 行定义.

◆ separatorDashed()

Element separatorDashed ( )

使用 DASHED 样式在两个其他元素之间绘制垂直或水平分隔线。

参见
separator
separatorLight
separatorDashed
separatorDouble
separatorHeavy
separatorEmpty
separatorRounded
separatorStyled
separatorCharacter

在两个元素之间添加视觉分隔。

示例

// 将“border”用作函数...
Element document = vbox({
text("up"),
text("down"),
});

输出

up
╍╍╍╍
down

在文件 src/ftxui/dom/separator.cpp241 行定义.

◆ separatorHeavy()

Element separatorHeavy ( )

使用 HEAVY 样式在两个其他元素之间绘制垂直或水平分隔线。

参见
separator
separatorLight
separatorDashed
separatorDouble
separatorHeavy
separatorEmpty
separatorRounded
separatorStyled
separatorCharacter

在两个元素之间添加视觉分隔。

示例

// 将“border”用作函数...
Element document = vbox({
text("up"),
text("down"),
});
Element separatorHeavy()
使用 HEAVY 样式在两个其他元素之间绘制垂直或水平分隔线。

输出

up
━━━━
down

在文件 src/ftxui/dom/separator.cpp277 行定义.

◆ separatorDouble()

Element separatorDouble ( )

使用 DOUBLE 样式在两个其他元素之间绘制垂直或水平分隔线。

参见
separator
separatorLight
separatorDashed
separatorDouble
separatorHeavy
separatorEmpty
separatorRounded
separatorStyled
separatorCharacter

在两个元素之间添加视觉分隔。

示例

// 将“border”用作函数...
Element document = vbox({
text("up"),
text("down"),
});
Element separatorDouble()
使用 DOUBLE 样式在两个其他元素之间绘制垂直或水平分隔线。

输出

up
════
down

在文件 src/ftxui/dom/separator.cpp313 行定义.

◆ separatorEmpty()

Element separatorEmpty ( )

使用 EMPTY 样式在两个其他元素之间绘制垂直或水平分隔线。

参见
separator
separatorLight
separatorDashed
separatorDouble
separatorHeavy
separatorEmpty
separatorRounded
separatorStyled
separatorCharacter

在两个元素之间添加视觉分隔。

示例

// 将“border”用作函数...
Element document = vbox({
text("up"),
text("down"),
});

输出

up
down

在文件 src/ftxui/dom/separator.cpp349 行定义.

◆ separatorCharacter()

Element separatorCharacter ( std::string value)

在两个其他元素之间绘制垂直或水平分隔线。

参数
value用于填充分隔区域的字符。
参见
separator
separatorLight
separatorDashed
separatorDouble
separatorHeavy
separatorEmpty
separatorRounded
separatorStyled
separatorCharacter

在两个元素之间添加视觉分隔。

示例

// 将“border”用作函数...
Element document = vbox({
text("up"),
text("down"),
});

输出

up
────
down

在文件 src/ftxui/dom/separator.cpp386 行定义.

◆ separator() [2/2]

Element separator ( Pixel pixel)

在两个元素之间绘制用给定像素填充的分隔线。

参见
separator
separatorLight
separatorDashed
separatorHeavy
separatorDouble
separatorStyled

示例

Pixel empty;
Element document = vbox({
text("Up"),
separator(empty),
text("Down"),
})
一个 Unicode 字符及其相关样式。

输出

Up
Down

在文件 src/ftxui/dom/separator.cpp417 行定义.

◆ size()

Decorator size ( WidthOrHeight direction,
Constraint constraint,
int value )

对元素大小应用约束。

参数
direction元素的宽度 WIDTH 或高度 HEIGHT 是否必须受到约束。 约束。
constraint约束的类型。
value值。

在文件 src/ftxui/dom/size.cpp89 行定义.

◆ spinner()

Element spinner ( int charset_index,
size_t image_index )

用于表示时间或事件的效果。这显示了一个 ASCII 艺术“视频”。

参数
charset_index“视频”的类型。
image_index“视频”的“帧”。您需要为每个“步”增加此值。

在文件 src/ftxui/dom/spinner.cpp279 行定义.

◆ strikethrough()

Element strikethrough ( Element child)

对文本应用删除线。

在文件 strikethrough.cpp17 行定义.

◆ text() [1/2]

Element text ( std::string text)

显示一段UTF8编码的Unicode文本。

参见
ftxui::to_wstring

示例

Element document = text("Hello world!");

输出

Hello world!

在文件 text.cpp141 行定义.

◆ text() [2/2]

Element text ( std::wstring text)

显示一段Unicode文本。

参见
ftxui::to_wstring

示例

Element document = text(L"Hello world!");

输出

Hello world!

在文件 text.cpp160 行定义.

◆ vtext() [1/2]

Element vtext ( std::string text)

垂直显示一段Unicode文本。

参见
ftxui::to_wstring

示例

Element document = vtext("Hello world!");
Element vtext(std::wstring text)
垂直显示一段Unicode文本。

输出

H
e
l
l
o
w
o
r
l
d
!

在文件 text.cpp190 行定义.

◆ vtext() [2/2]

Element vtext ( std::wstring text)

垂直显示一段Unicode文本。

参见
ftxui::to_wstring

示例

Element document = vtext(L"Hello world!");

输出

H
e
l
l
o
w
o
r
l
d
!

在文件 text.cpp220 行定义.

◆ underlined()

Element underlined ( Element child)

给定元素加下划线。

在文件 underlined.cpp33 行定义.

◆ underlinedDouble()

Element underlinedDouble ( Element child)

对文本应用双下划线。

在文件 underlined_double.cpp17 行定义.

◆ nothing()

Element nothing ( Element element)

一个什么都不做的装饰器。

在文件 dom/util.cpp28 行定义.

◆ operator|() [1/3]

Decorator operator| ( Decorator a,
Decorator b )

将两个装饰器组合成一个。

示例

auto decorator = bold | blink;
Element blink(Element)
绘制的文本在可见和隐藏之间交替。

在文件 dom/util.cpp40 行定义.

◆ operator|() [2/3]

Elements operator| ( Elements elements,
Decorator decorator )

从一组元素中,对每个元素应用一个装饰器。

返回
装饰后的元素集。

在文件 dom/util.cpp48 行定义.

◆ operator|() [3/3]

Element operator| ( Element element,
Decorator decorator )

从一个元素中,应用一个装饰器。

返回
装饰后的元素。

示例

以下两者等效:

bold(text("Hello"));
Element bold(Element)
使用粗体字体,用于强调元素。
text("Hello") | bold;

在文件 dom/util.cpp70 行定义.

◆ operator|=()

Element & operator|= ( Element & e,
Decorator d )

对元素应用一个装饰器。

返回
装饰后的元素。

示例

以下两者等效:

auto element = text("Hello");
element |= bold;

在文件 dom/util.cpp85 行定义.

◆ emptyElement()

Element emptyElement ( )

一个大小为 0x0 且不绘制任何内容的元素。

在文件 dom/util.cpp140 行定义.

◆ vbox()

Element vbox ( Elements children)

垂直一个接一个显示元素的容器。

参数
children容器中的元素
返回
容器。

示例

text("Up"),
text("Down"),
});

在文件 vbox.cpp96 行定义.

◆ SetColorSupport()

void SetColorSupport ( Color color)

在自动检测失败时覆盖终端颜色支持

在文件 terminal.cpp133 行定义.