Loading...
Searching...
No Matches
requirement.hpp
Go to the documentation of this file.
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#ifndef FTXUI_DOM_REQUIREMENT_HPP
#define FTXUI_DOM_REQUIREMENT_HPP
#include "ftxui/screen/box.hpp"
#include "ftxui/screen/screen.hpp"
namespace ftxui {
class Node;
struct Requirement {
// The required size to fully draw the element.
int min_x = 0;
int min_y = 0;
// How much flexibility is given to the component.
int flex_grow_x = 0;
int flex_grow_y = 0;
int flex_shrink_x = 0;
int flex_shrink_y = 0;
// Focus management to support the frame/focus/select element.
struct Focused {
bool enabled = false;
Box box;
Node* node = nullptr;
Screen::Cursor::Shape cursor_shape = Screen::Cursor::Shape::Hidden;
// Internal for interactions with components.
bool component_active = false;
// Return whether this requirement should be preferred over the other.
bool Prefer(const Focused& other) const {
if (!other.enabled) {
return false;
}
if (!enabled) {
return true;
}
return other.component_active && !component_active;
}
};
Focused focused;
};
} // namespace ftxui
#endif // FTXUI_DOM_REQUIREMENT_HPP
box.hpp
ftxui::Node
Definition node.hpp:23
ftxui
Definition animation.hpp:10
ftxui::Requirement::flex_grow_y
int flex_grow_y
Definition requirement.hpp:20
ftxui::Requirement::min_y
int min_y
Definition requirement.hpp:16
ftxui::Requirement::flex_grow_x
int flex_grow_x
Definition requirement.hpp:19
ftxui::Requirement::min_x
int min_x
Definition requirement.hpp:15
ftxui::Requirement::focused
Focused focused
Definition requirement.hpp:46
ftxui::Requirement::flex_shrink_y
int flex_shrink_y
Definition requirement.hpp:22
ftxui::Requirement::flex_shrink_x
int flex_shrink_x
Definition requirement.hpp:21
ftxui::Requirement
Definition requirement.hpp:13
screen.hpp
ftxui::Box
Definition box.hpp:9
ftxui::Requirement::Focused
Definition requirement.hpp:25
ftxui::Requirement::Focused::cursor_shape
Screen::Cursor::Shape cursor_shape
Definition requirement.hpp:29
ftxui::Requirement::Focused::enabled
bool enabled
Definition requirement.hpp:26
ftxui::Requirement::Focused::Prefer
bool Prefer(const Focused &other) const
Definition requirement.hpp:35
ftxui::Requirement::Focused::box
Box box
Definition requirement.hpp:27
ftxui::Requirement::Focused::node
Node * node
Definition requirement.hpp:28
ftxui::Requirement::Focused::component_active
bool component_active
Definition requirement.hpp:32
ftxui::Screen::Cursor::Shape
Shape
Definition screen.hpp:52
ftxui::Screen::Cursor::Hidden
@ Hidden
Definition screen.hpp:53