FTXUI  0.11.1
C++ functional terminal UI.
composite_decorator.cpp
Go to the documentation of this file.
1 
2 #include <utility> // for move
3 
4 #include "ftxui/dom/elements.hpp" // for Element, filler, operator|, hbox, flex_grow, vbox, xflex_grow, yflex_grow, align_right, center, hcenter, vcenter
5 
6 namespace ftxui {
7 
8 /// @brief Center an element horizontally.
9 /// @param child The decorated element.
10 /// @return The centered element.
11 /// @ingroup dom
13  return hbox(filler(), std::move(child), filler());
14 }
15 
16 /// @brief Center an element vertically.
17 /// @param child The decorated element.
18 /// @return The centered element.
19 /// @ingroup dom
21  return vbox(filler(), std::move(child), filler());
22 }
23 
24 /// @brief Center an element horizontally and vertically.
25 /// @param child The decorated element.
26 /// @return The centered element.
27 /// @ingroup dom
29  return hcenter(vcenter(std::move(child)));
30 }
31 
32 /// @brief Align an element on the right side.
33 /// @param child The decorated element.
34 /// @return The right aligned element.
35 /// @ingroup dom
37  return hbox(filler(), std::move(child));
38 }
39 
40 } // namespace ftxui
41 
42 // Copyright 2020 Arthur Sonzogni. All rights reserved.
43 // Use of this source code is governed by the MIT license that can be found in
44 // the LICENSE file.
std::shared_ptr< Node > Element
Definition: elements.hpp:16
Element hbox(Elements)
A container displaying elements horizontally one by one.
Definition: hbox.cpp:76
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:94
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:77