Loading...
Searching...
No Matches
flexbox_helper.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_FLEXBOX_HELPER_HPP
#define FTXUI_DOM_FLEXBOX_HELPER_HPP
#include <vector>
#include "ftxui/dom/flexbox_config.hpp"
namespace ftxui::flexbox_helper {
// A block is a rectangle in the flexbox.
struct Block {
// Input:
int min_size_x = 0;
int min_size_y = 0;
int flex_grow_x = 0;
int flex_grow_y = 0;
int flex_shrink_x = 0;
int flex_shrink_y = 0;
// Output:
int line{};
int line_position{};
int x = 0;
int y = 0;
int dim_x = 0;
int dim_y = 0;
bool overflow = false;
};
// A line is a row of blocks.
struct Line {
std::vector<Block*> blocks;
int x = 0;
int y = 0;
int dim_x = 0;
int dim_y = 0;
};
struct Global {
std::vector<Block> blocks;
std::vector<Line> lines;
FlexboxConfig config;
int size_x;
int size_y;
};
void Compute(Global& global);
} // namespace ftxui::flexbox_helper
#endif /* end of include guard: FTXUI_DOM_FLEXBOX_HELPER_HPP*/
flexbox_config.hpp
ftxui::flexbox_helper
Definition flexbox_helper.cpp:14
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::Global::size_y
int size_y
Definition flexbox_helper.hpp:46
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::Global::lines
std::vector< Line > lines
Definition flexbox_helper.hpp:43
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::Compute
void Compute(Global &global)
Definition flexbox_helper.cpp:369
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::Global::blocks
std::vector< Block > blocks
Definition flexbox_helper.hpp:42
ftxui::flexbox_helper::Line::blocks
std::vector< Block * > blocks
Definition flexbox_helper.hpp:34
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::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::Block
Definition flexbox_helper.hpp:13
ftxui::flexbox_helper::Global
Definition flexbox_helper.hpp:41
ftxui::flexbox_helper::Line
Definition flexbox_helper.hpp:33
ftxui::FlexboxConfig
Definition flexbox_config.hpp:15