11enum class FlexDirection { Row, Column };
12enum class PositionType { Relative, Absolute };
13enum class Justify { FlexStart, Center, FlexEnd, SpaceBetween };
14enum class Align { Auto, FlexStart, Center, FlexEnd, Stretch, Baseline };
15enum class FlexWrap { NoWrap, Wrap, WrapReverse };
26 if (std::isnan(
v))
return NAN;
34 float resolveOr(
float parent,
float fallback)
const {
36 return std::isnan(res) ? fallback : res;
125void calculateLayout(LayoutNode* node,
float parentWidth,
float parentHeight,
bool isRoot =
false,
const VexUI* ui =
nullptr,
float forcedW = NAN,
float forcedH = NAN);
Class defining VexUI, it initializes the UI system, loads, renders, converts ui data,...
void calculateLayout(LayoutNode *node, float parentWidth, float parentHeight, bool isRoot=false, const VexUI *ui=nullptr, float forcedW=NAN, float forcedH=NAN)
Calculate the layout of a node tree using flex layout algorithm.
Lightweight struct to hold parsed sizes safely away from VexUI dependencies.
float resolve(float parent) const
Resolve the flex value to pixels based on parent dimension.
float resolveOr(float parent, float fallback) const
Resolve the flex value to pixels, with a fallback if unspecified.
bool isPercent
Whether value is a percentage.
Layout node representing a single UI element in the layout tree.
FlexValue paddingLeft
Left padding.
FlexValue marginTop
Top margin.
FlexValue marginRight
Right margin.
FlexValue paddingBottom
Bottom padding.
FlexValue left
Left position offset.
void insertChild(LayoutNode *child, size_t index)
Insert a child node at a specific index.
FlexValue height
Element height.
void * context
Opaque context pointer for user data.
FlexValue borderWidth
Border width.
FlexValue top
Top position offset.
std::vector< LayoutNode * > children
Child nodes.
Justify justifyContent
Justify content alignment.
FlexValue bottom
Bottom position offset.
float computedHeight
Computed height.
std::function< void(LayoutNode *, float, float)> measureFunc
Measure function for intrinsic sizing (e.g., text).
FlexValue marginBottom
Bottom margin.
float flexShrink
Flex shrink factor.
float flexGrow
Flex grow factor.
FlexValue width
Element width.
FlexValue marginLeft
Left margin.
float computedWidth
Computed width.
float computedTop
Computed top position.
Align alignSelf
Align self override.
PositionType positionType
Position type (relative or absolute).
FlexDirection flexDirection
Direction of flex layout.
FlexValue paddingRight
Right padding.
LayoutNode * parent
Parent node in the layout tree.
float computedLeft
Computed left position.
FlexWrap flexWrap
Flex wrap behavior.
FlexValue right
Right position offset.
FlexValue paddingTop
Top padding.
Align alignItems
Align items cross-axis alignment.