]> Pileus Git - ~andy/gtk/blob - gtk/gtkcontainer.h
new functions which wraps gtk_arg_get_info().
[~andy/gtk] / gtk / gtkcontainer.h
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
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.
8  *
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.
13  *
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.
18  */
19 #ifndef __GTK_CONTAINER_H__
20 #define __GTK_CONTAINER_H__
21
22
23 #include <gdk/gdk.h>
24 #include <gtk/gtkenums.h>
25 #include <gtk/gtkwidget.h>
26 #include <gtk/gtkadjustment.h>
27
28
29 #ifdef __cplusplus
30 extern "C" {
31 #pragma }
32 #endif /* __cplusplus */
33
34
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))
40
41 #define GTK_IS_RESIZE_CONTAINER(widget) (GTK_IS_CONTAINER (widget) && ((GtkContainer*) (widget))->resize_mode != GTK_RESIZE_PARENT)
42
43
44 typedef struct _GtkContainer       GtkContainer;
45 typedef struct _GtkContainerClass  GtkContainerClass;
46
47 struct _GtkContainer
48 {
49   GtkWidget widget;
50   
51   GtkWidget *focus_child;
52   
53   guint border_width : 16;
54   guint need_resize : 1;
55   guint resize_mode : 2;
56   
57   
58   /* The list of children that requested a resize
59    */
60   GSList *resize_widgets;
61 };
62
63 struct _GtkContainerClass
64 {
65   GtkWidgetClass parent_class;
66   
67   guint   n_child_args;
68
69   void (* add)                  (GtkContainer    *container,
70                                  GtkWidget       *widget);
71   void (* remove)               (GtkContainer    *container,
72                                  GtkWidget       *widget);
73   void (* check_resize)         (GtkContainer    *container);
74   void (* foreach)              (GtkContainer    *container,
75                                  GtkCallback      callback,
76                                  gpointer         callbabck_data);
77   gint (* focus)                (GtkContainer    *container,
78                                  GtkDirectionType  direction);
79   void (* set_focus_child)      (GtkContainer    *container,
80                                  GtkWidget       *widget);
81   GtkType (*child_type)         (GtkContainer   *container);
82   void    (*set_child_arg)      (GtkContainer   *container,
83                                  GtkWidget      *child,
84                                  GtkArg         *arg,
85                                  guint           arg_id);
86   void    (*get_child_arg)      (GtkContainer   *container,
87                                  GtkWidget      *child,
88                                  GtkArg         *arg,
89                                  guint           arg_id);
90 };
91
92 /* Application-level methods */
93
94 GtkType gtk_container_get_type           (void);
95 void    gtk_container_border_width       (GtkContainer     *container,
96                                           guint             border_width);
97 void    gtk_container_add                (GtkContainer     *container,
98                                           GtkWidget        *widget);
99 void    gtk_container_remove             (GtkContainer     *container,
100                                           GtkWidget        *widget);
101
102 void    gtk_container_set_resize_mode    (GtkContainer     *container,
103                                           GtkResizeMode     resize_mode);
104
105 void    gtk_container_check_resize       (GtkContainer     *container);
106
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);
122
123 /* Widget-level methods */
124
125 void   gtk_container_set_focus_child       (GtkContainer     *container,
126                                             GtkWidget        *child);
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);
134
135 GtkType gtk_container_child_type           (GtkContainer     *container);
136
137 /* the `arg_name' argument needs to be a const static string */
138 void    gtk_container_add_child_arg_type   (const gchar      *arg_name,
139                                             GtkType           arg_type,
140                                             guint             arg_flags,
141                                             guint             arg_id);
142      
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).
151  */
152 GtkArg* gtk_container_query_child_args     (GtkType            class_type,
153                                             guint32          **arg_flags,
154                                             guint             *nargs);
155
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));
160  */
161 void    gtk_container_child_getv           (GtkContainer      *container,
162                                             GtkWidget         *child,
163                                             guint              n_args,
164                                             GtkArg            *args);
165 void    gtk_container_child_setv           (GtkContainer      *container,
166                                             GtkWidget         *child,
167                                             guint              n_args,
168                                             GtkArg            *args);
169
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.
174  */
175 void    gtk_container_add_with_args        (GtkContainer      *container,
176                                             GtkWidget         *widget,
177                                             ...);
178 void    gtk_container_addv                 (GtkContainer      *container,
179                                             GtkWidget         *widget,
180                                             guint              n_args,
181                                             GtkArg            *args);
182 void    gtk_container_child_set            (GtkContainer      *container,
183                                             GtkWidget         *child,
184                                             ...);
185      
186
187 /* Non-public methods */
188
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,
192                                             GtkWidget    *child,
193                                             GtkArg       *arg,
194                                             GtkArgInfo   *info);
195 void    gtk_container_arg_get              (GtkContainer *container,
196                                             GtkWidget    *child,
197                                             GtkArg       *arg,
198                                             GtkArgInfo   *info);
199 gchar*  gtk_container_child_args_collect   (GtkType       object_type,
200                                             GSList      **arg_list_p,
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);
206
207
208 /* Deprecated methods */
209
210 /* Completely non-functional */
211 void    gtk_container_disable_resize     (GtkContainer     *container);
212 void    gtk_container_enable_resize      (GtkContainer     *container);
213
214 /* Use gtk_container_set_resize_mode() instead */
215 void    gtk_container_block_resize       (GtkContainer     *container);
216 void    gtk_container_unblock_resize     (GtkContainer     *container);
217
218 /* Use gtk_container_check_resize() instead */
219 gint    gtk_container_need_resize        (GtkContainer     *container);
220
221 #ifdef __cplusplus
222 }
223 #endif /* __cplusplus */
224
225
226 #endif /* __GTK_CONTAINER_H__ */