[]Struct gtk::MessageDialog

pub struct MessageDialog(_, _);

MessageDialog presents a dialog with some message text. It’s simply a convenience widget; you could construct the equivalent of MessageDialog from Dialog without too much effort, but MessageDialog saves typing.

One difference from Dialog is that MessageDialog sets the Window: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 DialogExt::run, though you can also pass in the DialogFlags::Modal flag, DialogExt::run automatically makes the dialog modal and waits for the user to respond to it. DialogExt::run returns when any dialog button is clicked.

An example for using a modal dialog:

 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 MessageDialog as follows:

An example for a non-modal dialog:

 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);

MessageDialog as Buildable

The MessageDialog implementation of the Buildable interface exposes the message area as an internal child with the name “message_area”.

Implements

MessageDialogExt, DialogExt, GtkWindowExt, BinExt, ContainerExt, WidgetExt, glib::object::ObjectExt, BuildableExt

Methods

impl MessageDialog
[src]

Creates a new message dialog, which is a simple dialog with some text the user may want to see. When the user clicks a button a “response” signal is emitted with response IDs from ResponseType. See Dialog for more details.

parent

transient parent, or None for none

flags

flags

type_

type of message

buttons

set of buttons to use

message_format

printf-style format string, or None

Returns

a new MessageDialog

Trait Implementations

impl<T: IsA<Object>> PartialOrd<T> for MessageDialog

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Ord for MessageDialog

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

impl<T: IsA<Object>> PartialEq<T> for MessageDialog

This method tests for !=.

impl Clone for MessageDialog

Performs copy-assignment from source. Read more

impl Eq for MessageDialog

impl Debug for MessageDialog

impl Hash for MessageDialog

Feeds a slice of this type into the given [Hasher]. Read more

impl IsA<Dialog> for MessageDialog

impl IsA<Window> for MessageDialog

impl IsA<Bin> for MessageDialog

impl IsA<Container> for MessageDialog

impl IsA<Widget> for MessageDialog

impl IsA<Buildable> for MessageDialog

impl IsA<Object> for MessageDialog

impl StaticType for MessageDialog

Auto Trait Implementations

impl !Send for MessageDialog

impl !Sync for MessageDialog

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

impl<T> From for T
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<'a, T> ToGlibContainerFromSlice for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<T> Cast for T where
    T: IsA<Object>, 
[src]

Upcasts an object to a superclass or interface T. Read more

Upcasts an object to a reference of its superclass or interface T. Read more

Tries to downcast to a subclass or interface implementor T. Read more

Tries to downcast to a reference of its subclass or interface implementor T. Read more

Returns true if the object is an instance of (can be cast to) T.

Tries to cast to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while downcast and upcast will do many checks at compile-time already. Read more

Tries to cast to reference to an object of type T. This handles upcasting, downcasting and casting between interface and interface implementors. All checks are performed at runtime, while downcast and upcast will do many checks at compile-time already. Read more

impl<T> IsA for T where
    T: StaticType + Wrapper + Into<ObjectRef> + UnsafeFrom<ObjectRef> + ToGlibPtr<'a, *mut <T as Wrapper>::GlibType>, 
[src]

impl<Super, Sub> Downcast for Super where
    Sub: IsA<Super>,
    Super: IsA<Super>, 
[src]

impl<T> ObjectExt for T where
    T: IsA<Object> + SetValue
[src]

impl<T> ToValue for T where
    T: SetValue + ?Sized
[src]