FTXUI 6.1.9 C++ functional terminal UI.

Loading...
Searching...
No Matches
flexbox_helper.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_FLEXBOX_HELPER_HPP
5#define FTXUI_DOM_FLEXBOX_HELPER_HPP
6
7#include <vector>
8#include "ftxui/dom/flexbox_config.hpp"
9
10 namespace ftxui::flexbox_helper {
11
12// A block is a rectangle in the flexbox.
13 struct Block {
14 // Input:
15 int min_size_x = 0;
16 int min_size_y = 0;
17 int flex_grow_x = 0;
18 int flex_grow_y = 0;
19 int flex_shrink_x = 0;
20 int flex_shrink_y = 0;
21
22 // Output:
23 int line{};
24 int line_position{};
25 int x = 0;
26 int y = 0;
27 int dim_x = 0;
28 int dim_y = 0;
29 bool overflow = false;
30};
31
32// A line is a row of blocks.
33 struct Line {
34 std::vector<Block*> blocks;
35 int x = 0;
36 int y = 0;
37 int dim_x = 0;
38 int dim_y = 0;
39};
40
41 struct Global {
42 std::vector<Block> blocks;
43 std::vector<Line> lines;
44 FlexboxConfig config;
45 int size_x;
46 int size_y;
47};
48
49 void Compute(Global& global);
50
51} // namespace ftxui::flexbox_helper
52
53#endif /* end of include guard: FTXUI_DOM_FLEXBOX_HELPER_HPP*/
flexbox_config.hpp
ftxui::FlexboxConfig
FlexboxConfig is a configuration structure that defines the layout properties for a flexbox container...
Definition flexbox_config.hpp:27
ftxui::flexbox_helper
Definition flexbox_helper.cpp:14
ftxui::flexbox_helper::Compute
void Compute(Global &global)
Definition flexbox_helper.cpp:369
ftxui::flexbox_helper::Block
Definition flexbox_helper.hpp:13
ftxui::flexbox_helper::Block::y
int y
Definition flexbox_helper.hpp:26
ftxui::flexbox_helper::Block::flex_grow_y
int flex_grow_y
Definition flexbox_helper.hpp:18
ftxui::flexbox_helper::Block::min_size_y
int min_size_y
Definition flexbox_helper.hpp:16
ftxui::flexbox_helper::Block::line
int line
Definition flexbox_helper.hpp:23
ftxui::flexbox_helper::Block::overflow
bool overflow
Definition flexbox_helper.hpp:29
ftxui::flexbox_helper::Block::x
int x
Definition flexbox_helper.hpp:25
ftxui::flexbox_helper::Block::dim_x
int dim_x
Definition flexbox_helper.hpp:27
ftxui::flexbox_helper::Block::flex_grow_x
int flex_grow_x
Definition flexbox_helper.hpp:17
ftxui::flexbox_helper::Block::line_position
int line_position
Definition flexbox_helper.hpp:24
ftxui::flexbox_helper::Block::flex_shrink_y
int flex_shrink_y
Definition flexbox_helper.hpp:20
ftxui::flexbox_helper::Block::min_size_x
int min_size_x
Definition flexbox_helper.hpp:15
ftxui::flexbox_helper::Block::dim_y
int dim_y
Definition flexbox_helper.hpp:28
ftxui::flexbox_helper::Block::flex_shrink_x
int flex_shrink_x
Definition flexbox_helper.hpp:19
ftxui::flexbox_helper::Global
Definition flexbox_helper.hpp:41
ftxui::flexbox_helper::Global::size_y
int size_y
Definition flexbox_helper.hpp:46
ftxui::flexbox_helper::Global::lines
std::vector< Line > lines
Definition flexbox_helper.hpp:43
ftxui::flexbox_helper::Global::blocks
std::vector< Block > blocks
Definition flexbox_helper.hpp:42
ftxui::flexbox_helper::Global::config
FlexboxConfig config
Definition flexbox_helper.hpp:44
ftxui::flexbox_helper::Global::size_x
int size_x
Definition flexbox_helper.hpp:45
ftxui::flexbox_helper::Line
Definition flexbox_helper.hpp:33
ftxui::flexbox_helper::Line::y
int y
Definition flexbox_helper.hpp:36
ftxui::flexbox_helper::Line::x
int x
Definition flexbox_helper.hpp:35
ftxui::flexbox_helper::Line::dim_x
int dim_x
Definition flexbox_helper.hpp:37
ftxui::flexbox_helper::Line::blocks
std::vector< Block * > blocks
Definition flexbox_helper.hpp:34
ftxui::flexbox_helper::Line::dim_y
int dim_y
Definition flexbox_helper.hpp:38