FTXUI
6.1.9
C++ functional terminal UI.
载入中...
搜索中...
未找到
composite_decorator.cpp
浏览该文件的文档.
1
// Copyright 2020 Arthur Sonzogni. All rights reserved.
2
// 本源代码的使用受可在 LICENSE 文件中找到的 MIT 许可的约束。
3
4
#include <utility>
// for move
5
6
#include "
ftxui/dom/elements.hpp
"
// for Element, filler, operator|, hbox, flex_grow, vbox, xflex_grow, yflex_grow, align_right, center, hcenter, vcenter
7
8
namespace
ftxui
{
9
10
/// @brief 水平居中一个元素。
11
/// @param child 被装饰的元素。
12
/// @return 居中的元素。
13
/// @ingroup dom
14
Element
hcenter
(
Element
child) {
15
return
hbox
(
filler
(), std::move(child),
filler
());
16
}
17
18
/// @brief 垂直居中一个元素。
19
/// @param child 被装饰的元素。
20
/// @return 居中的元素。
21
/// @ingroup dom
22
Element
vcenter
(
Element
child) {
23
return
vbox
(
filler
(), std::move(child),
filler
());
24
}
25
26
/// @brief 水平并垂直居中一个元素。
27
/// @param child 被装饰的元素。
28
/// @return 居中的元素。
29
/// @ingroup dom
30
Element
center
(
Element
child) {
31
return
hcenter
(
vcenter
(std::move(child)));
32
}
33
34
/// @brief 将元素右对齐。
35
/// @param child 被装饰的元素。
36
/// @return 右对齐的元素。
37
/// @ingroup dom
38
Element
align_right
(
Element
child) {
39
return
hbox
(
filler
(), std::move(child));
40
}
41
42
}
// namespace ftxui
elements.hpp
ftxui::center
Element center(Element)
水平并垂直居中一个元素。
定义
composite_decorator.cpp:30
ftxui::align_right
Element align_right(Element)
将元素右对齐。
定义
composite_decorator.cpp:38
ftxui::filler
Element filler()
一个元素,它将按比例扩展以填充容器中剩余的空间。
定义
flex.cpp:96
ftxui::vcenter
Element vcenter(Element)
垂直居中一个元素。
定义
composite_decorator.cpp:22
ftxui::hcenter
Element hcenter(Element)
水平居中一个元素。
定义
composite_decorator.cpp:14
ftxui::vbox
Element vbox(Elements)
垂直一个接一个显示元素的容器。
定义
vbox.cpp:96
ftxui
#include "ftxui/component/component_base.hpp" // 用于 ComponentBase
定义
animation.hpp:9
ftxui::Element
std::shared_ptr< Node > Element
定义
elements.hpp:22
ftxui::hbox
Element hbox(Elements)
一个按水平顺序逐一显示元素的容器。
定义
hbox.cpp:94