Gnome::Gtk4::AlertDialog
#------------------------------------------------------------------------------- #--[Class Description]---------------------------------------------------------- #-------------------------------------------------------------------------------
Description
Collects the arguments that are needed to present a message to the user.
The message is shown with the .choose() function.
If you don't need to wait for a button to be clicked, you can use .show().
Uml Diagram =for image :src<asset_files/images/plantuml/AlertDialog.png> :width<70%> :class<inline>
#------------------------------------------------------------------------------- #--[Class Initialization]------------------------------------------------------- #-------------------------------------------------------------------------------
Class initialization
new
:native-object
Create an object using a native object from an object of the same type found elsewhere. See also Gnome::N::TopLevelSupportClass.
multi method new ( N-Object() :$native-object! )
#-------------------------------------------------------------------------------
new-alertdialog
Creates a new Gnome::Gtk4::AlertDialog object.
The message will be set to the formatted string resulting from the arguments.
method new-alertdialog ( Str $format, β¦ --> Gnome::Gtk4::AlertDialog )
$format; printf()`-style format string.
β¦; β¦. Note that each argument must be specified as a type followed by its value!
#------------------------------------------------------------------------------- #--[Methods]-------------------------------------------------------------------- #-------------------------------------------------------------------------------
Methods
#-------------------------------------------------------------------------------
choose
Shows the alert to the user.
It is ok to pass undefined for the callback if the alert does not have more than one button. A simpler API for this case is .show().
method choose ( N-Object() $parent, N-Object() $cancellable, GAsyncReadyCallback &callback, gpointer $user-data )
$parent; the parent window.
$cancellable; a cancellable to cancel the operation.
GAsyncReadyCallback &callback; a callback to call when the operation is complete. The function must be specified with the following signature;
:( N-Object $source-object, N-Object $res, gpointer $data ).$user-data; data to pass to
$callback.
#-------------------------------------------------------------------------------
choose-finish
Finishes the .choose() call.
method choose-finish ( N-Object() $result, CArray[N-Error] $err --> Int )
$result; the result.
$err; Error object. When defined, an error can be returned when there is one. Use
Pointerwhen you want to ignore the error. .
Return value; the index of the button that was clicked, or -1 if the dialog was cancelled and cancel-button is not set.
#-------------------------------------------------------------------------------
get-buttons
Returns the button labels for the alert.
method get-buttons (--> Array[Str] )
Return value; the button labels.
#-------------------------------------------------------------------------------
get-cancel-button
Returns the index of the cancel button.
method get-cancel-button (--> Int )
Return value; the index of the cancel button, or -1.
#-------------------------------------------------------------------------------
get-default-button
Returns the index of the default button.
method get-default-button (--> Int )
Return value; the index of the default button, or -1.
#-------------------------------------------------------------------------------
get-detail
Returns the detail text that will be shown in the alert.
method get-detail (--> Str )
Return value; the detail text.
#-------------------------------------------------------------------------------
get-message
Returns the message that will be shown in the alert.
method get-message (--> Str )
Return value; the message.
#-------------------------------------------------------------------------------
get-modal
Returns whether the alert blocks interaction with the parent window while it is presented.
method get-modal (--> Bool )
Return value; true if the alert is modal.
#-------------------------------------------------------------------------------
set-buttons
Sets the button labels for the alert.
method set-buttons ( Array[Str] $labels )
$labels; the new button labels.
#-------------------------------------------------------------------------------
set-cancel-button
Sets the index of the cancel button.
See cancel-button for details of how this value is used.
method set-cancel-button ( Int() $button )
$button; the new cancel button.
#-------------------------------------------------------------------------------
set-default-button
Sets the index of the default button.
See default-button for details of how this value is used.
method set-default-button ( Int() $button )
$button; the new default button.
#-------------------------------------------------------------------------------
set-detail
Sets the detail text that will be shown in the alert.
method set-detail ( Str $detail )
$detail; the new detail text.
#-------------------------------------------------------------------------------
set-message
Sets the message that will be shown in the alert.
method set-message ( Str $message )
$message; the new message.
#-------------------------------------------------------------------------------
set-modal
Sets whether the alert blocks interaction with the parent window while it is presented.
method set-modal ( Bool() $modal )
$modal; the new value.
#-------------------------------------------------------------------------------
show
Shows the alert to the user.
This function is a simpler version of .choose() intended for dialogs with a single button.
If you want to cancel the dialog or if the alert has more than one button, you should use that function instead and provide it with a Gnome::Gtk4::AlertDialog and callback respectively.
method show ( N-Object() $parent )
$parent; the parent window.