SizerItem

One placed child of a sizer: a widget or a nested sizer, with its proportion, padding and in-cell alignment.

Returned by Sizer.add/addSizer for fluent configuration — chain proportion, pad, alignH/alignV (each returns the same item):

hbox.add(button).proportion(0).alignV(VAlign.middle).pad(Padding.all(4));
vbox.add(label).alignH(HAlign.right);

By default a child fills its cell on both axes. Setting alignH/alignV to a non-fill value keeps the child's preferred extent on that axis and pins it.

Members

Functions

alignH
SizerItem alignH(HAlign horizontal)

Set the horizontal placement within the cell.

alignV
SizerItem alignV(VAlign vertical)

Set the vertical placement within the cell.

fixed
SizerItem fixed()

Keep the child's preferred size on the main axis — it neither grows nor shrinks as the container resizes. A readable alias for proportion(0) (the default), so add(button).fixed() states the intent at the call site.

fixedSize
SizerItem fixedSize(Size size)

Override the child's content size with a fixed size that wins over its preferred size. This is an exact override, not a lower bound — the name says "fixed," not "minimum." Prefer autoSize/stretch and reach for this only for things with an inherently fixed extent (an icon, a fixed-width sidebar).

outerSize
Size outerSize()

The child's content size plus its padding.

pad
SizerItem pad(Padding padding)

Reserve padding around the child within its cell.

place
void place(Rect cell)

Place the child into cell, insetting by padding and applying alignment.

proportion
SizerItem proportion(int weight)

Set the main-axis weight (0 = keep the preferred size, non-stretching).

stretch
SizerItem stretch(int weight)

Make the child grow to share the container's leftover space, with the given weight (default 1). A readable alias for proportion(weight): two stretch() children split the slack evenly, stretch(2) versus stretch(1) splits it 2:1. So add(list).stretch() reads as "the list takes the slack."

Meta