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. All rights reserved.
2// このソースコードの使用は、LICENSEファイルにあるMITライセンスによって管理されています。
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
11int 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}
Element make_box(int x, int y)
Element window(Element title, Element content, BorderStyle border)
要素の周囲にタイトルとボーダーを持つウィンドウを描画します。
FTXUI ftxui:: 名前空間
Definition animation.hpp:9
return size
Definition string.cpp:1516
int main()
Definition vflow.cpp:11