|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /usr/share/gtk-doc/html/gtk/ |
Upload File : |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>GtkDialog</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
<link rel="start" href="index.html" title="GTK+ Reference Manual">
<link rel="up" href="WindowWidgets.html" title="Windows">
<link rel="prev" href="WindowWidgets.html" title="Windows">
<link rel="next" href="GtkInvisible.html" title="GtkInvisible">
<meta name="generator" content="GTK-Doc V1.6 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="part" href="gtk.html" title="Part I. GTK+ Overview">
<link rel="part" href="gtkbase.html" title="Part II. GTK+ Core Reference">
<link rel="part" href="gtkobjects.html" title="Part III. GTK+ Widgets and Objects">
<link rel="chapter" href="ch01.html" title="Object Hierarchy">
<link rel="chapter" href="ch02.html" title="Widget Gallery">
<link rel="chapter" href="WindowWidgets.html" title="Windows">
<link rel="chapter" href="DisplayWidgets.html" title="Display Widgets">
<link rel="chapter" href="ButtonWidgets.html" title="Buttons and Toggles">
<link rel="chapter" href="NumericEntry.html" title="Numeric/Text Data Entry">
<link rel="chapter" href="TextWidgetObjects.html" title="Multiline Text Editor">
<link rel="chapter" href="TreeWidgetObjects.html" title="Tree, List and Icon Grid Widgets">
<link rel="chapter" href="MenusAndCombos.html" title="Menus, Combo Box, Toolbar">
<link rel="chapter" href="Actions.html" title="Action-based menus and toolbars">
<link rel="chapter" href="SelectorWidgets.html" title="Selectors (File/Font/Color/Input Devices)">
<link rel="chapter" href="LayoutContainers.html" title="Layout Containers">
<link rel="chapter" href="Ornaments.html" title="Ornaments">
<link rel="chapter" href="ScrollingWidgets.html" title="Scrolling">
<link rel="chapter" href="Printing.html" title="Printing">
<link rel="chapter" href="MiscObjects.html" title="Miscellaneous">
<link rel="chapter" href="AbstractObjects.html" title="Abstract Base Classes">
<link rel="chapter" href="PlugSocket.html" title="Cross-process Embedding">
<link rel="chapter" href="SpecialObjects.html" title="Special-purpose features">
<link rel="chapter" href="RecentDocuments.html" title="Recently Used Documents">
<link rel="chapter" href="DeprecatedObjects.html" title="Deprecated">
<link rel="part" href="migrating.html" title="Part IV. Migrating from Previous Versions of GTK+">
<link rel="chapter" href="gtk-migrating-checklist.html" title="Migration Checklist">
<link rel="chapter" href="gtk-migrating-GtkFileChooser.html" title="Migrating from GtkFileSelection to GtkFileChooser">
<link rel="chapter" href="gtk-migrating-GtkAction.html" title="Migrating from old menu and toolbar systems to GtkAction">
<link rel="chapter" href="gtk-migrating-GtkComboBox.html" title="Migrating from GtkOptionMenu and GtkCombo to GtkComboBox and
GtkComboBoxEntry">
<link rel="chapter" href="gtk-migrating-GtkIconView.html" title="Migrating from GnomeIconList to GtkIconView">
<link rel="chapter" href="gtk-migrating-GtkAboutDialog.html" title="Migrating from GnomeAbout to GtkAboutDialog">
<link rel="chapter" href="gtk-migrating-GtkColorButton.html" title="Migrating from GnomeColorPicker to GtkColorButton">
<link rel="chapter" href="gtk-migrating-GtkAssistant.html" title="Migrating from GnomeDruid to GtkAssistant">
<link rel="chapter" href="gtk-migrating-GtkRecentChooser.html" title="Migrating from EggRecent to GtkRecentChooser">
<link rel="chapter" href="gtk-migrating-GtkLinkButton.html" title="Migrating from GnomeHRef to GtkLinkButton">
<link rel="part" href="pt05.html" title="Part V. GTK+ Tools">
<link rel="glossary" href="glossary.html" title="Glossary">
<link rel="index" href="ix01.html" title="Index">
<link rel="index" href="ix02.html" title="Index of deprecated symbols">
<link rel="index" href="ix03.html" title="Index of new symbols in 2.2">
<link rel="index" href="ix04.html" title="Index of new symbols in 2.4">
<link rel="index" href="ix05.html" title="Index of new symbols in 2.6">
<link rel="index" href="ix06.html" title="Index of new symbols in 2.8">
<link rel="index" href="ix07.html" title="Index of new symbols in 2.10">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="WindowWidgets.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="WindowWidgets.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GTK+ Reference Manual</th>
<td><a accesskey="n" href="GtkInvisible.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id2773207" class="shortcut">Top</a>
 | 
<a href="#id2775091" class="shortcut">Description</a>
 | 
<a href="#id2774728" class="shortcut">Object Hierarchy</a>
 | 
<a href="#id2774879" class="shortcut">Implemented Interfaces</a>
 | 
<a href="#id2774903" class="shortcut">Properties</a>
 | 
<a href="#id2774936" class="shortcut">Style Properties</a>
 | 
