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>
31 #endif /* __cplusplus */
34 #define GTK_TYPE_CONTAINER (gtk_container_get_type ())
35 #define GTK_CONTAINER(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_CONTAINER, GtkContainer))
36 #define GTK_CONTAINER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_CONTAINER, GtkContainerClass))
37 #define GTK_IS_CONTAINER(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_CONTAINER))
38 #define GTK_IS_CONTAINER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CONTAINER))
40 #define GTK_IS_RESIZE_CONTAINER(widget) (GTK_IS_CONTAINER (widget) && ((GtkContainer*) (widget))->resize_mode != GTK_RESIZE_PARENT)
43 typedef struct _GtkContainer GtkContainer;
44 typedef struct _GtkContainerClass GtkContainerClass;
50 GtkWidget *focus_child;
52 guint border_width : 16;
53 guint need_resize : 1;
54 guint resize_mode : 2;
57 /* The list of children that requested a resize
59 GSList *resize_widgets;
62 struct _GtkContainerClass
64 GtkWidgetClass parent_class;
68 void (* add) (GtkContainer *container,
70 void (* remove) (GtkContainer *container,
72 void (* check_resize) (GtkContainer *container);
73 void (* forall) (GtkContainer *container,
74 gboolean include_internals,
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 GList * gtk_container_get_toplevels (void);
135 void gtk_container_resize_children (GtkContainer *container);
137 GtkType gtk_container_child_type (GtkContainer *container);
139 /* the `arg_name' argument needs to be a const static string */
140 void gtk_container_add_child_arg_type (const gchar *arg_name,
145 /* Allocate a GtkArg array of size nargs that hold the
146 * names and types of the args that can be used with
147 * gtk_container_child_getv/gtk_container_child_setv.
148 * if (arg_flags!=NULL),
149 * (*arg_flags) will be set to point to a newly allocated
150 * guint array that holds the flags of the args.
151 * It is the callers response to do a
152 * g_free (returned_args); g_free (*arg_flags).
154 GtkArg* gtk_container_query_child_args (GtkType class_type,
158 /* gtk_container_child_getv() sets an arguments type and value, or just
159 * its type to GTK_TYPE_INVALID.
160 * if GTK_FUNDAMENTAL_TYPE (arg->type) == GTK_TYPE_STRING, it's the callers
161 * response to do a g_free (GTK_VALUE_STRING (arg));
163 void gtk_container_child_getv (GtkContainer *container,
167 void gtk_container_child_setv (GtkContainer *container,
172 /* gtk_container_add_with_args() takes a variable argument list of the form:
173 * (..., gchar *arg_name, ARG_VALUES, [repeatedly name/value pairs,] NULL)
174 * where ARG_VALUES type depend on the argument and can consist of
175 * more than one c-function argument.
177 void gtk_container_add_with_args (GtkContainer *container,
179 const gchar *first_arg_name,
181 void gtk_container_addv (GtkContainer *container,
185 void gtk_container_child_set (GtkContainer *container,
187 const gchar *first_arg_name,
191 /* Non-public methods */
193 void gtk_container_queue_resize (GtkContainer *container);
194 void gtk_container_clear_resize_widgets (GtkContainer *container);
195 void gtk_container_arg_set (GtkContainer *container,
199 void gtk_container_arg_get (GtkContainer *container,
203 gchar* gtk_container_child_args_collect (GtkType object_type,
205 GSList **info_list_p,
206 const gchar *first_arg_name,
208 gchar* gtk_container_child_arg_get_info (GtkType object_type,
209 const gchar *arg_name,
210 GtkArgInfo **info_p);
211 void gtk_container_forall (GtkContainer *container,
212 GtkCallback callback,
213 gpointer callback_data);
216 /* Deprecated methods */
218 /* Use gtk_container_set_resize_mode() instead */
219 void gtk_container_block_resize (GtkContainer *container);
220 void gtk_container_unblock_resize (GtkContainer *container);
222 /* Use gtk_container_check_resize() instead */
223 gint gtk_container_need_resize (GtkContainer *container);
227 #endif /* __cplusplus */
230 #endif /* __GTK_CONTAINER_H__ */