1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GTK+ Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
27 #ifndef __GTK_DIALOG_H__
28 #define __GTK_DIALOG_H__
32 #include <gtk/gtkwindow.h>
37 /* Parameters for dialog construction */
40 GTK_DIALOG_MODAL = 1 << 0, /* call gtk_window_set_modal (win, TRUE) */
41 GTK_DIALOG_DESTROY_WITH_PARENT = 1 << 1, /* call gtk_window_set_destroy_with_parent () */
42 GTK_DIALOG_NO_SEPARATOR = 1 << 2 /* no separator bar above buttons */
45 /* Convenience enum to use for response_id's. Positive values are
46 * totally user-interpreted. GTK will sometimes return
47 * GTK_RESPONSE_NONE if no response_id is available.
50 * if (gtk_dialog_run(dialog) == GTK_RESPONSE_ACCEPT)
55 /* GTK returns this if a response widget has no response_id,
56 * or if the dialog gets programmatically hidden or destroyed.
58 GTK_RESPONSE_NONE = -1,
60 /* GTK won't return these unless you pass them in
61 * as the response for an action widget. They are
62 * for your convenience.
64 GTK_RESPONSE_REJECT = -2,
65 GTK_RESPONSE_ACCEPT = -3,
67 /* If the dialog is deleted. */
68 GTK_RESPONSE_DELETE_EVENT = -4,
70 /* These are returned from GTK dialogs, and you can also use them
71 * yourself if you like.
74 GTK_RESPONSE_CANCEL = -6,
75 GTK_RESPONSE_CLOSE = -7,
76 GTK_RESPONSE_YES = -8,
78 GTK_RESPONSE_APPLY = -10,
79 GTK_RESPONSE_HELP = -11
83 #define GTK_TYPE_DIALOG (gtk_dialog_get_type ())
84 #define GTK_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_DIALOG, GtkDialog))
85 #define GTK_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_DIALOG, GtkDialogClass))
86 #define GTK_IS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_DIALOG))
87 #define GTK_IS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_DIALOG))
88 #define GTK_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_DIALOG, GtkDialogClass))
91 typedef struct _GtkDialog GtkDialog;
92 typedef struct _GtkDialogClass GtkDialogClass;
100 GtkWidget *action_area;
103 GtkWidget *separator;
106 struct _GtkDialogClass
108 GtkWindowClass parent_class;
110 void (* response) (GtkDialog *dialog, gint response_id);
112 /* Keybinding signals */
114 void (* close) (GtkDialog *dialog);
116 /* Padding for future expansion */
117 void (*_gtk_reserved1) (void);
118 void (*_gtk_reserved2) (void);
119 void (*_gtk_reserved3) (void);
120 void (*_gtk_reserved4) (void);
124 GType gtk_dialog_get_type (void) G_GNUC_CONST;
125 GtkWidget* gtk_dialog_new (void);
127 GtkWidget* gtk_dialog_new_with_buttons (const gchar *title,
129 GtkDialogFlags flags,
130 const gchar *first_button_text,
131 ...) G_GNUC_NULL_TERMINATED;
133 void gtk_dialog_add_action_widget (GtkDialog *dialog,
136 GtkWidget* gtk_dialog_add_button (GtkDialog *dialog,
137 const gchar *button_text,
139 void gtk_dialog_add_buttons (GtkDialog *dialog,
140 const gchar *first_button_text,
141 ...) G_GNUC_NULL_TERMINATED;
143 void gtk_dialog_set_response_sensitive (GtkDialog *dialog,
146 void gtk_dialog_set_default_response (GtkDialog *dialog,
149 void gtk_dialog_set_has_separator (GtkDialog *dialog,
151 gboolean gtk_dialog_get_has_separator (GtkDialog *dialog);
153 gboolean gtk_alternative_dialog_button_order (GdkScreen *screen);
154 void gtk_dialog_set_alternative_button_order (GtkDialog *dialog,
155 gint first_response_id,
157 void gtk_dialog_set_alternative_button_order_from_array (GtkDialog *dialog,
161 /* Emit response signal */
162 void gtk_dialog_response (GtkDialog *dialog,
165 /* Returns response_id */
166 gint gtk_dialog_run (GtkDialog *dialog);
169 /* For private use only */
170 void _gtk_dialog_set_ignore_separator (GtkDialog *dialog,
171 gboolean ignore_separator);
172 gint _gtk_dialog_get_response_for_widget (GtkDialog *dialog,
177 #endif /* __GTK_DIALOG_H__ */