MessageDialogRef

public struct MessageDialogRef : MessageDialogProtocol, GWeakCapturing

GtkMessageDialog presents a dialog with some message text.

An example GtkMessageDialog

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 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.

  • ptr
    Untyped pointer to the underlying `GtkMessageDialog` instance.
    

    For type-safe access, use the generated, typed pointer message_dialog_ptr property instead.

    Declaration

    Swift

    public let ptr: UnsafeMutableRawPointer!

MessageDialog Class

  • Designated initialiser from the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafeMutablePointer<GtkMessageDialog>)
  • Designated initialiser from a constant pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init(_ p: UnsafePointer<GtkMessageDialog>)
  • Conditional initialiser from an optional pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafeMutablePointer<GtkMessageDialog>?)
  • Conditional initialiser from an optional, non-mutable pointer to the underlying C data type

    Declaration

    Swift

    @inlinable
    init!(_ maybePointer: UnsafePointer<GtkMessageDialog>?)
  • Conditional initialiser from an optional gpointer

    Declaration

    Swift

    @inlinable
    init!(gpointer g: gpointer?)
  • Conditional initialiser from an optional, non-mutable gconstpointer

    Declaration

    Swift

    @inlinable
    init!(gconstpointer g: gconstpointer?)
  • Reference intialiser for a related type that implements MessageDialogProtocol

    Declaration

    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)