gtk2/docs/reference/gtk/tmpl/gtkmessagedialog.sgml
Owen Taylor 61b2f259e5 Move notification of "has_default" to here, so it is safe to call
Fri Nov 16 19:44:35 2001  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtkwindow.c (gtk_window_set_default): Move
	notification of "has_default" to here, so it
	is safe to call gtk_window_set_default() instead
	of gtk_widget_grab_default().

	* gtk/gtkwindow.c (gtk_window_set_focus): Make it call
	gtk_widget_grab_focus(), which then calls
	_gtk_widget_internal_set_focus(). This makes
	gtk_window_set_focus() a safe way of both setting
	and unsetting the focus widget.

	* gtk/gtkwidget.c (gtk_widget_propagate_state): Use
	gtk_widget_get_toplevel(), instead of gtk_widget_ancestor
	to find the toplevel.

	* gtk/gtkwindow.h: Move gtk_window_set_focus/default
	from the "internal functions" section.
2001-11-17 01:18:49 +00:00

115 lines
3.2 KiB
Plaintext

<!-- ##### SECTION Title ##### -->
GtkMessageDialog
<!-- ##### SECTION Short_Description ##### -->
convenient message window
<!-- ##### SECTION Long_Description ##### -->
<para>
#GtkMessageDialog 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 #GtkMessageDialog
from #GtkDialog without too much effort, but #GtkMessageDialog saves typing.
</para>
<para>
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>
<title>Modal #GtkMessageDialog</title>
<programlisting>
dialog = gtk_message_dialog_new (main_application_window,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Error loading file '%s': %s",
filename, g_strerror (errno));
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
</programlisting>
</example>
</para>
<para>
You might do a non-modal #GtkMessageDialog as follows:
<example>
<title>Non-modal #GtkMessageDialog</title>
<programlisting>
dialog = gtk_message_dialog_new (main_application_window,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Error loading file '%s': %s",
filename, g_strerror (errno));
/* Destroy the dialog when the user responds to it (e.g. clicks a button) */
gtk_signal_connect_object (GTK_OBJECT (dialog), "response",
GTK_SIGNAL_FUNC (gtk_widget_destroy),
GTK_OBJECT (dialog));
</programlisting>
</example>
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
#GtkDialog
</para>
<!-- ##### STRUCT GtkMessageDialog ##### -->
<para>
</para>
<!-- ##### ENUM GtkMessageType ##### -->
<para>
The type of message being displayed in the dialog.
</para>
@GTK_MESSAGE_INFO: Informational message
@GTK_MESSAGE_WARNING: Nonfatal warning message
@GTK_MESSAGE_QUESTION: Question requiring a choice
@GTK_MESSAGE_ERROR: Fatal error message
<!-- ##### ENUM GtkButtonsType ##### -->
<para>
Prebuilt sets of buttons for the dialog. If
none of these choices are appropriate, simply use GTK_BUTTONS_NONE
then call gtk_dialog_add_buttons().
</para>
@GTK_BUTTONS_NONE: no buttons at all
@GTK_BUTTONS_OK: an OK button
@GTK_BUTTONS_CLOSE: a Close button
@GTK_BUTTONS_CANCEL: a Cancel button
@GTK_BUTTONS_YES_NO: Yes and No buttons
@GTK_BUTTONS_OK_CANCEL: OK and Cancel buttons
<!-- ##### FUNCTION gtk_message_dialog_new ##### -->
<para>
</para>
@parent:
@flags:
@type:
@buttons:
@message_format:
@Varargs:
@Returns:
<!-- ##### ARG GtkMessageDialog:message-type ##### -->
<para>
</para>
<!-- ##### ARG GtkMessageDialog:buttons ##### -->
<para>
</para>