Skip to content
ConsoleMonster
Class

Align

ConsoleMonster.Layout

Namespace
ConsoleMonster.Layout
Assembly
ConsoleMonster
Implements
IContainer IWidget IContentOwner
Modifiers
sealed

Places a content 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 content 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

Usage

Explore 15 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Returned or exposed by 7

Accepted by parameters 8

Constructors

public Align(IWidget? content = null, HorizontalAlignment horizontal = Center, VerticalAlignment vertical = Top) #

Creates an alignment wrapper.

Parameters

content ConsoleMonster.Layout.IWidget? = null optional
The content.
horizontal ConsoleMonster.Layout.HorizontalAlignment = Center optional
Horizontal placement (default centre).
vertical ConsoleMonster.Layout.VerticalAlignment = Top optional
Vertical placement (default top).

Methods

public Size Measure(Constraints constraints, RenderContext context) #

Returns the size the widget wants within the constraints.

Parameters

constraints ConsoleMonster.Layout.Constraints required
The space offered.
context ConsoleMonster.Canvas.RenderContext required
Profile, theme and glyphs.

Returns

Size The desired size, never larger than the constraints.
public 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 required
The target region.
context ConsoleMonster.Canvas.RenderContext required
Profile, theme and glyphs.

Properties

public IWidget Content { get; set; } #

The content.

public HorizontalAlignment Horizontal { get; set; } #

Horizontal placement.

public VerticalAlignment Vertical { get; set; } #

Vertical placement.

public IReadOnlyList<IWidget> Children { get; } #

The child widgets in layout order.

Extension Methods

Content 2 overloads
public static Align Content(Align align, IWidget content) #

Configures this container's content before session ownership.

Parameters

align ConsoleMonster.Layout.Align required
The instance.
content ConsoleMonster.Layout.IWidget required
The widget or nested content builder.

Returns

Align The same instance.
public static Align Content(Align align, Action<ContentBuilder> content) #

Configures this container's content before session ownership.

Parameters

align ConsoleMonster.Layout.Align required
The instance.
content System.Action<ConsoleMonster.Layout.ContentBuilder> required
The widget or nested content builder.

Returns

Align The same instance.
public static Align Horizontal(Align align, HorizontalAlignment value) #

Sets Align.Horizontal: Horizontal placement.

Parameters

align ConsoleMonster.Layout.Align required
The instance.
value ConsoleMonster.Layout.HorizontalAlignment required
The value.

Returns

Align The same instance.

Examples

// C# initializer or property                                      // C# fluent
new global::ConsoleMonster.Layout.Align { Horizontal = value };    Ui.Align().Horizontal(value);
public static Align Vertical(Align align, VerticalAlignment value) #

Sets Align.Vertical: Vertical placement.

Parameters

align ConsoleMonster.Layout.Align required
The instance.
value ConsoleMonster.Layout.VerticalAlignment required
The value.

Returns

Align The same instance.

Examples

// C# initializer or property                                    // C# fluent
new global::ConsoleMonster.Layout.Align { Vertical = value };    Ui.Align().Vertical(value);