Skip to content

API reference

Class Stack

Namespace: MicroEngine.UI
Assembly: MicroEngine.UI.dll
Guide: UI widgets

Children placed one after another, top to bottom or left to right, with a space between them: menus, rows of buttons, forms.

C#
public sealed class Stack : Widget

Inheritance

object ← Widget ← Stack

Inherited Members

Widget.Measure(UiContext), Widget.Arrange(RectF, UiContext), Widget.Draw(IRenderer, UiContext), Widget.Bounds, Widget.Visible, Widget.Enabled, Widget.Width, Widget.Height, Widget.Offset, Widget.Opacity, Widget.BlocksPointer, Widget.Parent, Widget.Root, Widget.Children, Widget.Focusable, Widget.ClipsChildren, Widget.IsFocused, Widget.IsHovered, Widget.IsPressed, Widget.IsEnabledInTree, Widget.IsVisibleInTree, object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Constructors

Stack()

C#
public Stack()

Properties

Align

How children are placed across the stack (Stretch by default: as wide as the stack, or as tall in a row).

C#
public Align Align { get; set; }

Property Value

Align

Children

The widgets this one contains, in focus and drawing order.

C#
public override IReadOnlyList<Widget> Children { get; }

Property Value

IReadOnlyList<Widget>

Orientation

The direction children follow each other (Vertical by default).

C#
public Orientation Orientation { get; set; }

Property Value

Orientation

Spacing

Space between children in UI units; null (the default) is 4 layout units.

C#
public float? Spacing { get; set; }

Property Value

float?

Methods

Add(Widget)

Adds child after the others and returns the stack, so stacks can be written in one expression.

C#
public Stack Add(Widget child)

Parameters

child Widget

Returns

Stack

Exceptions

InvalidOperationException

The child already belongs to another widget or root.

ArrangeContent(RectF, UiContext)

Places the children within bounds; nothing by default.

C#
protected override void ArrangeContent(RectF bounds, UiContext context)

Parameters

bounds RectF

context UiContext

DrawContent(IRenderer, UiContext)

Draws the widget in Bounds, and its children.

C#
protected override void DrawContent(IRenderer renderer, UiContext context)

Parameters

renderer IRenderer

context UiContext

MeasureContent(UiContext)

The size the widget’s content needs, in UI units.

C#
protected override Vector2 MeasureContent(UiContext context)

Parameters

context UiContext

Returns

Vector2

Remove(Widget)

Removes child; false when it was not in the stack.

C#
public bool Remove(Widget child)

Parameters

child Widget

Returns

bool