# Toast notifications

`XmToast` is a per-instance, non-modal notification composite. It owns a message label and an optional action button; the application owns placement, severity policy and the callback that performs an action. The toolkit does not create a process-global queue, move shells to screen edges, or alter dialogs, menus or navigation.

`XmToastShow` replaces the instance's current presentation and starts its configured timeout. `XmToastPause` cancels or restarts the full timeout, `XmToastDismiss` is idempotent, and `XmToastInvokeAction` dispatches without launching a command. A timeout of zero leaves the toast visible until explicit dismissal. Message and action labels are copied `XmString` resources; callbacks run on the owning Xt application context. Escape respects widget sensitivity, so a disabled toast remains visible until dismissed by its owner or timeout policy.

For right-to-left layouts, the optional action occupies the logical start edge and the message follows it. Left-to-right layouts retain the conventional message-first, action-at-end arrangement.

A live `XmNlayoutDirection` update recalculates that child layout.

Accessibility exposes a shown toast as a panel named from its message and reports an action only when an action label is present. The installed fixture covers show/dismiss, pause, action dispatch, timeout teardown, accessibility and destruction.

## Component demo

Captured gallery example and its corresponding source excerpt.

**Demo**

![xmToastWidgetClass demo](<gallery-screenshots/xm-toastwidgetclass.png>)

**Source**

Actual gallery excerpt: class = xmToastWidgetClass. The host supplies parent, name, callback and client\_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery\_examples.c.

```c
label = XmStringCreateLocalized((char *)"Document saved successfully");
example = XtVaCreateManagedWidget((char *)name, class, parent,
                                  XmNtoastMessage, label,
                                  XmNtoastTimeout, 0, NULL);
XmToastShow(example);
```

[Complete demo source](<demos/programs/ckmotif-gallery/gallery_examples.c>) · [Public header](<lib/Xm/Toast.h>)
