Skip to content
ConsoleMonster

API Reference

Class

Grid (Layout)

Namespace ConsoleMonster.Layout
Assembly ConsoleMonster
Source Grid.cs:12
Implements
Modifiers sealed

Lays children out in equal-width columns, row by row. Cells in a row share the row height. When columns would become narrower than Grid.MinColumnWidth, the grid uses fewer columns. In a live frame with spare height, rows grow equally so the grid fills its region.

Inheritance

  • Object
  • Grid

Usage

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

Accepted by parameters 8

Constructors

public Grid(Int32 columns, params IWidget[] children) #

Creates a grid.

Parameters

columns System.Int32 requiredposition: 0
Number of columns (at least 1).
children ConsoleMonster.Layout.IWidget[] requiredposition: 1
Initial children.

Methods

public Grid Add(IWidget child) #
Returns: Grid

Adds a cell.

Parameters

child ConsoleMonster.Layout.IWidget requiredposition: 0
The child.

Returns

This instance.

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 Int32 ColumnCount { get; } #

The preferred number of columns.

public Int32 ColumnGap { get; set; } #

Blank columns between cells (default 1).

public Int32 RowGap { get; set; } #

Blank rows between grid rows (default 0).

public Int32 MinColumnWidth { get; set; } #

The narrowest column before the grid reduces its column count (default 24).

public Boolean FillHeight { get; set; } #

Whether rows grow to fill spare height in a bounded region (default true).

public IReadOnlyList<IWidget> Children { get; } #

The child widgets in layout order.

Extension Methods

public static Grid WithColumnGap(Grid grid, Int32 value) #
Returns: Grid

Sets Grid.ColumnGap: Blank columns between cells (default 1).

Parameters

grid ConsoleMonster.Layout.Grid requiredposition: 0
The instance.
value System.Int32 requiredposition: 1
The value.

Returns

The same instance.

public static Grid WithFillHeight(Grid grid, Boolean value = true) #
Returns: Grid

Sets Grid.FillHeight: Whether rows grow to fill spare height in a bounded region (default true).

Parameters

grid ConsoleMonster.Layout.Grid requiredposition: 0
The instance.
value System.Boolean = true optionalposition: 1
The value (default true).

Returns

The same instance.

public static Grid WithMinColumnWidth(Grid grid, Int32 value) #
Returns: Grid

Sets Grid.MinColumnWidth: The narrowest column before the grid reduces its column count (default 24).

Parameters

grid ConsoleMonster.Layout.Grid requiredposition: 0
The instance.
value System.Int32 requiredposition: 1
The value.

Returns

The same instance.

public static Grid WithRowGap(Grid grid, Int32 value) #
Returns: Grid

Sets Grid.RowGap: Blank rows between grid rows (default 0).

Parameters

grid ConsoleMonster.Layout.Grid requiredposition: 0
The instance.
value System.Int32 requiredposition: 1
The value.

Returns

The same instance.