Skip to content
ConsoleMonster
Class

Padding

ConsoleMonster.Layout

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

Adds blank space around a content.

Inheritance

  • object
  • Padding

Usage

Explore 23 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 11

Accepted by parameters 12

Constructors

public Padding(IWidget? content = null, int left = 1, int top = 0, int right = 1, int bottom = 0) #

Creates padding.

Parameters

content ConsoleMonster.Layout.IWidget? = null optional
The content.
left int = 1 optional
Left cells.
top int = 0 optional
Top rows.
right int = 1 optional
Right cells.
bottom int = 0 optional
Bottom rows.

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 int Left { get; set; } #

Left cells.

public int Top { get; set; } #

Top rows.

public int Right { get; set; } #

Right cells.

public int Bottom { get; set; } #

Bottom rows.

public IReadOnlyList<IWidget> Children { get; } #

The child widgets in layout order.

Extension Methods

public static Padding Bottom(Padding padding, int value) #

Sets Padding.Bottom: Bottom rows.

Parameters

padding ConsoleMonster.Layout.Padding required
The instance.
value int required
The value.

Returns

Padding The same instance.

Examples

// C# initializer or property                                    // C# fluent
new global::ConsoleMonster.Layout.Padding { Bottom = value };    Ui.Padding().Bottom(value);
Content 2 overloads
public static Padding Content(Padding padding, IWidget content) #

Configures this container's content before session ownership.

Parameters

padding ConsoleMonster.Layout.Padding required
The instance.
content ConsoleMonster.Layout.IWidget required
The widget or nested content builder.

Returns

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

Configures this container's content before session ownership.

Parameters

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

Returns

Padding The same instance.
public static Padding Left(Padding padding, int value) #

Sets Padding.Left: Left cells.

Parameters

padding ConsoleMonster.Layout.Padding required
The instance.
value int required
The value.

Returns

Padding The same instance.

Examples

// C# initializer or property                                  // C# fluent
new global::ConsoleMonster.Layout.Padding { Left = value };    Ui.Padding().Left(value);
public static Padding Right(Padding padding, int value) #

Sets Padding.Right: Right cells.

Parameters

padding ConsoleMonster.Layout.Padding required
The instance.
value int required
The value.

Returns

Padding The same instance.

Examples

// C# initializer or property                                   // C# fluent
new global::ConsoleMonster.Layout.Padding { Right = value };    Ui.Padding().Right(value);
public static Padding Top(Padding padding, int value) #

Sets Padding.Top: Top rows.

Parameters

padding ConsoleMonster.Layout.Padding required
The instance.
value int required
The value.

Returns

Padding The same instance.

Examples

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