FTXUI 6.1.9
C++ functional terminal UI.
Loading...
Searching...
No Matches
examples/dom/size.cpp
Go to the documentation of this file.
1// Copyright 2020 Arthur Sonzogni. All rights reserved.
2// このソースコードの使用は、LICENSE ファイルにあるMITライセンスに準拠しています。
3#include <ftxui/dom/elements.hpp> // for operator|, text, Element, hcenter, Fit, hbox, size, window, Elements, bold, dim, EQUAL, WIDTH
4#include <ftxui/screen/screen.hpp> // for Screen
5#include <memory> // for allocator, shared_ptr
6#include <string> // for string, to_string
7#include <utility> // for move
8
9#include "ftxui/dom/node.hpp" // for Render
10#include "ftxui/screen/color.hpp" // for ftxui
11
12int main() {
13 using namespace ftxui;
14 auto make_box = [](const std::string& title) {
15 return window(text(title) | hcenter | bold,
16 text("content") | hcenter | dim);
17 };
18
19 Elements content;
20 for (int x = 3; x < 30; ++x) {
21 content.push_back(make_box(std::to_string(x)) | size(WIDTH, EQUAL, x));
22 }
23
24 auto document = hbox(std::move(content));
25 auto screen = Screen::Create(Dimension::Fit(document));
26 Render(screen, document);
27 screen.Print();
28
29 return 0;
30}
Element make_box(int x, int y)
Element window(Element title, Element content, BorderStyle border)
要素の周囲にタイトルとボーダーを持つウィンドウを描画します。
FTXUI ftxui:: 名前空間
Definition animation.hpp:9
std::vector< Element > Elements
Definition elements.hpp:22
return size
Definition string.cpp:1516