mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-17 16:38:09 +08:00
Introduce xflex and yflex.
This commit is contained in:

committed by
Arthur Sonzogni

parent
13e4f97c35
commit
e3ca437a48
@@ -8,11 +8,11 @@
|
||||
namespace ftxui {
|
||||
|
||||
Element hcenter(Element child) {
|
||||
return hbox(filler(), std::move(child), filler()) | flex_grow;
|
||||
return hbox(filler(), std::move(child), filler()) | xflex_grow;
|
||||
}
|
||||
|
||||
Element vcenter(Element child) {
|
||||
return vbox(filler(), std::move(child), filler()) | flex_grow;
|
||||
return vbox(filler(), std::move(child), filler()) | yflex_grow;
|
||||
}
|
||||
|
||||
Element center(Element child) {
|
||||
|
@@ -14,11 +14,27 @@ void function_flex_grow(Requirement& r) {
|
||||
r.flex_grow_y = 1;
|
||||
}
|
||||
|
||||
void function_xflex_grow(Requirement& r) {
|
||||
r.flex_grow_x = 1;
|
||||
}
|
||||
|
||||
void function_yflex_grow(Requirement& r) {
|
||||
r.flex_grow_y = 1;
|
||||
}
|
||||
|
||||
void function_flex_shrink(Requirement& r) {
|
||||
r.flex_shrink_x = 1;
|
||||
r.flex_shrink_y = 1;
|
||||
}
|
||||
|
||||
void function_xflex_shrink(Requirement& r) {
|
||||
r.flex_shrink_x = 1;
|
||||
}
|
||||
|
||||
void function_yflex_shrink(Requirement& r) {
|
||||
r.flex_shrink_y = 1;
|
||||
}
|
||||
|
||||
void function_flex(Requirement& r) {
|
||||
r.flex_grow_x = 1;
|
||||
r.flex_grow_y = 1;
|
||||
@@ -26,6 +42,16 @@ void function_flex(Requirement& r) {
|
||||
r.flex_shrink_y = 1;
|
||||
}
|
||||
|
||||
void function_xflex(Requirement& r) {
|
||||
r.flex_grow_x = 1;
|
||||
r.flex_shrink_x = 1;
|
||||
}
|
||||
|
||||
void function_yflex(Requirement& r) {
|
||||
r.flex_grow_y = 1;
|
||||
r.flex_shrink_y = 1;
|
||||
}
|
||||
|
||||
void function_not_flex(Requirement& r) {
|
||||
r.flex_grow_x = 0;
|
||||
r.flex_grow_y = 0;
|
||||
@@ -65,14 +91,38 @@ Element flex(Element child) {
|
||||
return std::make_shared<Flex>(function_flex, std::move(child));
|
||||
}
|
||||
|
||||
Element xflex(Element child) {
|
||||
return std::make_shared<Flex>(function_xflex, std::move(child));
|
||||
}
|
||||
|
||||
Element yflex(Element child) {
|
||||
return std::make_shared<Flex>(function_yflex, std::move(child));
|
||||
}
|
||||
|
||||
Element flex_grow(Element child) {
|
||||
return std::make_shared<Flex>(function_flex_grow, std::move(child));
|
||||
}
|
||||
|
||||
Element xflex_grow(Element child) {
|
||||
return std::make_shared<Flex>(function_xflex_grow, std::move(child));
|
||||
}
|
||||
|
||||
Element yflex_grow(Element child) {
|
||||
return std::make_shared<Flex>(function_yflex_grow, std::move(child));
|
||||
}
|
||||
|
||||
Element flex_shrink(Element child) {
|
||||
return std::make_shared<Flex>(function_flex_shrink, std::move(child));
|
||||
}
|
||||
|
||||
Element xflex_shrink(Element child) {
|
||||
return std::make_shared<Flex>(function_xflex_shrink, std::move(child));
|
||||
}
|
||||
|
||||
Element yflex_shrink(Element child) {
|
||||
return std::make_shared<Flex>(function_yflex_shrink, std::move(child));
|
||||
}
|
||||
|
||||
Element notflex(Element child) {
|
||||
return std::make_shared<Flex>(function_not_flex, std::move(child));
|
||||
}
|
||||
|
Reference in New Issue
Block a user