FTXUI 7.0.3
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// 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
10
11namespace ftxui {
12class Node;
13
14/// @brief Requirementは、ターミナルユーザーインターフェースにおけるNodeのレイアウト要件を定義する構造体です。
15///
16/// 要素を完全に描画するために必要な最小サイズを指定します。
17/// @ingroup dom
18struct FTXUI_EXPORT(DOM) Requirement {
19 // 要素を完全に描画するために必要なサイズ。
20 int min_x = 0;
21 int min_y = 0;
22
23 // コンポーネントにどれだけの柔軟性が与えられるか。
24 int flex_grow_x = 0;
25 int flex_grow_y = 0;
26 int flex_shrink_x = 0;
27 int flex_shrink_y = 0;
28
29 // フレーム/フォーカス/選択要素をサポートするためのフォーカス管理。
30 struct Focused {
31 bool enabled = false;
32 Box box;
33 Node* node = nullptr;
34 Screen::Cursor::Shape cursor_shape = Screen::Cursor::Shape::Hidden;
35
36 // コンポーネントとのやり取りのための内部用。
37 bool component_active = false;
38 bool component_focused = false;
39
40 // この要件が他のものより優先されるべきかどうかを返します。
41 bool Prefer(const Focused& other) const {
42 if (!other.enabled) {
43 return false;
44 }
45 if (!enabled) {
46 return true;
47 }
48 if (other.component_focused != component_focused) {
49 return other.component_focused;
50 }
51
52 return other.component_active && !component_active;
53 }
54 };
55 Focused focused;
56};
57
58} // namespace ftxui
59
60#endif // FTXUI_DOM_REQUIREMENT_HPP
FTXUI ftxui::名前空間
Definition animation.hpp:11
Node * node
Definition node.hpp:95