Class Toast.Builder<B extends Toast.Builder<B>>
- Type Parameters:
B
- the type of the Builder that is returned
- All Implemented Interfaces:
BuilderInterface
- Enclosing class:
Toast
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Finish building theToast
object.Emitted after the button has been clicked.onDismissed
(Toast.DismissedCallback handler) Emitted when the toast has been dismissed.setActionName
(String actionName) The name of the associated action.setActionTarget
(Variant actionTarget) The parameter for action invocations.setButtonLabel
(String buttonLabel) The label to show on the button.setCustomTitle
(Widget customTitle) The custom title widget.setPriority
(ToastPriority priority) The priority of the toast.setTimeout
(int timeout) The timeout of the toast, in seconds.The title of the toast.setUseMarkup
(boolean useMarkup) Whether to use Pango markup for the toast title.Methods inherited from class org.gnome.gobject.GObject.Builder
onNotify
Methods inherited from class io.github.jwharm.javagi.gobject.Builder
addBuilderProperty, connect, connect, connectSignals, getArena, getNames, getValues
-
Constructor Details
-
Builder
protected Builder()Default constructor for aBuilder
object.
-
-
Method Details
-
build
Finish building theToast
object. This will callGObject.withProperties(org.gnome.glib.Type, java.lang.String[], org.gnome.gobject.Value[])
to create a new GObject instance, which is then cast toToast
.- Overrides:
build
in classGObject.Builder<B extends Toast.Builder<B>>
- Returns:
- a new instance of
Toast
with the properties that were set in the Builder object.
-
setActionName
-
setActionTarget
-
setButtonLabel
The label to show on the button.Underlines in the button text can be used to indicate a mnemonic.
If set to
NULL
, the button won't be shown.See
Toast:action-name
.- Parameters:
buttonLabel
- the value for thebutton-label
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setCustomTitle
The custom title widget.It will be displayed instead of the title if set. In this case,
Toast:title
is ignored.Setting a custom title will unset
Toast:title
.- Parameters:
customTitle
- the value for thecustom-title
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setPriority
The priority of the toast.Priority controls how the toast behaves when another toast is already being displayed.
If the priority is
ADW_TOAST_PRIORITY_NORMAL
, the toast will be queued.If the priority is
ADW_TOAST_PRIORITY_HIGH
, the toast will be displayed immediately, pushing the previous toast into the queue instead.- Parameters:
priority
- the value for thepriority
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setTimeout
The timeout of the toast, in seconds.If timeout is 0, the toast is displayed indefinitely until manually dismissed.
Toasts cannot disappear while being hovered, pressed (on touchscreen), or have keyboard focus inside them.
- Parameters:
timeout
- the value for thetimeout
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setTitle
The title of the toast.The title can be marked up with the Pango text markup language.
Setting a title will unset
Toast:custom-title
.If
Toast:custom-title
is set, it will be used instead.- Parameters:
title
- the value for thetitle
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setUseMarkup
Whether to use Pango markup for the toast title.- Parameters:
useMarkup
- the value for theuse-markup
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
onButtonClicked
Emitted after the button has been clicked.It can be used as an alternative to setting an action.
- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-
onDismissed
Emitted when the toast has been dismissed.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - See Also:
-