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 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
28 #error "Only <gtk/gtk.h> can be included directly."
31 #ifndef __GTK_CONTAINER_H__
32 #define __GTK_CONTAINER_H__
35 #include <gtk/gtkwidget.h>
36 #include <gtk/gtkadjustment.h>
41 #define GTK_TYPE_CONTAINER (gtk_container_get_type ())
42 #define GTK_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CONTAINER, GtkContainer))
43 #define GTK_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CONTAINER, GtkContainerClass))
44 #define GTK_IS_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CONTAINER))
45 #define GTK_IS_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CONTAINER))
46 #define GTK_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CONTAINER, GtkContainerClass))
49 typedef struct _GtkContainer GtkContainer;
50 typedef struct _GtkContainerPrivate GtkContainerPrivate;
51 typedef struct _GtkContainerClass GtkContainerClass;
58 GtkContainerPrivate *priv;
61 struct _GtkContainerClass
63 GtkWidgetClass parent_class;
65 unsigned int handle_border_width : 1;
67 void (*add) (GtkContainer *container,
69 void (*remove) (GtkContainer *container,
71 void (*check_resize) (GtkContainer *container);
72 void (*forall) (GtkContainer *container,
73 gboolean include_internals,
75 gpointer callback_data);
76 void (*set_focus_child) (GtkContainer *container,
78 GType (*child_type) (GtkContainer *container);
79 gchar* (*composite_name) (GtkContainer *container,
81 void (*set_child_property) (GtkContainer *container,
86 void (*get_child_property) (GtkContainer *container,
92 /* Padding for future expansion */
93 void (*_gtk_reserved1) (void);
94 void (*_gtk_reserved2) (void);
95 void (*_gtk_reserved3) (void);
96 void (*_gtk_reserved4) (void);
97 void (*_gtk_reserved5) (void);
98 void (*_gtk_reserved6) (void);
99 void (*_gtk_reserved7) (void);
100 void (*_gtk_reserved8) (void);
104 /* Application-level methods */
106 GType gtk_container_get_type (void) G_GNUC_CONST;
107 void gtk_container_set_border_width (GtkContainer *container,
109 guint gtk_container_get_border_width (GtkContainer *container);
110 void gtk_container_add (GtkContainer *container,
112 void gtk_container_remove (GtkContainer *container,
115 void gtk_container_set_resize_mode (GtkContainer *container,
116 GtkResizeMode resize_mode);
117 GtkResizeMode gtk_container_get_resize_mode (GtkContainer *container);
119 void gtk_container_check_resize (GtkContainer *container);
121 void gtk_container_foreach (GtkContainer *container,
122 GtkCallback callback,
123 gpointer callback_data);
124 GList* gtk_container_get_children (GtkContainer *container);
126 void gtk_container_propagate_draw (GtkContainer *container,
130 void gtk_container_set_focus_chain (GtkContainer *container,
131 GList *focusable_widgets);
132 gboolean gtk_container_get_focus_chain (GtkContainer *container,
133 GList **focusable_widgets);
134 void gtk_container_unset_focus_chain (GtkContainer *container);
136 #define GTK_IS_RESIZE_CONTAINER(widget) (GTK_IS_CONTAINER (widget) && \
137 (gtk_container_get_resize_mode (GTK_CONTAINER (widget)) != GTK_RESIZE_PARENT))
139 /* Widget-level methods */
141 void gtk_container_set_reallocate_redraws (GtkContainer *container,
142 gboolean needs_redraws);
143 void gtk_container_set_focus_child (GtkContainer *container,
146 gtk_container_get_focus_child (GtkContainer *container);
147 void gtk_container_set_focus_vadjustment (GtkContainer *container,
148 GtkAdjustment *adjustment);
149 GtkAdjustment *gtk_container_get_focus_vadjustment (GtkContainer *container);
150 void gtk_container_set_focus_hadjustment (GtkContainer *container,
151 GtkAdjustment *adjustment);
152 GtkAdjustment *gtk_container_get_focus_hadjustment (GtkContainer *container);
154 void gtk_container_resize_children (GtkContainer *container);
156 GType gtk_container_child_type (GtkContainer *container);
159 void gtk_container_class_install_child_property (GtkContainerClass *cclass,
162 GParamSpec* gtk_container_class_find_child_property (GObjectClass *cclass,
163 const gchar *property_name);
164 GParamSpec** gtk_container_class_list_child_properties (GObjectClass *cclass,
165 guint *n_properties);
166 void gtk_container_add_with_properties (GtkContainer *container,
168 const gchar *first_prop_name,
169 ...) G_GNUC_NULL_TERMINATED;
170 void gtk_container_child_set (GtkContainer *container,
172 const gchar *first_prop_name,
173 ...) G_GNUC_NULL_TERMINATED;
174 void gtk_container_child_get (GtkContainer *container,
176 const gchar *first_prop_name,
177 ...) G_GNUC_NULL_TERMINATED;
178 void gtk_container_child_set_valist (GtkContainer *container,
180 const gchar *first_property_name,
182 void gtk_container_child_get_valist (GtkContainer *container,
184 const gchar *first_property_name,
186 void gtk_container_child_set_property (GtkContainer *container,
188 const gchar *property_name,
189 const GValue *value);
190 void gtk_container_child_get_property (GtkContainer *container,
192 const gchar *property_name,
196 * GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID:
197 * @object: the #GObject on which set_child_property() or get_child_property()
199 * @property_id: the numeric id of the property
200 * @pspec: the #GParamSpec of the property
202 * This macro should be used to emit a standard warning about unexpected
203 * properties in set_child_property() and get_child_property() implementations.
205 #define GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID(object, property_id, pspec) \
206 G_OBJECT_WARN_INVALID_PSPEC ((object), "child property id", (property_id), (pspec))
209 void gtk_container_forall (GtkContainer *container,
210 GtkCallback callback,
211 gpointer callback_data);
213 void gtk_container_class_handle_border_width (GtkContainerClass *klass);
215 /* Non-public methods */
216 void _gtk_container_queue_resize (GtkContainer *container);
217 void _gtk_container_resize_invalidate (GtkContainer *container);
218 void _gtk_container_clear_resize_widgets (GtkContainer *container);
219 gchar* _gtk_container_child_composite_name (GtkContainer *container,
221 void _gtk_container_dequeue_resize_handler (GtkContainer *container);
222 GList *_gtk_container_focus_sort (GtkContainer *container,
224 GtkDirectionType direction,
225 GtkWidget *old_focus);
226 gboolean _gtk_container_get_need_resize (GtkContainer *container);
227 void _gtk_container_set_need_resize (GtkContainer *container,
228 gboolean need_resize);
229 gboolean _gtk_container_get_reallocate_redraws (GtkContainer *container);
233 #endif /* __GTK_CONTAINER_H__ */