Skip to content
ConsoleMonster

API Reference

Class

Align

Namespace ConsoleMonster.Layout
Assembly ConsoleMonster
Implements
Modifiers sealed

Places a child at its measured size inside a larger region: left, centre or right, and top, middle or bottom. Horizontally aligned content claims the full offered width so it can be centred or pushed right; vertical alignment applies when the parent gives the child more rows than it measured (a fixed height or a fill share). Children that already measure to the full width, such as progress bars, are unaffected horizontally.

Inheritance

  • Object
  • Align

Constructors

public Align(IWidget child, HorizontalAlignment horizontal = Center, VerticalAlignment vertical = Top) #

Creates an alignment wrapper.

Parameters

child ConsoleMonster.Layout.IWidget requiredposition: 0
The child.
horizontal ConsoleMonster.Layout.HorizontalAlignment = Center optionalposition: 1
Horizontal placement (default centre).
vertical ConsoleMonster.Layout.VerticalAlignment = Top optionalposition: 2
Vertical placement (default top).

Methods

public 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 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.

Properties

public IWidget Child { get; } #

The child.

public HorizontalAlignment Horizontal { get; } #

Horizontal placement.

public VerticalAlignment Vertical { get; } #

Vertical placement.

public IReadOnlyList<IWidget> Children { get; } #

The child widgets in layout order.