FTXUI 6.1.9
C++ functional terminal UI.
Loading...
Searching...
No Matches
requirement.hpp
Go to the documentation of this file.
1// Copyright 2020 Arthur Sonzogni. All rights reserved.
2// 本原始碼受 MIT 授權條款保護,詳情請參閱 LICENSE 檔案。
3#ifndef FTXUI_DOM_REQUIREMENT_HPP
4#define FTXUI_DOM_REQUIREMENT_HPP
5
8
9namespace ftxui {
10class Node;
11
12/// @brief Requirement 是一個結構,定義了終端使用者介面中節點的佈局要求。
13///
14/// 它指定了完全繪製元素所需的最小尺寸。
15/// @ingroup dom
17 // 完全繪製元素所需的尺寸。
18 int min_x = 0;
19 int min_y = 0;
20
21 // 元件的彈性程度。
22 int flex_grow_x = 0;
23 int flex_grow_y = 0;
26
27 // 焦點管理,支援frame/focus/select元素。
28 struct Focused {
29 bool enabled = false;
31 Node* node = nullptr;
33
34 // 內部用於與元件互動。
35 bool component_active = false;
36
37 // 返回此需求是否應優先於另一個。
38 bool Prefer(const Focused& other) const {
39 if (!other.enabled) {
40 return false;
41 }
42 if (!enabled) {
43 return true;
44 }
45
46 return other.component_active && !component_active;
47 }
48 };
50};
51
52} // namespace ftxui
53
54#endif // FTXUI_DOM_REQUIREMENT_HPP
節點是DOM樹中所有元素的基底類別。
Definition node.hpp:34
Requirement 是一個結構,定義了終端使用者介面中節點的佈局要求。
Box 是一個表示二維空間中矩形區域的結構。
Definition box.hpp:14
FTXUI 的 ftxui:: 命名空間
Definition animation.hpp:10
Screen::Cursor::Shape cursor_shape
bool Prefer(const Focused &other) const