FTXUI 6.1.9
C++ functional terminal UI.
载入中...
搜索中...
未找到
flexbox_helper.hpp
浏览该文件的文档.
1// Copyright 2020 Arthur Sonzogni. All rights reserved.
2// 本源代码的使用受可在 LICENSE 文件中找到的 MIT 许可协议的约束。
3#ifndef FTXUI_DOM_FLEXBOX_HELPER_HPP
4#define FTXUI_DOM_FLEXBOX_HELPER_HPP
5
6#include <vector>
8
9namespace ftxui::flexbox_helper {
10
11// 块是flexbox中的一个矩形。
12struct Block {
13 // 输入:
14 int min_size_x = 0;
15 int min_size_y = 0;
16 int flex_grow_x = 0;
17 int flex_grow_y = 0;
20
21 // 输出:
22 int line{};
24 int x = 0;
25 int y = 0;
26 int dim_x = 0;
27 int dim_y = 0;
28 bool overflow = false;
29};
30
31// 行是块的行。
32struct Line {
33 std::vector<Block*> blocks;
34 int x = 0;
35 int y = 0;
36 int dim_x = 0;
37 int dim_y = 0;
38};
39
40struct Global {
41 std::vector<Block> blocks;
42 std::vector<Line> lines;
44 int size_x;
45 int size_y;
46};
47
48void Compute(Global& global);
49
50} // namespace ftxui::flexbox_helper
51
52#endif /* include guard 结束: FTXUI_DOM_FLEXBOX_HELPER_HPP*/
FlexboxConfig 是一个配置结构体,定义了弹性盒子容器的布局属性。
void Compute(Global &global)