RegionWidget
ConsoleMonster.Widgets
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 RegionHandle. The swap goes through the session's update queue, so it is thread-safe and lands between frames; the surrounding layout is recomposed and the existing cell diff writes only changed cells. 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
- LiveWidget
- RegionWidget
Constructors
public RegionWidget(string widgetId, IWidget? content = null) #Creates a slot.
Parameters
- widgetId string
- The live name the slot is addressed by.
- content ConsoleMonster.Layout.IWidget? = null
- The first content, or null for an empty slot.
Methods
public override void Apply(LiveEvent liveEvent) #Applies an event to the widget's state.
Parameters
- liveEvent ConsoleMonster.Live.LiveEvent
- The event.
public RegionHandle Handle(ILiveDispatcher dispatcher) #A handle that replaces the content through a dispatcher (a live session).
Parameters
- dispatcher ConsoleMonster.Live.ILiveDispatcher
- The dispatcher.
public override Size Measure(Constraints constraints, RenderContext context) #Returns the size the widget wants within the constraints.
Parameters
- constraints ConsoleMonster.Layout.Constraints
- The space offered.
- context ConsoleMonster.Canvas.RenderContext
- Profile, theme and glyphs.
public override void Render(Region region, RenderContext context) #Renders into a region. The region may be smaller or larger than the measured size.
Parameters
- region ConsoleMonster.Canvas.Region
- The target region.
- context ConsoleMonster.Canvas.RenderContext
- Profile, theme and glyphs.
public void Set(IWidget? content) #Replaces the content directly (not thread-safe; use a handle while a session runs).
Parameters
- content ConsoleMonster.Layout.IWidget?
- The new content, or null to empty the slot.
Inherited Methods
public virtual string? Describe(LiveEvent liveEvent) #Parameters
- liveEvent LiveEvent
Returns
string?Properties
public IReadOnlyList<IWidget> Children { get; } #The child widgets in layout order.