Skip to content

UIStackPanel Class

Definition

Namespace: Brine2D.UI

A container that stacks its children automatically in a single direction, computing positions from the Spacing and each child's Size. Brine2D.UI.UIStackPanel.Size is updated to fit the content on every Brine2D.UI.UIStackPanel.Render\(Brine2D\.Rendering\.IRenderer\) call.

C#
public class UIStackPanel : Brine2D.UI.IUIComponent, Brine2D.UI.IAnchoredUIComponent

Inheritance System.Object → UIStackPanel

Implements IUIComponent, IAnchoredUIComponent

Properties
Anchor The screen anchor point this component is positioned relative to.
AnchorOffset Pixel offset from the resolved anchor point.
BackgroundColor Optional background color. When null, no background is drawn.
BlocksInput When true, mouse events over this panel are consumed. Defaults to false.
ClipChildren When true, children are clipped to the panel bounds during rendering. Defaults to false.
LastKnownScreenSize Last screen size pushed by UICanvas. Used when propagating to children added after this stack panel is already on a canvas.
Orientation Stacking direction. Defaults to Brine2D.UI.StackOrientation.Vertical.
Padding Padding in pixels on all sides inside the panel background.
Spacing Gap in pixels between successive children.
Methods
AddChild\(IUIComponent\) Adds a child. Children are laid out in the order they are added.
ClearChildren() Removes all children.
GetChildren() Gets all children in layout order.
PerformLayout() Recomputes each child's position and returns the resulting content size. Can be called before the first Brine2D.UI.UIStackPanel.Render\(Brine2D\.Rendering\.IRenderer\) if you need sizes early.
RemoveChild\(IUIComponent\) Removes a child.