Table of Contents

Class ToastContent

Namespace
SharpConsoleUI.Controls
Assembly
SharpConsoleUI.dll

A transient toast overlay rendered as a desktop portal. Role-themed; INPC-reactive.

public sealed class ToastContent : PortalContentBase, IContainer, IDOMPaintable, IMouseAwareControl, IWindowControl, IDisposable, IHasPortalBounds, IColorRoleableControl, INotifyPropertyChanged
Inheritance
ToastContent
Implements
Inherited Members
Extension Methods

Constructors

ToastContent(string, NotificationSeverity, ColorRole)

Initializes a new ToastContent with the given message, severity, and color role.

public ToastContent(string message, NotificationSeverity severity, ColorRole role)

Parameters

message string

The message text to display.

severity NotificationSeverity

The severity level supplying the icon and accent color.

role ColorRole

The semantic color role used for theming.

Properties

ColorRole

The semantic color role. Default = no role (normal resolution).

public ColorRole ColorRole { get; set; }

Property Value

ColorRole

ColorRoleMode

Optional ThemeMode override for role-colour derivation. When non-null, the role's dark/light seed colours are resolved as if the theme were in this mode, regardless of the theme's own Mode. When null (the default), the active theme's mode is used.

public ThemeMode? ColorRoleMode { get; set; }

Property Value

ThemeMode?

Message

Gets or sets the message text shown in the toast.

public string Message { get; set; }

Property Value

string

Outline

When true and a role is set, renders outline style (role color on text + border, surface fill).

public bool Outline { get; set; }

Property Value

bool

Severity

Gets or sets the severity supplying the icon and accent color.

public NotificationSeverity Severity { get; set; }

Property Value

NotificationSeverity

Sticky

Gets or sets whether the toast is sticky (does not auto-dismiss).

public bool Sticky { get; set; }

Property Value

bool

Methods

GetPortalBounds()

Returns the absolute position and size for this portal overlay. Subclasses must implement this to provide their bounds.

public override Rectangle GetPortalBounds()

Returns

Rectangle

PaintPortalContent(CharacterBuffer, LayoutRect, LayoutRect, Color, Color)

Paints the rounded toast box with a severity-role border and a matching inner accent bar.

protected override void PaintPortalContent(CharacterBuffer buffer, LayoutRect bounds, LayoutRect clipRect, Color defaultFg, Color defaultBg)

Parameters

buffer CharacterBuffer
bounds LayoutRect
clipRect LayoutRect
defaultFg Color
defaultBg Color

ProcessMouseEvent(MouseEventArgs)

Processes a mouse event. When BorderStyle is set, coordinates are already adjusted for the border offset.

public override bool ProcessMouseEvent(MouseEventArgs args)

Parameters

args MouseEventArgs

Returns

bool

SetBounds(Rectangle)

Set by ToastService from the toast's stacking slot.

public void SetBounds(Rectangle bounds)

Parameters

bounds Rectangle

Events

PropertyChanged

Occurs when a property value changes.

public event PropertyChangedEventHandler? PropertyChanged

Event Type

PropertyChangedEventHandler