Skip to content
ConsoleMonster

API Reference

Class

Slot

Namespace ConsoleMonster.Widgets
Assembly ConsoleMonster
Source Slot.cs:22
Modifiers sealed

A named place in a layout whose widget can be replaced while a live session runs: put it anywhere (inside a panel, a column, a dashboard), then swap its content with LiveSession.Region or a SlotHandle. The swap goes through the session's update queue, so it is thread-safe and lands between frames; the surrounding frame stays and only the changed cells are redrawn. Live widgets inside the new content are registered with the session under their names, replacing widgets of the same name. Live operations: set (Payload = the new widget), clear.

Inheritance

Constructors

public Slot(String name, IWidget? content = null) #

Creates a slot.

Parameters

name System.String requiredposition: 0
The live name the slot is addressed by.
content ConsoleMonster.Layout.IWidget? = null optionalposition: 1
The first content, or null for an empty slot.

Methods

public override Void Apply(LiveEvent liveEvent) #
Returns: Void

Applies an event to the widget's state.

Parameters

liveEvent ConsoleMonster.Live.LiveEvent requiredposition: 0
The event.
public SlotHandle Handle(ILiveDispatcher dispatcher) #
Returns: SlotHandle

A handle that replaces the content through a dispatcher (a live session).

Parameters

dispatcher ConsoleMonster.Live.ILiveDispatcher requiredposition: 0
The dispatcher.

Returns

The handle.

public override Size Measure(Constraints constraints, RenderContext context) #
Returns: Size

Returns the size the widget wants within the constraints.

Parameters

constraints ConsoleMonster.Layout.Constraints requiredposition: 0
The space offered.
context ConsoleMonster.Canvas.RenderContext requiredposition: 1
Profile, theme and glyphs.

Returns

The desired size, never larger than the constraints.

public override Void Render(Region region, RenderContext context) #
Returns: Void

Renders into a region. The region may be smaller or larger than the measured size.

Parameters

region ConsoleMonster.Canvas.Region requiredposition: 0
The target region.
context ConsoleMonster.Canvas.RenderContext requiredposition: 1
Profile, theme and glyphs.
public Void Set(IWidget? content) #
Returns: Void

Replaces the content directly (not thread-safe; use a handle while a session runs).

Parameters

content ConsoleMonster.Layout.IWidget? requiredposition: 0
The new content, or null to empty the slot.

Properties

public IWidget Content { get; } #

The current content.

public IReadOnlyList<IWidget> Children { get; } #

The child widgets in layout order.