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