2020-04-19 21:00:37 +02: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-09 19:06:03 +02:00
|
|
|
#include "ftxui/dom/elements.hpp"
|
2020-03-22 22:32:44 +01:00
|
|
|
#include "ftxui/dom/node.hpp"
|
2018-09-19 21:52:25 +02:00
|
|
|
|
2019-01-12 15:00:08 +01:00
|
|
|
namespace ftxui {
|
2018-09-19 21:52:25 +02:00
|
|
|
|
2020-05-20 20:36:47 +02:00
|
|
|
Element hcenter(Element child) {
|
2020-07-17 00:27:39 +02:00
|
|
|
return hbox(filler(), std::move(child), filler()) | xflex_grow;
|
2018-09-19 21:52:25 +02:00
|
|
|
}
|
|
|
|
|
2020-05-20 20:36:47 +02:00
|
|
|
Element vcenter(Element child) {
|
2020-07-17 00:27:39 +02:00
|
|
|
return vbox(filler(), std::move(child), filler()) | yflex_grow;
|
2018-09-19 21:52:25 +02:00
|
|
|
}
|
|
|
|
|
2020-05-20 20:36:47 +02:00
|
|
|
Element center(Element child) {
|
2020-06-01 23:40:32 +02:00
|
|
|
return hcenter(vcenter(std::move(child))) | flex_grow;
|
2018-09-19 21:52:25 +02:00
|
|
|
}
|
|
|
|
|
2020-05-20 20:36:47 +02:00
|
|
|
Element align_right(Element child) {
|
2020-06-01 23:40:32 +02:00
|
|
|
return hbox(filler(), std::move(child)) | flex_grow;
|
2019-01-06 18:53:02 +01:00
|
|
|
}
|
|
|
|
|
2020-03-22 22:32:44 +01:00
|
|
|
} // namespace ftxui
|