MessageDialogProtocol

public protocol MessageDialogProtocol : DialogProtocol

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

  • ptr

    Untyped pointer to the underlying GtkMessageDialog instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • message_dialog_ptr Default implementation

    Typed pointer to the underlying GtkMessageDialog instance.

    Default Implementation

    Return the stored, untyped pointer as a typed pointer to the GtkMessageDialog instance.

    Declaration

    Swift

    var message_dialog_ptr: UnsafeMutablePointer<GtkMessageDialog>! { get }
  • Required Initialiser for types conforming to MessageDialogProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

MessageDialog Class

  • Bind a MessageDialogPropertyName source 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 : ObjectProtocol

    Parameters

    source_property

    the source property to bind

    target

    the target object to bind to

    target_property

    the target property to bind to

    flags

    the flags to pass to the Binding

    transform_from

    ValueTransformer to use for forward transformation

    transform_to

    ValueTransformer to use for backwards transformation

    Return Value

    binding reference or nil in case of an error

  • get(property:) Extension method

    Get the value of a MessageDialog property

    Declaration

    Swift

    @inlinable
    func get(property: MessageDialogPropertyName) -> GLibObject.Value

    Parameters

    property

    the property to get the value for

    Return Value

    the value of the named property

  • set(property:value:) Extension method

    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

    property

    the property to get the value for

    Return Value

    the value of the named property

MessageDialog Class: MessageDialogProtocol extension (methods and fields)

  • getMessageArea() Extension method

    Returns 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 [methodGtk.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>!)
  • messageArea Extension method

    Returns 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 [methodGtk.Dialog.get_content_area] for the corresponding function in the parent [classGtk.Dialog].

    Declaration

    Swift

    @inlinable
    var messageArea: WidgetRef! { get }
  • parentInstance Extension method

    Undocumented

    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

    secondaryText

    string 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

    secondaryText

    string to set the secondary text to