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))
42 typedef struct _GtkContainer GtkContainer;
43 typedef struct _GtkContainerClass GtkContainerClass;
49 GtkWidget *focus_child;
51 guint border_width : 16;
52 guint need_resize : 1;
53 guint resize_mode : 2;
56 /* The list of children that requested a resize
58 GSList *resize_widgets;
61 struct _GtkContainerClass
63 GtkWidgetClass parent_class;
67 void (* add) (GtkContainer *container,
69 void (* remove) (GtkContainer *container,
71 void (* check_resize) (GtkContainer *container);
72 void (* foreach) (GtkContainer *container,
74 gpointer callbabck_data);
75 gint (* focus) (GtkContainer *container,
76 GtkDirectionType direction);
77 void (* set_focus_child) (GtkContainer *container,
79 GtkType (*child_type) (GtkContainer *container);
80 void (*set_child_arg) (GtkContainer *container,
84 void (*get_child_arg) (GtkContainer *container,
90 /* Application-level methods */
92 GtkType gtk_container_get_type (void);
93 void gtk_container_border_width (GtkContainer *container,
95 void gtk_container_add (GtkContainer *container,
97 void gtk_container_remove (GtkContainer *container,
100 void gtk_container_set_resize_mode (GtkContainer *container,
101 GtkResizeMode resize_mode);
103 void gtk_container_check_resize (GtkContainer *container);
105 void gtk_container_foreach (GtkContainer *container,
106 GtkCallback callback,
107 gpointer callback_data);
108 void gtk_container_foreach_interp (GtkContainer *container,
109 GtkCallbackMarshal marshal,
110 gpointer callback_data,
111 GtkDestroyNotify notify);
112 void gtk_container_foreach_full (GtkContainer *container,
113 GtkCallback callback,
114 GtkCallbackMarshal marshal,
115 gpointer callback_data,
116 GtkDestroyNotify notify);
117 GList* gtk_container_children (GtkContainer *container);
118 gint gtk_container_focus (GtkContainer *container,
119 GtkDirectionType direction);
121 /* Widget-level methods */
123 void gtk_container_set_focus_child (GtkContainer *container,
125 void gtk_container_set_focus_vadjustment (GtkContainer *container,
126 GtkAdjustment *adjustment);
127 void gtk_container_set_focus_hadjustment (GtkContainer *container,
128 GtkAdjustment *adjustment);
129 void gtk_container_register_toplevel (GtkContainer *container);
130 void gtk_container_unregister_toplevel (GtkContainer *container);
131 void gtk_container_resize_children (GtkContainer *container);
133 GtkType gtk_container_child_type (GtkContainer *container);
135 void gtk_container_add_child_arg_type (const gchar *arg_name,
140 /* Allocate a GtkArg array of size nargs that hold the
141 * names and types of the args that can be used with
142 * gtk_container_child_arg_get/gtk_container_child_arg_set.
143 * if (arg_flags!=NULL),
144 * (*arg_flags) will be set to point to a newly allocated
145 * guint array that holds the flags of the args.
146 * It is the callers response to do a
147 * g_free (returned_args); g_free (*arg_flags).
149 GtkArg* gtk_container_query_child_args (GtkType class_type,
153 /* gtk_container_child_arg_getv() sets an arguments type and value, or just
154 * its type to GTK_TYPE_INVALID.
155 * if arg->type == GTK_TYPE_STRING, it's the callers response to
156 * do a g_free (GTK_VALUE_STRING (arg));
158 void gtk_container_child_arg_getv (GtkContainer *container,
162 void gtk_container_child_arg_setv (GtkContainer *container,
167 /* gtk_container_add_with_args() takes a variable argument list of the form:
168 * (..., gchar *arg_name, ARG_VALUES, [repeatedly name/value pairs,] NULL)
169 * where ARG_VALUES type depend on the argument and can consist of
170 * more than one c-function argument.
172 void gtk_container_add_with_args (GtkContainer *container,
175 void gtk_container_add_with_argv (GtkContainer *container,
181 /* Non-public methods */
182 void gtk_container_clear_resize_widgets (GtkContainer *container);
184 /* Deprecated methods */
186 /* completely non-functional */
187 void gtk_container_disable_resize (GtkContainer *container);
188 void gtk_container_enable_resize (GtkContainer *container);
190 /* Use gtk_container_set_resize_mode() instead */
191 void gtk_container_block_resize (GtkContainer *container);
192 void gtk_container_unblock_resize (GtkContainer *container);
194 /* Use gtk_container_check_resize() instead */
195 gint gtk_container_need_resize (GtkContainer *container);
199 #endif /* __cplusplus */
202 #endif /* __GTK_CONTAINER_H__ */