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_CONTAINER_H__ |
26 | #define __GTK_CONTAINER_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/gtkwidget.h> |
34 | |
35 | G_BEGIN_DECLS |
36 | |
37 | #define GTK_TYPE_CONTAINER (gtk_container_get_type ()) |
38 | #define GTK_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CONTAINER, GtkContainer)) |
39 | #define GTK_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CONTAINER, GtkContainerClass)) |
40 | #define GTK_IS_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CONTAINER)) |
41 | #define GTK_IS_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CONTAINER)) |
42 | #define GTK_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CONTAINER, GtkContainerClass)) |
43 | |
44 | |
45 | typedef struct _GtkContainer GtkContainer; |
46 | typedef struct _GtkContainerPrivate GtkContainerPrivate; |
47 | typedef struct _GtkContainerClass GtkContainerClass; |
48 | |
49 | struct _GtkContainer |
50 | { |
51 | GtkWidget widget; |
52 | |
53 | /*< private >*/ |
54 | GtkContainerPrivate *priv; |
55 | }; |
56 | |
57 | /** |
58 | * GtkContainerClass: |
59 | * @parent_class: The parent class. |
60 | * @add: Signal emitted when a widget is added to container. |
61 | * @remove: Signal emitted when a widget is removed from container. |
62 | * @check_resize: Signal emitted when a size recalculation is needed. |
63 | * @forall: Invokes callback on each child of container. |
64 | * @set_focus_child: Sets the focused child of container. |
65 | * @child_type: Returns the type of the children supported by the container. |
66 | * @composite_name: Gets a widget’s composite name. Deprecated: 3.10. |
67 | * @set_child_property: Set a property on a child of container. |
68 | * @get_child_property: Get a property from a child of container. |
69 | * @get_path_for_child: Get path representing entire widget hierarchy |
70 | * from the toplevel down to and including @child. |
71 | * |
72 | * Base class for containers. |
73 | */ |
74 | struct _GtkContainerClass |
75 | { |
76 | GtkWidgetClass parent_class; |
77 | |
78 | /*< public >*/ |
79 | |
80 | void (*add) (GtkContainer *container, |
81 | GtkWidget *widget); |
82 | void (*remove) (GtkContainer *container, |
83 | GtkWidget *widget); |
84 | void (*check_resize) (GtkContainer *container); |
85 | void (*forall) (GtkContainer *container, |
86 | gboolean include_internals, |
87 | GtkCallback callback, |
88 | gpointer callback_data); |
89 | void (*set_focus_child) (GtkContainer *container, |
90 | GtkWidget *child); |
91 | GType (*child_type) (GtkContainer *container); |
92 | gchar* (*composite_name) (GtkContainer *container, |
93 | GtkWidget *child); |
94 | void (*set_child_property) (GtkContainer *container, |
95 | GtkWidget *child, |
96 | guint property_id, |
97 | const GValue *value, |
98 | GParamSpec *pspec); |
99 | void (*get_child_property) (GtkContainer *container, |
100 | GtkWidget *child, |
101 | guint property_id, |
102 | GValue *value, |
103 | GParamSpec *pspec); |
104 | GtkWidgetPath * (*get_path_for_child) (GtkContainer *container, |
105 | GtkWidget *child); |
106 | |
107 | |
108 | /*< private >*/ |
109 | |
110 | unsigned int _handle_border_width : 1; |
111 | |
112 | /* Padding for future expansion */ |
113 | void (*_gtk_reserved1) (void); |
114 | void (*_gtk_reserved2) (void); |
115 | void (*_gtk_reserved3) (void); |
116 | void (*_gtk_reserved4) (void); |
117 | void (*_gtk_reserved5) (void); |
118 | void (*_gtk_reserved6) (void); |
119 | void (*_gtk_reserved7) (void); |
120 | void (*_gtk_reserved8) (void); |
121 | }; |
122 | |
123 | |
124 | /** |
125 | * GtkResizeMode: |
126 | * @GTK_RESIZE_PARENT: Pass resize request to the parent |
127 | * @GTK_RESIZE_QUEUE: Queue resizes on this widget |
128 | * @GTK_RESIZE_IMMEDIATE: Resize immediately. Deprecated. |
129 | */ |
130 | typedef enum |
131 | { |
132 | GTK_RESIZE_PARENT, |
133 | GTK_RESIZE_QUEUE, |
134 | GTK_RESIZE_IMMEDIATE |
135 | } GtkResizeMode; |
136 | |
137 | |
138 | /* Application-level methods */ |
139 | |
140 | GDK_AVAILABLE_IN_ALL |
141 | GType gtk_container_get_type (void) G_GNUC_CONST; |
142 | GDK_AVAILABLE_IN_ALL |
143 | void gtk_container_set_border_width (GtkContainer *container, |
144 | guint border_width); |
145 | GDK_AVAILABLE_IN_ALL |
146 | guint gtk_container_get_border_width (GtkContainer *container); |
147 | GDK_AVAILABLE_IN_ALL |
148 | void gtk_container_add (GtkContainer *container, |
149 | GtkWidget *widget); |
150 | GDK_AVAILABLE_IN_ALL |
151 | void gtk_container_remove (GtkContainer *container, |
152 | GtkWidget *widget); |
153 | |
154 | GDK_DEPRECATED_IN_3_12 |
155 | void gtk_container_set_resize_mode (GtkContainer *container, |
156 | GtkResizeMode resize_mode); |
157 | GDK_DEPRECATED_IN_3_12 |
158 | GtkResizeMode gtk_container_get_resize_mode (GtkContainer *container); |
159 | |
160 | GDK_AVAILABLE_IN_ALL |
161 | void gtk_container_check_resize (GtkContainer *container); |
162 | |
163 | GDK_AVAILABLE_IN_ALL |
164 | void gtk_container_foreach (GtkContainer *container, |
165 | GtkCallback callback, |
166 | gpointer callback_data); |
167 | GDK_AVAILABLE_IN_ALL |
168 | GList* gtk_container_get_children (GtkContainer *container); |
169 | |
170 | GDK_AVAILABLE_IN_ALL |
171 | void gtk_container_propagate_draw (GtkContainer *container, |
172 | GtkWidget *child, |
173 | cairo_t *cr); |
174 | |
175 | GDK_AVAILABLE_IN_ALL |
176 | void gtk_container_set_focus_chain (GtkContainer *container, |
177 | GList *focusable_widgets); |
178 | GDK_AVAILABLE_IN_ALL |
179 | gboolean gtk_container_get_focus_chain (GtkContainer *container, |
180 | GList **focusable_widgets); |
181 | GDK_AVAILABLE_IN_ALL |
182 | void gtk_container_unset_focus_chain (GtkContainer *container); |
183 | |
184 | #define GTK_IS_RESIZE_CONTAINER(widget) (GTK_IS_CONTAINER (widget) && \ |
185 | (gtk_container_get_resize_mode (GTK_CONTAINER (widget)) != GTK_RESIZE_PARENT)) |
186 | |
187 | /* Widget-level methods */ |
188 | |
189 | GDK_DEPRECATED_IN_3_14 |
190 | void gtk_container_set_reallocate_redraws (GtkContainer *container, |
191 | gboolean needs_redraws); |
192 | GDK_AVAILABLE_IN_ALL |
193 | void gtk_container_set_focus_child (GtkContainer *container, |
194 | GtkWidget *child); |
195 | GDK_AVAILABLE_IN_ALL |
196 | GtkWidget * |
197 | gtk_container_get_focus_child (GtkContainer *container); |
198 | GDK_AVAILABLE_IN_ALL |
199 | void gtk_container_set_focus_vadjustment (GtkContainer *container, |
200 | GtkAdjustment *adjustment); |
201 | GDK_AVAILABLE_IN_ALL |
202 | GtkAdjustment *gtk_container_get_focus_vadjustment (GtkContainer *container); |
203 | GDK_AVAILABLE_IN_ALL |
204 | void gtk_container_set_focus_hadjustment (GtkContainer *container, |
205 | GtkAdjustment *adjustment); |
206 | GDK_AVAILABLE_IN_ALL |
207 | GtkAdjustment *gtk_container_get_focus_hadjustment (GtkContainer *container); |
208 | |
209 | GDK_DEPRECATED_IN_3_10 |
210 | void gtk_container_resize_children (GtkContainer *container); |
211 | |
212 | GDK_AVAILABLE_IN_ALL |
213 | GType gtk_container_child_type (GtkContainer *container); |
214 | |
215 | |
216 | GDK_AVAILABLE_IN_ALL |
217 | void gtk_container_class_install_child_property (GtkContainerClass *cclass, |
218 | guint property_id, |
219 | GParamSpec *pspec); |
220 | GDK_AVAILABLE_IN_3_18 |
221 | void gtk_container_class_install_child_properties (GtkContainerClass *cclass, |
222 | guint n_pspecs, |
223 | GParamSpec **pspecs); |
224 | GDK_AVAILABLE_IN_ALL |
225 | GParamSpec* gtk_container_class_find_child_property (GObjectClass *cclass, |
226 | const gchar *property_name); |
227 | GDK_AVAILABLE_IN_ALL |
228 | GParamSpec** gtk_container_class_list_child_properties (GObjectClass *cclass, |
229 | guint *n_properties); |
230 | GDK_AVAILABLE_IN_ALL |
231 | void gtk_container_add_with_properties (GtkContainer *container, |
232 | GtkWidget *widget, |
233 | const gchar *first_prop_name, |
234 | ...) G_GNUC_NULL_TERMINATED; |
235 | GDK_AVAILABLE_IN_ALL |
236 | void gtk_container_child_set (GtkContainer *container, |
237 | GtkWidget *child, |
238 | const gchar *first_prop_name, |
239 | ...) G_GNUC_NULL_TERMINATED; |
240 | GDK_AVAILABLE_IN_ALL |
241 | void gtk_container_child_get (GtkContainer *container, |
242 | GtkWidget *child, |
243 | const gchar *first_prop_name, |
244 | ...) G_GNUC_NULL_TERMINATED; |
245 | GDK_AVAILABLE_IN_ALL |
246 | void gtk_container_child_set_valist (GtkContainer *container, |
247 | GtkWidget *child, |
248 | const gchar *first_property_name, |
249 | va_list var_args); |
250 | GDK_AVAILABLE_IN_ALL |
251 | void gtk_container_child_get_valist (GtkContainer *container, |
252 | GtkWidget *child, |
253 | const gchar *first_property_name, |
254 | va_list var_args); |
255 | GDK_AVAILABLE_IN_ALL |
256 | void gtk_container_child_set_property (GtkContainer *container, |
257 | GtkWidget *child, |
258 | const gchar *property_name, |
259 | const GValue *value); |
260 | GDK_AVAILABLE_IN_ALL |
261 | void gtk_container_child_get_property (GtkContainer *container, |
262 | GtkWidget *child, |
263 | const gchar *property_name, |
264 | GValue *value); |
265 | |
266 | GDK_AVAILABLE_IN_3_2 |
267 | void gtk_container_child_notify (GtkContainer *container, |
268 | GtkWidget *child, |
269 | const gchar *child_property); |
270 | |
271 | GDK_AVAILABLE_IN_3_18 |
272 | void gtk_container_child_notify_by_pspec (GtkContainer *container, |
273 | GtkWidget *child, |
274 | GParamSpec *pspec); |
275 | |
276 | /** |
277 | * GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID: |
278 | * @object: the #GObject on which set_child_property() or get_child_property() |
279 | * was called |
280 | * @property_id: the numeric id of the property |
281 | * @pspec: the #GParamSpec of the property |
282 | * |
283 | * This macro should be used to emit a standard warning about unexpected |
284 | * properties in set_child_property() and get_child_property() implementations. |
285 | */ |
286 | #define GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID(object, property_id, pspec) \ |
287 | G_OBJECT_WARN_INVALID_PSPEC ((object), "child property", (property_id), (pspec)) |
288 | |
289 | |
290 | GDK_AVAILABLE_IN_ALL |
291 | void gtk_container_forall (GtkContainer *container, |
292 | GtkCallback callback, |
293 | gpointer callback_data); |
294 | |
295 | GDK_AVAILABLE_IN_ALL |
296 | void gtk_container_class_handle_border_width (GtkContainerClass *klass); |
297 | |
298 | GDK_AVAILABLE_IN_ALL |
299 | GtkWidgetPath * gtk_container_get_path_for_child (GtkContainer *container, |
300 | GtkWidget *child); |
301 | |
302 | G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkContainer, g_object_unref) |
303 | |
304 | G_END_DECLS |
305 | |
306 | #endif /* __GTK_CONTAINER_H__ */ |
307 | |