Adw.ToastOverlay

g Adw.ToastOverlay Adw.ToastOverlay GObject.GInterface GObject.GInterface Gtk.Accessible Gtk.Accessible GObject.GInterface->Gtk.Accessible Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.ConstraintTarget Gtk.ConstraintTarget GObject.GInterface->Gtk.ConstraintTarget GObject.InitiallyUnowned GObject.InitiallyUnowned Gtk.Widget Gtk.Widget GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Accessible->Gtk.Widget Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget->Gtk.Widget Gtk.Widget->Adw.ToastOverlay

Subclasses:

None

Methods

Inherited:

Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1)

Structs:

Gtk.WidgetClass (18), GObject.ObjectClass (5)

class

new ()

add_toast (toast)

get_child ()

set_child (child)

Virtual Methods

Inherited:

Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9)

Properties

Inherited:

Gtk.Widget (34), Gtk.Accessible (1)

Name

Type

Flags

Short Description

child

Gtk.Widget

r/w/en

Signals

Inherited:

Gtk.Widget (13), GObject.Object (1)

Fields

Inherited:

Gtk.Widget (13), GObject.Object (1)

Class Details

class Adw.ToastOverlay(**kwargs)
Bases:

Gtk.Widget

Abstract:

No

Structure:

Adw.ToastOverlayClass

A widget showing toasts above its content.

<picture> <source srcset=”toast-overlay-dark.png” media=”(prefers-color-scheme: dark)”> <img src=”toast-overlay.png” alt=”toast-overlay”> </picture>

Much like [class`Gtk`.Overlay], AdwToastOverlay is a container with a single main child, on top of which it can display a [class`Toast`], overlaid. Toasts can be shown with [method`ToastOverlay`.add_toast].

See [class`Toast`] for details.

CSS nodes

`` toastoverlay ├── [child] ├── toast ┊ ├── widget ┊ │ ├── [label.heading]

│ ╰── [custom title] ├── [button] ╰── button.circular.flat

``

AdwToastOverlay’s CSS node is called toastoverlay. It contains the child, as well as zero or more toast subnodes.

Each of the toast nodes contains a widget subnode, optionally a button subnode, and another button subnode with .circular and .flat style classes.

The widget subnode contains a label subnode with the .heading style class, or a custom widget provided by the application.

Accessibility

AdwToastOverlay uses the GTK_ACCESSIBLE_ROLE_TAB_GROUP role.

classmethod new()
Returns:

the new created AdwToastOverlay

Return type:

Gtk.Widget

Creates a new AdwToastOverlay.

add_toast(toast)
Parameters:

toast (Adw.Toast) – a toast

Displays toast.

Only one toast can be shown at a time; if a toast is already being displayed, either toast or the original toast will be placed in a queue, depending on the priority of toast. See [property`Toast`:py:data::priority<Adw.ToastOverlay.props.priority>].

If called on a toast that’s already displayed, its timeout will be reset.

If called on a toast currently in the queue, the toast will be bumped forward to be shown as soon as possible.

get_child()
Returns:

the child widget of self

Return type:

Gtk.Widget or None

Gets the child widget of self.

set_child(child)
Parameters:

child (Gtk.Widget or None) – the child widget

Sets the child widget of self.

Property Details

Adw.ToastOverlay.props.child
Name:

child

Type:

Gtk.Widget

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The child widget.