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 | |
34 | G_BEGIN_DECLS |
35 | |
36 | /** |
37 | * GtkDialogFlags: |
38 | * @GTK_DIALOG_MODAL: Make the constructed dialog modal |
39 | * @GTK_DIALOG_DESTROY_WITH_PARENT: Destroy the dialog when its parent is destroyed |
40 | * @GTK_DIALOG_USE_HEADER_BAR: Create dialog with actions in header |
41 | * bar instead of action area |
42 | * |
43 | * Flags used to influence dialog construction. |
44 | */ |
45 | typedef enum |
46 | { |
47 | GTK_DIALOG_MODAL = 1 << 0, |
48 | GTK_DIALOG_DESTROY_WITH_PARENT = 1 << 1, |
49 | = 1 << 2 |
50 | } GtkDialogFlags; |
51 | |
52 | /** |
53 | * GtkResponseType: |
54 | * @GTK_RESPONSE_NONE: Returned if an action widget has no response id, |
55 | * or if the dialog gets programmatically hidden or destroyed |
56 | * @GTK_RESPONSE_REJECT: Generic response id, not used by GTK dialogs |
57 | * @GTK_RESPONSE_ACCEPT: Generic response id, not used by GTK dialogs |
58 | * @GTK_RESPONSE_DELETE_EVENT: Returned if the dialog is deleted |
59 | * @GTK_RESPONSE_OK: Returned by OK buttons in GTK dialogs |
60 | * @GTK_RESPONSE_CANCEL: Returned by Cancel buttons in GTK dialogs |
61 | * @GTK_RESPONSE_CLOSE: Returned by Close buttons in GTK dialogs |
62 | * @GTK_RESPONSE_YES: Returned by Yes buttons in GTK dialogs |
63 | * @GTK_RESPONSE_NO: Returned by No buttons in GTK dialogs |
64 | * @GTK_RESPONSE_APPLY: Returned by Apply buttons in GTK dialogs |
65 | * @GTK_RESPONSE_HELP: Returned by Help buttons in GTK dialogs |
66 | * |
67 | * Predefined values for use as response ids in gtk_dialog_add_button(). |
68 | * |
69 | * All predefined values are negative; GTK leaves values of 0 or greater for |
70 | * application-defined response ids. |
71 | */ |
72 | typedef enum |
73 | { |
74 | GTK_RESPONSE_NONE = -1, |
75 | GTK_RESPONSE_REJECT = -2, |
76 | GTK_RESPONSE_ACCEPT = -3, |
77 | GTK_RESPONSE_DELETE_EVENT = -4, |
78 | GTK_RESPONSE_OK = -5, |
79 | GTK_RESPONSE_CANCEL = -6, |
80 | GTK_RESPONSE_CLOSE = -7, |
81 | GTK_RESPONSE_YES = -8, |
82 | GTK_RESPONSE_NO = -9, |
83 | GTK_RESPONSE_APPLY = -10, |
84 | GTK_RESPONSE_HELP = -11 |
85 | } GtkResponseType; |
86 | |
87 | |
88 | #define GTK_TYPE_DIALOG (gtk_dialog_get_type ()) |
89 | #define GTK_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_DIALOG, GtkDialog)) |
90 | #define GTK_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_DIALOG, GtkDialogClass)) |
91 | #define GTK_IS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_DIALOG)) |
92 | #define GTK_IS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_DIALOG)) |
93 | #define GTK_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_DIALOG, GtkDialogClass)) |
94 | |
95 | |
96 | typedef struct _GtkDialog GtkDialog; |
97 | typedef struct _GtkDialogClass GtkDialogClass; |
98 | |
99 | struct _GtkDialog |
100 | { |
101 | GtkWindow parent_instance; |
102 | }; |
103 | |
104 | /** |
105 | * GtkDialogClass: |
106 | * @parent_class: The parent class. |
107 | * @response: Signal emitted when an action widget is activated. |
108 | * @close: Signal emitted when the user uses a keybinding to close the dialog. |
109 | */ |
110 | struct _GtkDialogClass |
111 | { |
112 | GtkWindowClass parent_class; |
113 | |
114 | /*< public >*/ |
115 | |
116 | void (* response) (GtkDialog *dialog, int response_id); |
117 | |
118 | /* Keybinding signals */ |
119 | |
120 | void (* close) (GtkDialog *dialog); |
121 | |
122 | /*< private >*/ |
123 | |
124 | gpointer padding[8]; |
125 | }; |
126 | |
127 | |
128 | GDK_AVAILABLE_IN_ALL |
129 | GType gtk_dialog_get_type (void) G_GNUC_CONST; |
130 | GDK_AVAILABLE_IN_ALL |
131 | GtkWidget* gtk_dialog_new (void); |
132 | |
133 | GDK_AVAILABLE_IN_ALL |
134 | GtkWidget* gtk_dialog_new_with_buttons (const char *title, |
135 | GtkWindow *parent, |
136 | GtkDialogFlags flags, |
137 | const char *first_button_text, |
138 | ...) G_GNUC_NULL_TERMINATED; |
139 | |
140 | GDK_AVAILABLE_IN_ALL |
141 | void gtk_dialog_add_action_widget (GtkDialog *dialog, |
142 | GtkWidget *child, |
143 | int response_id); |
144 | GDK_AVAILABLE_IN_ALL |
145 | GtkWidget* gtk_dialog_add_button (GtkDialog *dialog, |
146 | const char *button_text, |
147 | int response_id); |
148 | GDK_AVAILABLE_IN_ALL |
149 | void gtk_dialog_add_buttons (GtkDialog *dialog, |
150 | const char *first_button_text, |
151 | ...) G_GNUC_NULL_TERMINATED; |
152 | |
153 | GDK_AVAILABLE_IN_ALL |
154 | void gtk_dialog_set_response_sensitive (GtkDialog *dialog, |
155 | int response_id, |
156 | gboolean setting); |
157 | GDK_AVAILABLE_IN_ALL |
158 | void gtk_dialog_set_default_response (GtkDialog *dialog, |
159 | int response_id); |
160 | GDK_AVAILABLE_IN_ALL |
161 | GtkWidget* gtk_dialog_get_widget_for_response (GtkDialog *dialog, |
162 | int response_id); |
163 | GDK_AVAILABLE_IN_ALL |
164 | int gtk_dialog_get_response_for_widget (GtkDialog *dialog, |
165 | GtkWidget *widget); |
166 | |
167 | /* Emit response signal */ |
168 | GDK_AVAILABLE_IN_ALL |
169 | void gtk_dialog_response (GtkDialog *dialog, |
170 | int response_id); |
171 | |
172 | GDK_AVAILABLE_IN_ALL |
173 | GtkWidget * gtk_dialog_get_content_area (GtkDialog *dialog); |
174 | GDK_AVAILABLE_IN_ALL |
175 | GtkWidget * (GtkDialog *dialog); |
176 | |
177 | G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkDialog, g_object_unref) |
178 | |
179 | G_END_DECLS |
180 | |
181 | #endif /* __GTK_DIALOG_H__ */ |
182 | |