]> Pileus Git - ~andy/gtk/blob - gtk/gtkcontainer.h
Deprecation cleanup
[~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 Lesser 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  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser 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
20 /*
21  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
22  * file for a list of people on the GTK+ Team.  See the ChangeLog
23  * files for a list of changes.  These files are distributed with
24  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
25  */
26
27 #ifndef __GTK_CONTAINER_H__
28 #define __GTK_CONTAINER_H__
29
30
31 #include <gdk/gdk.h>
32 #include <gtk/gtkenums.h>
33 #include <gtk/gtkwidget.h>
34 #include <gtk/gtkadjustment.h>
35
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif /* __cplusplus */
40
41
42 #define GTK_TYPE_CONTAINER              (gtk_container_get_type ())
43 #define GTK_CONTAINER(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CONTAINER, GtkContainer))
44 #define GTK_CONTAINER_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CONTAINER, GtkContainerClass))
45 #define GTK_IS_CONTAINER(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CONTAINER))
46 #define GTK_IS_CONTAINER_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CONTAINER))
47 #define GTK_CONTAINER_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CONTAINER, GtkContainerClass))
48
49 #define GTK_IS_RESIZE_CONTAINER(widget) (GTK_IS_CONTAINER (widget) && ((GtkContainer*) (widget))->resize_mode != GTK_RESIZE_PARENT)
50
51
52 typedef struct _GtkContainer       GtkContainer;
53 typedef struct _GtkContainerClass  GtkContainerClass;
54
55 struct _GtkContainer
56 {
57   GtkWidget widget;
58   
59   GtkWidget *focus_child;
60   
61   guint border_width : 16;
62   guint need_resize : 1;
63   guint resize_mode : 2;
64   guint reallocate_redraws : 1;
65   guint has_focus_chain : 1;
66 };
67
68 struct _GtkContainerClass
69 {
70   GtkWidgetClass parent_class;
71
72   void    (*add)                (GtkContainer    *container,
73                                  GtkWidget       *widget);
74   void    (*remove)             (GtkContainer    *container,
75                                  GtkWidget       *widget);
76   void    (*check_resize)       (GtkContainer    *container);
77   void    (*forall)             (GtkContainer    *container,
78                                  gboolean         include_internals,
79                                  GtkCallback      callback,
80                                  gpointer         callback_data);
81   void    (*set_focus_child)    (GtkContainer    *container,
82                                  GtkWidget       *widget);
83   GType   (*child_type)         (GtkContainer    *container);
84   gchar*  (*composite_name)     (GtkContainer    *container,
85                                  GtkWidget       *child);
86   void    (*set_child_property) (GtkContainer    *container,
87                                  GtkWidget       *child,
88                                  guint            property_id,
89                                  const GValue    *value,
90                                  GParamSpec      *pspec);
91   void    (*get_child_property) (GtkContainer    *container,
92                                  GtkWidget       *child,
93                                  guint            property_id,
94                                  GValue          *value,
95                                  GParamSpec      *pspec);
96
97   /* Padding for future expansion */
98   void (*_gtk_reserved1) (void);
99   void (*_gtk_reserved2) (void);
100   void (*_gtk_reserved3) (void);
101   void (*_gtk_reserved4) (void);
102 };
103
104 /* Application-level methods */
105
106 GType   gtk_container_get_type           (void) G_GNUC_CONST;
107 void    gtk_container_set_border_width   (GtkContainer     *container,
108                                           guint             border_width);
109 guint   gtk_container_get_border_width   (GtkContainer     *container);
110 void    gtk_container_add                (GtkContainer     *container,
111                                           GtkWidget        *widget);
112 void    gtk_container_remove             (GtkContainer     *container,
113                                           GtkWidget        *widget);
114
115 void    gtk_container_set_resize_mode    (GtkContainer     *container,
116                                           GtkResizeMode     resize_mode);
117 GtkResizeMode gtk_container_get_resize_mode (GtkContainer     *container);
118
119 void    gtk_container_check_resize       (GtkContainer     *container);
120
121 void     gtk_container_foreach      (GtkContainer       *container,
122                                      GtkCallback         callback,
123                                      gpointer            callback_data);
124 #ifndef GTK_DISABLE_DEPRECATED
125 void     gtk_container_foreach_full (GtkContainer       *container,
126                                      GtkCallback         callback,
127                                      GtkCallbackMarshal  marshal,
128                                      gpointer            callback_data,
129                                      GtkDestroyNotify    notify);
130 #endif /*  GTK_DISABLE_DEPRECATED */
131 GList*   gtk_container_get_children     (GtkContainer       *container);
132
133 #ifndef GTK_DISABLE_DEPRECATED
134 #define gtk_container_children gtk_container_get_children
135 #endif
136
137 void     gtk_container_propagate_expose (GtkContainer   *container,
138                                          GtkWidget      *child,
139                                          GdkEventExpose *event);
140
141 void     gtk_container_set_focus_chain  (GtkContainer   *container,
142                                          GList          *focusable_widgets);
143 gboolean gtk_container_get_focus_chain  (GtkContainer   *container,
144                                          GList         **focusable_widgets);
145 void     gtk_container_unset_focus_chain (GtkContainer  *container);
146
147 /* Widget-level methods */
148
149 void   gtk_container_set_reallocate_redraws (GtkContainer    *container,
150                                              gboolean         needs_redraws);
151 void   gtk_container_set_focus_child       (GtkContainer     *container,
152                                             GtkWidget        *child);
153 void   gtk_container_set_focus_vadjustment (GtkContainer     *container,
154                                             GtkAdjustment    *adjustment);
155 GtkAdjustment *gtk_container_get_focus_vadjustment (GtkContainer *container);
156 void   gtk_container_set_focus_hadjustment (GtkContainer     *container,
157                                             GtkAdjustment    *adjustment);
158 GtkAdjustment *gtk_container_get_focus_hadjustment (GtkContainer *container);
159
160 void    gtk_container_resize_children      (GtkContainer     *container);
161
162 GType   gtk_container_child_type           (GtkContainer     *container);
163
164
165 void         gtk_container_class_install_child_property (GtkContainerClass *cclass,
166                                                          guint              property_id,
167                                                          GParamSpec        *pspec);
168 GParamSpec*  gtk_container_class_find_child_property    (GObjectClass      *cclass,
169                                                          const gchar       *property_name);
170 GParamSpec** gtk_container_class_list_child_properties  (GObjectClass      *cclass,
171                                                          guint             *n_properties);
172 void         gtk_container_add_with_properties          (GtkContainer      *container,
173                                                          GtkWidget         *widget,
174                                                          const gchar       *first_prop_name,
175                                                          ...);
176 void         gtk_container_child_set                    (GtkContainer      *container,
177                                                          GtkWidget         *child,
178                                                          const gchar       *first_prop_name,
179                                                          ...);     
180 void         gtk_container_child_get                    (GtkContainer      *container,
181                                                          GtkWidget         *child,
182                                                          const gchar       *first_prop_name,
183                                                          ...);     
184 void         gtk_container_child_set_valist             (GtkContainer      *container,
185                                                          GtkWidget         *child,
186                                                          const gchar       *first_property_name,
187                                                          va_list            var_args);
188 void         gtk_container_child_get_valist             (GtkContainer      *container,
189                                                          GtkWidget         *child,
190                                                          const gchar       *first_property_name,
191                                                          va_list            var_args);
192 void         gtk_container_child_set_property           (GtkContainer      *container,
193                                                          GtkWidget         *child,
194                                                          const gchar       *property_name,
195                                                          const GValue      *value);
196 void         gtk_container_child_get_property           (GtkContainer      *container,
197                                                          GtkWidget         *child,
198                                                          const gchar       *property_name,
199                                                          GValue            *value);
200
201 #define GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID(object, property_id, pspec) \
202     G_OBJECT_WARN_INVALID_PSPEC ((object), "child property id", (property_id), (pspec))
203
204
205 void    gtk_container_forall                 (GtkContainer *container,
206                                               GtkCallback   callback,
207                                               gpointer      callback_data);
208
209 /* Non-public methods */
210 void    _gtk_container_queue_resize          (GtkContainer *container);
211 void    _gtk_container_clear_resize_widgets   (GtkContainer *container);
212 gchar*  _gtk_container_child_composite_name   (GtkContainer *container,
213                                               GtkWidget    *child);
214 void   _gtk_container_dequeue_resize_handler (GtkContainer *container);
215 GList *_gtk_container_focus_sort             (GtkContainer     *container,
216                                               GList            *children,
217                                               GtkDirectionType  direction,
218                                               GtkWidget        *old_focus);
219
220 #ifndef GTK_DISABLE_DEPRECATED
221 #define gtk_container_border_width              gtk_container_set_border_width
222 #endif /* GTK_DISABLE_DEPRECATED */
223
224 #ifdef __cplusplus
225 }
226 #endif /* __cplusplus */
227
228
229 #endif /* __GTK_CONTAINER_H__ */