FTXUI
6.1.9
C++ functional terminal UI.
Loading...
Searching...
No Matches
hflow.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|, size, Element, text, hcenter, Decorator, Fit, WIDTH, hflow, window, EQUAL, GREATER_THAN, HEIGHT, bold, border, dim, LESS_THAN
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
style =
size
(WIDTH, GREATER_THAN, 20) | border |
22
size
(HEIGHT, GREATER_THAN, 30) |
size
(WIDTH, LESS_THAN, 50);
23
24
auto
document = hflow({
25
make_box
(7, 7),
26
make_box
(7, 5),
27
make_box
(5, 7),
28
make_box
(10, 4),
29
make_box
(10, 4),
30
make_box
(10, 4),
31
make_box
(10, 4),
32
make_box
(11, 4),
33
make_box
(11, 4),
34
make_box
(11, 4),
35
make_box
(11, 4),
36
make_box
(12, 4),
37
make_box
(12, 5),
38
make_box
(12, 4),
39
make_box
(13, 4),
40
make_box
(13, 3),
41
make_box
(13, 3),
42
make_box
(10, 3),
43
}) |
44
style;
45
46
auto
screen
= Screen::Create(Dimension::Full(), Dimension::Fit(document));
47
Render(
screen
, document);
48
screen
.Print();
49
getchar();
50
51
return
0;
52
}
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
main
int main()
Definition
hflow.cpp:12
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