Skip to main content

ModalFrame class

Namespace: Arlecchino.Modals · Assembly: Arlecchino

Everything a dialog needs from the application: where to draw, the words to draw in, the keys to obey, and how to close. A dialog is a value, so it is given these when asked to act.

public sealed class ModalFrame

Properties

MemberSummary
DepthHow many dialogs are already open under this one. Each is offset a row down and three columns along, so a dialog opened from a dialog reads as being on top of it rather than instead of it.
HeightHow many rows tall.
KeymapKeys to obey.
KeysTurns a key press into the character it stands for.
ScreenThe whole screen, for a dialog that would rather place itself.
StringsThe words the application says things in.
WidthHow many cells wide the frame is.

Methods

MemberSummary
Box(string, IReadOnlyList<Piece[]>, string)Draws a titled box holding the lines given, with the hints under a rule. Every dialog the framework brings is drawn through this.
Centered(int, int)A box of the size asked for, in the middle of the screen and never off the edge of it.
Close()Closes the dialog on top, which while it is being handled is this one.
Copy(string)Puts text on the clipboard, for the dialogs that offer copying.
Divider(SurfaceRegion, int)The rule that separates the body of a dialog from its hints.

Properties in detail

Depth

public int Depth { get; }

How many dialogs are already open under this one. Each is offset a row down and three columns along, so a dialog opened from a dialog reads as being on top of it rather than instead of it.

Type int

Height

public int Height { get; }

How many rows tall.

Type int

Keymap

public ArlecchinoKeymap Keymap { get; }

Keys to obey.

Type ArlecchinoKeymap

Keys

public KeyText Keys { get; }

Turns a key press into the character it stands for.

Type KeyText

Screen

public SurfaceRegion Screen { get; }

The whole screen, for a dialog that would rather place itself.

Type SurfaceRegion

Strings

public ArlecchinoStrings Strings { get; }

The words the application says things in.

Type ArlecchinoStrings

Width

public int Width { get; }

How many cells wide the frame is.

Type int

Methods in detail

Box(string, IReadOnlyList<Piece[]>, string)

public ValueTuple<SurfaceRegion, SurfaceRegion> Box(
string title,
IReadOnlyList<Piece[]> body,
string footer);

Draws a titled box holding the lines given, with the hints under a rule. Every dialog the framework brings is drawn through this.

Parameters

NameTypeDescription
titlestringWhat the dialog is called.
bodyIReadOnlyList<T><Piece[]>The lines, each a run of pieces.
footerstringWhat the keys do, along the bottom.

Returns ValueTuple<T1, T2><SurfaceRegion, SurfaceRegion> — The whole box, and the region inside it the lines were written in.

Centered(int, int)

public SurfaceRegion Centered(int contentWidth, int contentHeight);

A box of the size asked for, in the middle of the screen and never off the edge of it.

Parameters

NameTypeDescription
contentWidthintHow wide what goes in it is.
contentHeightintHow tall.

Returns SurfaceRegion — Where the box goes.

Close()

public void Close();

Closes the dialog on top, which while it is being handled is this one.

Copy(string)

public void Copy(string text);

Puts text on the clipboard, for the dialogs that offer copying.

Parameters

NameTypeDescription
textstringWhat to copy.

Divider(SurfaceRegion, int)

public static void Divider(SurfaceRegion box, int insideRow);

The rule that separates the body of a dialog from its hints.

Parameters

NameTypeDescription
boxSurfaceRegionThe whole box, border included.
insideRowintWhich row inside the box it goes under.