FTXUI
6.1.9
C++ functional terminal UI.
载入中...
搜索中...
未找到
requirement.hpp
浏览该文件的文档.
1
// Copyright 2020 Arthur Sonzogni. All rights reserved.
2
// Use of this source code is governed by the MIT license that can be found in
3
// the LICENSE file.
4
#ifndef FTXUI_DOM_REQUIREMENT_HPP
5
#define FTXUI_DOM_REQUIREMENT_HPP
6
7
#include "
ftxui/screen/box.hpp
"
8
#include "
ftxui/screen/screen.hpp
"
9
10
namespace
ftxui
{
11
class
Node;
12
13
/// @brief Requirement 是一个结构体,用于定义终端用户界面中 Node 的布局要求。
14
///
15
/// 它指定了完整绘制元素所需的最小尺寸,
16
/// @ingroup dom
17
struct
Requirement
{
18
// 完整绘制元素所需的尺寸。
19
int
min_x
= 0;
20
int
min_y
= 0;
21
22
// 赋予组件的灵活性。
23
int
flex_grow_x
= 0;
24
int
flex_grow_y
= 0;
25
int
flex_shrink_x
= 0;
26
int
flex_shrink_y
= 0;
27
28
// 焦点管理以支持 frame/focus/select 元素。
29
struct
Focused
{
30
bool
enabled
=
false
;
31
Box
box
;
32
Node
*
node
=
nullptr
;
33
Screen::Cursor::Shape
cursor_shape
=
Screen::Cursor::Shape::Hidden
;
34
35
// 用于与组件交互的内部变量。
36
bool
component_active
=
false
;
37
38
// 返回此要求是否应优先于另一个要求。
39
bool
Prefer
(
const
Focused
& other)
const
{
40
if
(!other.
enabled
) {
41
return
false
;
42
}
43
if
(!
enabled
) {
44
return
true
;
45
}
46
47
return
other.
component_active
&& !
component_active
;
48
}
49
};
50
Focused
focused
;
51
};
52
53
}
// namespace ftxui
54
55
#endif
// FTXUI_DOM_REQUIREMENT_HPP
box.hpp
ftxui::Requirement::flex_grow_y
int flex_grow_y
定义
requirement.hpp:24
ftxui::Requirement::min_y
int min_y
定义
requirement.hpp:20
ftxui::Requirement::flex_grow_x
int flex_grow_x
定义
requirement.hpp:23
ftxui::Requirement::min_x
int min_x
定义
requirement.hpp:19
ftxui::Requirement::focused
Focused focused
定义
requirement.hpp:50
ftxui::Requirement::flex_shrink_y
int flex_shrink_y
定义
requirement.hpp:26
ftxui::Requirement::flex_shrink_x
int flex_shrink_x
定义
requirement.hpp:25
ftxui::Node
Node 是 DOM 树中所有元素的基类。
定义
node.hpp:33
ftxui::Requirement
Requirement 是一个结构体,用于定义终端用户界面中 Node 的布局要求。
定义
requirement.hpp:17
ftxui::Box
Box是一个表示2D空间中矩形区域的结构体。
定义
box.hpp:15
ftxui
#include "ftxui/component/component_base.hpp" // 用于 ComponentBase
定义
animation.hpp:9
screen.hpp
ftxui::Requirement::Focused
定义
requirement.hpp:29
ftxui::Requirement::Focused::cursor_shape
Screen::Cursor::Shape cursor_shape
定义
requirement.hpp:33
ftxui::Requirement::Focused::enabled
bool enabled
定义
requirement.hpp:30
ftxui::Requirement::Focused::Prefer
bool Prefer(const Focused &other) const
定义
requirement.hpp:39
ftxui::Requirement::Focused::box
Box box
定义
requirement.hpp:31
ftxui::Requirement::Focused::node
Node * node
定义
requirement.hpp:32
ftxui::Requirement::Focused::component_active
bool component_active
定义
requirement.hpp:36
ftxui::Screen::Cursor::Shape
Shape
定义
screen.hpp:54
ftxui::Screen::Cursor::Hidden
@ Hidden
定义
screen.hpp:55