]> Pileus Git - ~andy/gtk/blob - gtk/gtkcontainer.h
fix PROP_EVENTS.
[~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)              (GTK_CHECK_CAST ((obj), GTK_TYPE_CONTAINER, GtkContainer))
44 #define GTK_CONTAINER_CLASS(klass)      (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_CONTAINER, GtkContainerClass))
45 #define GTK_IS_CONTAINER(obj)           (GTK_CHECK_TYPE ((obj), GTK_TYPE_CONTAINER))
46 #define GTK_IS_CONTAINER_CLASS(klass)   (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CONTAINER))
47 #define GTK_CONTAINER_GET_CLASS(obj)    (GTK_CHECK_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   /* The list of children that requested a resize
68    */
69   GSList *resize_widgets;
70 };
71
72 struct _GtkContainerClass
73 {
74   GtkWidgetClass parent_class;
75
76   void    (*add)                (GtkContainer    *container,
77                                  GtkWidget       *widget);
78   void    (*remove)             (GtkContainer    *container,
79                                  GtkWidget       *widget);
80   void    (*check_resize)       (GtkContainer    *container);
81   void    (*forall)             (GtkContainer    *container,
82                                  gboolean         include_internals,
83                                  GtkCallback      callback,
84                                  gpointer         callback_data);
85   void    (*set_focus_child)    (GtkContainer    *container,
86                                  GtkWidget       *widget);
87   GtkType (*child_type)         (GtkContainer    *container);
88   gchar*  (*composite_name)     (GtkContainer    *container,
89                                  GtkWidget       *child);
90   void    (*set_child_property) (GtkContainer    *container,
91                                  GtkWidget       *child,
92                                  guint            property_id,
93                                  const GValue    *value,
94                                  GParamSpec      *pspec);
95   void    (*get_child_property) (GtkContainer    *container,
96                                  GtkWidget       *child,
97                                  guint            property_id,
98                                  GValue          *value,
99                                  GParamSpec      *pspec);
100   /* Padding for future expansion */
101   GtkFunction pad1;
102   GtkFunction pad2;
103 };
104
105 /* Application-level methods */
106
107 GtkType gtk_container_get_type           (void) G_GNUC_CONST;
108 void    gtk_container_set_border_width   (GtkContainer     *container,
109                                           guint             border_width);
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
118 void    gtk_container_check_resize       (GtkContainer     *container);
119
120 void     gtk_container_foreach      (GtkContainer       *container,
121                                      GtkCallback         callback,
122                                      gpointer            callback_data);
123 void     gtk_container_foreach_full (GtkContainer       *container,
124                                      GtkCallback         callback,
125                                      GtkCallbackMarshal  marshal,
126                                      gpointer            callback_data,
127                                      GtkDestroyNotify    notify);
128 GList*   gtk_container_children     (GtkContainer       *container);
129 void     gtk_container_propagate_expose (GtkContainer   *container,
130                                          GtkWidget      *child,
131                                          GdkEventExpose *event);
132
133 void     gtk_container_set_focus_chain  (GtkContainer   *container,
134                                          GList          *focusable_widgets);
135 void     gtk_container_unset_focus_chain (GtkContainer  *container);
136
137 /* Widget-level methods */
138
139 void   gtk_container_set_reallocate_redraws (GtkContainer    *container,
140                                              gboolean         needs_redraws);
141 void   gtk_container_set_focus_child       (GtkContainer     *container,
142                                             GtkWidget        *child);
143 void   gtk_container_set_focus_vadjustment (GtkContainer     *container,
144                                             GtkAdjustment    *adjustment);
145 void   gtk_container_set_focus_hadjustment (GtkContainer     *container,
146                                             GtkAdjustment    *adjustment);
147
148 void    gtk_container_resize_children      (GtkContainer     *container);
149
150 GtkType 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                                                          ...);
164 void         gtk_container_child_set                    (GtkContainer      *container,
165                                                          GtkWidget         *child,
166                                                          const gchar       *first_prop_name,
167                                                          ...);     
168 void         gtk_container_child_get                    (GtkContainer      *container,
169                                                          GtkWidget         *child,
170                                                          const gchar       *first_prop_name,
171                                                          ...);     
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
181
182 #define GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID(object, property_id, pspec) \
183     G_OBJECT_WARN_INVALID_PSPEC ((object), "child property id", (property_id), (pspec))
184
185
186 /* Non-public methods */
187 void    gtk_container_queue_resize           (GtkContainer *container);
188 void    gtk_container_clear_resize_widgets   (GtkContainer *container);
189 void    gtk_container_forall                 (GtkContainer *container,
190                                               GtkCallback   callback,
191                                               gpointer      callback_data);
192 gchar*  gtk_container_child_composite_name   (GtkContainer *container,
193                                               GtkWidget    *child);
194 void    gtk_container_dequeue_resize_handler (GtkContainer *container);
195
196 #ifdef __cplusplus
197 }
198 #endif /* __cplusplus */
199
200
201 #endif /* __GTK_CONTAINER_H__ */