Class ToastOverlay

All Implemented Interfaces:
Accessible, Buildable, ConstraintTarget, Proxy

@Generated("org.javagi.JavaGI") public final class ToastOverlay extends Widget implements Accessible, Buildable, ConstraintTarget

A widget showing toasts above its content.

toast-overlay

Much like Overlay, AdwToastOverlay is a container with a single main child, on top of which it can display a Toast, overlaid. Toasts can be shown with addToast(Toast).

Use dismissAll() to dismiss all toasts at once, or Toast.dismiss() to dismiss a single toast.

See 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.AccessibleRole.group role.

  • Constructor Details

    • ToastOverlay

      public ToastOverlay(MemorySegment address)
      Create a ToastOverlay instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • ToastOverlay

      public ToastOverlay()
      Create a new ToastOverlay.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the ToastOverlay class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected ToastOverlay asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class Widget
      Returns:
      the instance as if it were its parent type
    • addToast

      public void addToast(Toast 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 Toast: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.

      Parameters:
      toast - a toast
    • dismissAll

      public void dismissAll()

      Dismisses all displayed toasts.

      Use Toast.dismiss() to dismiss a single toast.

      Since:
      1.7
    • getChild

      public @Nullable Widget getChild()
      Gets the child widget of self.
      Returns:
      the child widget of this ToastOverlay
    • setChild

      public void setChild(@Nullable Widget child)
      Sets the child widget of self.
      Parameters:
      child - the child widget
    • builder

      public static ToastOverlay.Builder<? extends ToastOverlay.Builder> builder()
      A ToastOverlay.Builder object constructs a ToastOverlay with the specified properties. Use the various set...() methods to set properties, and finish construction with ToastOverlay.Builder.build().
      Returns:
      the builder object