Package ch.bailu.gtk.adw
Class MessageDialog
- All Implemented Interfaces:
PointerInterface
A dialog presenting a message or a question.
<picture>
<source srcset="message-dialog-dark.png" media="(prefers-color-scheme: dark)">
<img src="message-dialog.png" alt="message-dialog">
</picture>
Message 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@MessageDialog::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@MessageDialog: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, `AdwMessageDialog` is closed automatically.
An example of using a message dialog:
```c
GtkWidget *dialog;
dialog = adw_message_dialog_new (parent, _("Replace File?"), NULL);
adw_message_dialog_format_body (ADW_MESSAGE_DIALOG (dialog),
_("A file named “%s” already exists. Do you want to replace it?"),
filename);
adw_message_dialog_add_responses (ADW_MESSAGE_DIALOG (dialog),
"cancel", _("_Cancel"),
"replace", _("_Replace"),
NULL);
adw_message_dialog_set_response_appearance (ADW_MESSAGE_DIALOG (dialog), "replace", ADW_RESPONSE_DESTRUCTIVE);
adw_message_dialog_set_default_response (ADW_MESSAGE_DIALOG (dialog), "cancel");
adw_message_dialog_set_close_response (ADW_MESSAGE_DIALOG (dialog), "cancel");
g_signal_connect (dialog, "response", G_CALLBACK (response_cb), self);
gtk_window_present (GTK_WINDOW (dialog));
```
## AdwMessageDialog as GtkBuildable
`AdwMessageDialog` supports adding responses in UI definitions by via the
`<responses>` element that may contain multiple `<response>` elements, each
respresenting 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@MessageDialog.set_response_enabled] and
[method@MessageDialog.set_response_appearance] for details.
Example of an `AdwMessageDialog` UI definition:
```xml
<object class="AdwMessageDialog" 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>
```
## Accessibility
`AdwMessageDialog` uses the `GTK_ACCESSIBLE_ROLE_DIALOG` role.
<picture>
<source srcset="message-dialog-dark.png" media="(prefers-color-scheme: dark)">
<img src="message-dialog.png" alt="message-dialog">
</picture>
Message 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@MessageDialog::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@MessageDialog: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, `AdwMessageDialog` is closed automatically.
An example of using a message dialog:
```c
GtkWidget *dialog;
dialog = adw_message_dialog_new (parent, _("Replace File?"), NULL);
adw_message_dialog_format_body (ADW_MESSAGE_DIALOG (dialog),
_("A file named “%s” already exists. Do you want to replace it?"),
filename);
adw_message_dialog_add_responses (ADW_MESSAGE_DIALOG (dialog),
"cancel", _("_Cancel"),
"replace", _("_Replace"),
NULL);
adw_message_dialog_set_response_appearance (ADW_MESSAGE_DIALOG (dialog), "replace", ADW_RESPONSE_DESTRUCTIVE);
adw_message_dialog_set_default_response (ADW_MESSAGE_DIALOG (dialog), "cancel");
adw_message_dialog_set_close_response (ADW_MESSAGE_DIALOG (dialog), "cancel");
g_signal_connect (dialog, "response", G_CALLBACK (response_cb), self);
gtk_window_present (GTK_WINDOW (dialog));
```
## AdwMessageDialog as GtkBuildable
`AdwMessageDialog` supports adding responses in UI definitions by via the
`<responses>` element that may contain multiple `<response>` elements, each
respresenting 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@MessageDialog.set_response_enabled] and
[method@MessageDialog.set_response_appearance] for details.
Example of an `AdwMessageDialog` UI definition:
```xml
<object class="AdwMessageDialog" 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>
```
## Accessibility
`AdwMessageDialog` uses the `GTK_ACCESSIBLE_ROLE_DIALOG` role.
https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.MessageDialog.html
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class ch.bailu.gtk.gtk.Window
Window.OnActivateDefault, Window.OnActivateFocus, Window.OnCloseRequest, Window.OnEnableDebugging, Window.OnKeysChangedNested classes/interfaces inherited from class 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.OnUnrealizeNested classes/interfaces inherited from class ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify -
Field Summary
FieldsFields inherited from class ch.bailu.gtk.gtk.Window
SIGNAL_ON_ACTIVATE_DEFAULT, SIGNAL_ON_ACTIVATE_FOCUS, SIGNAL_ON_CLOSE_REQUEST, SIGNAL_ON_ENABLE_DEBUGGING, SIGNAL_ON_KEYS_CHANGEDFields inherited from class 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_UNREALIZEFields inherited from class ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY -
Constructor Summary
ConstructorsConstructorDescriptionMessageDialog(Window parent, Str heading, Str body) Creates a new `AdwMessageDialog`.MessageDialog(Window parent, String heading, String body) Creates a new `AdwMessageDialog`.MessageDialog(PointerContainer pointer) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddResponse(Str id, Str label) Adds a response with @id and @label to @self.voidaddResponse(String id, String label) Adds a response with @id and @label to @self.voidaddResponses(Str first_id, Object... _elipse) Adds multiple responses to @self.voidaddResponses(String first_id, Object... _elipse) Adds multiple responses to @self.Implements interfaceAccessible.Implements interfaceBuildable.Implements interfaceConstraintTarget.asNative()Implements interfaceNative.asRoot()Implements interfaceRoot.Implements interfaceShortcutManager.voidformatBody(Str format, Object... _elipse) Sets the formatted body text of @self.voidformatBody(String format, Object... _elipse) Sets the formatted body text of @self.voidformatBodyMarkup(Str format, Object... _elipse) Sets the formatted body text of @self with Pango markup.voidformatBodyMarkup(String format, Object... _elipse) Sets the formatted body text of @self with Pango markup.voidformatHeading(Str format, Object... _elipse) Sets the formatted heading of @self.voidformatHeading(String format, Object... _elipse) Sets the formatted heading of @self.voidformatHeadingMarkup(Str format, Object... _elipse) Sets the formatted heading of @self with Pango markup.voidformatHeadingMarkup(String format, Object... _elipse) Sets the formatted heading of @self with Pango markup.getBody()Gets the body text of @self.booleanGets whether the body text of @self includes Pango markup.static ClassHandlerGets 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.booleanGets whether the heading of @self includes Pango markup.static intstatic longstatic TypeSystem.TypeSizeintgetResponseAppearance(Str response) Gets the appearance of @response.intgetResponseAppearance(String response) Gets the appearance of @response.booleangetResponseEnabled(Str response) Gets whether @response is enabled.booleangetResponseEnabled(String response) Gets whether @response is enabled.getResponseLabel(Str response) Gets the label of @response.getResponseLabel(String response) Gets the label of @response.static longstatic TypeSystem.TypeSizebooleanhasResponse(Str response) Gets whether @self has a response with the ID @response.booleanhasResponse(String response) Gets whether @self has a response with the ID @response.onResponse(MessageDialog.OnResponse signal) Connect to signal "response".voidEmits the [signal@MessageDialog::response] signal with the given response ID.voidEmits the [signal@MessageDialog::response] signal with the given response ID.voidSets the body text of @self.voidSets the body text of @self.voidsetBodyUseMarkup(boolean use_markup) Sets whether the body text of @self includes Pango markup.voidsetCloseResponse(Str response) Sets the ID of the close response of @self.voidsetCloseResponse(String response) Sets the ID of the close response of @self.voidsetDefaultResponse(Str response) Sets the ID of the default response of @self.voidsetDefaultResponse(String response) Sets the ID of the default response of @self.voidsetExtraChild(Widget child) Sets the child widget of @self.voidsetHeading(Str heading) Sets the heading of @self.voidsetHeading(String heading) Sets the heading of @self.voidsetHeadingUseMarkup(boolean use_markup) Sets whether the heading of @self includes Pango markup.voidsetResponseAppearance(Str response, int appearance) Sets the appearance for @response.voidsetResponseAppearance(String response, int appearance) Sets the appearance for @response.voidsetResponseEnabled(Str response, boolean enabled) Sets whether @response is enabled.voidsetResponseEnabled(String response, boolean enabled) Sets whether @response is enabled.voidsetResponseLabel(Str response, Str label) Sets the label of @response to @label.voidsetResponseLabel(String response, String label) Sets the label of @response to @label.Methods inherited from class ch.bailu.gtk.gtk.Window
close, destroy, fullscreen, fullscreenOnMonitor, getApplication, getChild, getDecorated, getDefaultIconName, getDefaultSize, getDefaultWidget, getDeletable, getDestroyWithParent, getFocus, getFocusVisible, getGroup, getHandleMenubarAccel, getHideOnClose, getIconName, getMnemonicsVisible, getModal, getResizable, getTitle, getTitlebar, getToplevels, getTransientFor, hasGroup, isActive, isFullscreen, isMaximized, listToplevels, maximize, minimize, onActivateDefault, onActivateFocus, onCloseRequest, onEnableDebugging, onKeysChanged, present, presentWithTime, setApplication, setAutoStartupNotification, setChild, setDecorated, setDefaultIconName, setDefaultSize, setDefaultWidget, setDeletable, setDestroyWithParent, setDisplay, setFocus, setFocusVisible, setHandleMenubarAccel, setHideOnClose, setIconName, setIconName, setInteractiveDebugging, setMnemonicsVisible, setModal, setResizable, setStartupId, setStartupId, setTitle, setTitle, setTitlebar, setTransientFor, unfullscreen, unmaximize, unminimizeMethods inherited from class 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, getCanFocus, getCanTarget, getChildVisible, getClipboard, getCssClasses, getCssName, getCursor, getDefaultDirection, getDirection, getDisplay, getFirstChild, getFocusable, getFocusChild, getFocusOnClick, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, 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, 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, unsetStateFlagsMethods inherited from class 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, weakUnrefMethods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacksMethods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNullMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Field Details
-
SIGNAL_ON_RESPONSE
- See Also:
-
-
Constructor Details
-
MessageDialog
-
MessageDialog
Creates a new `AdwMessageDialog`.
@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@MessageDialog.format_body] or similar methods afterwards:
```c
GtkWidget *dialog;
dialog = adw_message_dialog_new (parent, _("Replace File?"), NULL);
adw_message_dialog_format_body (ADW_MESSAGE_DIALOG (dialog),
_("A file named “%s” already exists. Do you want to replace it?"),
filename);
```- Parameters:
parent- transient parentheading- the headingbody- the body text
-
MessageDialog
Creates a new `AdwMessageDialog`.
@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@MessageDialog.format_body] or similar methods afterwards:
```c
GtkWidget *dialog;
dialog = adw_message_dialog_new (parent, _("Replace File?"), NULL);
adw_message_dialog_format_body (ADW_MESSAGE_DIALOG (dialog),
_("A file named “%s” already exists. Do you want to replace it?"),
filename);
```- Parameters:
parent- transient parentheading- the headingbody- the body text
-
-
Method Details
-
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@MessageDialog::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@MessageDialog.set_response_label] can be used to change the response
label after it had been added.
[method@MessageDialog.set_response_enabled] and
[method@MessageDialog.set_response_appearance] can be used to customize the
responses further.- Parameters:
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@MessageDialog::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@MessageDialog.set_response_label] can be used to change the response
label after it had been added.
[method@MessageDialog.set_response_enabled] and
[method@MessageDialog.set_response_appearance] can be used to customize the
responses further.- Parameters:
id- the response IDlabel- the response label
-
addResponses
Adds multiple responses to @self.
This is the same as calling [method@MessageDialog.add_response] repeatedly.
The variable argument list should be `NULL`-terminated list of response IDs
and labels.
Example:
```c
adw_message_dialog_add_responses (dialog,
"cancel", _("_Cancel"),
"discard", _("_Discard"),
"save", _("_Save"),
NULL);
```- Parameters:
first_id- response id_elipse- label for first response, then more id-label pairs
-
addResponses
Adds multiple responses to @self.
This is the same as calling [method@MessageDialog.add_response] repeatedly.
The variable argument list should be `NULL`-terminated list of response IDs
and labels.
Example:
```c
adw_message_dialog_add_responses (dialog,
"cancel", _("_Cancel"),
"discard", _("_Discard"),
"save", _("_Save"),
NULL);
```- Parameters:
first_id- response id_elipse- label for first response, then more id-label pairs
-
formatBody
Sets the formatted body text of @self.
See [property@MessageDialog:body].- Parameters:
format- the formatted string for the body text_elipse- the parameters to insert into @format
-
formatBody
Sets the formatted body text of @self.
See [property@MessageDialog:body].- Parameters:
format- the formatted string for the body text_elipse- 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@MessageDialog:body].- Parameters:
format- the formatted string for the body text with Pango markup_elipse- 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@MessageDialog:body].- Parameters:
format- the formatted string for the body text with Pango markup_elipse- the parameters to insert into @format
-
formatHeading
Sets the formatted heading of @self.
See [property@MessageDialog:heading].- Parameters:
format- the formatted string for the heading_elipse- the parameters to insert into @format
-
formatHeading
Sets the formatted heading of @self.
See [property@MessageDialog:heading].- Parameters:
format- the formatted string for the heading_elipse- 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@MessageDialog:heading].- Parameters:
format- the formatted string for the heading with Pango markup_elipse- 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@MessageDialog:heading].- Parameters:
format- the formatted string for the heading with Pango markup_elipse- the parameters to insert into @format
-
getBody
Gets the body text of @self.- Returns:
- the body of @self.
-
getBodyUseMarkup
public boolean getBodyUseMarkup()Gets whether the body text of @self includes Pango markup.- Returns:
- whether @self uses markup for body text
-
getCloseResponse
Gets the ID of the close response of @self.- Returns:
- the close response ID
-
getDefaultResponse
Gets the ID of the default response of @self.- Returns:
- the default response ID
-
getExtraChild
Gets the child widget of @self.- Returns:
- the child widget of @self.
-
getHeading
Gets the heading of @self.- Returns:
- the heading of @self.
-
getHeadingUseMarkup
public boolean getHeadingUseMarkup()Gets whether the heading of @self includes Pango markup.- Returns:
- whether @self uses markup for heading
-
getResponseAppearance
Gets the appearance of @response.
See [method@MessageDialog.set_response_appearance].- Parameters:
response- a response ID- Returns:
- the appearance of @response
-
getResponseAppearance
Gets the appearance of @response.
See [method@MessageDialog.set_response_appearance].- Parameters:
response- a response ID- Returns:
- the appearance of @response
-
getResponseEnabled
Gets whether @response is enabled.
See [method@MessageDialog.set_response_enabled].- Parameters:
response- a response ID- Returns:
- whether @response is enabled
-
getResponseEnabled
Gets whether @response is enabled.
See [method@MessageDialog.set_response_enabled].- Parameters:
response- a response ID- Returns:
- whether @response is enabled
-
getResponseLabel
Gets the label of @response.
See [method@MessageDialog.set_response_label].- Parameters:
response- a response ID- Returns:
- the label of @response
-
getResponseLabel
Gets the label of @response.
See [method@MessageDialog.set_response_label].- Parameters:
response- a response ID- Returns:
- the label of @response
-
hasResponse
Gets whether @self has a response with the ID @response.- Parameters:
response- response ID- Returns:
- whether @self has a response with the ID @response.
-
hasResponse
Gets whether @self has a response with the ID @response.- Parameters:
response- response ID- Returns:
- whether @self has a response with the ID @response.
-
response
Emits the [signal@MessageDialog::response] signal with the given response ID.
Used to indicate that the user has responded to the dialog in some way.- Parameters:
response- response ID
-
response
Emits the [signal@MessageDialog::response] signal with the given response ID.
Used to indicate that the user has responded to the dialog in some way.- Parameters:
response- response ID
-
setBody
Sets the body text of @self.- Parameters:
body- the body of @self
-
setBody
Sets the body text of @self.- Parameters:
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].- Parameters:
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@MessageDialog::response] if the window 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`.- Parameters:
response- the close response ID
-
setCloseResponse
Sets the ID of the close response of @self.
It will be passed to [signal@MessageDialog::response] if the window 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`.- Parameters:
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.- Parameters:
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.- Parameters:
response- the default response ID
-
setExtraChild
Sets the child widget of @self.
The child widget is displayed below the heading and body.- Parameters:
child- the child widget
-
setHeading
Sets the heading of @self.- Parameters:
heading- the heading of @self
-
setHeading
Sets the heading of @self.- Parameters:
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].- Parameters:
use_markup- whether to use markup for heading
-
setResponseAppearance
Sets the appearance for @response.
<picture>
<source srcset="message-dialog-appearance-dark.png" media="(prefers-color-scheme: dark)">
<img src="message-dialog-appearance.png" alt="message-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.- Parameters:
response- a response IDappearance- appearance for @response
-
setResponseAppearance
Sets the appearance for @response.
<picture>
<source srcset="message-dialog-appearance-dark.png" media="(prefers-color-scheme: dark)">
<img src="message-dialog-appearance.png" alt="message-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.- Parameters:
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@MessageDialog:close-response] while
it's not enabled.
Responses are enabled by default.- Parameters:
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@MessageDialog:close-response] while
it's not enabled.
Responses are enabled by default.- Parameters:
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.- Parameters:
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.- Parameters:
response- a response IDlabel- the label of @response
-
onResponse
Connect to signal "response".
SeeMessageDialog.OnResponse.onResponse(ch.bailu.gtk.type.Str)for signal description.
FieldSIGNAL_ON_RESPONSEcontains original signal name and can be used as resource reference.- Parameters:
signal- callback function (lambda).- Returns:
SignalHandler. Can be used to disconnect signal and to release callback function.
-
asAccessible
Implements interfaceAccessible. Call this to get access to interface functions.- Overrides:
asAccessiblein classWindow- Returns:
Accessible
-
asBuildable
Implements interfaceBuildable. Call this to get access to interface functions.- Overrides:
asBuildablein classWindow- Returns:
Buildable
-
asConstraintTarget
Implements interfaceConstraintTarget. Call this to get access to interface functions.- Overrides:
asConstraintTargetin classWindow- Returns:
ConstraintTarget
-
asNative
Implements interfaceNative. Call this to get access to interface functions. -
asRoot
Implements interfaceRoot. Call this to get access to interface functions. -
asShortcutManager
Implements interfaceShortcutManager. Call this to get access to interface functions.- Overrides:
asShortcutManagerin classWindow- Returns:
ShortcutManager
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-