MessageDialogProtocol
public protocol MessageDialogProtocol : DialogProtocol
GtkMessageDialog presents a dialog with some message text.

It’s simply a convenience widget; you could construct the equivalent of
GtkMessageDialog from GtkDialog without too much effort, but
GtkMessageDialog saves typing.
The easiest way to do a modal message dialog is to use the GTK_DIALOG_MODAL
flag, which will call [methodGtk.Window.set_modal] internally. The dialog will
prevent interaction with the parent window until it’s hidden or destroyed.
You can use the [signalGtk.Dialog::response] signal to know when the user
dismissed the dialog.
An example for using a modal dialog:
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL;
dialog = gtk_message_dialog_new (parent_window,
flags,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Error reading “`s`”: `s`",
filename,
g_strerror (errno));
// Destroy the dialog when the user responds to it
// (e.g. clicks a button)
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy),
NULL);
You might do a non-modal GtkMessageDialog simply by omitting the
GTK_DIALOG_MODAL flag:
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT;
dialog = gtk_message_dialog_new (parent_window,
flags,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Error reading “`s`”: `s`",
filename,
g_strerror (errno));
// Destroy the dialog when the user responds to it
// (e.g. clicks a button)
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy),
NULL);
GtkMessageDialog as GtkBuildable
The GtkMessageDialog implementation of the GtkBuildable interface exposes
the message area as an internal child with the name “message_area”.
The MessageDialogProtocol protocol exposes the methods and properties of an underlying GtkMessageDialog instance.
The default implementation of these can be found in the protocol extension below.
For a concrete class that implements these methods and properties, see MessageDialog.
Alternatively, use MessageDialogRef as a lighweight, unowned reference if you already have an instance you just want to use.
-
Untyped pointer to the underlying
GtkMessageDialoginstance.Declaration
Swift
var ptr: UnsafeMutableRawPointer! { get } -
message_dialog_ptrDefault implementationTyped pointer to the underlying
GtkMessageDialoginstance.Default Implementation
Return the stored, untyped pointer as a typed pointer to the
GtkMessageDialoginstance.Declaration
Swift
var message_dialog_ptr: UnsafeMutablePointer<GtkMessageDialog>! { get } -
Required Initialiser for types conforming to
MessageDialogProtocolDeclaration
Swift
init(raw: UnsafeMutableRawPointer)
-
bind(property:Extension methodto: _: flags: transformFrom: transformTo: ) Bind a
MessageDialogPropertyNamesource property to a given target object.Declaration
Swift
@discardableResult @inlinable func bind<Q, T>(property source_property: MessageDialogPropertyName, to target: T, _ target_property: Q, flags f: BindingFlags = .default, transformFrom transform_from: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }, transformTo transform_to: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }) -> BindingRef! where Q : PropertyNameProtocol, T : ObjectProtocolParameters
source_propertythe source property to bind
targetthe target object to bind to
target_propertythe target property to bind to
flagsthe flags to pass to the
Bindingtransform_fromValueTransformerto use for forward transformationtransform_toValueTransformerto use for backwards transformationReturn Value
binding reference or
nilin case of an error -
get(property:Extension method) Get the value of a MessageDialog property
Declaration
Swift
@inlinable func get(property: MessageDialogPropertyName) -> GLibObject.ValueParameters
propertythe property to get the value for
Return Value
the value of the named property
-
set(property:Extension methodvalue: ) Set the value of a MessageDialog property. Note that this will only have an effect on properties that are writable and not construct-only!
Declaration
Swift
@inlinable func set(property: MessageDialogPropertyName, value v: GLibObject.Value)Parameters
propertythe property to get the value for
Return Value
the value of the named property
-
getMessageArea()Extension methodReturns the message area of the dialog.
This is the box where the dialog’s primary and secondary labels are packed. You can add your own extra content to that box and it will appear below those labels. See [method
Gtk.Dialog.get_content_area] for the corresponding function in the parent [classGtk.Dialog].Declaration
Swift
@inlinable func getMessageArea() -> WidgetRef! -
setMarkup(str:Extension method) Sets the text of the message dialog.
Declaration
Swift
@inlinable func setMarkup(str: UnsafePointer<CChar>!) -
messageAreaExtension methodReturns the message area of the dialog.
This is the box where the dialog’s primary and secondary labels are packed. You can add your own extra content to that box and it will appear below those labels. See [method
Gtk.Dialog.get_content_area] for the corresponding function in the parent [classGtk.Dialog].Declaration
Swift
@inlinable var messageArea: WidgetRef! { get } -
parentInstanceExtension methodUndocumented
Declaration
Swift
@inlinable var parentInstance: GtkDialog { get } -
set(secondaryText:Extension method) Convenience method to set the secondary text of a message dialog
Declaration
Swift
@inlinable func set(secondaryText: String)Parameters
secondaryTextstring to set the secondary text to
-
set(secondaryMarkup:Extension method) Convenience method to set markup for the secondary text of of a message dialog
Declaration
Swift
@inlinable func set(secondaryMarkup: String)Parameters
secondaryTextstring to set the secondary text to
View on GitHub
Install in Dash
MessageDialogProtocol Protocol Reference