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 #ifndef __GTK_CONTAINER_H__
28 #define __GTK_CONTAINER_H__
32 #include <gtk/gtkenums.h>
33 #include <gtk/gtkwidget.h>
34 #include <gtk/gtkadjustment.h>
39 #endif /* __cplusplus */
42 #define GTK_TYPE_CONTAINER (gtk_container_get_type ())
43 #define GTK_CONTAINER(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_CONTAINER, GtkContainer))
44 #define GTK_CONTAINER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_CONTAINER, GtkContainerClass))
45 #define GTK_IS_CONTAINER(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_CONTAINER))
46 #define GTK_IS_CONTAINER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CONTAINER))
47 #define GTK_CONTAINER_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_CONTAINER, GtkContainerClass))
49 #define GTK_IS_RESIZE_CONTAINER(widget) (GTK_IS_CONTAINER (widget) && ((GtkContainer*) (widget))->resize_mode != GTK_RESIZE_PARENT)
52 typedef struct _GtkContainer GtkContainer;
53 typedef struct _GtkContainerClass GtkContainerClass;
59 GtkWidget *focus_child;
61 guint border_width : 16;
62 guint need_resize : 1;
63 guint resize_mode : 2;
64 guint reallocate_redraws : 1;
65 guint has_focus_chain : 1;
67 /* The list of children that requested a resize
69 GSList *resize_widgets;
72 struct _GtkContainerClass
74 GtkWidgetClass parent_class;
76 void (*add) (GtkContainer *container,
78 void (*remove) (GtkContainer *container,
80 void (*check_resize) (GtkContainer *container);
81 void (*forall) (GtkContainer *container,
82 gboolean include_internals,
84 gpointer callback_data);
85 void (*set_focus_child) (GtkContainer *container,
87 GtkType (*child_type) (GtkContainer *container);
88 gchar* (*composite_name) (GtkContainer *container,
90 void (*set_child_property) (GtkContainer *container,
95 void (*get_child_property) (GtkContainer *container,
100 /* Padding for future expansion */
105 /* Application-level methods */
107 GtkType gtk_container_get_type (void) G_GNUC_CONST;
108 void gtk_container_set_border_width (GtkContainer *container,
110 guint gtk_container_get_border_width (GtkContainer *container);
111 void gtk_container_add (GtkContainer *container,
113 void gtk_container_remove (GtkContainer *container,
116 void gtk_container_set_resize_mode (GtkContainer *container,
117 GtkResizeMode resize_mode);
118 GtkResizeMode gtk_container_get_resize_mode (GtkContainer *container);
120 void gtk_container_check_resize (GtkContainer *container);
122 void gtk_container_foreach (GtkContainer *container,
123 GtkCallback callback,
124 gpointer callback_data);
125 void gtk_container_foreach_full (GtkContainer *container,
126 GtkCallback callback,
127 GtkCallbackMarshal marshal,
128 gpointer callback_data,
129 GtkDestroyNotify notify);
130 GList* gtk_container_get_children (GtkContainer *container);
132 #ifndef GTK_DISABLE_DEPRECATED
133 #define gtk_container_children gtk_container_get_children
136 void gtk_container_propagate_expose (GtkContainer *container,
138 GdkEventExpose *event);
140 void gtk_container_set_focus_chain (GtkContainer *container,
141 GList *focusable_widgets);
142 gboolean gtk_container_get_focus_chain (GtkContainer *container,
143 GList **focusable_widgets);
144 void gtk_container_unset_focus_chain (GtkContainer *container);
146 /* Widget-level methods */
148 void gtk_container_set_reallocate_redraws (GtkContainer *container,
149 gboolean needs_redraws);
150 void gtk_container_set_focus_child (GtkContainer *container,
152 void gtk_container_set_focus_vadjustment (GtkContainer *container,
153 GtkAdjustment *adjustment);
154 GtkAdjustment *gtk_container_get_focus_vadjustment (GtkContainer *container);
155 void gtk_container_set_focus_hadjustment (GtkContainer *container,
156 GtkAdjustment *adjustment);
157 GtkAdjustment *gtk_container_get_focus_hadjustment (GtkContainer *container);
159 void gtk_container_resize_children (GtkContainer *container);
161 GtkType gtk_container_child_type (GtkContainer *container);
164 void gtk_container_class_install_child_property (GtkContainerClass *cclass,
167 GParamSpec* gtk_container_class_find_child_property (GObjectClass *cclass,
168 const gchar *property_name);
169 GParamSpec** gtk_container_class_list_child_properties (GObjectClass *cclass,
170 guint *n_properties);
171 void gtk_container_add_with_properties (GtkContainer *container,
173 const gchar *first_prop_name,
175 void gtk_container_child_set (GtkContainer *container,
177 const gchar *first_prop_name,
179 void gtk_container_child_get (GtkContainer *container,
181 const gchar *first_prop_name,
183 void gtk_container_child_set_valist (GtkContainer *container,
185 const gchar *first_property_name,
187 void gtk_container_child_get_valist (GtkContainer *container,
189 const gchar *first_property_name,
191 void gtk_container_child_set_property (GtkContainer *container,
193 const gchar *property_name,
194 const GValue *value);
195 void gtk_container_child_get_property (GtkContainer *container,
197 const gchar *property_name,
200 #define GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID(object, property_id, pspec) \
201 G_OBJECT_WARN_INVALID_PSPEC ((object), "child property id", (property_id), (pspec))
204 void gtk_container_forall (GtkContainer *container,
205 GtkCallback callback,
206 gpointer callback_data);
208 /* Non-public methods */
209 void _gtk_container_queue_resize (GtkContainer *container);
210 void _gtk_container_clear_resize_widgets (GtkContainer *container);
211 gchar* _gtk_container_child_composite_name (GtkContainer *container,
213 void _gtk_container_dequeue_resize_handler (GtkContainer *container);
215 #ifndef GTK_DISABLE_DEPRECATED
216 #define gtk_container_border_width gtk_container_set_border_width
217 #endif /* GTK_DISABLE_DEPRECATED */
221 #endif /* __cplusplus */
224 #endif /* __GTK_CONTAINER_H__ */