FTXUI  6.0.2
C++ functional terminal UI.
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
14 // The required size to fully draw the element.
15 int min_x = 0;
16 int min_y = 0;
17
18 // How much flexibility is given to the component.
19 int flex_grow_x = 0;
20 int flex_grow_y = 0;
23
24 // Focus management to support the frame/focus/select element.
25 struct Focused {
26 bool enabled = false;
28 Node* node = nullptr;
30
31 // Internal for interactions with components.
32 bool component_active = false;
33
34 // Return whether this requirement should be preferred over the other.
35 bool Prefer(const Focused& other) const {
36 if (!other.enabled) {
37 return false;
38 }
39 if (!enabled) {
40 return true;
41 }
42
43 return other.component_active && !component_active;
44 }
45 };
47};
48
49} // namespace ftxui
50
51#endif // FTXUI_DOM_REQUIREMENT_HPP
std::shared_ptr< T > Make(Args &&... args)
Definition component.hpp:26
Screen::Cursor::Shape cursor_shape
bool Prefer(const Focused &other) const