Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Inti::Gtk::MessageDialog Class Reference

A GtkMessageDialog C++ wrapper class. More...

`#include <inti/gtk/messagedialog.h>`

Inheritance diagram for Inti::Gtk::MessageDialog:

List of all members.

## Public Member Functions

Constructors

- MessageDialog (Window *parent=0, DialogFlagsField flags=DIALOG_DESTROY_WITH_PARENT)
    Construct a new message dialog with the specified parent and dialog flags.
- MessageDialog (MessageType type, ButtonType buttons, Window *parent=0, DialogFlagsField flags=DIALOG_DESTROY_WITH_PARENT)
    Constructs a new message dialog, which is a simple dialog with an icon indicating the dialog type (error, warning, etc).
- MessageDialog (MessageType type, ButtonType buttons, const String &message, Window *parent=0, DialogFlagsField flags=DIALOG_DESTROY_WITH_PARENT)
    Constructs a new message dialog, which is a simple dialog with an icon indicating the dialog type (error, warning, etc.) and some text the user may want to see.
- virtual ~MessageDialog ()
    Destructor.

Accessors

- GtkMessageDialog * gtk_message_dialog () const
    Get a pointer to the GtkMessageDialog structure.
- GtkMessageDialogClass * gtk_message_dialog_class () const
    Get a pointer to the GtkMessageDialogClass structure.
- operator GtkMessageDialog * () const
    Conversion operator; safely converts a MessageDialog to a GtkMessageDialog pointer.

Methods

- void set_message (const String &message)
    Sets the message text displayed by the message dialog.
- void set_message (const char *message_format,...)
    Sets the message text displayed by the message dialog.

Property Proxies

- const ButtonsPropertyProxy prop_buttons ()
    The buttons shown in the message dialog (ButtonType : Write / Construct Only).
- const MessageTypePropertyProxy prop_message_type ()
    The type of message (MessageType : Read / Write / Construct).

## Protected Member Functions

Constructors

- MessageDialog (GtkMessageDialog *dialog, bool reference=false)
    Construct a new MessageDialog from an existing GtkMessageDialog.

## Detailed Description

A GtkMessageDialog C++ wrapper class.

MessageDialog presents a dialog with an image representing the type of message (Error, Question, etc.) alongside 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. 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.

Example: A modal dialog.

        Gtk::MessageDialog dialog(Gtk::MESSAGE_ERROR, Gtk::BUTTONS_CLOSE, this);
        dialog.set_message("Error loading file '%s': %s", filename.c_str(), error.message());
        dialog.set_position(Gtk::WIN_POS_CENTER);
        dialog.run();
        dialog.dispose();

To create a non-modal dialog you have to construct the dialog as above but instead of calling Gtk::Dialog::run(), connect a callback slot to the dialog's response signal and call Gtk::Widget::show(). After handling the user's response in your response singal handler, you would either call Gtk::Widget::hide() to hide the dialog or call Gtk::Object::dispose() to destroy it, depending on whether you want to construct the dialog each time, or use the same dialog over again.

## Constructor & Destructor Documentation

Inti::Gtk::MessageDialog::MessageDialog | ( | GtkMessageDialog * | dialog,
|  | bool | reference = false
| ) | `[explicit, protected]`

Construct a new MessageDialog from an existing GtkMessageDialog.

Parameters:

  dialog | A pointer to a GtkMessageDialog.
  reference | Set false if the initial reference count is floating, set true if it's not.

The dialog can be a newly created GtkMessageDialog or an existing GtkMessageDialog (see G::Object::Object).

Inti::Gtk::MessageDialog::MessageDialog | ( | Window * | parent = 0,
|  | DialogFlagsField | flags = DIALOG_DESTROY_WITH_PARENT
| ) |

Construct a new message dialog with the specified parent and dialog flags.

Parameters:

  parent | The transient parent, or null for none.
  flags | The dialog creation flags.

If you call this constructor you must call prop_buttons() to set the buttons to show in the dialog. For example, prop_buttons().set(Gtk::BUTTONS_CLOSE); You must also call prop_message_type() to set the type of message. For example, prop_message_type().set(Gtk::MESSAGE_ERROR); You must call set_message() to set the message text.

Inti::Gtk::MessageDialog::MessageDialog | ( | MessageType | type,
|  | ButtonType | buttons,
|  | Window * | parent = 0,
|  | DialogFlagsField | flags = DIALOG_DESTROY_WITH_PARENT
| ) |

Constructs a new message dialog, which is a simple dialog with an icon indicating the dialog type (error, warning, etc).

Parameters:

  type | The type of message.
  buttons | The set of buttons to use.
  parent | The transient parent, or null for none.
  flags | The dialog creation flags.

If you call this constructor you must call set_message() to set the message text. When the user clicks a button a "response" signal is emitted with response IDs from the Gtk::ResponseType enumeration (see Gtk::Dialog for more details).

Inti::Gtk::MessageDialog::MessageDialog | ( | MessageType | type,
|  | ButtonType | buttons,
|  | const String & | message,
|  | Window * | parent = 0,
|  | DialogFlagsField | flags = DIALOG_DESTROY_WITH_PARENT
| ) |

Constructs a new message dialog, which is a simple dialog with an icon indicating the dialog type (error, warning, etc.) and some text the user may want to see.

Parameters:

  type | The type of message.
  buttons | The set of buttons to use.
  message | The message string.
  parent | The transient parent, or null for none.
  flags | The dialog creation flags.

When the user clicks a button a "response" signal is emitted with response IDs from the Gtk::ResponseType enumeration(see Gtk::Dialog for more details).

## Member Function Documentation

void Inti::Gtk::MessageDialog::set_message | ( | const char * | message_format,
|  | ... |
| ) |

Sets the message text displayed by the message dialog.

Parameters:

  message_format | A printf()-style format string.
  ... | The arguments for message_format.

void Inti::Gtk::MessageDialog::set_message | ( | const String & | message | ) |

Sets the message text displayed by the message dialog.

Parameters:

  message | The message string.

The documentation for this class was generated from the following file:

- messagedialog.h

Main Page - Footer