#include <toastmessage.h>

Represents a toast message that can be shown to the user. A toast message is a small, transient notification typically anchored to the main application window, displaying a short text and an optional action button.
Instances of this interface act as a stable identity for coalescing: if Show is called again on the same instance (or on a copy of the same reference) while the previous toast triggered by it is still visible, the two occurrences are merged into a single toast instead of showing two separate ones. The occurrence count passed to the ToastMessageFormatter reflects how many times Show has been called for this instance since the toast was last dismissed.
Public Types | |
| enum class | ICON_TYPE { NONE , WARNING , ERROR } |
Public Member Functions | |
| MAXON_METHOD Result< void > | SetMessageFormatter (ToastMessageFormatter &&formatter) |
| MAXON_METHOD Result< void > | SetActionButton (const String &actionButtonText, ToastActionDelegate &&actionButtonDelegate) |
| enum maxon::ToastMessageInterface::ICON_TYPE | MAXON_ENUM_LIST_CLASS (ICON_TYPE) |
| MAXON_METHOD void | SetIconType (ICON_TYPE iconType) |
| MAXON_METHOD Result< void > | Show () |
Private Member Functions | |
| MAXON_INTERFACE (ToastMessageInterface, MAXON_REFERENCE_NORMAL, "net.maxon.interface.toastmessage") | |
|
strong |
|
private |
| MAXON_METHOD Result<void> SetMessageFormatter | ( | ToastMessageFormatter && | formatter | ) |
Sets the formatter used to compute the displayed text of the toast message. This must be set before calling Show, since the text of the toast (for any occurrence count) is always derived from this formatter.
| [in] | formatter | The formatter to use. The caller owns the pointed the moved-from delegate. |
| MAXON_METHOD Result<void> SetActionButton | ( | const String & | actionButtonText, |
| ToastActionDelegate && | actionButtonDelegate | ||
| ) |
Sets the text and delegate of the toast message's action button. Setting an action button is optional; if never called, the toast is shown without one. If this toast is coalesced with a later occurrence, the action button text and delegate set by the most recent call are the ones retained and used.
| [in] | actionButtonText | The text of the action button. |
| [in] | actionButtonDelegate | The delegate invoked when the action button is pressed. The caller owns the pointed the moved-from delegate. |
| enum maxon::ToastMessageInterface::ICON_TYPE MAXON_ENUM_LIST_CLASS | ( | ICON_TYPE | ) |
| MAXON_METHOD void SetIconType | ( | ICON_TYPE | iconType | ) |
Sets the type of icon shown alongside the toast message. Setting an icon is optional; if never called, the toast is shown without one (ICON_TYPE::NONE). If this toast is coalesced with a later occurrence, the icon type set by the most recent call is the one retained and used.
| [in] | iconType | The icon type to display. See ICON_TYPE. |
| MAXON_METHOD Result<void> Show | ( | ) |
Shows the toast message. If a toast previously shown by this same instance is still visible, this occurrence is coalesced into it: the occurrence count is incremented, the message text is recomputed via the formatter set with SetMessageFormatter, and the toast's visible-time is extended. Otherwise, a new toast is shown with an occurrence count of 1.