FTXUI
6.1.9
C++ functional terminal UI.
Loading...
Searching...
No Matches
vflow.cpp
Go to the documentation of this file.
1
// 版權所有 2020 Arthur Sonzogni。保留所有權利。
2
// 本原始碼的使用受 MIT 授權條款約束,該條款可在 LICENSE 檔案中找到。
3
#include <stdio.h>
// for getchar
4
#include <
ftxui/dom/elements.hpp
>
// for operator|, Element, size, text, hcenter, Fit, vflow, window, EQUAL, bold, border, dim, HEIGHT, WIDTH
5
#include <
ftxui/screen/screen.hpp
>
// for Full, Screen
6
#include <string>
// for allocator, char_traits, operator+, to_string, string
7
8
#include "
ftxui/dom/node.hpp
"
// for Render
9
#include "
ftxui/screen/color.hpp
"
// for ftxui
10
11
int
main
() {
12
using namespace
ftxui
;
13
auto
make_box
= [](
int
dimx,
int
dimy) {
14
std::string title = std::to_string(dimx) +
"x"
+ std::to_string(dimy);
15
return
window(text(title) | hcenter | bold,
16
text(
"content"
) | hcenter | dim) |
17
size(WIDTH, EQUAL, dimx) | size(HEIGHT, EQUAL, dimy);
18
};
19
20
auto
document = vflow({
21
make_box
(7, 7),
22
make_box
(7, 5),
23
make_box
(5, 7),
24
make_box
(10, 4),
25
make_box
(10, 4),
26
make_box
(10, 4),
27
make_box
(10, 4),
28
make_box
(11, 4),
29
make_box
(11, 4),
30
make_box
(11, 4),
31
make_box
(11, 4),
32
make_box
(12, 4),
33
make_box
(12, 5),
34
make_box
(12, 4),
35
make_box
(13, 4),
36
make_box
(13, 3),
37
make_box
(13, 3),
38
make_box
(10, 3),
39
}) |
40
border;
41
42
auto
screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
43
Render
(screen, document);
44
screen.Print();
45
getchar();
46
47
return
0;
48
}
color.hpp
elements.hpp
make_box
Element make_box(int x, int y)
Definition
examples/component/focus.cpp:17
Render
void Render(Screen &screen, const Element &element)
在 ftxui::Screen 上顯示元素。
Definition
node.cpp:82
ftxui
FTXUI 的 ftxui:: 命名空間
Definition
animation.hpp:10
node.hpp
screen.hpp
main
int main()
Definition
vflow.cpp:11