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// 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 is a structure that defines the layout requirements for a
14/// Node in the terminal user interface.
15///
16/// It specifies the minimum size required to fully draw the element,
17/// @ingroup dom
19 // The required size to fully draw the element.
20 int min_x = 0;
21 int min_y = 0;
22
23 // How much flexibility is given to the component.
24 int flex_grow_x = 0;
25 int flex_grow_y = 0;
28
29 // Focus management to support the frame/focus/select element.
30 struct Focused {
31 bool enabled = false;
33 Node* node = nullptr;
35
36 // Internal for interactions with components.
37 bool component_active = false;
38
39 // Return whether this requirement should be preferred over the other.
40 bool Prefer(const Focused& other) const {
41 if (!other.enabled) {
42 return false;
43 }
44 if (!enabled) {
45 return true;
46 }
47
48 return other.component_active && !component_active;
49 }
50 };
52};
53
54} // namespace ftxui
55
56#endif // FTXUI_DOM_REQUIREMENT_HPP
Node is the base class for all elements in the DOM tree.
Definition node.hpp:37
Requirement is a structure that defines the layout requirements for a Node in the terminal user inter...
Box is a structure that represents a rectangular area in a 2D space.
Definition box.hpp:16
The FTXUI ftxui:: namespace.
Definition animation.hpp:10
Screen::Cursor::Shape cursor_shape
bool Prefer(const Focused &other) const