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
9
10namespace ftxui {
11class Node;
12
13/// @brief Requirement 是一个结构体,用于定义终端用户界面中 Node 的布局要求。
14///
15/// 它指定了完整绘制元素所需的最小尺寸,
16/// @ingroup dom
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;
27
28 // 焦点管理以支持 frame/focus/select 元素。
29 struct Focused {
30 bool enabled = false;
32 Node* node = nullptr;
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 };
51};
52
53} // namespace ftxui
54
55#endif // FTXUI_DOM_REQUIREMENT_HPP
Node 是 DOM 树中所有元素的基类。
Requirement 是一个结构体,用于定义终端用户界面中 Node 的布局要求。
Box是一个表示2D空间中矩形区域的结构体。
定义 box.hpp:15
#include "ftxui/component/component_base.hpp" // 用于 ComponentBase
Screen::Cursor::Shape cursor_shape
bool Prefer(const Focused &other) const