FTXUI  5.0.0
C++ functional terminal UI.
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
9namespace ftxui {
10
11/// @brief Center an element horizontally.
12/// @param child The decorated element.
13/// @return The centered element.
14/// @ingroup dom
16 return hbox(filler(), std::move(child), filler());
17}
18
19/// @brief Center an element vertically.
20/// @param child The decorated element.
21/// @return The centered element.
22/// @ingroup dom
24 return vbox(filler(), std::move(child), filler());
25}
26
27/// @brief Center an element horizontally and vertically.
28/// @param child The decorated element.
29/// @return The centered element.
30/// @ingroup dom
32 return hcenter(vcenter(std::move(child)));
33}
34
35/// @brief Align an element on the right side.
36/// @param child The decorated element.
37/// @return The right aligned element.
38/// @ingroup dom
40 return hbox(filler(), std::move(child));
41}
42
43} // namespace ftxui
std::shared_ptr< Node > Element
Definition: elements.hpp:23
Element hbox(Elements)
A container displaying elements horizontally one by one.
Definition: hbox.cpp:83
Element center(Element)
Center an element horizontally and vertically.
Element align_right(Element)
Align an element on the right side.
Element filler()
An element that will take expand proportionnally to the space left in a container.
Definition: flex.cpp:98
Element vcenter(Element)
Center an element vertically.
Element hcenter(Element)
Center an element horizontally.
Element vbox(Elements)
A container displaying elements vertically one by one.
Definition: vbox.cpp:83