FTXUI
6.1.9
C++ functional terminal UI.
Loading...
Searching...
No Matches
vflow.cpp
Go to the documentation of this file.
1
// Copyright 2020 Arthur Sonzogni. Todos los derechos reservados.
2
// El uso de este código fuente se rige por la licencia MIT que se puede encontrar en
3
// el archivo LICENSE.
4
#include <stdio.h>
// for getchar
5
#include <
ftxui/dom/elements.hpp
>
// for operator|, Element, size, text, hcenter, Fit, vflow, window, EQUAL, bold, border, dim, HEIGHT, WIDTH
6
#include <
ftxui/screen/screen.hpp
>
// for Full, Screen
7
#include <string>
// for allocator, char_traits, operator+, to_string, string
8
9
#include "
ftxui/dom/node.hpp
"
// for Render
10
#include "
ftxui/screen/color.hpp
"
// for ftxui
11
12
int
main
() {
13
using namespace
ftxui
;
14
auto
make_box
= [](
int
dimx,
int
dimy) {
15
std::string
title
= std::to_string(dimx) +
"x"
+ std::to_string(dimy);
16
return
window
(text(
title
) | hcenter | bold,
17
text(
"content"
) | hcenter | dim) |
18
size
(WIDTH,
EQUAL
, dimx) |
size
(HEIGHT,
EQUAL
, dimy);
19
};
20
21
auto
document = vflow({
22
make_box
(7, 7),
23
make_box
(7, 5),
24
make_box
(5, 7),
25
make_box
(10, 4),
26
make_box
(10, 4),
27
make_box
(10, 4),
28
make_box
(10, 4),
29
make_box
(11, 4),
30
make_box
(11, 4),
31
make_box
(11, 4),
32
make_box
(11, 4),
33
make_box
(12, 4),
34
make_box
(12, 5),
35
make_box
(12, 4),
36
make_box
(13, 4),
37
make_box
(13, 3),
38
make_box
(13, 3),
39
make_box
(10, 3),
40
}) |
41
border;
42
43
auto
screen
= Screen::Create(Dimension::Full(), Dimension::Fit(document));
44
Render(
screen
, document);
45
screen
.Print();
46
getchar();
47
48
return
0;
49
}
color.hpp
screen
auto screen
Definition
composition.cpp:56
elements.hpp
make_box
Element make_box(int x, int y)
Definition
examples/component/focus.cpp:17
size
return dimx size(HEIGHT, EQUAL, dimy)
title
std::string title
Definition
homescreen.cpp:407
EQUAL
return EQUAL
Definition
homescreen.cpp:410
window
return window(text(title)|hcenter|bold, text("contenido")|hcenter|dim)|size(WIDTH
ftxui
El espacio de nombres ftxui:: de FTXUI.
Definition
animation.hpp:10
node.hpp
screen.hpp
main
int main()
Definition
vflow.cpp:12