Xfce Foundation Classes
Main Page  | IndexNamespace List  |  Alphabetical List  |  Class List  |  File List


Xfc::Gtk::MessageDialog Class Reference

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

#include <xfc/gtk/messagedialog.hh>

Inheritance diagram for Xfc::Gtk::MessageDialog:

Xfc::Gtk::Dialog Xfc::Gtk::Window Xfc::Gtk::Bin Xfc::Gtk::Container Xfc::Gtk::Widget Xfc::Gtk::Object Xfc::Atk::Implementor Xfc::G::Object Xfc::G::TypeInterface Xfc::G::TypeInstance Xfc::G::TypeInstance Xfc::Trackable Xfc::Trackable List of all members.

Public Member Functions

Accessors
Methods

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.

See also: the MessageDialog and Dialog HOWTOs.


Constructor & Destructor Documentation

Xfc::Gtk::MessageDialog::MessageDialog ( GtkMessageDialog *  dialog,
bool  owns_reference = false 
) [explicit, protected]

Construct a new MessageDialog from an existing GtkMessageDialog.

Parameters:
dialog A pointer to a GtkMessageDialog.
owns_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).

Xfc::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 property_buttons() to set the buttons to show in the dialog. For example, property_buttons().set(Gtk::BUTTONS_CLOSE); You must also call property_message_type() to set the type of message. For example, property_message_type().set(Gtk::MESSAGE_ERROR); You must call set_message() to set the message text.

Xfc::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).

Xfc::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).

Xfc::Gtk::MessageDialog::MessageDialog ( GtkMessageDialog *  dialog,
bool  owns_reference = false 
) [explicit, protected]

Construct a new MessageDialog from an existing GtkMessageDialog.

Parameters:
dialog A pointer to a GtkMessageDialog.
owns_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).

Xfc::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 property_buttons() to set the buttons to show in the dialog. For example, property_buttons().set(Gtk::BUTTONS_CLOSE); You must also call property_message_type() to set the type of message. For example, property_message_type().set(Gtk::MESSAGE_ERROR); You must call set_message() to set the message text.

Xfc::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).

Xfc::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 Xfc::Gtk::MessageDialog::set_message ( const String message  ) 

Sets the message text displayed by the message dialog.

Parameters:
message The message string.

void Xfc::Gtk::MessageDialog::format_message ( const char *  message_format,
  ... 
)

Formats the message text displayed by the message dialog.

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

void Xfc::Gtk::MessageDialog::set_markup ( const String message  ) 

Parses message which is marked up with the Pango text markup language, setting the message text displayed based on the parse results.

Parameters:
message A markup string.

void Xfc::Gtk::MessageDialog::format_markup ( const char *  message_format,
  ... 
)

Parses message_format which is marked up with the Pango text markup language, setting the message text displayed based on the parse results.

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

void Xfc::Gtk::MessageDialog::set_secondary_text ( const String message  ) 

Sets the secondary text of the message dialog to be message.

Parameters:
message The message string.
Note that setting a secondary text makes the primary text become bold, unless you have provided explicit markup.

void Xfc::Gtk::MessageDialog::format_secondary_text ( const char *  message_format,
  ... 
)

Sets the secondary text of the message dialog to be message_format (with printf()-style).

Parameters:
message_format printf()-style format string.
... The arguments for message_format.
Note that setting a secondary text makes the primary text become bold, unless you have provided explicit markup.

void Xfc::Gtk::MessageDialog::set_secondary_markup ( const String message  ) 

Sets the secondary text of the message dialog to be message, which is marked up with the Pango text markup language.

Parameters:
message A markup string (see Pango markup format);
Note that setting a secondary text makes the primary text become bold, unless you have provided explicit markup.

void Xfc::Gtk::MessageDialog::format_secondary_markup ( const char *  message_format,
  ... 
)

Sets the secondary text of the message dialog to be message_format (with printf()-style), which is marked up with the Pango text markup language.

Parameters:
message_format A printf()-style markup string (see Pango markup format).
... The arguments for message_format.
Note that setting a secondary text makes the primary text become bold, unless you have provided explicit markup.


The documentation for this class was generated from the following file: Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC 4.3