Skip to content
ConsoleMonster
Class

Rule

ConsoleMonster.Widgets

Namespace
ConsoleMonster.Widgets
Assembly
ConsoleMonster
Implements
IWidget
Modifiers
sealed

A horizontal line across the width, optionally with a title: ── Results ──────.

Inheritance

  • object
  • Rule

Usage

Explore 19 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 9

Accepted by parameters 10

Constructors

Rule 2 overloads
public Rule(RichText title) #

Creates a rule with a multicolour title.

Parameters

title ConsoleMonster.Text.RichText required
The title.
public Rule(string? title = null) #

Creates a rule with an optional title (markup).

Parameters

title string? = null optional
The title, or null.

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 string? Title { get; set; } #

The title (markup).

public HorizontalAlignment Alignment { get; set; } #

Title alignment (default left).

public ThemeToken LineRole { get; set; } #

The line's theme role (default ThemeToken.Border).

public BoxStyle? LineStyle { get; set; } #

The line's box style, or null to use the glyph profile's ordinary rule line.

Extension Methods

public static Rule Alignment(Rule rule, HorizontalAlignment value) #

Sets Rule.Alignment: Title alignment (default left).

Parameters

rule ConsoleMonster.Widgets.Rule required
The instance.
value ConsoleMonster.Layout.HorizontalAlignment required
The value.

Returns

Rule The same instance.

Examples

// C# initializer or property                                     // C# fluent
new global::ConsoleMonster.Widgets.Rule { Alignment = value };    Ui.Rule().Alignment(value);
public static Rule LineRole(Rule rule, ThemeToken value) #

Sets Rule.LineRole: The line's theme role (default ThemeToken.Border).

Parameters

rule ConsoleMonster.Widgets.Rule required
The instance.
value ConsoleMonster.Styling.ThemeToken required
The value.

Returns

Rule The same instance.

Examples

// C# initializer or property                                    // C# fluent
new global::ConsoleMonster.Widgets.Rule { LineRole = value };    Ui.Rule().LineRole(value);
public static Rule LineStyle(Rule rule, BoxStyle? value) #

Sets Rule.LineStyle: The line's box style, or null to use the glyph profile's ordinary rule line.

Parameters

rule ConsoleMonster.Widgets.Rule required
The instance.
value ConsoleMonster.Glyphs.BoxStyle? required
The value.

Returns

Rule The same instance.

Examples

// C# initializer or property                                     // C# fluent
new global::ConsoleMonster.Widgets.Rule { LineStyle = value };    Ui.Rule().LineStyle(value);
public static Rule Title(Rule rule, string? value) #

Sets Rule.Title: The title (markup).

Parameters

rule ConsoleMonster.Widgets.Rule required
The instance.
value string? required
The value.

Returns

Rule The same instance.

Examples

// C# initializer or property                                 // C# fluent
new global::ConsoleMonster.Widgets.Rule { Title = value };    Ui.Rule().Title(value);