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;
78 void (* add) (GtkContainer *container,
80 void (* remove) (GtkContainer *container,
82 void (* check_resize) (GtkContainer *container);
83 void (* forall) (GtkContainer *container,
84 gboolean include_internals,
86 gpointer callback_data);
87 void (* set_focus_child) (GtkContainer *container,
89 GtkType (*child_type) (GtkContainer *container);
90 void (*set_child_arg) (GtkContainer *container,
94 void (*get_child_arg) (GtkContainer *container,
98 gchar* (*composite_name) (GtkContainer *container,
101 /* Padding for future expansion */
106 /* Application-level methods */
108 GtkType gtk_container_get_type (void) G_GNUC_CONST;
109 void gtk_container_set_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);
119 void gtk_container_check_resize (GtkContainer *container);
121 void gtk_container_foreach (GtkContainer *container,
122 GtkCallback callback,
123 gpointer callback_data);
124 void gtk_container_foreach_full (GtkContainer *container,
125 GtkCallback callback,
126 GtkCallbackMarshal marshal,
127 gpointer callback_data,
128 GtkDestroyNotify notify);
129 GList* gtk_container_children (GtkContainer *container);
130 void gtk_container_propagate_expose (GtkContainer *container,
132 GdkEventExpose *event);
134 void gtk_container_set_focus_chain (GtkContainer *container,
135 GList *focusable_widgets);
136 void gtk_container_unset_focus_chain (GtkContainer *container);
138 /* Widget-level methods */
140 void gtk_container_set_reallocate_redraws (GtkContainer *container,
141 gboolean needs_redraws);
142 void gtk_container_set_focus_child (GtkContainer *container,
144 void gtk_container_set_focus_vadjustment (GtkContainer *container,
145 GtkAdjustment *adjustment);
146 void gtk_container_set_focus_hadjustment (GtkContainer *container,
147 GtkAdjustment *adjustment);
149 void gtk_container_resize_children (GtkContainer *container);
151 GtkType gtk_container_child_type (GtkContainer *container);
153 /* the `arg_name' argument needs to be a const static string */
154 void gtk_container_add_child_arg_type (const gchar *arg_name,
159 /* Allocate a GtkArg array of size nargs that hold the
160 * names and types of the args that can be used with
161 * gtk_container_child_getv/gtk_container_child_setv.
162 * if (arg_flags!=NULL),
163 * (*arg_flags) will be set to point to a newly allocated
164 * guint array that holds the flags of the args.
165 * It is the callers response to do a
166 * g_free (returned_args); g_free (*arg_flags).
168 GtkArg* gtk_container_query_child_args (GtkType class_type,
172 /* gtk_container_child_getv() sets an arguments type and value, or just
173 * its type to GTK_TYPE_INVALID.
174 * if GTK_FUNDAMENTAL_TYPE (arg->type) == GTK_TYPE_STRING, it's the callers
175 * response to do a g_free (GTK_VALUE_STRING (arg));
177 void gtk_container_child_getv (GtkContainer *container,
181 void gtk_container_child_setv (GtkContainer *container,
186 /* gtk_container_add_with_args() takes a variable argument list of the form:
187 * (..., gchar *arg_name, ARG_VALUES, [repeatedly name/value pairs,] NULL)
188 * where ARG_VALUES type depend on the argument and can consist of
189 * more than one c-function argument.
191 void gtk_container_add_with_args (GtkContainer *container,
193 const gchar *first_arg_name,
195 void gtk_container_addv (GtkContainer *container,
199 void gtk_container_child_set (GtkContainer *container,
201 const gchar *first_arg_name,
204 /* Non-public methods */
206 void gtk_container_queue_resize (GtkContainer *container);
207 void gtk_container_clear_resize_widgets (GtkContainer *container);
208 void gtk_container_arg_set (GtkContainer *container,
212 void gtk_container_arg_get (GtkContainer *container,
216 gchar* gtk_container_child_args_collect (GtkType object_type,
218 GSList **info_list_p,
219 const gchar *first_arg_name,
221 gchar* gtk_container_child_arg_get_info (GtkType object_type,
222 const gchar *arg_name,
223 GtkArgInfo **info_p);
224 void gtk_container_forall (GtkContainer *container,
225 GtkCallback callback,
226 gpointer callback_data);
227 gchar* gtk_container_child_composite_name (GtkContainer *container,
229 void gtk_container_dequeue_resize_handler (GtkContainer *container);
233 #endif /* __cplusplus */
236 #endif /* __GTK_CONTAINER_H__ */