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 Library 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 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library 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.
19 #ifndef __GTK_CONTAINER_H__
20 #define __GTK_CONTAINER_H__
24 #include <gtk/gtkenums.h>
25 #include <gtk/gtkwidget.h>
26 #include <gtk/gtkadjustment.h>
32 #endif /* __cplusplus */
35 #define GTK_TYPE_CONTAINER (gtk_container_get_type ())
36 #define GTK_CONTAINER(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_CONTAINER, GtkContainer))
37 #define GTK_CONTAINER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_CONTAINER, GtkContainerClass))
38 #define GTK_IS_CONTAINER(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_CONTAINER))
39 #define GTK_IS_CONTAINER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CONTAINER))
41 #define GTK_IS_RESIZE_CONTAINER(widget) (GTK_IS_CONTAINER (widget) && ((GtkContainer*) (widget))->resize_mode != GTK_RESIZE_PARENT)
44 typedef struct _GtkContainer GtkContainer;
45 typedef struct _GtkContainerClass GtkContainerClass;
51 GtkWidget *focus_child;
53 guint border_width : 16;
54 guint need_resize : 1;
55 guint resize_mode : 2;
58 /* The list of children that requested a resize
60 GSList *resize_widgets;
63 struct _GtkContainerClass
65 GtkWidgetClass parent_class;
69 void (* add) (GtkContainer *container,
71 void (* remove) (GtkContainer *container,
73 void (* check_resize) (GtkContainer *container);
74 void (* foreach) (GtkContainer *container,
76 gpointer callbabck_data);
77 gint (* focus) (GtkContainer *container,
78 GtkDirectionType direction);
79 void (* set_focus_child) (GtkContainer *container,
81 GtkType (*child_type) (GtkContainer *container);
82 void (*set_child_arg) (GtkContainer *container,
86 void (*get_child_arg) (GtkContainer *container,
92 /* Application-level methods */
94 GtkType gtk_container_get_type (void);
95 void gtk_container_border_width (GtkContainer *container,
97 void gtk_container_add (GtkContainer *container,
99 void gtk_container_remove (GtkContainer *container,
102 void gtk_container_set_resize_mode (GtkContainer *container,
103 GtkResizeMode resize_mode);
105 void gtk_container_check_resize (GtkContainer *container);
107 void gtk_container_foreach (GtkContainer *container,
108 GtkCallback callback,
109 gpointer callback_data);
110 void gtk_container_foreach_interp (GtkContainer *container,
111 GtkCallbackMarshal marshal,
112 gpointer callback_data,
113 GtkDestroyNotify notify);
114 void gtk_container_foreach_full (GtkContainer *container,
115 GtkCallback callback,
116 GtkCallbackMarshal marshal,
117 gpointer callback_data,
118 GtkDestroyNotify notify);
119 GList* gtk_container_children (GtkContainer *container);
120 gint gtk_container_focus (GtkContainer *container,
121 GtkDirectionType direction);
123 /* Widget-level methods */
125 void gtk_container_set_focus_child (GtkContainer *container,
127 void gtk_container_set_focus_vadjustment (GtkContainer *container,
128 GtkAdjustment *adjustment);
129 void gtk_container_set_focus_hadjustment (GtkContainer *container,
130 GtkAdjustment *adjustment);
131 void gtk_container_register_toplevel (GtkContainer *container);
132 void gtk_container_unregister_toplevel (GtkContainer *container);
133 void gtk_container_resize_children (GtkContainer *container);
135 GtkType gtk_container_child_type (GtkContainer *container);
137 /* the `arg_name' argument needs to be a const static string */
138 void gtk_container_add_child_arg_type (const gchar *arg_name,
143 /* Allocate a GtkArg array of size nargs that hold the
144 * names and types of the args that can be used with
145 * gtk_container_child_getv/gtk_container_child_setv.
146 * if (arg_flags!=NULL),
147 * (*arg_flags) will be set to point to a newly allocated
148 * guint array that holds the flags of the args.
149 * It is the callers response to do a
150 * g_free (returned_args); g_free (*arg_flags).
152 GtkArg* gtk_container_query_child_args (GtkType class_type,
156 /* gtk_container_child_getv() sets an arguments type and value, or just
157 * its type to GTK_TYPE_INVALID.
158 * if GTK_FUNDAMENTAL_TYPE (arg->type) == GTK_TYPE_STRING, it's the callers
159 * response to do a g_free (GTK_VALUE_STRING (arg));
161 void gtk_container_child_getv (GtkContainer *container,
165 void gtk_container_child_setv (GtkContainer *container,
170 /* gtk_container_add_with_args() takes a variable argument list of the form:
171 * (..., gchar *arg_name, ARG_VALUES, [repeatedly name/value pairs,] NULL)
172 * where ARG_VALUES type depend on the argument and can consist of
173 * more than one c-function argument.
175 void gtk_container_add_with_args (GtkContainer *container,
178 void gtk_container_addv (GtkContainer *container,
182 void gtk_container_child_set (GtkContainer *container,
187 /* Non-public methods */
189 void gtk_container_queue_resize (GtkContainer *container);
190 void gtk_container_clear_resize_widgets (GtkContainer *container);
191 void gtk_container_arg_set (GtkContainer *container,
195 void gtk_container_arg_get (GtkContainer *container,
199 gchar* gtk_container_child_args_collect (GtkType object_type,
201 GSList **info_list_p,
202 gpointer var_args_p);
203 gchar* gtk_container_child_arg_get_info (GtkType object_type,
204 const gchar *arg_name,
205 GtkArgInfo **info_p);
208 /* Deprecated methods */
210 /* Completely non-functional */
211 void gtk_container_disable_resize (GtkContainer *container);
212 void gtk_container_enable_resize (GtkContainer *container);
214 /* Use gtk_container_set_resize_mode() instead */
215 void gtk_container_block_resize (GtkContainer *container);
216 void gtk_container_unblock_resize (GtkContainer *container);
218 /* Use gtk_container_check_resize() instead */
219 gint gtk_container_need_resize (GtkContainer *container);
223 #endif /* __cplusplus */
226 #endif /* __GTK_CONTAINER_H__ */