Table of Contents

Class OverlayStack

Namespace
MiniTui
Assembly
MiniTui.dll

Modal overlays drawn over the screens (§9.3). While any is open, the top one gets every key.

[SuppressMessage("Naming", "CA1711:Identifiers should not have incorrect suffix", Justification = "Name from the spec (§9.3); it is a stack.")]
public sealed class OverlayStack
Inheritance
OverlayStack
Inherited Members

Remarks

Changes made from another thread while the app runs are posted to the UI thread.

Properties

Any

True while any overlay is open.

public bool Any { get; }

Property Value

bool

Top

The overlay on top, or null.

public Overlay? Top { get; }

Property Value

Overlay

Methods

Close(Overlay)

Close an overlay. Does nothing if it isn't open.

public void Close(Overlay overlay)

Parameters

overlay Overlay

ConfirmAsync(string, string, string)

Ask a yes/no question. Enter on Yes and y answer true; Enter on No, n, Esc and closing the dialog answer false. Awaited on the UI thread, the continuation runs there.

public Task<bool> ConfirmAsync(string message, string yes = "Yes", string no = "No")

Parameters

message string
yes string
no string

Returns

Task<bool>

Show(Overlay)

Open an overlay on top of the others.

public void Show(Overlay overlay)

Parameters

overlay Overlay

Exceptions

InvalidOperationException

The overlay is already mounted.

ShowHelp()

Show the key bindings in scope on the current focus chain, grouped by component (§9.5).

public void ShowHelp()

ShowMenuAsync(IReadOnlyList<MenuItem>, Rect, int)

Show a PopupMenu next to anchor (1.x spec §7). The task answers the chosen item's index, or null if the menu was dismissed. With no items it shows nothing and answers null. Awaited on the UI thread, the continuation runs there.

public Task<int?> ShowMenuAsync(IReadOnlyList<MenuItem> items, Rect anchor, int selected = 0)

Parameters

items IReadOnlyList<MenuItem>
anchor Rect
selected int

Returns

Task<int?>

ShowMessageAsync(string, Text)

Show a scrollable message. The task completes when it's closed (Enter or Esc).

public Task ShowMessageAsync(string title, Text body)

Parameters

title string
body Text

Returns

Task

ShowPalette(CommandRegistry?)

Show a CommandPalette over ItemsFor(App, CommandRegistry?): the key bindings in scope and the commands of commands (1.x spec §13). Not bound by default: app.Keys.Add("ctrl+p", "Commands", () => app.Overlays.ShowPalette()).

public void ShowPalette(CommandRegistry? commands = null)

Parameters

commands CommandRegistry