]> Pileus Git - ~andy/gtk/blob - gtk/gtkcontainer.h
Remove --g-fatal-warnings flag from argv.
[~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
42 typedef struct _GtkContainer       GtkContainer;
43 typedef struct _GtkContainerClass  GtkContainerClass;
44
45 struct _GtkContainer
46 {
47   GtkWidget widget;
48   
49   GtkWidget *focus_child;
50   
51   guint border_width : 16;
52   guint need_resize : 1;
53   guint resize_mode : 2;
54   
55   
56   /* The list of children that requested a resize
57    */
58   GSList *resize_widgets;
59 };
60
61 struct _GtkContainerClass
62 {
63   GtkWidgetClass parent_class;
64   
65   guint   n_child_args;
66
67   void (* add)                  (GtkContainer    *container,
68                                  GtkWidget       *widget);
69   void (* remove)               (GtkContainer    *container,
70                                  GtkWidget       *widget);
71   void (* check_resize)         (GtkContainer    *container);
72   void (* foreach)              (GtkContainer    *container,
73                                  GtkCallback      callback,
74                                  gpointer         callbabck_data);
75   gint (* focus)                (GtkContainer    *container,
76                                  GtkDirectionType  direction);
77   void (* set_focus_child)      (GtkContainer    *container,
78                                  GtkWidget       *widget);
79   GtkType (*child_type)         (GtkContainer   *container);
80   void    (*set_child_arg)      (GtkContainer   *container,
81                                  GtkWidget      *child,
82                                  GtkArg         *arg,
83                                  guint           arg_id);
84   void    (*get_child_arg)      (GtkContainer   *container,
85                                  GtkWidget      *child,
86                                  GtkArg         *arg,
87                                  guint           arg_id);
88 };
89
90 /* Application-level methods */
91
92 GtkType gtk_container_get_type           (void);
93 void    gtk_container_border_width       (GtkContainer     *container,
94                                           guint             border_width);
95 void    gtk_container_add                (GtkContainer     *container,
96                                           GtkWidget        *widget);
97 void    gtk_container_remove             (GtkContainer     *container,
98                                           GtkWidget        *widget);
99
100 void    gtk_container_set_resize_mode    (GtkContainer     *container,
101                                           GtkResizeMode     resize_mode);
102
103 void    gtk_container_check_resize       (GtkContainer     *container);
104
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);
120
121 /* Widget-level methods */
122
123 void   gtk_container_set_focus_child       (GtkContainer     *container,
124                                             GtkWidget        *child);
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);
132
133 GtkType gtk_container_child_type           (GtkContainer     *container);
134
135 void    gtk_container_add_child_arg_type   (const gchar      *arg_name,
136                                             GtkType           arg_type,
137                                             guint             arg_flags,
138                                             guint             arg_id);
139
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).
148  */
149 GtkArg* gtk_container_query_child_args     (GtkType            class_type,
150                                             guint32          **arg_flags,
151                                             guint             *nargs);
152
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));
157  */
158 void    gtk_container_child_arg_getv       (GtkContainer      *container,
159                                             GtkWidget         *child,
160                                             guint              n_args,
161                                             GtkArg            *args);
162 void    gtk_container_child_arg_setv       (GtkContainer      *container,
163                                             GtkWidget         *child,
164                                             guint              n_args,
165                                             GtkArg            *args);
166
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.
171  */
172 void    gtk_container_add_with_args        (GtkContainer      *container,
173                                             GtkWidget         *widget,
174                                             ...);
175 void    gtk_container_add_with_argv        (GtkContainer      *container,
176                                             GtkWidget         *widget,
177                                             guint              n_args,
178                                             GtkArg            *args);
179
180
181 /* Non-public methods */
182 void    gtk_container_clear_resize_widgets (GtkContainer *container);
183
184 /* Deprecated methods */
185
186 /* completely non-functional */
187 void    gtk_container_disable_resize     (GtkContainer     *container);
188 void    gtk_container_enable_resize      (GtkContainer     *container);
189
190 /* Use gtk_container_set_resize_mode() instead */
191 void    gtk_container_block_resize       (GtkContainer     *container);
192 void    gtk_container_unblock_resize     (GtkContainer     *container);
193
194 /* Use gtk_container_check_resize() instead */
195 gint    gtk_container_need_resize        (GtkContainer     *container);
196
197 #ifdef __cplusplus
198 }
199 #endif /* __cplusplus */
200
201
202 #endif /* __GTK_CONTAINER_H__ */