Skip to main content

Modal class

Namespace: Arlecchino.Modals · Assembly: Arlecchino

A dialog waiting for an answer, assigned to ArlecchinoState.Modal. It draws itself and reads its own keys, so a kind an application writes is another subclass and nothing more.

public abstract class Modal

Derived types NumericModal, TextAreaModal, TextModal, CommandModal, OptionListModal, ColorModal, SegmentedModal, ToggleModal, MessageModal, NotificationModal

Constructors

MemberSummary
Modal()

Properties

MemberSummary
BoxWhere the box was drawn last frame. Set as the dialog draws itself, and used to tell a click on it from a click outside.
TitleTitle written into the top edge of the box.
TypingThe line this dialog is being typed into now, or nothing while it is not being typed into at all. Naming it is all a dialog has to do to be pasted into.

Methods

MemberSummary
Draw(ModalFrame)Draws it.
Handle(ModalFrame, KeyPress)Reads one key, which reaches no one else while this dialog is on top.
HandleMouse(ModalFrame, MouseEvent)Reads one mouse event. Dialogs that cannot be clicked leave it alone.
HandlePaste(ModalFrame, string)Takes a block of pasted text, which lands in Modal.Typing as one edit. A dialog of several rows overrides this; one of a single row has nothing to add.

Constructors in detail

Obsolete

Constructors of types with required members are not supported in this version of your compiler.

public Modal();

Properties in detail

Box

public SurfaceRegion Box { get; set; }

Where the box was drawn last frame. Set as the dialog draws itself, and used to tell a click on it from a click outside.

Type SurfaceRegion

Title

public string Title { get; init; }

Title written into the top edge of the box.

Type string

Typing

public virtual ITextEntry? Typing { get; }

The line this dialog is being typed into now, or nothing while it is not being typed into at all. Naming it is all a dialog has to do to be pasted into.

Type ITextEntry

Methods in detail

Draw(ModalFrame)

public abstract void Draw(ModalFrame frame);

Draws it.

Parameters

NameTypeDescription
frameModalFrameWhere to draw, and the words to draw in.

Handle(ModalFrame, KeyPress)

public abstract void Handle(ModalFrame frame, KeyPress key);

Reads one key, which reaches no one else while this dialog is on top.

Parameters

NameTypeDescription
frameModalFrameThe keys to obey, and how to close.
keyKeyPressThe key that arrived.

HandleMouse(ModalFrame, MouseEvent)

public virtual void HandleMouse(ModalFrame frame, MouseEvent mouse);

Reads one mouse event. Dialogs that cannot be clicked leave it alone.

Parameters

NameTypeDescription
frameModalFrameThe keys to obey, and how to close.
mouseMouseEventThe event that arrived.

HandlePaste(ModalFrame, string)

public virtual void HandlePaste(ModalFrame frame, string text);

Takes a block of pasted text, which lands in Modal.Typing as one edit. A dialog of several rows overrides this; one of a single row has nothing to add.

Parameters

NameTypeDescription
frameModalFrameThe keys to obey, and how to close.
textstringWhat was pasted, with the terminal's markers already stripped.