Skip to content
ConsoleMonster
Class

Columns

ConsoleMonster.Layout

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

Places children side by side. Children in a row share their height, so panels line up instead of forming a staircase. When the width drops below the children's minimum widths the columns stack vertically instead of squeezing content unreadably.

Inheritance

  • object
  • Columns

Usage

Explore 16 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 8

Accepted by parameters 8

Constructors

public Columns(params IWidget[] children) #

Creates columns that share the width equally.

Parameters

children ConsoleMonster.Layout.IWidget[] required
The children.

Methods

public Columns Add(IWidget child, LayoutSize? size = null) #

Adds a child.

Parameters

child ConsoleMonster.Layout.IWidget required
The child.
size ConsoleMonster.Layout.LayoutSize? = null optional
Its width specification (default one equal fraction).

Returns

Columns This instance.
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 int Gap { get; set; } #

Blank columns between children (default 1).

public int CollapseBelow { get; set; } #

Width below which the columns stack vertically. -1 (default) uses the sum of the children's minimum widths (fractions without a minimum count as 16 cells).

public IReadOnlyList<IWidget> Children { get; } #

The child widgets in layout order.

public IReadOnlyList<LayoutSize> Sizes { get; } #

Size specifications, parallel to Columns.Children.

Extension Methods

public static Columns CollapseBelow(Columns columns, int value) #

Sets Columns.CollapseBelow: Width below which the columns stack vertically. -1 (default) uses the sum of the children's minimum widths (fractions without a minimum count as 16 cells).

Parameters

columns ConsoleMonster.Layout.Columns required
The instance.
value int required
The value.

Returns

Columns The same instance.

Examples

// C# initializer or property     // C# fluent
columns.CollapseBelow = value;    Ui.Columns().CollapseBelow(value);
Content 2 overloads
public static Columns Content(Columns columns, IWidget content) #

Configures this container's content before session ownership.

Parameters

columns ConsoleMonster.Layout.Columns required
The instance.
content ConsoleMonster.Layout.IWidget required
The widget or nested content builder.

Returns

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

Configures this container's content before session ownership.

Parameters

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

Returns

Columns The same instance.
public static Columns Gap(Columns columns, int value) #

Sets Columns.Gap: Blank columns between children (default 1).

Parameters

columns ConsoleMonster.Layout.Columns required
The instance.
value int required
The value.

Returns

Columns The same instance.

Examples

// C# initializer or property    // C# fluent
columns.Gap = value;             Ui.Columns().Gap(value);