]> Pileus Git - ~andy/gtk/blob - gtk/gtkcontainer.h
gtkcontainer: Move public members to private structure
[~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 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
28 #error "Only <gtk/gtk.h> can be included directly."
29 #endif
30
31 #ifndef __GTK_CONTAINER_H__
32 #define __GTK_CONTAINER_H__
33
34
35 #include <gtk/gtkwidget.h>
36 #include <gtk/gtkadjustment.h>
37
38
39 G_BEGIN_DECLS
40
41 #define GTK_TYPE_CONTAINER              (gtk_container_get_type ())
42 #define GTK_CONTAINER(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CONTAINER, GtkContainer))
43 #define GTK_CONTAINER_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CONTAINER, GtkContainerClass))
44 #define GTK_IS_CONTAINER(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CONTAINER))
45 #define GTK_IS_CONTAINER_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CONTAINER))
46 #define GTK_CONTAINER_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CONTAINER, GtkContainerClass))
47
48
49 typedef struct _GtkContainer       GtkContainer;
50 typedef struct _GtkContainerPriv   GtkContainerPriv;
51 typedef struct _GtkContainerClass  GtkContainerClass;
52
53 struct _GtkContainer
54 {
55   GtkWidget widget;
56
57   /*< private >*/
58   GtkContainerPriv *priv;
59 };
60
61 struct _GtkContainerClass
62 {
63   GtkWidgetClass parent_class;
64
65   void    (*add)                (GtkContainer    *container,
66                                  GtkWidget       *widget);
67   void    (*remove)             (GtkContainer    *container,
68                                  GtkWidget       *widget);
69   void    (*check_resize)       (GtkContainer    *container);
70   void    (*forall)             (GtkContainer    *container,
71                                  gboolean         include_internals,
72                                  GtkCallback      callback,
73                                  gpointer         callback_data);
74   void    (*set_focus_child)    (GtkContainer    *container,
75                                  GtkWidget       *widget);
76   GType   (*child_type)         (GtkContainer    *container);
77   gchar*  (*composite_name)     (GtkContainer    *container,
78                                  GtkWidget       *child);
79   void    (*set_child_property) (GtkContainer    *container,
80                                  GtkWidget       *child,
81                                  guint            property_id,
82                                  const GValue    *value,
83                                  GParamSpec      *pspec);
84   void    (*get_child_property) (GtkContainer    *container,
85                                  GtkWidget       *child,
86                                  guint            property_id,
87                                  GValue          *value,
88                                  GParamSpec      *pspec);
89
90   /* Padding for future expansion */
91   void (*_gtk_reserved1) (void);
92   void (*_gtk_reserved2) (void);
93   void (*_gtk_reserved3) (void);
94   void (*_gtk_reserved4) (void);
95 };
96
97
98 /* Application-level methods */
99
100 GType   gtk_container_get_type           (void) G_GNUC_CONST;
101 void    gtk_container_set_border_width   (GtkContainer     *container,
102                                           guint             border_width);
103 guint   gtk_container_get_border_width   (GtkContainer     *container);
104 void    gtk_container_add                (GtkContainer     *container,
105                                           GtkWidget        *widget);
106 void    gtk_container_remove             (GtkContainer     *container,
107                                           GtkWidget        *widget);
108
109 void    gtk_container_set_resize_mode    (GtkContainer     *container,
110                                           GtkResizeMode     resize_mode);
111 GtkResizeMode gtk_container_get_resize_mode (GtkContainer     *container);
112
113 void    gtk_container_check_resize       (GtkContainer     *container);
114
115 void     gtk_container_foreach      (GtkContainer       *container,
116                                      GtkCallback         callback,
117                                      gpointer            callback_data);
118 GList*   gtk_container_get_children     (GtkContainer       *container);
119
120 void     gtk_container_propagate_expose (GtkContainer   *container,
121                                          GtkWidget      *child,
122                                          GdkEventExpose *event);
123
124 void     gtk_container_set_focus_chain  (GtkContainer   *container,
125                                          GList          *focusable_widgets);
126 gboolean gtk_container_get_focus_chain  (GtkContainer   *container,
127                                          GList         **focusable_widgets);
128 void     gtk_container_unset_focus_chain (GtkContainer  *container);
129
130 #define GTK_IS_RESIZE_CONTAINER(widget) (GTK_IS_CONTAINER (widget) && \
131                                         (gtk_container_get_resize_mode (GTK_CONTAINER (widget)) != GTK_RESIZE_PARENT))
132
133 /* Widget-level methods */
134
135 void   gtk_container_set_reallocate_redraws (GtkContainer    *container,
136                                              gboolean         needs_redraws);
137 void   gtk_container_set_focus_child       (GtkContainer     *container,
138                                             GtkWidget        *child);
139 GtkWidget *
140        gtk_container_get_focus_child       (GtkContainer     *container);
141 void   gtk_container_set_focus_vadjustment (GtkContainer     *container,
142                                             GtkAdjustment    *adjustment);
143 GtkAdjustment *gtk_container_get_focus_vadjustment (GtkContainer *container);
144 void   gtk_container_set_focus_hadjustment (GtkContainer     *container,
145                                             GtkAdjustment    *adjustment);
146 GtkAdjustment *gtk_container_get_focus_hadjustment (GtkContainer *container);
147
148 void    gtk_container_resize_children      (GtkContainer     *container);
149
150 GType   gtk_container_child_type           (GtkContainer     *container);
151
152
153 void         gtk_container_class_install_child_property (GtkContainerClass *cclass,
154                                                          guint              property_id,
155                                                          GParamSpec        *pspec);
156 GParamSpec*  gtk_container_class_find_child_property    (GObjectClass      *cclass,
157                                                          const gchar       *property_name);
158 GParamSpec** gtk_container_class_list_child_properties  (GObjectClass      *cclass,
159                                                          guint             *n_properties);
160 void         gtk_container_add_with_properties          (GtkContainer      *container,
161                                                          GtkWidget         *widget,
162                                                          const gchar       *first_prop_name,
163                                                          ...) G_GNUC_NULL_TERMINATED;
164 void         gtk_container_child_set                    (GtkContainer      *container,
165                                                          GtkWidget         *child,
166                                                          const gchar       *first_prop_name,
167                                                          ...) G_GNUC_NULL_TERMINATED;
168 void         gtk_container_child_get                    (GtkContainer      *container,
169                                                          GtkWidget         *child,
170                                                          const gchar       *first_prop_name,
171                                                          ...) G_GNUC_NULL_TERMINATED;
172 void         gtk_container_child_set_valist             (GtkContainer      *container,
173                                                          GtkWidget         *child,
174                                                          const gchar       *first_property_name,
175                                                          va_list            var_args);
176 void         gtk_container_child_get_valist             (GtkContainer      *container,
177                                                          GtkWidget         *child,
178                                                          const gchar       *first_property_name,
179                                                          va_list            var_args);
180 void         gtk_container_child_set_property           (GtkContainer      *container,
181                                                          GtkWidget         *child,
182                                                          const gchar       *property_name,
183                                                          const GValue      *value);
184 void         gtk_container_child_get_property           (GtkContainer      *container,
185                                                          GtkWidget         *child,
186                                                          const gchar       *property_name,
187                                                          GValue            *value);
188
189 #define GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID(object, property_id, pspec) \
190     G_OBJECT_WARN_INVALID_PSPEC ((object), "child property id", (property_id), (pspec))
191
192
193 void    gtk_container_forall                 (GtkContainer *container,
194                                               GtkCallback   callback,
195                                               gpointer      callback_data);
196
197 /* Non-public methods */
198 void    _gtk_container_queue_resize          (GtkContainer *container);
199 void    _gtk_container_clear_resize_widgets   (GtkContainer *container);
200 gchar*  _gtk_container_child_composite_name   (GtkContainer *container,
201                                               GtkWidget    *child);
202 void   _gtk_container_dequeue_resize_handler (GtkContainer *container);
203 GList *_gtk_container_focus_sort             (GtkContainer     *container,
204                                               GList            *children,
205                                               GtkDirectionType  direction,
206                                               GtkWidget        *old_focus);
207 gboolean _gtk_container_get_need_resize      (GtkContainer     *container);
208 void     _gtk_container_set_need_resize      (GtkContainer     *container,
209                                               gboolean          need_resize);
210 gboolean _gtk_container_get_reallocate_redraws (GtkContainer   *container);
211
212 G_END_DECLS
213
214 #endif /* __GTK_CONTAINER_H__ */