22 int direction_index = 0;
24 int justify_content_index = 0;
25 int align_items_index = 0;
26 int align_content_index = 0;
28 std::vector<std::string> directions = {
35 std::vector<std::string> wraps = {
41 std::vector<std::string> justify_content = {
42 "FlexStart",
"FlexEnd",
"Center",
"Stretch",
43 "SpaceBetween",
"SpaceAround",
"SpaceEvenly",
46 std::vector<std::string> align_items = {
53 std::vector<std::string> align_content = {
54 "FlexStart",
"FlexEnd",
"Center",
"Stretch",
55 "SpaceBetween",
"SpaceAround",
"SpaceEvenly",
58 auto radiobox_direction =
Radiobox(&directions, &direction_index);
59 auto radiobox_wrap =
Radiobox(&wraps, &wrap_index);
60 auto radiobox_justify_content =
61 Radiobox(&justify_content, &justify_content_index);
62 auto radiobox_align_items =
Radiobox(&align_items, &align_items_index);
63 auto radiobox_align_content =
Radiobox(&align_content, &align_content_index);
65 bool element_xflex_grow =
false;
66 bool element_yflex_grow =
false;
67 bool group_xflex_grow =
true;
68 bool group_yflex_grow =
true;
69 auto checkbox_element_xflex_grow =
70 Checkbox(
"element |= xflex_grow", &element_xflex_grow);
71 auto checkbox_element_yflex_grow =
72 Checkbox(
"element |= yflex_grow", &element_yflex_grow);
73 auto checkbox_group_xflex_grow =
74 Checkbox(
"group |= xflex_grow", &group_xflex_grow);
75 auto checkbox_group_yflex_grow =
76 Checkbox(
"group |= yflex_grow", &group_yflex_grow);
78 auto make_box = [&](
size_t dimx,
size_t dimy,
size_t index) {
79 std::string
title = std::to_string(dimx) +
"x" + std::to_string(dimy);
81 text(std::to_string(index)) | hcenter | dim) |
85 if (element_xflex_grow) {
88 if (element_yflex_grow) {
94 auto content_renderer =
Renderer([&] {
124 if (!group_xflex_grow) {
127 if (!group_yflex_grow) {
131 group = group |
flex;
138 int space_right = 10;
139 int space_bottom = 1;
142 content_renderer, &space_right);
145 content_renderer, &space_bottom);
148 Container::Horizontal({
151 Container::Vertical({
152 checkbox_element_xflex_grow,
153 checkbox_element_yflex_grow,
154 checkbox_group_xflex_grow,
155 checkbox_group_yflex_grow,
158 Container::Horizontal({
159 radiobox_justify_content,
160 radiobox_align_items,
161 radiobox_align_content,
170 radiobox_direction->
Render()),
174 checkbox_element_xflex_grow->Render(),
175 checkbox_element_yflex_grow->Render(),
176 checkbox_group_xflex_grow->Render(),
177 checkbox_group_yflex_grow->Render(),
182 radiobox_justify_content->
Render()),
184 radiobox_align_items->
Render()),
186 radiobox_align_content->
Render()),
188 content_renderer->Render() | flex |
border,
Element make_box(int x, int y)
static ScreenInteractive Fullscreen()
Component Radiobox(RadioboxOption options)
Una lista de elementos, donde solo uno puede ser seleccionado.
Component Renderer(Component child, std::function< Element()>)
Retorna un nuevo Componente, similar a |child|, pero usando |render| como el evento Component::Render...
Component ResizableSplitRight(Component main, Component back, int *main_size)
Una división horizontal entre dos componentes, configurable usando el ratón.
Component ResizableSplitBottom(Component main, Component back, int *main_size)
Una división vertical entre dos componentes, configurable usando el ratón.
Component Checkbox(CheckboxOption options)
Dibuja un elemento seleccionable.
AlignContent align_content
@ Center
Los elementos se centran a lo largo del eje transversal.
virtual void Render(Screen &screen)
Muestra un elemento en un ftxui::Screen.
JustifyContent justify_content
@ Center
Los elementos se centran a lo largo de la línea.
FlexboxConfig & Set(FlexboxConfig::Direction)
Establece la dirección del flexbox.
Decorator bgcolor(Color)
Decora usando un color de fondo.
Element window(Element title, Element content, BorderStyle border=ROUNDED)
Draw window with a title and a border around the element.
Element xflex_grow(Element)
Expandir si es posible en el eje X.
Decorator size(WidthOrHeight, Constraint, int value)
Aplica una restricción al tamaño de un elemento.
Element flex(Element)
Hace que un elemento hijo se expanda proporcionalmente al espacio restante en un contenedor.
Element center(Element)
Centra un elemento horizontal y verticalmente.
Element text(std::wstring text)
Muestra un fragmento de texto Unicode.
Element yflex_grow(Element)
Expandir si es posible en el eje Y.
Element notflex(Element)
Hace que el elemento no sea flexible.
Element filler()
Un elemento que se expandirá proporcionalmente al espacio restante en un contenedor.
Element border(Element)
Draw a border around the element.
Decorator color(Color)
Decora usando un color de primer plano.
FlexboxConfig es una estructura de configuración que define las propiedades de diseño para un contene...
static Color HSV(uint8_t hue, uint8_t saturation, uint8_t value)
Construye un Color a partir de su representación HSV. https://en.wikipedia.org/wiki/HSL_and_HSV.
El espacio de nombres ftxui:: de FTXUI.
Element flexbox(Elements, FlexboxConfig config=FlexboxConfig())
Un contenedor que muestra elementos en filas/columnas y es capaz de ajustarse a la siguiente columna/...
Element hbox(Elements)
Un contenedor que muestra elementos horizontalmente uno por uno.