A flow-layout container: stacks its children in a row (vertical = false) or column (vertical = true), spaced by gap with padding around the group. stretch sizes each UIComponent child to fill the cross axis; otherwise align places them (START/CENTER/END). The main axis auto-grows to fit — a vertical stack keeps its given width and computes its height, a horizontal stack keeps its height and computes its width.

gap/padding are base (unscaled) pixels, scaled by UITheme.scale like the rest of the library. Relayout happens on render(), so call invalidate() (or relayout()) after changing a child's size; a theme scale change relayouts automatically. Non-interactive and pointer-transparent — children keep their own interactivity.

Constructor

@:value({ padding : 0, gap : 8 })new(vertical:Bool, extent:Float, gap:Float = 8, padding:Float = 0)

Parameters:

vertical

true for a column, false for a row

extent

the cross-axis size (width for a column, height for a row)

gap

base spacing between children

padding

base inset around the group

Variables

@:value(START)align:UIAlign = START

Cross-axis placement when not stretching.

@:value(8)gap:Float = 8

Base (unscaled) space between children.

@:value(0)padding:Float = 0

Base (unscaled) inset around the group.

@:value(false)stretch:Bool = false

Size each UIComponent child to fill the cross axis.

vertical:Bool

true stacks children top-to-bottom; false left-to-right.

Methods

add(child:DisplayObject):UIStack

Appends a child and relayouts.

Parameters:

child

the display object to add

Returns:

this stack (for chaining)

addAll(children:Array<DisplayObject>):UIStack

Appends several children and relayouts.

Parameters:

children

the display objects to add

Returns:

this stack (for chaining)

clear():Void

Removes every child from the layout (does not dispose them).

inlinerelayout():Void

Forces an immediate relayout (so w/h are valid now, not on the next frame).

removeItem(child:DisplayObject):Void

Removes a child from the layout (does not dispose it).

Parameters:

child

the child to remove

Inherited Variables

Defined by UIComponent

@:value(true)enabled:Bool = true

Disabled widgets ignore the pointer and typically render dimmed.

@:value(0)read onlyh:Float = 0

Layout height in UI units.

@:value(MouseCursor.BUTTON)hoverCursor:MouseCursor = MouseCursor.BUTTON

Native cursor while hovering (interactive widgets; null keeps the arrow).

@:value(false)read onlyhovered:Bool = false

true while the cursor is over this widget.

@:value(false)longPressable:Bool = false

Opts a subclass that overrides onRightPress (without setting onRightClick) into long-press-as-right-click on touch. Widgets with onRightClick set are included automatically.

@:value(null)onClick:() ‑> Void = null

Fired on a completed click (press + release on this widget). Requires an interactive widget.

@:value(null)onHover:() ‑> Void = null

Fired when the cursor first enters this widget (hover-driven descriptions/previews). Interactive widgets only.

@:value(null)onRightClick:() ‑> Void = null

Fired on a right mouse press over this widget (context menus). Only interactive widgets receive pointer events, so this never fires on passive widgets like UILabel/UIPanel — attach it to a UIButton (or another interactive widget) instead. On touch, a long-press fires the same path (see UIRoot.longPressMs).

@:value(false)read onlypressed:Bool = false

true while a press that started here is held.

@:value(null)tooltip:String = null

Optional tooltip text (already-localized or a fixed string).

@:value(null)tooltipShortcut:String = null

Optional right-aligned shortcut hint rendered in the tooltip.

@:value(0)read onlyw:Float = 0

Layout width in UI units (independent of DisplayObject's content-derived width).

Inherited Methods

Defined by UIComponent

dispose():Void

Tears the widget down: listeners, pointer references, children, parent link.

invalidate():Void

Schedules a repaint for the next frame (cheap; deduplicated).

resize(width:Float, height:Float):Void

Sets the layout size and repaints when it changed.

Parameters:

width

the new layout width in UI units

height

the new layout height in UI units