]> Pileus Git - ~andy/gtk/blob - gtk/gtkdialog.h
stylecontext: Do invalidation on first resize container
[~andy/gtk] / gtk / gtkdialog.h
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
29 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
30 #error "Only <gtk/gtk.h> can be included directly."
31 #endif
32
33 #include <gtk/gtkwindow.h>
34
35
36 G_BEGIN_DECLS
37
38 /**
39  * GtkDialogFlags:
40  * @GTK_DIALOG_MODAL: Make the constructed dialog modal,
41  *     see gtk_window_set_modal()
42  * @GTK_DIALOG_DESTROY_WITH_PARENT: Destroy the dialog when its
43  *     parent is destroyed, see gtk_window_set_destroy_with_parent()
44  *
45  * Flags used to influence dialog construction.
46  */
47 typedef enum
48 {
49   GTK_DIALOG_MODAL               = 1 << 0,
50   GTK_DIALOG_DESTROY_WITH_PARENT = 1 << 1
51 } GtkDialogFlags;
52
53 /**
54  * GtkResponseType:
55  * @GTK_RESPONSE_NONE: Returned if an action widget has no response id,
56  *     or if the dialog gets programmatically hidden or destroyed
57  * @GTK_RESPONSE_REJECT: Generic response id, not used by GTK+ dialogs
58  * @GTK_RESPONSE_ACCEPT: Generic response id, not used by GTK+ dialogs
59  * @GTK_RESPONSE_DELETE_EVENT: Returned if the dialog is deleted
60  * @GTK_RESPONSE_OK: Returned by OK buttons in GTK+ dialogs
61  * @GTK_RESPONSE_CANCEL: Returned by Cancel buttons in GTK+ dialogs
62  * @GTK_RESPONSE_CLOSE: Returned by Close buttons in GTK+ dialogs
63  * @GTK_RESPONSE_YES: Returned by Yes buttons in GTK+ dialogs
64  * @GTK_RESPONSE_NO: Returned by No buttons in GTK+ dialogs
65  * @GTK_RESPONSE_APPLY: Returned by Apply buttons in GTK+ dialogs
66  * @GTK_RESPONSE_HELP: Returned by Help buttons in GTK+ dialogs
67  *
68  * Predefined values for use as response ids in gtk_dialog_add_button().
69  * All predefined values are negative, GTK+ leaves positive values 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 _GtkDialogPrivate       GtkDialogPrivate;
98 typedef struct _GtkDialogClass         GtkDialogClass;
99
100 /**
101  * GtkDialog:
102  *
103  * The GtkDialog struct contains only private fields
104  * and should not be directly accessed.
105  */
106 struct _GtkDialog
107 {
108   GtkWindow window;
109
110   /*< private >*/
111   GtkDialogPrivate *priv;
112 };
113
114 struct _GtkDialogClass
115 {
116   GtkWindowClass parent_class;
117
118   void (* response) (GtkDialog *dialog, gint response_id);
119
120   /* Keybinding signals */
121
122   void (* close)    (GtkDialog *dialog);
123
124   /* Padding for future expansion */
125   void (*_gtk_reserved1) (void);
126   void (*_gtk_reserved2) (void);
127   void (*_gtk_reserved3) (void);
128   void (*_gtk_reserved4) (void);
129 };
130
131
132 GType      gtk_dialog_get_type (void) G_GNUC_CONST;
133 GtkWidget* gtk_dialog_new      (void);
134
135 GtkWidget* gtk_dialog_new_with_buttons (const gchar     *title,
136                                         GtkWindow       *parent,
137                                         GtkDialogFlags   flags,
138                                         const gchar     *first_button_text,
139                                         ...) G_GNUC_NULL_TERMINATED;
140
141 void       gtk_dialog_add_action_widget (GtkDialog   *dialog,
142                                          GtkWidget   *child,
143                                          gint         response_id);
144 GtkWidget* gtk_dialog_add_button        (GtkDialog   *dialog,
145                                          const gchar *button_text,
146                                          gint         response_id);
147 void       gtk_dialog_add_buttons       (GtkDialog   *dialog,
148                                          const gchar *first_button_text,
149                                          ...) G_GNUC_NULL_TERMINATED;
150
151 void gtk_dialog_set_response_sensitive (GtkDialog *dialog,
152                                         gint       response_id,
153                                         gboolean   setting);
154 void gtk_dialog_set_default_response   (GtkDialog *dialog,
155                                         gint       response_id);
156 GtkWidget* gtk_dialog_get_widget_for_response (GtkDialog *dialog,
157                                                gint       response_id);
158 gint gtk_dialog_get_response_for_widget (GtkDialog *dialog,
159                                          GtkWidget *widget);
160
161 gboolean gtk_alternative_dialog_button_order (GdkScreen *screen);
162 void     gtk_dialog_set_alternative_button_order (GtkDialog *dialog,
163                                                   gint       first_response_id,
164                                                   ...);
165 void     gtk_dialog_set_alternative_button_order_from_array (GtkDialog *dialog,
166                                                              gint       n_params,
167                                                              gint      *new_order);
168
169 /* Emit response signal */
170 void gtk_dialog_response           (GtkDialog *dialog,
171                                     gint       response_id);
172
173 /* Returns response_id */
174 gint gtk_dialog_run                (GtkDialog *dialog);
175
176 GtkWidget * gtk_dialog_get_action_area  (GtkDialog *dialog);
177 GtkWidget * gtk_dialog_get_content_area (GtkDialog *dialog);
178
179 G_END_DECLS
180
181 #endif /* __GTK_DIALOG_H__ */