FTXUI
6.1.9
C++ functional terminal UI.
Loading...
Searching...
No Matches
composite_decorator.cpp
Go to the documentation of this file.
1
// Copyright 2020 Arthur Sonzogni. All rights reserved.
2
// Use of this source code is governed by the MIT license that can be found in
3
// the LICENSE file.
4
5
#include <utility>
// for move
6
7
#include "
ftxui/dom/elements.hpp
"
// for Element, filler, operator|, hbox, flex_grow, vbox, xflex_grow, yflex_grow, align_right, center, hcenter, vcenter
8
9
namespace
ftxui
{
10
11
/// @brief 水平置中一個元素。
12
/// @param child 被裝飾的元素。
13
/// @return 水平置中的元素。
14
/// @ingroup dom
15
Element
hcenter
(
Element
child) {
16
return
hbox
(
filler
(), std::move(child),
filler
());
17
}
18
19
/// @brief 垂直置中一個元素。
20
/// @param child 被裝飾的元素。
21
/// @return 垂直置中的元素。
22
/// @ingroup dom
23
Element
vcenter
(
Element
child) {
24
return
vbox
(
filler
(), std::move(child),
filler
());
25
}
26
27
/// @brief 水平與垂直置中一個元素。
28
/// @param child 被裝飾的元素。
29
/// @return 置中的元素。
30
/// @ingroup dom
31
Element
center
(
Element
child) {
32
return
hcenter
(
vcenter
(std::move(child)));
33
}
34
35
/// @brief 將元素靠右對齊。
36
/// @param child 被裝飾的元素。
37
/// @return 靠右對齊的元素。
38
/// @ingroup dom
39
Element
align_right
(
Element
child) {
40
return
hbox
(
filler
(), std::move(child));
41
}
42
43
}
// namespace ftxui
elements.hpp
ftxui::center
Element center(Element)
水平與垂直置中一個元素。
Definition
composite_decorator.cpp:31
ftxui::align_right
Element align_right(Element)
將元素靠右對齊。
Definition
composite_decorator.cpp:39
ftxui::filler
Element filler()
一個元素,它會按比例擴展以佔據容器中剩餘的空間。
Definition
flex.cpp:97
ftxui::vcenter
Element vcenter(Element)
垂直置中一個元素。
Definition
composite_decorator.cpp:23
ftxui::hcenter
Element hcenter(Element)
水平置中一個元素。
Definition
composite_decorator.cpp:15
ftxui::vbox
Element vbox(Elements)
一個垂直一個接一個顯示元素的容器。
Definition
vbox.cpp:95
ftxui
FTXUI 的 ftxui:: 命名空間
Definition
animation.hpp:10
ftxui::Element
std::shared_ptr< Node > Element
Definition
elements.hpp:22
ftxui::hbox
Element hbox(Elements)
一個逐一水平顯示元素的容器。
Definition
hbox.cpp:94