Package ch.bailu.gtk.adw
Klasse AlertDialog
- Alle implementierten Schnittstellen:
PointerInterface
A dialog presenting a message or a question.
<picture>
<source srcset="alert-dialog-dark.png" media="(prefers-color-scheme: dark)">
<img src="alert-dialog.png" alt="alert-dialog">
</picture>
Alert dialogs have a heading, a body, an optional child widget, and one or
multiple responses, each presented as a button.
Each response has a unique string ID, and a button label. Additionally, each
response can be enabled or disabled, and can have a suggested or destructive
appearance.
When one of the responses is activated, or the dialog is closed, the
[signal@AlertDialog::response] signal will be emitted. This signal is
detailed, and the detail, as well as the `response` parameter will be set to
the ID of the activated response, or to the value of the
[property@AlertDialog:close-response] property if the dialog had been closed
without activating any of the responses.
Response buttons can be presented horizontally or vertically depending on
available space.
When a response is activated, `AdwAlertDialog` is closed automatically.
An example of using an alert dialog:
```c
AdwDialog *dialog;
dialog = adw_alert_dialog_new (_("Replace File?"), NULL);
adw_alert_dialog_format_body (ADW_ALERT_DIALOG (dialog),
_("A file named “%s” already exists. Do you want to replace it?"),
filename);
adw_alert_dialog_add_responses (ADW_ALERT_DIALOG (dialog),
"cancel", _("_Cancel"),
"replace", _("_Replace"),
NULL);
adw_alert_dialog_set_response_appearance (ADW_ALERT_DIALOG (dialog),
"replace",
ADW_RESPONSE_DESTRUCTIVE);
adw_alert_dialog_set_default_response (ADW_ALERT_DIALOG (dialog), "cancel");
adw_alert_dialog_set_close_response (ADW_ALERT_DIALOG (dialog), "cancel");
g_signal_connect (dialog, "response", G_CALLBACK (response_cb), self);
adw_dialog_present (dialog, parent);
```
## Async API
`AdwAlertDialog` can also be used via the [method@AlertDialog.choose] method.
This API follows the GIO async pattern, for example:
```c
static void
dialog_cb (AdwAlertDialog *dialog,
GAsyncResult *result,
MyWindow *self)
{
const char *response = adw_alert_dialog_choose_finish (dialog, result);
// ...
}
static void
show_dialog (MyWindow *self)
{
AdwDialog *dialog;
dialog = adw_alert_dialog_new (_("Replace File?"), NULL);
adw_alert_dialog_format_body (ADW_ALERT_DIALOG (dialog),
_("A file named “%s” already exists. Do you want to replace it?"),
filename);
adw_alert_dialog_add_responses (ADW_ALERT_DIALOG (dialog),
"cancel", _("_Cancel"),
"replace", _("_Replace"),
NULL);
adw_alert_dialog_set_response_appearance (ADW_ALERT_DIALOG (dialog),
"replace",
ADW_RESPONSE_DESTRUCTIVE);
adw_alert_dialog_set_default_response (ADW_ALERT_DIALOG (dialog), "cancel");
adw_alert_dialog_set_close_response (ADW_ALERT_DIALOG (dialog), "cancel");
adw_alert_dialog_choose (ADW_ALERT_DIALOG (dialog), GTK_WIDGET (self),
NULL, (GAsyncReadyCallback) dialog_cb, self);
}
```
## AdwAlertDialog as GtkBuildable
`AdwAlertDialog` supports adding responses in UI definitions by via the
`<responses>` element that may contain multiple `<response>` elements, each
representing a response.
Each of the `<response>` elements must have the `id` attribute specifying the
response ID. The contents of the element are used as the response label.
Response labels can be translated with the usual `translatable`, `context`
and `comments` attributes.
The `<response>` elements can also have `enabled` and/or `appearance`
attributes. See [method@AlertDialog.set_response_enabled] and
[method@AlertDialog.set_response_appearance] for details.
Example of an `AdwAlertDialog` UI definition:
```xml
<object class="AdwAlertDialog" id="dialog">
<property name="heading" translatable="yes">Save Changes?</property>
<property name="body" translatable="yes">Open documents contain unsaved changes. Changes which are not saved will be permanently lost.</property>
<property name="default-response">save</property>
<property name="close-response">cancel</property>
<signal name="response" handler="response_cb"/>
<responses>
<response id="cancel" translatable="yes">_Cancel</response>
<response id="discard" translatable="yes" appearance="destructive">_Discard</response>
<response id="save" translatable="yes" appearance="suggested" enabled="false">_Save</response>
</responses>
</object>
```
<picture>
<source srcset="alert-dialog-dark.png" media="(prefers-color-scheme: dark)">
<img src="alert-dialog.png" alt="alert-dialog">
</picture>
Alert dialogs have a heading, a body, an optional child widget, and one or
multiple responses, each presented as a button.
Each response has a unique string ID, and a button label. Additionally, each
response can be enabled or disabled, and can have a suggested or destructive
appearance.
When one of the responses is activated, or the dialog is closed, the
[signal@AlertDialog::response] signal will be emitted. This signal is
detailed, and the detail, as well as the `response` parameter will be set to
the ID of the activated response, or to the value of the
[property@AlertDialog:close-response] property if the dialog had been closed
without activating any of the responses.
Response buttons can be presented horizontally or vertically depending on
available space.
When a response is activated, `AdwAlertDialog` is closed automatically.
An example of using an alert dialog:
```c
AdwDialog *dialog;
dialog = adw_alert_dialog_new (_("Replace File?"), NULL);
adw_alert_dialog_format_body (ADW_ALERT_DIALOG (dialog),
_("A file named “%s” already exists. Do you want to replace it?"),
filename);
adw_alert_dialog_add_responses (ADW_ALERT_DIALOG (dialog),
"cancel", _("_Cancel"),
"replace", _("_Replace"),
NULL);
adw_alert_dialog_set_response_appearance (ADW_ALERT_DIALOG (dialog),
"replace",
ADW_RESPONSE_DESTRUCTIVE);
adw_alert_dialog_set_default_response (ADW_ALERT_DIALOG (dialog), "cancel");
adw_alert_dialog_set_close_response (ADW_ALERT_DIALOG (dialog), "cancel");
g_signal_connect (dialog, "response", G_CALLBACK (response_cb), self);
adw_dialog_present (dialog, parent);
```
## Async API
`AdwAlertDialog` can also be used via the [method@AlertDialog.choose] method.
This API follows the GIO async pattern, for example:
```c
static void
dialog_cb (AdwAlertDialog *dialog,
GAsyncResult *result,
MyWindow *self)
{
const char *response = adw_alert_dialog_choose_finish (dialog, result);
// ...
}
static void
show_dialog (MyWindow *self)
{
AdwDialog *dialog;
dialog = adw_alert_dialog_new (_("Replace File?"), NULL);
adw_alert_dialog_format_body (ADW_ALERT_DIALOG (dialog),
_("A file named “%s” already exists. Do you want to replace it?"),
filename);
adw_alert_dialog_add_responses (ADW_ALERT_DIALOG (dialog),
"cancel", _("_Cancel"),
"replace", _("_Replace"),
NULL);
adw_alert_dialog_set_response_appearance (ADW_ALERT_DIALOG (dialog),
"replace",
ADW_RESPONSE_DESTRUCTIVE);
adw_alert_dialog_set_default_response (ADW_ALERT_DIALOG (dialog), "cancel");
adw_alert_dialog_set_close_response (ADW_ALERT_DIALOG (dialog), "cancel");
adw_alert_dialog_choose (ADW_ALERT_DIALOG (dialog), GTK_WIDGET (self),
NULL, (GAsyncReadyCallback) dialog_cb, self);
}
```
## AdwAlertDialog as GtkBuildable
`AdwAlertDialog` supports adding responses in UI definitions by via the
`<responses>` element that may contain multiple `<response>` elements, each
representing a response.
Each of the `<response>` elements must have the `id` attribute specifying the
response ID. The contents of the element are used as the response label.
Response labels can be translated with the usual `translatable`, `context`
and `comments` attributes.
The `<response>` elements can also have `enabled` and/or `appearance`
attributes. See [method@AlertDialog.set_response_enabled] and
[method@AlertDialog.set_response_appearance] for details.
Example of an `AdwAlertDialog` UI definition:
```xml
<object class="AdwAlertDialog" id="dialog">
<property name="heading" translatable="yes">Save Changes?</property>
<property name="body" translatable="yes">Open documents contain unsaved changes. Changes which are not saved will be permanently lost.</property>
<property name="default-response">save</property>
<property name="close-response">cancel</property>
<signal name="response" handler="response_cb"/>
<responses>
<response id="cancel" translatable="yes">_Cancel</response>
<response id="discard" translatable="yes" appearance="destructive">_Discard</response>
<response id="save" translatable="yes" appearance="suggested" enabled="false">_Save</response>
</responses>
</object>
```
https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.AlertDialog.html
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenModifizierer und TypKlasseBeschreibungstatic interface
static interface
Von Klasse geerbte verschachtelte Klassen/Schnittstellen ch.bailu.gtk.adw.Dialog
Dialog.OnCloseAttempt, Dialog.OnClosed
Von Klasse geerbte verschachtelte Klassen/Schnittstellen ch.bailu.gtk.gtk.Widget
Widget.OnDestroy, Widget.OnDestroyNotify, Widget.OnDirectionChanged, Widget.OnHide, Widget.OnKeynavFailed, Widget.OnMap, Widget.OnMnemonicActivate, Widget.OnMoveFocus, Widget.OnQueryTooltip, Widget.OnRealize, Widget.OnShow, Widget.OnStateFlagsChanged, Widget.OnTickCallback, Widget.OnUnmap, Widget.OnUnrealize
Von Klasse geerbte verschachtelte Klassen/Schnittstellen ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Feldübersicht
FelderVon Klasse geerbte Felder ch.bailu.gtk.adw.Dialog
SIGNAL_ON_CLOSE_ATTEMPT, SIGNAL_ON_CLOSED
Von Klasse geerbte Felder ch.bailu.gtk.gtk.Widget
SIGNAL_ON_DESTROY, SIGNAL_ON_DIRECTION_CHANGED, SIGNAL_ON_HIDE, SIGNAL_ON_KEYNAV_FAILED, SIGNAL_ON_MAP, SIGNAL_ON_MNEMONIC_ACTIVATE, SIGNAL_ON_MOVE_FOCUS, SIGNAL_ON_QUERY_TOOLTIP, SIGNAL_ON_REALIZE, SIGNAL_ON_SHOW, SIGNAL_ON_STATE_FLAGS_CHANGED, SIGNAL_ON_UNMAP, SIGNAL_ON_UNREALIZE
Von Klasse geerbte Felder ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungAlertDialog
(PointerContainer pointer) AlertDialog
(Str heading, Str body) Creates a new `AdwAlertDialog`.AlertDialog
(String heading, String body) Creates a new `AdwAlertDialog`. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
addResponse
(Str id, Str label) Adds a response with @id and @label to @self.void
addResponse
(String id, String label) Adds a response with @id and @label to @self.void
addResponses
(Str first_id, Object... _ellipsis) Adds multiple responses to @self.void
addResponses
(String first_id, Object... _ellipsis) Adds multiple responses to @self.Implements interfaceAccessible
.Implements interfaceBuildable
.Implements interfaceConstraintTarget
.Implements interfaceShortcutManager
.void
choose
(Widget parent, Cancellable cancellable, AlertDialog.OnAsyncReadyCallback callback, Pointer user_data) This function shows @self to the user.chooseFinish
(AsyncResult result) Finishes the [method@AlertDialog.choose] call and returns the response ID.void
formatBody
(Str format, Object... _ellipsis) Sets the formatted body text of @self.void
formatBody
(String format, Object... _ellipsis) Sets the formatted body text of @self.void
formatBodyMarkup
(Str format, Object... _ellipsis) Sets the formatted body text of @self with Pango markup.void
formatBodyMarkup
(String format, Object... _ellipsis) Sets the formatted body text of @self with Pango markup.void
formatHeading
(Str format, Object... _ellipsis) Sets the formatted heading of @self.void
formatHeading
(String format, Object... _ellipsis) Sets the formatted heading of @self.void
formatHeadingMarkup
(Str format, Object... _ellipsis) Sets the formatted heading of @self with Pango markup.void
formatHeadingMarkup
(String format, Object... _ellipsis) Sets the formatted heading of @self with Pango markup.getBody()
Gets the body text of @self.boolean
Gets whether the body text of @self includes Pango markup.static ClassHandler
Gets the ID of the close response of @self.Gets the ID of the default response of @self.Gets the child widget of @self.Gets the heading of @self.boolean
Gets whether the heading of @self includes Pango markup.static int
static long
static TypeSystem.TypeSize
boolean
Gets whether @self prefers wide layout.int
getResponseAppearance
(Str response) Gets the appearance of @response.int
getResponseAppearance
(String response) Gets the appearance of @response.boolean
getResponseEnabled
(Str response) Gets whether @response is enabled.boolean
getResponseEnabled
(String response) Gets whether @response is enabled.getResponseLabel
(Str response) Gets the label of @response.getResponseLabel
(String response) Gets the label of @response.static long
static TypeSystem.TypeSize
boolean
hasResponse
(Str response) Gets whether @self has a response with the ID @response.boolean
hasResponse
(String response) Gets whether @self has a response with the ID @response.onResponse
(AlertDialog.OnResponse signal) Connect to signal "response".void
removeResponse
(Str id) Removes a response from @self.void
removeResponse
(String id) Removes a response from @self.void
Sets the body text of @self.void
Sets the body text of @self.void
setBodyUseMarkup
(boolean use_markup) Sets whether the body text of @self includes Pango markup.void
setCloseResponse
(Str response) Sets the ID of the close response of @self.void
setCloseResponse
(String response) Sets the ID of the close response of @self.void
setDefaultResponse
(Str response) Sets the ID of the default response of @self.void
setDefaultResponse
(String response) Sets the ID of the default response of @self.void
setExtraChild
(Widget child) Sets the child widget of @self.void
setHeading
(Str heading) Sets the heading of @self.void
setHeading
(String heading) Sets the heading of @self.void
setHeadingUseMarkup
(boolean use_markup) Sets whether the heading of @self includes Pango markup.void
setPreferWideLayout
(boolean prefer_wide_layout) Sets whether @self prefers wide layout.void
setResponseAppearance
(Str response, int appearance) Sets the appearance for @response.void
setResponseAppearance
(String response, int appearance) Sets the appearance for @response.void
setResponseEnabled
(Str response, boolean enabled) Sets whether @response is enabled.void
setResponseEnabled
(String response, boolean enabled) Sets whether @response is enabled.void
setResponseLabel
(Str response, Str label) Sets the label of @response to @label.void
setResponseLabel
(String response, String label) Sets the label of @response to @label.Von Klasse geerbte Methoden ch.bailu.gtk.adw.Dialog
addBreakpoint, close, forceClose, getCanClose, getChild, getContentHeight, getContentWidth, getCurrentBreakpoint, getDefaultWidget, getFocus, getFollowsContentSize, getPresentationMode, getTitle, onCloseAttempt, onClosed, present, setCanClose, setChild, setContentHeight, setContentWidth, setDefaultWidget, setFocus, setFollowsContentSize, setPresentationMode, setTitle, setTitle
Von Klasse geerbte Methoden ch.bailu.gtk.gtk.Widget
actionSetEnabled, actionSetEnabled, activate, activateAction, activateAction, activateActionVariant, activateActionVariant, activateDefault, addController, addCssClass, addCssClass, addMnemonicLabel, addTickCallback, allocate, childFocus, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, createPangoLayout, disposeTemplate, dragCheckThreshold, errorBell, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getBaseline, getCanFocus, getCanTarget, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getDefaultDirection, getDirection, getDisplay, getFirstChild, getFocusable, getFocusChild, getFocusOnClick, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getLimitEvents, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getName, getNative, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPreferredSize, getPrevSibling, getPrimaryClipboard, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTemplateChild, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth, grabFocus, hasCssClass, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, observeChildren, observeControllers, onDestroy, onDirectionChanged, onHide, onKeynavFailed, onMap, onMnemonicActivate, onMoveFocus, onQueryTooltip, onRealize, onShow, onStateFlagsChanged, onUnmap, onUnrealize, pick, queueAllocate, queueDraw, queueResize, realize, removeController, removeCssClass, removeCssClass, removeMnemonicLabel, removeTickCallback, setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setCursorFromName, setDefaultDirection, setDirection, setFocusable, setFocusChild, setFocusOnClick, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLayoutManager, setLimitEvents, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setName, setOpacity, setOverflow, setParent, setReceivesDefault, setSensitive, setSizeRequest, setStateFlags, setTooltipMarkup, setTooltipMarkup, setTooltipText, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible, shouldLayout, show, sizeAllocate, snapshotChild, triggerTooltipQuery, unmap, unparent, unrealize, unsetStateFlags
Von Klasse geerbte Methoden ch.bailu.gtk.type.PropertyHolder
getBooleanProperty, getIntProperty, getObjectProperty, getStringProperty, getStrProperty, setBooleanProperty, setIntProperty, setObjectProperty, setStringProperty, setStrProperty
Von Klasse geerbte Methoden ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Von Klasse geerbte Methoden ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Von Klasse geerbte Methoden ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Von Klasse geerbte Methoden java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Von Schnittstelle geerbte Methoden ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Felddetails
-
SIGNAL_ON_RESPONSE
- Siehe auch:
-
-
Konstruktordetails
-
AlertDialog
-
AlertDialog
Creates a new `AdwAlertDialog`.
@heading and @body can be set to `NULL`. This can be useful if they need to
be formatted or use markup. In that case, set them to `NULL` and call
[method@AlertDialog.format_body] or similar methods afterwards:
```c
AdwDialog *dialog;
dialog = adw_alert_dialog_new (_("Replace File?"), NULL);
adw_alert_dialog_format_body (ADW_ALERT_DIALOG (dialog),
_("A file named “%s” already exists. Do you want to replace it?"),
filename);
```- Parameter:
heading
- the headingbody
- the body text
-
AlertDialog
Creates a new `AdwAlertDialog`.
@heading and @body can be set to `NULL`. This can be useful if they need to
be formatted or use markup. In that case, set them to `NULL` and call
[method@AlertDialog.format_body] or similar methods afterwards:
```c
AdwDialog *dialog;
dialog = adw_alert_dialog_new (_("Replace File?"), NULL);
adw_alert_dialog_format_body (ADW_ALERT_DIALOG (dialog),
_("A file named “%s” already exists. Do you want to replace it?"),
filename);
```- Parameter:
heading
- the headingbody
- the body text
-
-
Methodendetails
-
getClassHandler
-
addResponse
Adds a response with @id and @label to @self.
Responses are represented as buttons in the dialog.
Response ID must be unique. It will be used in [signal@AlertDialog::response]
to tell which response had been activated, as well as to inspect and modify
the response later.
An embedded underline in @label indicates a mnemonic.
[method@AlertDialog.set_response_label] can be used to change the response
label after it had been added.
[method@AlertDialog.set_response_enabled] and
[method@AlertDialog.set_response_appearance] can be used to customize the
responses further.- Parameter:
id
- the response IDlabel
- the response label
-
addResponse
Adds a response with @id and @label to @self.
Responses are represented as buttons in the dialog.
Response ID must be unique. It will be used in [signal@AlertDialog::response]
to tell which response had been activated, as well as to inspect and modify
the response later.
An embedded underline in @label indicates a mnemonic.
[method@AlertDialog.set_response_label] can be used to change the response
label after it had been added.
[method@AlertDialog.set_response_enabled] and
[method@AlertDialog.set_response_appearance] can be used to customize the
responses further.- Parameter:
id
- the response IDlabel
- the response label
-
addResponses
Adds multiple responses to @self.
This is the same as calling [method@AlertDialog.add_response] repeatedly. The
variable argument list should be `NULL`-terminated list of response IDs and
labels.
Example:
```c
adw_alert_dialog_add_responses (dialog,
"cancel", _("_Cancel"),
"discard", _("_Discard"),
"save", _("_Save"),
NULL);
```- Parameter:
first_id
- response id_ellipsis
- label for first response, then more id-label pairs
-
addResponses
Adds multiple responses to @self.
This is the same as calling [method@AlertDialog.add_response] repeatedly. The
variable argument list should be `NULL`-terminated list of response IDs and
labels.
Example:
```c
adw_alert_dialog_add_responses (dialog,
"cancel", _("_Cancel"),
"discard", _("_Discard"),
"save", _("_Save"),
NULL);
```- Parameter:
first_id
- response id_ellipsis
- label for first response, then more id-label pairs
-
choose
public void choose(@Nullable Widget parent, @Nullable Cancellable cancellable, AlertDialog.OnAsyncReadyCallback callback, @Nullable Pointer user_data) This function shows @self to the user.
If the window is an [class@Window] or [class@ApplicationWindow], the dialog
will be shown within it. Otherwise, it will be a separate window.- Parameter:
parent
- the parent widgetcancellable
- a `GCancellable` to cancel the operationcallback
- a callback to call when the operation is completeuser_data
- data to pass to @callback
-
chooseFinish
Finishes the [method@AlertDialog.choose] call and returns the response ID.- Parameter:
result
- a `GAsyncResult`- Gibt zurück:
- the ID of the response that was selected, or [property@AlertDialog:close-response] if the call was cancelled.
-
formatBody
Sets the formatted body text of @self.
See [property@AlertDialog:body].- Parameter:
format
- the formatted string for the body text_ellipsis
- the parameters to insert into @format
-
formatBody
Sets the formatted body text of @self.
See [property@AlertDialog:body].- Parameter:
format
- the formatted string for the body text_ellipsis
- the parameters to insert into @format
-
formatBodyMarkup
Sets the formatted body text of @self with Pango markup.
The @format is assumed to contain Pango markup.
Special XML characters in the `printf()` arguments passed to this function
will automatically be escaped as necessary, see
[func@GLib.markup_printf_escaped].
See [property@AlertDialog:body].- Parameter:
format
- the formatted string for the body text with Pango markup_ellipsis
- the parameters to insert into @format
-
formatBodyMarkup
Sets the formatted body text of @self with Pango markup.
The @format is assumed to contain Pango markup.
Special XML characters in the `printf()` arguments passed to this function
will automatically be escaped as necessary, see
[func@GLib.markup_printf_escaped].
See [property@AlertDialog:body].- Parameter:
format
- the formatted string for the body text with Pango markup_ellipsis
- the parameters to insert into @format
-
formatHeading
Sets the formatted heading of @self.
See [property@AlertDialog:heading].- Parameter:
format
- the formatted string for the heading_ellipsis
- the parameters to insert into @format
-
formatHeading
Sets the formatted heading of @self.
See [property@AlertDialog:heading].- Parameter:
format
- the formatted string for the heading_ellipsis
- the parameters to insert into @format
-
formatHeadingMarkup
Sets the formatted heading of @self with Pango markup.
The @format is assumed to contain Pango markup.
Special XML characters in the `printf()` arguments passed to this function
will automatically be escaped as necessary, see
[func@GLib.markup_printf_escaped].
See [property@AlertDialog:heading].- Parameter:
format
- the formatted string for the heading with Pango markup_ellipsis
- the parameters to insert into @format
-
formatHeadingMarkup
Sets the formatted heading of @self with Pango markup.
The @format is assumed to contain Pango markup.
Special XML characters in the `printf()` arguments passed to this function
will automatically be escaped as necessary, see
[func@GLib.markup_printf_escaped].
See [property@AlertDialog:heading].- Parameter:
format
- the formatted string for the heading with Pango markup_ellipsis
- the parameters to insert into @format
-
getBody
Gets the body text of @self.- Gibt zurück:
- the body of @self.
-
getBodyUseMarkup
public boolean getBodyUseMarkup()Gets whether the body text of @self includes Pango markup.- Gibt zurück:
- whether @self uses markup for body text
-
getCloseResponse
Gets the ID of the close response of @self.- Gibt zurück:
- the close response ID
-
getDefaultResponse
Gets the ID of the default response of @self.- Gibt zurück:
- the default response ID
-
getExtraChild
Gets the child widget of @self.- Gibt zurück:
- the child widget of @self.
-
getHeading
Gets the heading of @self.- Gibt zurück:
- the heading of @self.
-
getHeadingUseMarkup
public boolean getHeadingUseMarkup()Gets whether the heading of @self includes Pango markup.- Gibt zurück:
- whether @self uses markup for heading
-
getPreferWideLayout
public boolean getPreferWideLayout()Gets whether @self prefers wide layout.- Gibt zurück:
- whether to prefer wide layout
-
getResponseAppearance
Gets the appearance of @response.
See [method@AlertDialog.set_response_appearance].- Parameter:
response
- a response ID- Gibt zurück:
- the appearance of @response
-
getResponseAppearance
Gets the appearance of @response.
See [method@AlertDialog.set_response_appearance].- Parameter:
response
- a response ID- Gibt zurück:
- the appearance of @response
-
getResponseEnabled
Gets whether @response is enabled.
See [method@AlertDialog.set_response_enabled].- Parameter:
response
- a response ID- Gibt zurück:
- whether @response is enabled
-
getResponseEnabled
Gets whether @response is enabled.
See [method@AlertDialog.set_response_enabled].- Parameter:
response
- a response ID- Gibt zurück:
- whether @response is enabled
-
getResponseLabel
Gets the label of @response.
See [method@AlertDialog.set_response_label].- Parameter:
response
- a response ID- Gibt zurück:
- the label of @response
-
getResponseLabel
Gets the label of @response.
See [method@AlertDialog.set_response_label].- Parameter:
response
- a response ID- Gibt zurück:
- the label of @response
-
hasResponse
Gets whether @self has a response with the ID @response.- Parameter:
response
- response ID- Gibt zurück:
- whether @self has a response with the ID @response.
-
hasResponse
Gets whether @self has a response with the ID @response.- Parameter:
response
- response ID- Gibt zurück:
- whether @self has a response with the ID @response.
-
removeResponse
Removes a response from @self.- Parameter:
id
- the response ID
-
removeResponse
Removes a response from @self.- Parameter:
id
- the response ID
-
setBody
Sets the body text of @self.- Parameter:
body
- the body of @self
-
setBody
Sets the body text of @self.- Parameter:
body
- the body of @self
-
setBodyUseMarkup
public void setBodyUseMarkup(boolean use_markup) Sets whether the body text of @self includes Pango markup.
See [func@Pango.parse_markup].- Parameter:
use_markup
- whether to use markup for body text
-
setCloseResponse
Sets the ID of the close response of @self.
It will be passed to [signal@AlertDialog::response] if the dialog is closed
by pressing <kbd>Escape</kbd> or with a system action.
It doesn't have to correspond to any of the responses in the dialog.
The default close response is `close`.- Parameter:
response
- the close response ID
-
setCloseResponse
Sets the ID of the close response of @self.
It will be passed to [signal@AlertDialog::response] if the dialog is closed
by pressing <kbd>Escape</kbd> or with a system action.
It doesn't have to correspond to any of the responses in the dialog.
The default close response is `close`.- Parameter:
response
- the close response ID
-
setDefaultResponse
Sets the ID of the default response of @self.
If set, pressing <kbd>Enter</kbd> will activate the corresponding button.
If set to `NULL` or to a non-existent response ID, pressing <kbd>Enter</kbd>
will do nothing.- Parameter:
response
- the default response ID
-
setDefaultResponse
Sets the ID of the default response of @self.
If set, pressing <kbd>Enter</kbd> will activate the corresponding button.
If set to `NULL` or to a non-existent response ID, pressing <kbd>Enter</kbd>
will do nothing.- Parameter:
response
- the default response ID
-
setExtraChild
Sets the child widget of @self.
The child widget is displayed below the heading and body.- Parameter:
child
- the child widget
-
setHeading
Sets the heading of @self.- Parameter:
heading
- the heading of @self
-
setHeading
Sets the heading of @self.- Parameter:
heading
- the heading of @self
-
setHeadingUseMarkup
public void setHeadingUseMarkup(boolean use_markup) Sets whether the heading of @self includes Pango markup.
See [func@Pango.parse_markup].- Parameter:
use_markup
- whether to use markup for heading
-
setPreferWideLayout
public void setPreferWideLayout(boolean prefer_wide_layout) Sets whether @self prefers wide layout.
Prefer horizontal button layout when possible, and wider dialog width
otherwise.- Parameter:
prefer_wide_layout
- whether to prefer wide layout
-
setResponseAppearance
Sets the appearance for @response.
<picture>
<source srcset="alert-dialog-appearance-dark.png" media="(prefers-color-scheme: dark)">
<img src="alert-dialog-appearance.png" alt="alert-dialog-appearance">
</picture>
Use `ADW_RESPONSE_SUGGESTED` to mark important responses such as the
affirmative action, like the Save button in the example.
Use `ADW_RESPONSE_DESTRUCTIVE` to draw attention to the potentially damaging
consequences of using @response. This appearance acts as a warning to the
user. The Discard button in the example is using this appearance.
The default appearance is `ADW_RESPONSE_DEFAULT`.
Negative responses like Cancel or Close should use the default appearance.- Parameter:
response
- a response IDappearance
- appearance for @response
-
setResponseAppearance
Sets the appearance for @response.
<picture>
<source srcset="alert-dialog-appearance-dark.png" media="(prefers-color-scheme: dark)">
<img src="alert-dialog-appearance.png" alt="alert-dialog-appearance">
</picture>
Use `ADW_RESPONSE_SUGGESTED` to mark important responses such as the
affirmative action, like the Save button in the example.
Use `ADW_RESPONSE_DESTRUCTIVE` to draw attention to the potentially damaging
consequences of using @response. This appearance acts as a warning to the
user. The Discard button in the example is using this appearance.
The default appearance is `ADW_RESPONSE_DEFAULT`.
Negative responses like Cancel or Close should use the default appearance.- Parameter:
response
- a response IDappearance
- appearance for @response
-
setResponseEnabled
Sets whether @response is enabled.
If @response is not enabled, the corresponding button will have
[property@Gtk.Widget:sensitive] set to `FALSE` and it can't be activated as
a default response.
@response can still be used as [property@AlertDialog:close-response] while
it's not enabled.
Responses are enabled by default.- Parameter:
response
- a response IDenabled
- whether to enable @response
-
setResponseEnabled
Sets whether @response is enabled.
If @response is not enabled, the corresponding button will have
[property@Gtk.Widget:sensitive] set to `FALSE` and it can't be activated as
a default response.
@response can still be used as [property@AlertDialog:close-response] while
it's not enabled.
Responses are enabled by default.- Parameter:
response
- a response IDenabled
- whether to enable @response
-
setResponseLabel
Sets the label of @response to @label.
Labels are displayed on the dialog buttons. An embedded underline in @label
indicates a mnemonic.- Parameter:
response
- a response IDlabel
- the label of @response
-
setResponseLabel
Sets the label of @response to @label.
Labels are displayed on the dialog buttons. An embedded underline in @label
indicates a mnemonic.- Parameter:
response
- a response IDlabel
- the label of @response
-
onResponse
Connect to signal "response".
SeeAlertDialog.OnResponse.onResponse(ch.bailu.gtk.type.Str)
for signal description.
FieldSIGNAL_ON_RESPONSE
contains original signal name and can be used as resource reference.- Parameter:
signal
- callback function (lambda).- Gibt zurück:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
asAccessible
Implements interfaceAccessible
. Call this to get access to interface functions.- Setzt außer Kraft:
asAccessible
in KlasseDialog
- Gibt zurück:
Accessible
-
asBuildable
Implements interfaceBuildable
. Call this to get access to interface functions.- Setzt außer Kraft:
asBuildable
in KlasseDialog
- Gibt zurück:
Buildable
-
asConstraintTarget
Implements interfaceConstraintTarget
. Call this to get access to interface functions.- Setzt außer Kraft:
asConstraintTarget
in KlasseDialog
- Gibt zurück:
ConstraintTarget
-
asShortcutManager
Implements interfaceShortcutManager
. Call this to get access to interface functions.- Setzt außer Kraft:
asShortcutManager
in KlasseDialog
- Gibt zurück:
ShortcutManager
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-