2020-04-20 03:00:37 +08:00
|
|
|
// Copyright 2020 Arthur Sonzogni. All rights reserved.
|
|
|
|
// Use of this source code is governed by the MIT license that can be found in
|
|
|
|
// the LICENSE file.
|
|
|
|
|
2018-10-10 01:06:03 +08:00
|
|
|
#include "ftxui/dom/elements.hpp"
|
2020-03-23 05:32:44 +08:00
|
|
|
#include "ftxui/dom/node.hpp"
|
2018-09-20 03:52:25 +08:00
|
|
|
|
2019-01-12 22:00:08 +08:00
|
|
|
namespace ftxui {
|
2018-09-20 03:52:25 +08:00
|
|
|
|
2020-05-21 02:36:47 +08:00
|
|
|
Element hcenter(Element child) {
|
2020-06-02 05:40:32 +08:00
|
|
|
return hbox(filler(), std::move(child), filler()) | flex_grow;
|
2018-09-20 03:52:25 +08:00
|
|
|
}
|
|
|
|
|
2020-05-21 02:36:47 +08:00
|
|
|
Element vcenter(Element child) {
|
2020-06-02 05:40:32 +08:00
|
|
|
return vbox(filler(), std::move(child), filler()) | flex_grow;
|
2018-09-20 03:52:25 +08:00
|
|
|
}
|
|
|
|
|
2020-05-21 02:36:47 +08:00
|
|
|
Element center(Element child) {
|
2020-06-02 05:40:32 +08:00
|
|
|
return hcenter(vcenter(std::move(child))) | flex_grow;
|
2018-09-20 03:52:25 +08:00
|
|
|
}
|
|
|
|
|
2020-05-21 02:36:47 +08:00
|
|
|
Element align_right(Element child) {
|
2020-06-02 05:40:32 +08:00
|
|
|
return hbox(filler(), std::move(child)) | flex_grow;
|
2019-01-07 01:53:02 +08:00
|
|
|
}
|
|
|
|
|
2020-03-23 05:32:44 +08:00
|
|
|
} // namespace ftxui
|