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.
public sealed class Stack : WidgetInheritance
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()
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).
public Align Align { get; set; }Property Value
Children
The widgets this one contains, in focus and drawing order.
public override IReadOnlyList<Widget> Children { get; }Property Value
Orientation
The direction children follow each other (Vertical by default).
public Orientation Orientation { get; set; }Property Value
Spacing
Space between children in UI units; null (the default) is 4 layout units.
public float? Spacing { get; set; }Property Value
Methods
Add(Widget)
Adds child after the others and returns the stack, so stacks can be written in one expression.
public Stack Add(Widget child)Parameters
child Widget
Returns
Exceptions
The child already belongs to another widget or root.
ArrangeContent(RectF, UiContext)
Places the children within bounds; nothing by default.
protected override void ArrangeContent(RectF bounds, UiContext context)Parameters
bounds RectF
context UiContext
DrawContent(IRenderer, UiContext)
Draws the widget in Bounds, and its children.
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.
protected override Vector2 MeasureContent(UiContext context)Parameters
context UiContext
Returns
Remove(Widget)
Removes child; false when it was not in the stack.
public bool Remove(Widget child)Parameters
child Widget