1/* GTK - The GIMP Toolkit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3 *
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.
8 *
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.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18/*
19 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
20 * file for a list of people on the GTK+ Team. See the ChangeLog
21 * files for a list of changes. These files are distributed with
22 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
23 */
24
25#ifndef __GTK_DIALOG_H__
26#define __GTK_DIALOG_H__
27
28#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
29#error "Only <gtk/gtk.h> can be included directly."
30#endif
31
32#include <gtk/gtkwindow.h>
33
34G_BEGIN_DECLS
35
36/**
37 * GtkDialogFlags:
38 * @GTK_DIALOG_MODAL: Make the constructed dialog modal,
39 * see gtk_window_set_modal()
40 * @GTK_DIALOG_DESTROY_WITH_PARENT: Destroy the dialog when its
41 * parent is destroyed, see gtk_window_set_destroy_with_parent()
42 * @GTK_DIALOG_USE_HEADER_BAR: Create dialog with actions in header
43 * bar instead of action area. Since 3.12.
44 *
45 * Flags used to influence dialog construction.
46 */
47typedef enum
48{
49 GTK_DIALOG_MODAL = 1 << 0,
50 GTK_DIALOG_DESTROY_WITH_PARENT = 1 << 1,
51 GTK_DIALOG_USE_HEADER_BAR = 1 << 2
52} GtkDialogFlags;
53
54/**
55 * GtkResponseType:
56 * @GTK_RESPONSE_NONE: Returned if an action widget has no response id,
57 * or if the dialog gets programmatically hidden or destroyed
58 * @GTK_RESPONSE_REJECT: Generic response id, not used by GTK+ dialogs
59 * @GTK_RESPONSE_ACCEPT: Generic response id, not used by GTK+ dialogs
60 * @GTK_RESPONSE_DELETE_EVENT: Returned if the dialog is deleted
61 * @GTK_RESPONSE_OK: Returned by OK buttons in GTK+ dialogs
62 * @GTK_RESPONSE_CANCEL: Returned by Cancel buttons in GTK+ dialogs
63 * @GTK_RESPONSE_CLOSE: Returned by Close buttons in GTK+ dialogs
64 * @GTK_RESPONSE_YES: Returned by Yes buttons in GTK+ dialogs
65 * @GTK_RESPONSE_NO: Returned by No buttons in GTK+ dialogs
66 * @GTK_RESPONSE_APPLY: Returned by Apply buttons in GTK+ dialogs
67 * @GTK_RESPONSE_HELP: Returned by Help buttons in GTK+ dialogs
68 *
69 * Predefined values for use as response ids in gtk_dialog_add_button().
70 * All predefined values are negative; GTK+ leaves values of 0 or greater for
71 * application-defined response ids.
72 */
73typedef enum
74{
75 GTK_RESPONSE_NONE = -1,
76 GTK_RESPONSE_REJECT = -2,
77 GTK_RESPONSE_ACCEPT = -3,
78 GTK_RESPONSE_DELETE_EVENT = -4,
79 GTK_RESPONSE_OK = -5,
80 GTK_RESPONSE_CANCEL = -6,
81 GTK_RESPONSE_CLOSE = -7,
82 GTK_RESPONSE_YES = -8,
83 GTK_RESPONSE_NO = -9,
84 GTK_RESPONSE_APPLY = -10,
85 GTK_RESPONSE_HELP = -11
86} GtkResponseType;
87
88
89#define GTK_TYPE_DIALOG (gtk_dialog_get_type ())
90#define GTK_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_DIALOG, GtkDialog))
91#define GTK_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_DIALOG, GtkDialogClass))
92#define GTK_IS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_DIALOG))
93#define GTK_IS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_DIALOG))
94#define GTK_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_DIALOG, GtkDialogClass))
95
96
97typedef struct _GtkDialog GtkDialog;
98typedef struct _GtkDialogPrivate GtkDialogPrivate;
99typedef struct _GtkDialogClass GtkDialogClass;
100
101/**
102 * GtkDialog:
103 *
104 * The #GtkDialog-struct contains only private fields
105 * and should not be directly accessed.
106 */
107struct _GtkDialog
108{
109 GtkWindow window;
110
111 /*< private >*/
112 GtkDialogPrivate *priv;
113};
114
115/**
116 * GtkDialogClass:
117 * @parent_class: The parent class.
118 * @response: Signal emitted when an action widget is activated.
119 * @close: Signal emitted when the user uses a keybinding to close the dialog.
120 */
121struct _GtkDialogClass
122{
123 GtkWindowClass parent_class;
124
125 /*< public >*/
126
127 void (* response) (GtkDialog *dialog, gint response_id);
128
129 /* Keybinding signals */
130
131 void (* close) (GtkDialog *dialog);
132
133 /*< private >*/
134
135 /* Padding for future expansion */
136 void (*_gtk_reserved1) (void);
137 void (*_gtk_reserved2) (void);
138 void (*_gtk_reserved3) (void);
139 void (*_gtk_reserved4) (void);
140};
141
142
143GDK_AVAILABLE_IN_ALL
144GType gtk_dialog_get_type (void) G_GNUC_CONST;
145GDK_AVAILABLE_IN_ALL
146GtkWidget* gtk_dialog_new (void);
147
148GDK_AVAILABLE_IN_ALL
149GtkWidget* gtk_dialog_new_with_buttons (const gchar *title,
150 GtkWindow *parent,
151 GtkDialogFlags flags,
152 const gchar *first_button_text,
153 ...) G_GNUC_NULL_TERMINATED;
154
155GDK_AVAILABLE_IN_ALL
156void gtk_dialog_add_action_widget (GtkDialog *dialog,
157 GtkWidget *child,
158 gint response_id);
159GDK_AVAILABLE_IN_ALL
160GtkWidget* gtk_dialog_add_button (GtkDialog *dialog,
161 const gchar *button_text,
162 gint response_id);
163GDK_AVAILABLE_IN_ALL
164void gtk_dialog_add_buttons (GtkDialog *dialog,
165 const gchar *first_button_text,
166 ...) G_GNUC_NULL_TERMINATED;
167
168GDK_AVAILABLE_IN_ALL
169void gtk_dialog_set_response_sensitive (GtkDialog *dialog,
170 gint response_id,
171 gboolean setting);
172GDK_AVAILABLE_IN_ALL
173void gtk_dialog_set_default_response (GtkDialog *dialog,
174 gint response_id);
175GDK_AVAILABLE_IN_ALL
176GtkWidget* gtk_dialog_get_widget_for_response (GtkDialog *dialog,
177 gint response_id);
178GDK_AVAILABLE_IN_ALL
179gint gtk_dialog_get_response_for_widget (GtkDialog *dialog,
180 GtkWidget *widget);
181
182GDK_DEPRECATED_IN_3_10
183gboolean gtk_alternative_dialog_button_order (GdkScreen *screen);
184GDK_DEPRECATED_IN_3_10
185void gtk_dialog_set_alternative_button_order (GtkDialog *dialog,
186 gint first_response_id,
187 ...);
188GDK_DEPRECATED_IN_3_10
189void gtk_dialog_set_alternative_button_order_from_array (GtkDialog *dialog,
190 gint n_params,
191 gint *new_order);
192
193/* Emit response signal */
194GDK_AVAILABLE_IN_ALL
195void gtk_dialog_response (GtkDialog *dialog,
196 gint response_id);
197
198/* Returns response_id */
199GDK_AVAILABLE_IN_ALL
200gint gtk_dialog_run (GtkDialog *dialog);
201
202GDK_DEPRECATED_IN_3_10
203GtkWidget * gtk_dialog_get_action_area (GtkDialog *dialog);
204GDK_AVAILABLE_IN_ALL
205GtkWidget * gtk_dialog_get_content_area (GtkDialog *dialog);
206GDK_AVAILABLE_IN_3_12
207GtkWidget * gtk_dialog_get_header_bar (GtkDialog *dialog);
208
209G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkDialog, g_object_unref)
210
211G_END_DECLS
212
213#endif /* __GTK_DIALOG_H__ */
214

source code of include/gtk-3.0/gtk/gtkdialog.h