14using FlexFunction = void (*)(Requirement&);
16void function_flex_grow(Requirement& r) {
21void function_xflex_grow(Requirement& r) {
25void function_yflex_grow(Requirement& r) {
29void function_flex_shrink(Requirement& r) {
34void function_xflex_shrink(Requirement& r) {
38void function_yflex_shrink(Requirement& r) {
42void function_flex(Requirement& r) {
49void function_xflex(Requirement& r) {
54void function_yflex(Requirement& r) {
59void function_not_flex(Requirement& r) {
68class Flex :
public Node {
70 explicit Flex(FlexFunction f) : f_(f) {}
71 Flex(FlexFunction f,
Element child) :
Node(unpack(std::move(child))), f_(f) {}
72 void ComputeRequirement()
override {
82 void SetBox(Box box)
override {
96 return std::make_shared<Flex>(function_flex);
121 return std::make_shared<Flex>(function_flex, std::move(child));
127 return std::make_shared<Flex>(function_xflex, std::move(child));
133 return std::make_shared<Flex>(function_yflex, std::move(child));
139 return std::make_shared<Flex>(function_flex_grow, std::move(child));
145 return std::make_shared<Flex>(function_xflex_grow, std::move(child));
151 return std::make_shared<Flex>(function_yflex_grow, std::move(child));
157 return std::make_shared<Flex>(function_flex_shrink, std::move(child));
163 return std::make_shared<Flex>(function_xflex_shrink, std::move(child));
169 return std::make_shared<Flex>(function_yflex_shrink, std::move(child));
175 return std::make_shared<Flex>(function_not_flex, std::move(child));
Element xflex(Element)
Expand/Minimize if possible/needed on the X axis.
Element xflex_grow(Element)
Expand if possible on the X axis.
Element flex(Element)
Make a child element to expand proportionnally to the space left in a container.
std::shared_ptr< Node > Element
Element yflex(Element)
Expand/Minimize if possible/needed on the Y axis.
Element flex_shrink(Element)
Minimize if needed.
Element yflex_grow(Element)
Expand if possible on the Y axis.
Element flex_grow(Element)
Expand if possible.
Element notflex(Element)
Make the element not flexible.
Element xflex_shrink(Element)
Minimize if needed on the X axis.
Element filler()
An element that will take expand proportionnally to the space left in a container.
Element yflex_shrink(Element)
Minimize if needed on the Y axis.