MessageDialogRef
public struct MessageDialogRef : MessageDialogProtocol, GWeakCapturing
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.
One difference from GtkDialog is that GtkMessageDialog sets the
GtkWindow:skip-taskbar-hint property to true, so that the dialog is hidden
from the taskbar by default.
The easiest way to do a modal message dialog is to use gtk_dialog_run(), though
you can also pass in the GTK_DIALOG_MODAL flag, gtk_dialog_run() automatically
makes the dialog modal and waits for the user to respond to it. gtk_dialog_run()
returns when any dialog button is clicked.
An example for using a modal dialog: (C Language Example):
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));
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
You might do a non-modal GtkMessageDialog as follows:
An example for a non-modal dialog: (C Language Example):
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_swapped (dialog, "response",
G_CALLBACK (gtk_widget_destroy),
dialog);
GtkMessageDialog as GtkBuildable
The GtkMessageDialog implementation of the GtkBuildable interface exposes the message area as an internal child with the name “message_area”.
The MessageDialogRef type acts as a lightweight Swift reference to an underlying GtkMessageDialog instance.
It exposes methods that can operate on this data type through MessageDialogProtocol conformance.
Use MessageDialogRef only as an unowned reference to an existing GtkMessageDialog instance.
-
Untyped pointer to the underlying `GtkMessageDialog` instance.For type-safe access, use the generated, typed pointer
message_dialog_ptrproperty instead.Declaration
Swift
public let ptr: UnsafeMutableRawPointer!
-
Designated initialiser from the underlying
Cdata typeDeclaration
Swift
@inlinable init(_ p: UnsafeMutablePointer<GtkMessageDialog>) -
Designated initialiser from a constant pointer to the underlying
Cdata typeDeclaration
Swift
@inlinable init(_ p: UnsafePointer<GtkMessageDialog>) -
Conditional initialiser from an optional pointer to the underlying
Cdata typeDeclaration
Swift
@inlinable init!(_ maybePointer: UnsafeMutablePointer<GtkMessageDialog>?) -
Conditional initialiser from an optional, non-mutable pointer to the underlying
Cdata typeDeclaration
Swift
@inlinable init!(_ maybePointer: UnsafePointer<GtkMessageDialog>?) -
Conditional initialiser from an optional
gpointerDeclaration
Swift
@inlinable init!(gpointer g: gpointer?) -
Conditional initialiser from an optional, non-mutable
gconstpointerDeclaration
Swift
@inlinable init!(gconstpointer g: gconstpointer?) -
Reference intialiser for a related type that implements
MessageDialogProtocolDeclaration
Swift
@inlinable init<T>(_ other: T) where T : MessageDialogProtocol -
This factory is syntactic sugar for setting weak pointers wrapped in
GWeak<T>Declaration
Swift
@inlinable static func unowned<T>(_ other: T) -> MessageDialogRef where T : MessageDialogProtocol -
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
MessageDialogProtocol.Declaration
Swift
@inlinable init<T>(cPointer: UnsafeMutablePointer<T>) -
Unsafe typed initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
MessageDialogProtocol.Declaration
Swift
@inlinable init<T>(constPointer: UnsafePointer<T>) -
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
MessageDialogProtocol.Declaration
Swift
@inlinable init(mutating raw: UnsafeRawPointer) -
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
MessageDialogProtocol.Declaration
Swift
@inlinable init(raw: UnsafeMutableRawPointer) -
Unsafe untyped initialiser. Do not use unless you know the underlying data type the pointer points to conforms to
MessageDialogProtocol.Declaration
Swift
@inlinable init(opaquePointer: OpaquePointer)
View on GitHub
Install in Dash
MessageDialogRef Structure Reference