<a href="#id2775004" class="shortcut">Signals</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="GtkDialog"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id2773207"></a><span class="refentrytitle">GtkDialog</span>
</h2>
<p>GtkDialog — Create popup windows</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">
#include <gtk/gtk.h>
<a href="GtkDialog.html#GtkDialog-struct">GtkDialog</a>;
enum <a href="GtkDialog.html#GtkDialogFlags">GtkDialogFlags</a>;
enum <a href="GtkDialog.html#GtkResponseType">GtkResponseType</a>;
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a>* <a href="GtkDialog.html#gtk-dialog-new">gtk_dialog_new</a> (void);
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a>* <a href="GtkDialog.html#gtk-dialog-new-with-buttons">gtk_dialog_new_with_buttons</a> (const <a
href="../glib/glib-Basic-Types.html#gchar"
>gchar</a> *title,
<a href="GtkWindow.html" title="GtkWindow">GtkWindow</a> *parent,
<a href="GtkDialog.html#GtkDialogFlags">GtkDialogFlags</a> flags,
const <a
href="../glib/glib-Basic-Types.html#gchar"
>gchar</a> *first_button_text,
...);
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> <a href="GtkDialog.html#gtk-dialog-run">gtk_dialog_run</a> (<a href="GtkDialog.html" title="GtkDialog">GtkDialog</a> *dialog);
void <a href="GtkDialog.html#gtk-dialog-response">gtk_dialog_response</a> (<a href="GtkDialog.html" title="GtkDialog">GtkDialog</a> *dialog,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> response_id);
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a>* <a href="GtkDialog.html#gtk-dialog-add-button">gtk_dialog_add_button</a> (<a href="GtkDialog.html" title="GtkDialog">GtkDialog</a> *dialog,
const <a
href="../glib/glib-Basic-Types.html#gchar"
>gchar</a> *button_text,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> response_id);
void <a href="GtkDialog.html#gtk-dialog-add-buttons">gtk_dialog_add_buttons</a> (<a href="GtkDialog.html" title="GtkDialog">GtkDialog</a> *dialog,
const <a
href="../glib/glib-Basic-Types.html#gchar"
>gchar</a> *first_button_text,
...);
void <a href="GtkDialog.html#gtk-dialog-add-action-widget">gtk_dialog_add_action_widget</a> (<a href="GtkDialog.html" title="GtkDialog">GtkDialog</a> *dialog,
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *child,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> response_id);
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> <a href="GtkDialog.html#gtk-dialog-get-has-separator">gtk_dialog_get_has_separator</a> (<a href="GtkDialog.html" title="GtkDialog">GtkDialog</a> *dialog);
void <a href="GtkDialog.html#gtk-dialog-set-default-response">gtk_dialog_set_default_response</a> (<a href="GtkDialog.html" title="GtkDialog">GtkDialog</a> *dialog,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> response_id);
void <a href="GtkDialog.html#gtk-dialog-set-has-separator">gtk_dialog_set_has_separator</a> (<a href="GtkDialog.html" title="GtkDialog">GtkDialog</a> *dialog,
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> setting);
void <a href="GtkDialog.html#gtk-dialog-set-response-sensitive">gtk_dialog_set_response_sensitive</a>
(<a href="GtkDialog.html" title="GtkDialog">GtkDialog</a> *dialog,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> response_id,
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> setting);
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> <a href="GtkDialog.html#gtk-dialog-get-response-for-widget">gtk_dialog_get_response_for_widget</a>
(<a href="GtkDialog.html" title="GtkDialog">GtkDialog</a> *dialog,
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *widget);
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> <a href="GtkDialog.html#gtk-alternative-dialog-button-order">gtk_alternative_dialog_button_order</a>
(<a
href="../gdk/GdkScreen.html"
>GdkScreen</a> *screen);
void <a href="GtkDialog.html#gtk-dialog-set-alternative-button-order">gtk_dialog_set_alternative_button_order</a>
(<a href="GtkDialog.html" title="GtkDialog">GtkDialog</a> *dialog,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> first_response_id,
...);
void <a href="GtkDialog.html#gtk-dialog-set-alternative-button-order-from-array">gtk_dialog_set_alternative_button_order_from_array</a>
(<a href="GtkDialog.html" title="GtkDialog">GtkDialog</a> *dialog,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> n_params,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> *new_order);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2774728"></a><h2>Object Hierarchy</h2>
<pre class="synopsis">
<a
href="../gobject/gobject-The-Base-Object-Type.html#GObject"
>GObject</a>
+----<a
href="../gobject/gobject-The-Base-Object-Type.html#GInitiallyUnowned"
>GInitiallyUnowned</a>
+----<a href="GtkObject.html" title="GtkObject">GtkObject</a>
+----<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a>
+----<a href="GtkContainer.html" title="GtkContainer">GtkContainer</a>
+----<a href="GtkBin.html" title="GtkBin">GtkBin</a>
+----<a href="GtkWindow.html" title="GtkWindow">GtkWindow</a>
+----GtkDialog
+----<a href="GtkAboutDialog.html" title="GtkAboutDialog">GtkAboutDialog</a>
+----<a href="GtkColorSelectionDialog.html" title="GtkColorSelectionDialog">GtkColorSelectionDialog</a>
+----<a href="GtkFileChooserDialog.html" title="GtkFileChooserDialog">GtkFileChooserDialog</a>
+----<a href="GtkFileSelection.html" title="GtkFileSelection">GtkFileSelection</a>
+----<a href="GtkFontSelectionDialog.html" title="GtkFontSelectionDialog">GtkFontSelectionDialog</a>
+----<a href="GtkInputDialog.html" title="GtkInputDialog">GtkInputDialog</a>
+----<a href="GtkMessageDialog.html" title="GtkMessageDialog">GtkMessageDialog</a>
+----<a href="GtkPageSetupUnixDialog.html" title="GtkPageSetupUnixDialog">GtkPageSetupUnixDialog</a>
+----<a href="GtkPrintUnixDialog.html" title="GtkPrintUnixDialog">GtkPrintUnixDialog</a>
+----<a href="GtkRecentChooserDialog.html" title="GtkRecentChooserDialog">GtkRecentChooserDialog</a>
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2774879"></a><h2>Implemented Interfaces</h2>
<p>
GtkDialog implements
AtkImplementorIface.</p>
</div>
<div class="refsect1" lang="en">
<a name="id2774903"></a><h2>Properties</h2>
<pre class="synopsis">
"<a href="GtkDialog.html#GtkDialog--has-separator">has-separator</a>" <a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> : Read / Write
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2774936"></a><h2>Style Properties</h2>
<pre class="synopsis">
"<a href="GtkDialog.html#GtkDialog--action-area-border">action-area-border</a>" <a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> : Read
"<a href="GtkDialog.html#GtkDialog--button-spacing">button-spacing</a>" <a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> : Read
"<a href="GtkDialog.html#GtkDialog--content-area-border">content-area-border</a>" <a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> : Read
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2775004"></a><h2>Signals</h2>
<pre class="synopsis">
"<a href="GtkDialog.html#GtkDialog-close">close</a>" void user_function (<a href="GtkDialog.html" title="GtkDialog">GtkDialog</a> *dialog,
<a
href="../glib/glib-Basic-Types.html#gpointer"
>gpointer</a> user_data) : Run last / Action
"<a href="GtkDialog.html#GtkDialog-response">response</a>" void user_function (<a href="GtkDialog.html" title="GtkDialog">GtkDialog</a> *dialog,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> arg1,
<a
href="../glib/glib-Basic-Types.html#gpointer"
>gpointer</a> user_data) : Run last
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2775091"></a><h2>Description</h2>
<p>
Dialog boxes are a convenient way to prompt the user for a small amount of
input, e.g. to display a message, ask a question, or anything else that does
not require extensive effort on the user's part.
</p>
<p>
GTK+ treats a dialog as a window split vertically. The top section is a
<a href="GtkVBox.html" title="GtkVBox"><span class="type">GtkVBox</span></a>, and is where widgets such as a <a href="GtkLabel.html" title="GtkLabel"><span class="type">GtkLabel</span></a> or a <a href="GtkEntry.html" title="GtkEntry"><span class="type">GtkEntry</span></a> should
be packed. The bottom area is known as the
<em class="structfield"><code>action_area</code></em>. This is generally used for
packing buttons into the dialog which may perform functions such as
cancel, ok, or apply. The two areas are separated by a <a href="GtkHSeparator.html" title="GtkHSeparator"><span class="type">GtkHSeparator</span></a>.
</p>
<p>
<a href="GtkDialog.html" title="GtkDialog"><span class="type">GtkDialog</span></a> boxes are created with a call to <a href="GtkDialog.html#gtk-dialog-new"><code class="function">gtk_dialog_new()</code></a> or
<a href="GtkDialog.html#gtk-dialog-new-with-buttons"><code class="function">gtk_dialog_new_with_buttons()</code></a>. <a href="GtkDialog.html#gtk-dialog-new-with-buttons"><code class="function">gtk_dialog_new_with_buttons()</code></a> is recommended; it
allows you to set the dialog title, some convenient flags, and add simple
buttons.
</p>
<p>
If 'dialog' is a newly created dialog, the two primary areas of the window
can be accessed as <code class="literal">GTK_DIALOG(dialog)->vbox</code> and
<code class="literal">GTK_DIALOG(dialog)->action_area</code>,
as can be seen from the example, below.
</p>
<p>
A 'modal' dialog (that is, one which freezes the rest of the application from
user input), can be created by calling <a href="GtkWindow.html#gtk-window-set-modal"><code class="function">gtk_window_set_modal()</code></a> on the dialog. Use
the <code class="function">GTK_WINDOW()</code> macro to cast the widget returned from <a href="GtkDialog.html#gtk-dialog-new"><code class="function">gtk_dialog_new()</code></a> into a
<a href="GtkWindow.html" title="GtkWindow"><span class="type">GtkWindow</span></a>. When using <a href="GtkDialog.html#gtk-dialog-new-with-buttons"><code class="function">gtk_dialog_new_with_buttons()</code></a> you can also pass the
<a href="GtkDialog.html#GTK-DIALOG-MODAL:CAPS"><span class="type">GTK_DIALOG_MODAL</span></a> flag to make a dialog modal.
</p>
<p>
If you add buttons to <a href="GtkDialog.html" title="GtkDialog"><span class="type">GtkDialog</span></a> using <a href="GtkDialog.html#gtk-dialog-new-with-buttons"><code class="function">gtk_dialog_new_with_buttons()</code></a>,
<a href="GtkDialog.html#gtk-dialog-add-button"><code class="function">gtk_dialog_add_button()</code></a>, <a href="GtkDialog.html#gtk-dialog-add-buttons"><code class="function">gtk_dialog_add_buttons()</code></a>, or
<a href="GtkDialog.html#gtk-dialog-add-action-widget"><code class="function">gtk_dialog_add_action_widget()</code></a>, clicking the button will emit a signal called
"response" with a response ID that you specified. GTK+ will never assign a
meaning to positive response IDs; these are entirely user-defined. But for
convenience, you can use the response IDs in the <a href="GtkDialog.html#GtkResponseType"><span class="type">GtkResponseType</span></a> enumeration
(these all have values less than zero). If a dialog receives a delete event,
the "response" signal will be emitted with a response ID of <a href="GtkDialog.html#GTK-RESPONSE-DELETE-EVENT:CAPS"><span class="type">GTK_RESPONSE_DELETE_EVENT</span></a>.
</p>
<p>
If you want to block waiting for a dialog to return before returning control
flow to your code, you can call <a href="GtkDialog.html#gtk-dialog-run"><code class="function">gtk_dialog_run()</code></a>. This function enters a
recursive main loop and waits for the user to respond to the dialog, returning the
response ID corresponding to the button the user clicked.
</p>
<p>
For the simple dialog in the following example, in reality you'd probably use
<a href="GtkMessageDialog.html" title="GtkMessageDialog"><span class="type">GtkMessageDialog</span></a> to save yourself some effort. But you'd need to create the
dialog contents manually if you had more than a simple message in the dialog.
</p>
<div class="example">
<a name="id2775400"></a><p class="title"><b>Example 1. Simple <span class="structname">GtkDialog</span> usage.</b></p>
<pre class="programlisting">
/* Function to open a dialog box displaying the message provided. */
void quick_message (gchar *message) {
GtkWidget *dialog, *label;
/* Create the widgets */
dialog = gtk_dialog_new_with_buttons ("Message",
main_application_window,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK,
GTK_RESPONSE_NONE,
NULL);
label = gtk_label_new (message);
/* Ensure that the dialog box is destroyed when the user responds. */
g_signal_connect_swapped (dialog,
"response",
G_CALLBACK (gtk_widget_destroy),
dialog);
/* Add the label, and show everything we've added to the dialog. */
gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox),
label);
gtk_widget_show_all (dialog);
}
</pre>
</div>
<p>
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2775435"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id2775445"></a><h3>
<a name="GtkDialog-struct"></a>GtkDialog</h3>
<a class="indexterm" name="id2775458"></a><pre class="programlisting">typedef struct {
GtkWidget *vbox;
GtkWidget *action_area;
} GtkDialog;
</pre>
<p>
<em class="structfield"><code>vbox</code></em> is a <a href="GtkVBox.html" title="GtkVBox"><span class="type">GtkVBox</span></a> - the main part of the
dialog box.
</p>
<p>
<em class="structfield"><code>action_area</code></em> is a <a href="GtkHButtonBox.html" title="GtkHButtonBox"><span class="type">GtkHButtonBox</span></a> packed below the
dividing <a href="GtkHSeparator.html" title="GtkHSeparator"><span class="type">GtkHSeparator</span></a> in the dialog. It is treated exactly the same
as any other <a href="GtkHButtonBox.html" title="GtkHButtonBox"><span class="type">GtkHButtonBox</span></a>.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2775519"></a><h3>
<a name="GtkDialogFlags"></a>enum GtkDialogFlags</h3>
<a class="indexterm" name="id2775532"></a><pre class="programlisting">typedef enum
{
GTK_DIALOG_MODAL = 1 << 0, /* call gtk_window_set_modal (win, TRUE) */
GTK_DIALOG_DESTROY_WITH_PARENT = 1 << 1, /* call gtk_window_set_destroy_with_parent () */
GTK_DIALOG_NO_SEPARATOR = 1 << 2 /* no separator bar above buttons */
} GtkDialogFlags;
</pre>
<p>
Flags used to influence dialog construction.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><a name="GTK-DIALOG-MODAL:CAPS"></a><code class="literal">GTK_DIALOG_MODAL</code></span></td>
<td>Make the constructed dialog modal,
see <code class="function">gtk_widget_set_modal()</code>.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="GTK-DIALOG-DESTROY-WITH-PARENT:CAPS"></a><code class="literal">GTK_DIALOG_DESTROY_WITH_PARENT</code></span></td>
<td>Destroy the dialog when its
parent is destroyed, see <a href="GtkWindow.html#gtk-window-set-destroy-with-parent"><code class="function">gtk_window_set_destroy_with_parent()</code></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="GTK-DIALOG-NO-SEPARATOR:CAPS"></a><code class="literal">GTK_DIALOG_NO_SEPARATOR</code></span></td>
<td>Don't put a separator between the
action area and the dialog content.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2775655"></a><h3>
<a name="GtkResponseType"></a>enum GtkResponseType</h3>
<a class="indexterm" name="id2775668"></a><pre class="programlisting">typedef enum
{
/* GTK returns this if a response widget has no response_id,
* or if the dialog gets programmatically hidden or destroyed.
*/
GTK_RESPONSE_NONE = -1,
/* GTK won't return these unless you pass them in
* as the response for an action widget. They are
* for your convenience.
*/
GTK_RESPONSE_REJECT = -2,
GTK_RESPONSE_ACCEPT = -3,
/* If the dialog is deleted. */
GTK_RESPONSE_DELETE_EVENT = -4,
/* These are returned from GTK dialogs, and you can also use them
* yourself if you like.
*/
GTK_RESPONSE_OK = -5,
GTK_RESPONSE_CANCEL = -6,
GTK_RESPONSE_CLOSE = -7,
GTK_RESPONSE_YES = -8,
GTK_RESPONSE_NO = -9,
GTK_RESPONSE_APPLY = -10,
GTK_RESPONSE_HELP = -11
} GtkResponseType;
</pre>
<p>
Predefined values for use as response ids in <a href="GtkDialog.html#gtk-dialog-add-button"><code class="function">gtk_dialog_add_button()</code></a>.
All predefined values are negative, GTK+ leaves positive values for
application-defined response ids.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><a name="GTK-RESPONSE-NONE:CAPS"></a><code class="literal">GTK_RESPONSE_NONE</code></span></td>
<td>Returned if an action widget has no response id, or if
the dialog gets programmatically hidden or destroyed.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="GTK-RESPONSE-REJECT:CAPS"></a><code class="literal">GTK_RESPONSE_REJECT</code></span></td>
<td>Generic response id, not used by GTK+ dialogs.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="GTK-RESPONSE-ACCEPT:CAPS"></a><code class="literal">GTK_RESPONSE_ACCEPT</code></span></td>
<td>Generic response id, not used by GTK+ dialogs.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="GTK-RESPONSE-DELETE-EVENT:CAPS"></a><code class="literal">GTK_RESPONSE_DELETE_EVENT</code></span></td>
<td>Returned if the dialog is deleted.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="GTK-RESPONSE-OK:CAPS"></a><code class="literal">GTK_RESPONSE_OK</code></span></td>
<td>Returned by OK buttons in GTK+ dialogs.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="GTK-RESPONSE-CANCEL:CAPS"></a><code class="literal">GTK_RESPONSE_CANCEL</code></span></td>
<td>Returned by Cancel buttons in GTK+ dialogs.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="GTK-RESPONSE-CLOSE:CAPS"></a><code class="literal">GTK_RESPONSE_CLOSE</code></span></td>
<td>Returned by Close buttons in GTK+ dialogs.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="GTK-RESPONSE-YES:CAPS"></a><code class="literal">GTK_RESPONSE_YES</code></span></td>
<td>Returned by Yes buttons in GTK+ dialogs.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="GTK-RESPONSE-NO:CAPS"></a><code class="literal">GTK_RESPONSE_NO</code></span></td>
<td>Returned by No buttons in GTK+ dialogs.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="GTK-RESPONSE-APPLY:CAPS"></a><code class="literal">GTK_RESPONSE_APPLY</code></span></td>
<td>Returned by Apply buttons in GTK+ dialogs.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="GTK-RESPONSE-HELP:CAPS"></a><code class="literal">GTK_RESPONSE_HELP</code></span></td>
<td>Returned by Help buttons in GTK+ dialogs.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2775968"></a><h3>
<a name="gtk-dialog-new"></a>gtk_dialog_new ()</h3>
<a class="indexterm" name="id2775980"></a><pre class="programlisting"><a href="GtkWidget.html" title="GtkWidget">GtkWidget</a>* gtk_dialog_new (void);</pre>
<p>
Creates a new dialog box. Widgets should not be packed into this <a href="GtkWindow.html" title="GtkWindow"><span class="type">GtkWindow</span></a>
directly, but into the <em class="parameter"><code>vbox</code></em> and <em class="parameter"><code>action_area</code></em>, as described above.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td>a new <a href="GtkDialog.html" title="GtkDialog"><span class="type">GtkDialog</span></a>.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2776046"></a><h3>
<a name="gtk-dialog-new-with-buttons"></a>gtk_dialog_new_with_buttons ()</h3>
<a class="indexterm" name="id2776060"></a><pre class="programlisting"><a href="GtkWidget.html" title="GtkWidget">GtkWidget</a>* gtk_dialog_new_with_buttons (const <a
href="../glib/glib-Basic-Types.html#gchar"
>gchar</a> *title,
<a href="GtkWindow.html" title="GtkWindow">GtkWindow</a> *parent,
<a href="GtkDialog.html#GtkDialogFlags">GtkDialogFlags</a> flags,
const <a
href="../glib/glib-Basic-Types.html#gchar"
>gchar</a> *first_button_text,
...);</pre>
<p>
Creates a new <a href="GtkDialog.html" title="GtkDialog"><span class="type">GtkDialog</span></a> with title <em class="parameter"><code>title</code></em> (or <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a> for the default
title; see <a href="GtkWindow.html#gtk-window-set-title"><code class="function">gtk_window_set_title()</code></a>) and transient parent <em class="parameter"><code>parent</code></em> (or
<a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a> for none; see <a href="GtkWindow.html#gtk-window-set-transient-for"><code class="function">gtk_window_set_transient_for()</code></a>). The <em class="parameter"><code>flags</code></em>
argument can be used to make the dialog modal (<a href="GtkDialog.html#GTK-DIALOG-MODAL:CAPS"><span class="type">GTK_DIALOG_MODAL</span></a>)
and/or to have it destroyed along with its transient parent
(<a href="GtkDialog.html#GTK-DIALOG-DESTROY-WITH-PARENT:CAPS"><span class="type">GTK_DIALOG_DESTROY_WITH_PARENT</span></a>). After <em class="parameter"><code>flags</code></em>, button
text/response ID pairs should be listed, with a <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a> pointer ending
the list. Button text can be either a stock ID such as
<a href="gtk-Stock-Items.html#GTK-STOCK-OK:CAPS"><span class="type">GTK_STOCK_OK</span></a>, or some arbitrary text. A response ID can be
any positive number, or one of the values in the <a href="GtkDialog.html#GtkResponseType"><span class="type">GtkResponseType</span></a>
enumeration. If the user clicks one of these dialog buttons,
<a href="GtkDialog.html" title="GtkDialog"><span class="type">GtkDialog</span></a> will emit the "response" signal with the corresponding
response ID. If a <a href="GtkDialog.html" title="GtkDialog"><span class="type">GtkDialog</span></a> receives the "delete_event" signal, it
will emit "response" with a response ID of <a href="GtkDialog.html#GTK-RESPONSE-DELETE-EVENT:CAPS"><span class="type">GTK_RESPONSE_DELETE_EVENT</span></a>.
However, destroying a dialog does not emit the "response" signal;
so be careful relying on "response" when using
the <a href="GtkDialog.html#GTK-DIALOG-DESTROY-WITH-PARENT:CAPS"><span class="type">GTK_DIALOG_DESTROY_WITH_PARENT</span></a> flag. Buttons are from left to right,
so the first button in the list will be the leftmost button in the dialog.
</p>
<p>
Here's a simple example:
</p>
<div class="informalexample"><pre class="programlisting">
GtkWidget *dialog = gtk_dialog_new_with_buttons ("My dialog",
main_app_window,
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK,
GTK_RESPONSE_ACCEPT,
GTK_STOCK_CANCEL,
GTK_RESPONSE_REJECT,
NULL);
</pre></div>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>title</code></em> :</span></td>
<td> Title of the dialog, or <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>parent</code></em> :</span></td>
<td> Transient parent of the dialog, or <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>flags</code></em> :</span></td>
<td> from <a href="GtkDialog.html#GtkDialogFlags"><span class="type">GtkDialogFlags</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>first_button_text</code></em> :</span></td>
<td> stock ID or text to go in first button, or <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>...</code></em> :</span></td>
<td> response ID for first button, then additional buttons, ending with <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a new <a href="GtkDialog.html" title="GtkDialog"><span class="type">GtkDialog</span></a>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2776445"></a><h3>
<a name="gtk-dialog-run"></a>gtk_dialog_run ()</h3>
<a class="indexterm" name="id2776458"></a><pre class="programlisting"><a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> gtk_dialog_run (<a href="GtkDialog.html" title="GtkDialog">GtkDialog</a> *dialog);</pre>
<p>
Blocks in a recursive main loop until the <em class="parameter"><code>dialog</code></em> either emits the
response signal, or is destroyed. If the dialog is destroyed during the call
to <a href="GtkDialog.html#gtk-dialog-run"><code class="function">gtk_dialog_run()</code></a>, gtk_dialog_returns <a href="GtkDialog.html#GTK-RESPONSE-NONE:CAPS"><span class="type">GTK_RESPONSE_NONE</span></a>.
Otherwise, it returns the response ID from the "response" signal emission.
Before entering the recursive main loop, <a href="GtkDialog.html#gtk-dialog-run"><code class="function">gtk_dialog_run()</code></a> calls
<a href="GtkWidget.html#gtk-widget-show"><code class="function">gtk_widget_show()</code></a> on the dialog for you. Note that you still
need to show any children of the dialog yourself.
</p>
<p>
During <a href="GtkDialog.html#gtk-dialog-run"><code class="function">gtk_dialog_run()</code></a>, the default behavior of "delete_event" is
disabled; if the dialog receives "delete_event", it will not be
destroyed as windows usually are, and <a href="GtkDialog.html#gtk-dialog-run"><code class="function">gtk_dialog_run()</code></a> will return
<a href="GtkDialog.html#GTK-RESPONSE-DELETE-EVENT:CAPS"><span class="type">GTK_RESPONSE_DELETE_EVENT</span></a>. Also, during <a href="GtkDialog.html#gtk-dialog-run"><code class="function">gtk_dialog_run()</code></a> the dialog will be
modal. You can force <a href="GtkDialog.html#gtk-dialog-run"><code class="function">gtk_dialog_run()</code></a> to return at any time by
calling <a href="GtkDialog.html#gtk-dialog-response"><code class="function">gtk_dialog_response()</code></a> to emit the "response"
signal. Destroying the dialog during <a href="GtkDialog.html#gtk-dialog-run"><code class="function">gtk_dialog_run()</code></a> is a very bad
idea, because your post-run code won't know whether the dialog was
destroyed or not.
</p>
<p>
After <a href="GtkDialog.html#gtk-dialog-run"><code class="function">gtk_dialog_run()</code></a> returns, you are responsible for hiding or
destroying the dialog if you wish to do so.
</p>
<p>
Typical usage of this function might be:
</p>
<div class="informalexample"><pre class="programlisting">
gint result = gtk_dialog_run (GTK_DIALOG (dialog));
switch (result)
{
case GTK_RESPONSE_ACCEPT:
do_application_specific_something ();
break;
default:
do_nothing_since_dialog_was_cancelled ();
break;
}
gtk_widget_destroy (dialog);
</pre></div>
<p>
</p>
<p>
Note that even though the recursive main loop gives the effect of a
modal dialog (it prevents the user from interacting with other
windows in the same window group while the dialog is run), callbacks
such as timeouts, IO channel watches, DND drops, etc, <span class="emphasis"><em>will</em></span>
be triggered during a <a href="GtkDialog.html#gtk-dialog-run"><code class="function">gtk_dialog_run()</code></a> call.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>dialog</code></em> :</span></td>
<td> a <a href="GtkDialog.html" title="GtkDialog"><span class="type">GtkDialog</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> response ID
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2776720"></a><h3>
<a name="gtk-dialog-response"></a>gtk_dialog_response ()</h3>
<a class="indexterm" name="id2776733"></a><pre class="programlisting">void gtk_dialog_response (<a href="GtkDialog.html" title="GtkDialog">GtkDialog</a> *dialog,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> response_id);</pre>
<p>
Emits the "response" signal with the given response ID. Used to
indicate that the user has responded to the dialog in some way;
typically either you or <a href="GtkDialog.html#gtk-dialog-run"><code class="function">gtk_dialog_run()</code></a> will be monitoring the
"response" signal and take appropriate action.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>dialog</code></em> :</span></td>
<td> a <a href="GtkDialog.html" title="GtkDialog"><span class="type">GtkDialog</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>response_id</code></em> :</span></td>
<td> response ID
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2776826"></a><h3>
<a name="gtk-dialog-add-button"></a>gtk_dialog_add_button ()</h3>
<a class="indexterm" name="id2776839"></a><pre class="programlisting"><a href="GtkWidget.html" title="GtkWidget">GtkWidget</a>* gtk_dialog_add_button (<a href="GtkDialog.html" title="GtkDialog">GtkDialog</a> *dialog,
const <a
href="../glib/glib-Basic-Types.html#gchar"
>gchar</a> *button_text,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> response_id);</pre>
<p>
Adds a button with the given text (or a stock button, if <em class="parameter"><code>button_text</code></em> is a
stock ID) and sets things up so that clicking the button will emit the
"response" signal with the given <em class="parameter"><code>response_id</code></em>. The button is appended to the
end of the dialog's action area. The button widget is returned, but usually
you don't need it.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>dialog</code></em> :</span></td>
<td> a <a href="GtkDialog.html" title="GtkDialog"><span class="type">GtkDialog</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>button_text</code></em> :</span></td>
<td> text of button, or stock ID
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>response_id</code></em> :</span></td>
<td> response ID for the button
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the button widget that was added
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2776968"></a><h3>
<a name="gtk-dialog-add-buttons"></a>gtk_dialog_add_buttons ()</h3>
<a class="indexterm" name="id2776981"></a><pre class="programlisting">void gtk_dialog_add_buttons (<a href="GtkDialog.html" title="GtkDialog">GtkDialog</a> *dialog,
const <a
href="../glib/glib-Basic-Types.html#gchar"
>gchar</a> *first_button_text,
...);</pre>
<p>
Adds more buttons, same as calling <a href="GtkDialog.html#gtk-dialog-add-button"><code class="function">gtk_dialog_add_button()</code></a>
repeatedly. The variable argument list should be <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a>-terminated
as with <a href="GtkDialog.html#gtk-dialog-new-with-buttons"><code class="function">gtk_dialog_new_with_buttons()</code></a>. Each button must have both
text and response ID.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>dialog</code></em> :</span></td>
<td> a <a href="GtkDialog.html" title="GtkDialog"><span class="type">GtkDialog</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>first_button_text</code></em> :</span></td>
<td> button text or stock ID
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>...</code></em> :</span></td>
<td> response ID for first button, then more text-response_id pairs
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2777110"></a><h3>
<a name="gtk-dialog-add-action-widget"></a>gtk_dialog_add_action_widget ()</h3>
<a class="indexterm" name="id2777124"></a><pre class="programlisting">void gtk_dialog_add_action_widget (<a href="GtkDialog.html" title="GtkDialog">GtkDialog</a> *dialog,
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *child,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> response_id);</pre>
<p>
Adds an activatable widget to the action area of a <a href="GtkDialog.html" title="GtkDialog"><span class="type">GtkDialog</span></a>,
connecting a signal handler that will emit the "response" signal on
the dialog when the widget is activated. The widget is appended to
the end of the dialog's action area. If you want to add a
non-activatable widget, simply pack it into the
<code class="literal">action_area</code> field of the <a href="GtkDialog.html" title="GtkDialog"><span class="type">GtkDialog</span></a> struct.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>dialog</code></em> :</span></td>
<td> a <a href="GtkDialog.html" title="GtkDialog"><span class="type">GtkDialog</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>child</code></em> :</span></td>
<td> an activatable widget
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>response_id</code></em> :</span></td>
<td> response ID for <em class="parameter"><code>child</code></em>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2777257"></a><h3>
<a name="gtk-dialog-get-has-separator"></a>gtk_dialog_get_has_separator ()</h3>
<a class="indexterm" name="id2777271"></a><pre class="programlisting"><a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> gtk_dialog_get_has_separator (<a href="GtkDialog.html" title="GtkDialog">GtkDialog</a> *dialog);</pre>
<p>
Accessor for whether the dialog has a separator.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>dialog</code></em> :</span></td>
<td> a <a href="GtkDialog.html" title="GtkDialog"><span class="type">GtkDialog</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> <a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a> if the dialog has a separator
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2777350"></a><h3>
<a name="gtk-dialog-set-default-response"></a>gtk_dialog_set_default_response ()</h3>
<a class="indexterm" name="id2777364"></a><pre class="programlisting">void gtk_dialog_set_default_response (<a href="GtkDialog.html" title="GtkDialog">GtkDialog</a> *dialog,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> response_id);</pre>
<p>
Sets the last widget in the dialog's action area with the given <em class="parameter"><code>response_id</code></em>
as the default widget for the dialog. Pressing "Enter" normally activates
the default widget.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>dialog</code></em> :</span></td>
<td> a <a href="GtkDialog.html" title="GtkDialog"><span class="type">GtkDialog</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>response_id</code></em> :</span></td>
<td> a response ID
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2777451"></a><h3>
<a name="gtk-dialog-set-has-separator"></a>gtk_dialog_set_has_separator ()</h3>
<a class="indexterm" name="id2777465"></a><pre class="programlisting">void gtk_dialog_set_has_separator (<a href="GtkDialog.html" title="GtkDialog">GtkDialog</a> *dialog,
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> setting);</pre>
<p>
Sets whether the dialog has a separator above the buttons.
<a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a> by default.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>dialog</code></em> :</span></td>
<td> a <a href="GtkDialog.html" title="GtkDialog"><span class="type">GtkDialog</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>setting</code></em> :</span></td>
<td> <a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a> to have a separator
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2777565"></a><h3>
<a name="gtk-dialog-set-response-sensitive"></a>gtk_dialog_set_response_sensitive ()</h3>
<a class="indexterm" name="id2777580"></a><pre class="programlisting">void gtk_dialog_set_response_sensitive
(<a href="GtkDialog.html" title="GtkDialog">GtkDialog</a> *dialog,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> response_id,
<a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> setting);</pre>
<p>
Calls <code class="literal">gtk_widget_set_sensitive (widget, <em class="parameter"><code>setting</code></em>)</code>
for each widget in the dialog's action area with the given <em class="parameter"><code>response_id</code></em>.
A convenient way to sensitize/desensitize dialog buttons.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>dialog</code></em> :</span></td>
<td> a <a href="GtkDialog.html" title="GtkDialog"><span class="type">GtkDialog</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>response_id</code></em> :</span></td>
<td> a response ID
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>setting</code></em> :</span></td>
<td> <a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a> for sensitive
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2777710"></a><h3>
<a name="gtk-dialog-get-response-for-widget"></a>gtk_dialog_get_response_for_widget ()</h3>
<a class="indexterm" name="id2777727"></a><pre class="programlisting"><a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> gtk_dialog_get_response_for_widget
(<a href="GtkDialog.html" title="GtkDialog">GtkDialog</a> *dialog,
<a href="GtkWidget.html" title="GtkWidget">GtkWidget</a> *widget);</pre>
<p>
Gets the response id of a widget in the action area
of a dialog.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>dialog</code></em> :</span></td>
<td> a <a href="GtkDialog.html" title="GtkDialog"><span class="type">GtkDialog</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>widget</code></em> :</span></td>
<td> a widget in the action area of <em class="parameter"><code>dialog</code></em>
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the response id of <em class="parameter"><code>widget</code></em>, or <a href="GtkDialog.html#GTK-RESPONSE-NONE:CAPS"><code class="literal">GTK_RESPONSE_NONE</code></a>
if <em class="parameter"><code>widget</code></em> doesn't have a response id set.
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.8
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2777852"></a><h3>
<a name="gtk-alternative-dialog-button-order"></a>gtk_alternative_dialog_button_order ()</h3>
<a class="indexterm" name="id2777868"></a><pre class="programlisting"><a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> gtk_alternative_dialog_button_order
(<a
href="../gdk/GdkScreen.html"
>GdkScreen</a> *screen);</pre>
<p>
Returns <a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a> if dialogs are expected to use an alternative
button order on the screen <em class="parameter"><code>screen</code></em>. See
<a href="GtkDialog.html#gtk-dialog-set-alternative-button-order"><code class="function">gtk_dialog_set_alternative_button_order()</code></a> for more details
about alternative button order.
</p>
<p>
If you need to use this function, you should probably connect
to the ::notify:gtk-alternative-button-order signal on the
<a href="GtkSettings.html" title="Settings"><span class="type">GtkSettings</span></a> object associated to <em class="parameter"><code>screen</code></em>, in order to be
notified if the button order setting changes.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>screen</code></em> :</span></td>
<td> a <a
href="../gdk/GdkScreen.html"
><span class="type">GdkScreen</span></a>, or <a
href="../glib/glib-Standard-Macros.html#NULL:CAPS"
><code class="literal">NULL</code></a> to use the default screen
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> Whether the alternative button order should be used
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.6
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2778003"></a><h3>
<a name="gtk-dialog-set-alternative-button-order"></a>gtk_dialog_set_alternative_button_order ()</h3>
<a class="indexterm" name="id2778019"></a><pre class="programlisting">void gtk_dialog_set_alternative_button_order
(<a href="GtkDialog.html" title="GtkDialog">GtkDialog</a> *dialog,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> first_response_id,
...);</pre>
<p>
Sets an alternative button order. If the gtk-alternative-button-order
setting is set to <a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a>, the dialog buttons are reordered according to
the order of the response ids passed to this function.
</p>
<p>
By default, GTK+ dialogs use the button order advocated by the Gnome
<a href="http://developer.gnome.org/projects/gup/hig/2.0/" target="_top">Human
Interface Guidelines</a> with the affirmative button at the far
right, and the cancel button left of it. But the builtin GTK+ dialogs
and <a href="GtkMessageDialog.html" title="GtkMessageDialog"><span class="type">GtkMessageDialog</span></a>s do provide an alternative button order,
which is more suitable on some platforms, e.g. Windows.
</p>
<p>
Use this function after adding all the buttons to your dialog, as the
following example shows:
</p>
<div class="informalexample"><pre class="programlisting">
cancel_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL);
ok_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
GTK_STOCK_OK,
GTK_RESPONSE_OK);
gtk_widget_grab_default (ok_button);
help_button = gtk_dialog_add_button (GTK_DIALOG (dialog),
GTK_STOCK_HELP,
GTK_RESPONSE_HELP);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
GTK_RESPONSE_HELP,
-1);
</pre></div>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>dialog</code></em> :</span></td>
<td> a <a href="GtkDialog.html" title="GtkDialog"><span class="type">GtkDialog</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>first_response_id</code></em> :</span></td>
<td> a response id used by one <em class="parameter"><code>dialog</code></em>'s buttons
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>...</code></em> :</span></td>
<td> a list of more response ids of <em class="parameter"><code>dialog</code></em>'s buttons, terminated by -1
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.6
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2778193"></a><h3>
<a name="gtk-dialog-set-alternative-button-order-from-array"></a>gtk_dialog_set_alternative_button_order_from_array ()</h3>
<a class="indexterm" name="id2778210"></a><pre class="programlisting">void gtk_dialog_set_alternative_button_order_from_array
(<a href="GtkDialog.html" title="GtkDialog">GtkDialog</a> *dialog,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> n_params,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> *new_order);</pre>
<p>
Sets an alternative button order. If the gtk-alternative-button-order
setting is set to <a
href="../glib/glib-Standard-Macros.html#TRUE:CAPS"
><code class="literal">TRUE</code></a>, the dialog buttons are reordered according to
the order of the response ids in <em class="parameter"><code>new_order</code></em>.
</p>
<p>
See <a href="GtkDialog.html#gtk-dialog-set-alternative-button-order"><code class="function">gtk_dialog_set_alternative_button_order()</code></a> for more information.
</p>
<p>
This function is for use by language bindings.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>dialog</code></em> :</span></td>
<td> a <a href="GtkDialog.html" title="GtkDialog"><span class="type">GtkDialog</span></a>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>n_params</code></em> :</span></td>
<td> the number of response ids in <em class="parameter"><code>new_order</code></em>
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>new_order</code></em> :</span></td>
<td> an array of response ids of <em class="parameter"><code>dialog</code></em>'s buttons
</td>
</tr>
</tbody>
</table></div>
<p>Since 2.6
</p>
</div>
</div>
<div class="refsect1" lang="en">
<a name="id2778368"></a><h2>Property Details</h2>
<div class="refsect2" lang="en">
<a name="id2778379"></a><h3>
<a name="GtkDialog--has-separator"></a>The "<code class="literal">has-separator</code>" property</h3>
<a class="indexterm" name="id2778396"></a><pre class="programlisting"> "has-separator" <a
href="../glib/glib-Basic-Types.html#gboolean"
>gboolean</a> : Read / Write</pre>
<p>The dialog has a separator bar above its buttons.</p>
<p>Default value: TRUE</p>
</div>
</div>
<div class="refsect1" lang="en">
<a name="id2778424"></a><h2>Style Property Details</h2>
<div class="refsect2" lang="en">
<a name="id2778435"></a><h3>
<a name="GtkDialog--action-area-border"></a>The "<code class="literal">action-area-border</code>" style property</h3>
<a class="indexterm" name="id2778452"></a><pre class="programlisting"> "action-area-border" <a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> : Read</pre>
<p>Width of border around the button area at the bottom of the dialog.</p>
<p>Allowed values: >= 0</p>
<p>Default value: 5</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2778483"></a><h3>
<a name="GtkDialog--button-spacing"></a>The "<code class="literal">button-spacing</code>" style property</h3>
<a class="indexterm" name="id2778500"></a><pre class="programlisting"> "button-spacing" <a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> : Read</pre>
<p>Spacing between buttons.</p>
<p>Allowed values: >= 0</p>
<p>Default value: 6</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2778530"></a><h3>
<a name="GtkDialog--content-area-border"></a>The "<code class="literal">content-area-border</code>" style property</h3>
<a class="indexterm" name="id2778547"></a><pre class="programlisting"> "content-area-border" <a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> : Read</pre>
<p>Width of border around the main dialog area.</p>
<p>Allowed values: >= 0</p>
<p>Default value: 2</p>
</div>
</div>
<div class="refsect1" lang="en">
<a name="id2778579"></a><h2>Signal Details</h2>
<div class="refsect2" lang="en">
<a name="id2778590"></a><h3>
<a name="GtkDialog-close"></a>The "close" signal</h3>
<a class="indexterm" name="id2778600"></a><pre class="programlisting">void user_function (<a href="GtkDialog.html" title="GtkDialog">GtkDialog</a> *dialog,
<a
href="../glib/glib-Basic-Types.html#gpointer"
>gpointer</a> user_data) : Run last / Action</pre>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>dialog</code></em> :</span></td>
<td>the object which received the signal.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>user_data</code></em> :</span></td>
<td>user data set when the signal handler was connected.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2778668"></a><h3>
<a name="GtkDialog-response"></a>The "response" signal</h3>
<a class="indexterm" name="id2778678"></a><pre class="programlisting">void user_function (<a href="GtkDialog.html" title="GtkDialog">GtkDialog</a> *dialog,
<a
href="../glib/glib-Basic-Types.html#gint"
>gint</a> arg1,
<a
href="../glib/glib-Basic-Types.html#gpointer"
>gpointer</a> user_data) : Run last</pre>
<p>
Emitted when an action widget is clicked, the dialog receives a delete event, or
the application programmer calls <a href="GtkDialog.html#gtk-dialog-response"><code class="function">gtk_dialog_response()</code></a>. On a delete event, the
response ID is <a href="GtkDialog.html#GTK-RESPONSE-NONE:CAPS"><span class="type">GTK_RESPONSE_NONE</span></a>. Otherwise, it depends on which action widget
was clicked.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>dialog</code></em> :</span></td>
<td>the object which received the signal.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>arg1</code></em> :</span></td>
<td>the response ID
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>user_data</code></em> :</span></td>
<td>user data set when the signal handler was connected.</td>
</tr>
</tbody>
</table></div>
</div>
</div>
<div class="refsect1" lang="en">
<a name="id2778793"></a><h2>See Also</h2>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><a href="GtkVBox.html" title="GtkVBox"><span class="type">GtkVBox</span></a></span></td>
<td><p>Pack widgets vertically.</p></td>
</tr>
<tr>
<td>
<span class="term"><a href="GtkWindow.html" title="GtkWindow"><span class="type">GtkWindow</span></a></span></td>
<td><p>Alter the properties of your dialog box.</p></td>
</tr>
<tr>
<td>
<span class="term"><a href="GtkButton.html" title="GtkButton"><span class="type">GtkButton</span></a></span></td>
<td><p>Add them to the <em class="structfield"><code>action_area</code></em> to get a
response from the user.</p></td>
</tr>
</tbody>
</table></div>
<p>
</p>
</div>
</div>
</body>
</html>