FTXUI  6.0.2
C++ functional terminal UI.
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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>
9
10namespace ftxui::flexbox_helper {
11
12// A block is a rectangle in the flexbox.
13struct 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;
21
22 // Output:
23 int line{};
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.
33struct 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
41struct Global {
42 std::vector<Block> blocks;
43 std::vector<Line> lines;
45 int size_x;
46 int size_y;
47};
48
49void Compute(Global& global);
50
51} // namespace ftxui::flexbox_helper
52
53#endif /* end of include guard: FTXUI_DOM_FLEXBOX_HELPER_HPP*/
void Compute(Global &global)
std::vector< Block * > blocks
std::shared_ptr< T > Make(Args &&... args)
Definition component.hpp:26