]> Pileus Git - ~andy/gtk/blob - gtk/gtkcontainer.h
Change FSF Address
[~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, see <http://www.gnu.org/licenses/>.
16  */
17
18 /*
19  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
20  * file for a list of people on the GTK+ Team.  See the ChangeLog
21  * files for a list of changes.  These files are distributed with
22  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
23  */
24
25 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
26 #error "Only <gtk/gtk.h> can be included directly."
27 #endif
28
29 #ifndef __GTK_CONTAINER_H__
30 #define __GTK_CONTAINER_H__
31
32
33 #include <gtk/gtkwidget.h>
34 #include <gtk/gtkadjustment.h>
35
36
37 G_BEGIN_DECLS
38
39 #define GTK_TYPE_CONTAINER              (gtk_container_get_type ())
40 #define GTK_CONTAINER(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CONTAINER, GtkContainer))
41 #define GTK_CONTAINER_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CONTAINER, GtkContainerClass))
42 #define GTK_IS_CONTAINER(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CONTAINER))
43 #define GTK_IS_CONTAINER_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CONTAINER))
44 #define GTK_CONTAINER_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CONTAINER, GtkContainerClass))
45
46
47 typedef struct _GtkContainer              GtkContainer;
48 typedef struct _GtkContainerPrivate       GtkContainerPrivate;
49 typedef struct _GtkContainerClass         GtkContainerClass;
50
51 struct _GtkContainer
52 {
53   GtkWidget widget;
54
55   /*< private >*/
56   GtkContainerPrivate *priv;
57 };
58
59 struct _GtkContainerClass
60 {
61   GtkWidgetClass parent_class;
62
63   void    (*add)                (GtkContainer    *container,
64                                  GtkWidget       *widget);
65   void    (*remove)             (GtkContainer    *container,
66                                  GtkWidget       *widget);
67   void    (*check_resize)       (GtkContainer    *container);
68   void    (*forall)             (GtkContainer    *container,
69                                  gboolean         include_internals,
70                                  GtkCallback      callback,
71                                  gpointer         callback_data);
72   void    (*set_focus_child)    (GtkContainer    *container,
73                                  GtkWidget       *child);
74   GType   (*child_type)         (GtkContainer    *container);
75   gchar*  (*composite_name)     (GtkContainer    *container,
76                                  GtkWidget       *child);
77   void    (*set_child_property) (GtkContainer    *container,
78                                  GtkWidget       *child,
79                                  guint            property_id,
80                                  const GValue    *value,
81                                  GParamSpec      *pspec);
82   void    (*get_child_property) (GtkContainer    *container,
83                                  GtkWidget       *child,
84                                  guint            property_id,
85                                  GValue          *value,
86                                  GParamSpec      *pspec);
87   GtkWidgetPath * (*get_path_for_child) (GtkContainer *container,
88                                          GtkWidget    *child);
89
90
91   /*< private >*/
92
93   unsigned int _handle_border_width : 1;
94
95   /* Padding for future expansion */
96   void (*_gtk_reserved1) (void);
97   void (*_gtk_reserved2) (void);
98   void (*_gtk_reserved3) (void);
99   void (*_gtk_reserved4) (void);
100   void (*_gtk_reserved5) (void);
101   void (*_gtk_reserved6) (void);
102   void (*_gtk_reserved7) (void);
103   void (*_gtk_reserved8) (void);
104 };
105
106
107 /* Application-level methods */
108
109 GType   gtk_container_get_type           (void) G_GNUC_CONST;
110 void    gtk_container_set_border_width   (GtkContainer     *container,
111                                           guint             border_width);
112 guint   gtk_container_get_border_width   (GtkContainer     *container);
113 void    gtk_container_add                (GtkContainer     *container,
114                                           GtkWidget        *widget);
115 void    gtk_container_remove             (GtkContainer     *container,
116                                           GtkWidget        *widget);
117
118 void    gtk_container_set_resize_mode    (GtkContainer     *container,
119                                           GtkResizeMode     resize_mode);
120 GtkResizeMode gtk_container_get_resize_mode (GtkContainer     *container);
121
122 void    gtk_container_check_resize       (GtkContainer     *container);
123
124 void     gtk_container_foreach      (GtkContainer       *container,
125                                      GtkCallback         callback,
126                                      gpointer            callback_data);
127 GList*   gtk_container_get_children     (GtkContainer       *container);
128
129 void     gtk_container_propagate_draw   (GtkContainer   *container,
130                                          GtkWidget      *child,
131                                          cairo_t        *cr);
132
133 void     gtk_container_set_focus_chain  (GtkContainer   *container,
134                                          GList          *focusable_widgets);
135 gboolean gtk_container_get_focus_chain  (GtkContainer   *container,
136                                          GList         **focusable_widgets);
137 void     gtk_container_unset_focus_chain (GtkContainer  *container);
138
139 #define GTK_IS_RESIZE_CONTAINER(widget) (GTK_IS_CONTAINER (widget) && \
140                                         (gtk_container_get_resize_mode (GTK_CONTAINER (widget)) != GTK_RESIZE_PARENT))
141
142 /* Widget-level methods */
143
144 void   gtk_container_set_reallocate_redraws (GtkContainer    *container,
145                                              gboolean         needs_redraws);
146 void   gtk_container_set_focus_child       (GtkContainer     *container,
147                                             GtkWidget        *child);
148 GtkWidget *
149        gtk_container_get_focus_child       (GtkContainer     *container);
150 void   gtk_container_set_focus_vadjustment (GtkContainer     *container,
151                                             GtkAdjustment    *adjustment);
152 GtkAdjustment *gtk_container_get_focus_vadjustment (GtkContainer *container);
153 void   gtk_container_set_focus_hadjustment (GtkContainer     *container,
154                                             GtkAdjustment    *adjustment);
155 GtkAdjustment *gtk_container_get_focus_hadjustment (GtkContainer *container);
156
157 void    gtk_container_resize_children      (GtkContainer     *container);
158
159 GType   gtk_container_child_type           (GtkContainer     *container);
160
161
162 void         gtk_container_class_install_child_property (GtkContainerClass *cclass,
163                                                          guint              property_id,
164                                                          GParamSpec        *pspec);
165 GParamSpec*  gtk_container_class_find_child_property    (GObjectClass      *cclass,
166                                                          const gchar       *property_name);
167 GParamSpec** gtk_container_class_list_child_properties  (GObjectClass      *cclass,
168                                                          guint             *n_properties);
169 void         gtk_container_add_with_properties          (GtkContainer      *container,
170                                                          GtkWidget         *widget,
171                                                          const gchar       *first_prop_name,
172                                                          ...) G_GNUC_NULL_TERMINATED;
173 void         gtk_container_child_set                    (GtkContainer      *container,
174                                                          GtkWidget         *child,
175                                                          const gchar       *first_prop_name,
176                                                          ...) G_GNUC_NULL_TERMINATED;
177 void         gtk_container_child_get                    (GtkContainer      *container,
178                                                          GtkWidget         *child,
179                                                          const gchar       *first_prop_name,
180                                                          ...) G_GNUC_NULL_TERMINATED;
181 void         gtk_container_child_set_valist             (GtkContainer      *container,
182                                                          GtkWidget         *child,
183                                                          const gchar       *first_property_name,
184                                                          va_list            var_args);
185 void         gtk_container_child_get_valist             (GtkContainer      *container,
186                                                          GtkWidget         *child,
187                                                          const gchar       *first_property_name,
188                                                          va_list            var_args);
189 void         gtk_container_child_set_property           (GtkContainer      *container,
190                                                          GtkWidget         *child,
191                                                          const gchar       *property_name,
192                                                          const GValue      *value);
193 void         gtk_container_child_get_property           (GtkContainer      *container,
194                                                          GtkWidget         *child,
195                                                          const gchar       *property_name,
196                                                          GValue            *value);
197
198 GDK_AVAILABLE_IN_3_2
199 void gtk_container_child_notify (GtkContainer *container,
200                                  GtkWidget    *child,
201                                  const gchar  *child_property);
202
203 /**
204  * GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID:
205  * @object: the #GObject on which set_child_property() or get_child_property()
206  *  was called
207  * @property_id: the numeric id of the property
208  * @pspec: the #GParamSpec of the property
209  *
210  * This macro should be used to emit a standard warning about unexpected
211  * properties in set_child_property() and get_child_property() implementations.
212  */
213 #define GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID(object, property_id, pspec) \
214     G_OBJECT_WARN_INVALID_PSPEC ((object), "child property id", (property_id), (pspec))
215
216
217 void    gtk_container_forall                 (GtkContainer *container,
218                                               GtkCallback   callback,
219                                               gpointer      callback_data);
220
221 void    gtk_container_class_handle_border_width (GtkContainerClass *klass);
222
223 GtkWidgetPath * gtk_container_get_path_for_child (GtkContainer      *container,
224                                                   GtkWidget         *child);
225
226 G_END_DECLS
227
228 #endif /* __GTK_CONTAINER_H__ */