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))
48 #define GTK_IS_RESIZE_CONTAINER(widget) (GTK_IS_CONTAINER (widget) && ((GtkContainer*) (widget))->resize_mode != GTK_RESIZE_PARENT)
51 typedef struct _GtkContainer GtkContainer;
52 typedef struct _GtkContainerClass GtkContainerClass;
58 GtkWidget *GSEAL (focus_child);
60 guint GSEAL (border_width) : 16;
63 guint GSEAL (need_resize) : 1;
64 guint GSEAL (resize_mode) : 2;
65 guint GSEAL (reallocate_redraws) : 1;
66 guint GSEAL (has_focus_chain) : 1;
69 struct _GtkContainerClass
71 GtkWidgetClass parent_class;
73 void (*add) (GtkContainer *container,
75 void (*remove) (GtkContainer *container,
77 void (*check_resize) (GtkContainer *container);
78 void (*forall) (GtkContainer *container,
79 gboolean include_internals,
81 gpointer callback_data);
82 void (*set_focus_child) (GtkContainer *container,
84 GType (*child_type) (GtkContainer *container);
85 gchar* (*composite_name) (GtkContainer *container,
87 void (*set_child_property) (GtkContainer *container,
92 void (*get_child_property) (GtkContainer *container,
98 /* Padding for future expansion */
99 void (*_gtk_reserved1) (void);
100 void (*_gtk_reserved2) (void);
101 void (*_gtk_reserved3) (void);
102 void (*_gtk_reserved4) (void);
105 /* Application-level methods */
107 GType 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 GList* gtk_container_get_children (GtkContainer *container);
127 void gtk_container_propagate_expose (GtkContainer *container,
129 GdkEventExpose *event);
131 void gtk_container_set_focus_chain (GtkContainer *container,
132 GList *focusable_widgets);
133 gboolean gtk_container_get_focus_chain (GtkContainer *container,
134 GList **focusable_widgets);
135 void gtk_container_unset_focus_chain (GtkContainer *container);
137 /* Widget-level methods */
139 void gtk_container_set_reallocate_redraws (GtkContainer *container,
140 gboolean needs_redraws);
141 void gtk_container_set_focus_child (GtkContainer *container,
144 gtk_container_get_focus_child (GtkContainer *container);
145 void gtk_container_set_focus_vadjustment (GtkContainer *container,
146 GtkAdjustment *adjustment);
147 GtkAdjustment *gtk_container_get_focus_vadjustment (GtkContainer *container);
148 void gtk_container_set_focus_hadjustment (GtkContainer *container,
149 GtkAdjustment *adjustment);
150 GtkAdjustment *gtk_container_get_focus_hadjustment (GtkContainer *container);
152 void gtk_container_resize_children (GtkContainer *container);
154 GType gtk_container_child_type (GtkContainer *container);
157 void gtk_container_class_install_child_property (GtkContainerClass *cclass,
160 GParamSpec* gtk_container_class_find_child_property (GObjectClass *cclass,
161 const gchar *property_name);
162 GParamSpec** gtk_container_class_list_child_properties (GObjectClass *cclass,
163 guint *n_properties);
164 void gtk_container_add_with_properties (GtkContainer *container,
166 const gchar *first_prop_name,
167 ...) G_GNUC_NULL_TERMINATED;
168 void gtk_container_child_set (GtkContainer *container,
170 const gchar *first_prop_name,
171 ...) G_GNUC_NULL_TERMINATED;
172 void gtk_container_child_get (GtkContainer *container,
174 const gchar *first_prop_name,
175 ...) G_GNUC_NULL_TERMINATED;
176 void gtk_container_child_set_valist (GtkContainer *container,
178 const gchar *first_property_name,
180 void gtk_container_child_get_valist (GtkContainer *container,
182 const gchar *first_property_name,
184 void gtk_container_child_set_property (GtkContainer *container,
186 const gchar *property_name,
187 const GValue *value);
188 void gtk_container_child_get_property (GtkContainer *container,
190 const gchar *property_name,
193 #define GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID(object, property_id, pspec) \
194 G_OBJECT_WARN_INVALID_PSPEC ((object), "child property id", (property_id), (pspec))
197 void gtk_container_forall (GtkContainer *container,
198 GtkCallback callback,
199 gpointer callback_data);
201 /* Non-public methods */
202 void _gtk_container_queue_resize (GtkContainer *container);
203 void _gtk_container_clear_resize_widgets (GtkContainer *container);
204 gchar* _gtk_container_child_composite_name (GtkContainer *container,
206 void _gtk_container_dequeue_resize_handler (GtkContainer *container);
207 GList *_gtk_container_focus_sort (GtkContainer *container,
209 GtkDirectionType direction,
210 GtkWidget *old_focus);
211 gboolean _gtk_container_get_need_resize (GtkContainer *container);
212 void _gtk_container_set_need_resize (GtkContainer *container,
213 gboolean need_resize);
217 #endif /* __GTK_CONTAINER_H__ */