gtkcontainer.h 10.3 KB
Newer Older
Cody Russell's avatar
Cody Russell committed
1
/* GTK - The GIMP Toolkit
Elliot Lee's avatar
Elliot Lee committed
2 3 4
 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
 *
 * This library is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU Lesser General Public
Elliot Lee's avatar
Elliot Lee committed
6 7 8 9 10
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * 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.
Elliot Lee's avatar
Elliot Lee committed
13
 *
14
 * You should have received a copy of the GNU Lesser General Public
Javier Jardón's avatar
Javier Jardón committed
15
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
Elliot Lee's avatar
Elliot Lee committed
16
 */
17 18

/*
19
 * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
20 21
 * file for a list of people on the GTK+ Team.  See the ChangeLog
 * files for a list of changes.  These files are distributed with
22
 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
23 24
 */

Elliot Lee's avatar
Elliot Lee committed
25 26 27 28
#ifndef __GTK_CONTAINER_H__
#define __GTK_CONTAINER_H__


29 30 31 32
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif

Elliot Lee's avatar
Elliot Lee committed
33 34 35
#include <gtk/gtkwidget.h>


36
G_BEGIN_DECLS
Elliot Lee's avatar
Elliot Lee committed
37

Tim Janik's avatar
Tim Janik committed
38
#define GTK_TYPE_CONTAINER              (gtk_container_get_type ())
Manish Singh's avatar
Manish Singh committed
39 40 41 42 43
#define GTK_CONTAINER(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_CONTAINER, GtkContainer))
#define GTK_CONTAINER_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_CONTAINER, GtkContainerClass))
#define GTK_IS_CONTAINER(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_CONTAINER))
#define GTK_IS_CONTAINER_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CONTAINER))
#define GTK_CONTAINER_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CONTAINER, GtkContainerClass))
44

Elliot Lee's avatar
Elliot Lee committed
45

46 47 48
typedef struct _GtkContainer              GtkContainer;
typedef struct _GtkContainerPrivate       GtkContainerPrivate;
typedef struct _GtkContainerClass         GtkContainerClass;
Elliot Lee's avatar
Elliot Lee committed
49 50 51 52

struct _GtkContainer
{
  GtkWidget widget;
53

54
  /*< private >*/
55
  GtkContainerPrivate *priv;
Elliot Lee's avatar
Elliot Lee committed
56 57
};

58 59 60 61 62 63 64 65 66
/**
 * GtkContainerClass:
 * @parent_class: The parent class.
 * @add: Signal emitted when a widget is added to container.
 * @remove: Signal emitted when a widget is removed from container.
 * @check_resize: Signal emitted when a size recalculation is needed.
 * @forall: Invokes callback on each child of container.
 * @set_focus_child: Sets the focused child of container.
 * @child_type: Returns the type of the children supported by the container.
67
 * @composite_name: Gets a widget’s composite name. Deprecated: 3.10.
68
 * @set_child_property: Set a property on a child of container.
69
 * @get_child_property: Get a property from a child of container.
70 71 72 73 74
 * @get_path_for_child: Get path representing entire widget hierarchy
 *    from the toplevel down to and including @child.
 *
 * Base class for containers.
 */
Elliot Lee's avatar
Elliot Lee committed
75 76 77
struct _GtkContainerClass
{
  GtkWidgetClass parent_class;
78

79 80
  /*< public >*/

Tim Janik's avatar
Tim Janik committed
81
  void    (*add)       		(GtkContainer	 *container,
82
				 GtkWidget	 *widget);
Tim Janik's avatar
Tim Janik committed
83
  void    (*remove)    		(GtkContainer	 *container,
84
				 GtkWidget	 *widget);
Tim Janik's avatar
Tim Janik committed
85 86
  void    (*check_resize)	(GtkContainer	 *container);
  void    (*forall)    		(GtkContainer	 *container,
87
				 gboolean	  include_internals,
88
				 GtkCallback	  callback,
89
				 gpointer	  callback_data);
Tim Janik's avatar
Tim Janik committed
90
  void    (*set_focus_child)	(GtkContainer	 *container,
91
				 GtkWidget	 *child);
Manish Singh's avatar
Manish Singh committed
92
  GType   (*child_type)		(GtkContainer	 *container);
Tim Janik's avatar
Tim Janik committed
93 94 95 96 97 98 99 100 101 102 103 104
  gchar*  (*composite_name)	(GtkContainer	 *container,
				 GtkWidget	 *child);
  void    (*set_child_property) (GtkContainer    *container,
				 GtkWidget       *child,
				 guint            property_id,
				 const GValue    *value,
				 GParamSpec      *pspec);
  void    (*get_child_property) (GtkContainer    *container,
                                 GtkWidget       *child,
				 guint            property_id,
				 GValue          *value,
				 GParamSpec      *pspec);
105 106
  GtkWidgetPath * (*get_path_for_child) (GtkContainer *container,
                                         GtkWidget    *child);
107

108 109 110 111 112

  /*< private >*/

  unsigned int _handle_border_width : 1;

113
  /* Padding for future expansion */
114 115 116 117
  void (*_gtk_reserved1) (void);
  void (*_gtk_reserved2) (void);
  void (*_gtk_reserved3) (void);
  void (*_gtk_reserved4) (void);
118 119 120 121
  void (*_gtk_reserved5) (void);
  void (*_gtk_reserved6) (void);
  void (*_gtk_reserved7) (void);
  void (*_gtk_reserved8) (void);
Elliot Lee's avatar
Elliot Lee committed
122 123
};

124

125
/* Application-level methods */
Elliot Lee's avatar
Elliot Lee committed
126

127
GDK_AVAILABLE_IN_ALL
Manish Singh's avatar
Manish Singh committed
128
GType   gtk_container_get_type		 (void) G_GNUC_CONST;
129
GDK_AVAILABLE_IN_ALL
130
void    gtk_container_set_border_width	 (GtkContainer	   *container,
131
					  guint		    border_width);
132
GDK_AVAILABLE_IN_ALL
133
guint   gtk_container_get_border_width   (GtkContainer     *container);
134
GDK_AVAILABLE_IN_ALL
135 136
void    gtk_container_add		 (GtkContainer	   *container,
					  GtkWidget	   *widget);
137
GDK_AVAILABLE_IN_ALL
138 139
void    gtk_container_remove		 (GtkContainer	   *container,
					  GtkWidget	   *widget);
140

141
GDK_DEPRECATED_IN_3_12
142 143
void    gtk_container_set_resize_mode    (GtkContainer     *container,
					  GtkResizeMode     resize_mode);
144
GDK_DEPRECATED_IN_3_12
145
GtkResizeMode gtk_container_get_resize_mode (GtkContainer     *container);
146

147
GDK_AVAILABLE_IN_ALL
148 149
void    gtk_container_check_resize       (GtkContainer     *container);

150
GDK_AVAILABLE_IN_ALL
151 152 153
void     gtk_container_foreach      (GtkContainer       *container,
				     GtkCallback         callback,
				     gpointer            callback_data);
154
GDK_AVAILABLE_IN_ALL
155 156
GList*   gtk_container_get_children     (GtkContainer       *container);

157
GDK_AVAILABLE_IN_ALL
158 159 160
void     gtk_container_propagate_draw   (GtkContainer   *container,
					 GtkWidget      *child,
					 cairo_t        *cr);
161

162
GDK_AVAILABLE_IN_ALL
163 164
void     gtk_container_set_focus_chain  (GtkContainer   *container,
                                         GList          *focusable_widgets);
165
GDK_AVAILABLE_IN_ALL
166 167
gboolean gtk_container_get_focus_chain  (GtkContainer   *container,
					 GList         **focusable_widgets);
168
GDK_AVAILABLE_IN_ALL
169 170
void     gtk_container_unset_focus_chain (GtkContainer  *container);

171 172 173
#define GTK_IS_RESIZE_CONTAINER(widget) (GTK_IS_CONTAINER (widget) && \
                                        (gtk_container_get_resize_mode (GTK_CONTAINER (widget)) != GTK_RESIZE_PARENT))

174 175
/* Widget-level methods */

176
GDK_AVAILABLE_IN_ALL
177 178
void   gtk_container_set_reallocate_redraws (GtkContainer    *container,
					     gboolean         needs_redraws);
179
GDK_AVAILABLE_IN_ALL
180 181
void   gtk_container_set_focus_child	   (GtkContainer     *container,
					    GtkWidget	     *child);
182
GDK_AVAILABLE_IN_ALL
183 184
GtkWidget *
       gtk_container_get_focus_child	   (GtkContainer     *container);
185
GDK_AVAILABLE_IN_ALL
186 187
void   gtk_container_set_focus_vadjustment (GtkContainer     *container,
					    GtkAdjustment    *adjustment);
188
GDK_AVAILABLE_IN_ALL
189
GtkAdjustment *gtk_container_get_focus_vadjustment (GtkContainer *container);
190
GDK_AVAILABLE_IN_ALL
191 192
void   gtk_container_set_focus_hadjustment (GtkContainer     *container,
					    GtkAdjustment    *adjustment);
193
GDK_AVAILABLE_IN_ALL
194
GtkAdjustment *gtk_container_get_focus_hadjustment (GtkContainer *container);
195

196
GDK_DEPRECATED_IN_3_10
197
void    gtk_container_resize_children      (GtkContainer     *container);
198

199
GDK_AVAILABLE_IN_ALL
Manish Singh's avatar
Manish Singh committed
200
GType   gtk_container_child_type	   (GtkContainer     *container);
201

202

203
GDK_AVAILABLE_IN_ALL
Tim Janik's avatar
Tim Janik committed
204 205 206
void         gtk_container_class_install_child_property (GtkContainerClass *cclass,
							 guint		    property_id,
							 GParamSpec	   *pspec);
207
GDK_AVAILABLE_IN_ALL
Tim Janik's avatar
Tim Janik committed
208 209
GParamSpec*  gtk_container_class_find_child_property	(GObjectClass	   *cclass,
							 const gchar	   *property_name);
210
GDK_AVAILABLE_IN_ALL
Tim Janik's avatar
Tim Janik committed
211 212
GParamSpec** gtk_container_class_list_child_properties	(GObjectClass	   *cclass,
							 guint		   *n_properties);
213
GDK_AVAILABLE_IN_ALL
Tim Janik's avatar
Tim Janik committed
214 215 216
void         gtk_container_add_with_properties		(GtkContainer	   *container,
							 GtkWidget	   *widget,
							 const gchar	   *first_prop_name,
217
							 ...) G_GNUC_NULL_TERMINATED;
218
GDK_AVAILABLE_IN_ALL
Tim Janik's avatar
Tim Janik committed
219 220 221
void         gtk_container_child_set			(GtkContainer	   *container,
							 GtkWidget	   *child,
							 const gchar	   *first_prop_name,
222
							 ...) G_GNUC_NULL_TERMINATED;
223
GDK_AVAILABLE_IN_ALL
Tim Janik's avatar
Tim Janik committed
224 225 226
void         gtk_container_child_get			(GtkContainer	   *container,
							 GtkWidget	   *child,
							 const gchar	   *first_prop_name,
227
							 ...) G_GNUC_NULL_TERMINATED;
228
GDK_AVAILABLE_IN_ALL
Tim Janik's avatar
Tim Janik committed
229 230 231 232
void         gtk_container_child_set_valist		(GtkContainer	   *container,
							 GtkWidget	   *child,
							 const gchar	   *first_property_name,
							 va_list	    var_args);
233
GDK_AVAILABLE_IN_ALL
Tim Janik's avatar
Tim Janik committed
234 235 236 237
void         gtk_container_child_get_valist		(GtkContainer	   *container,
							 GtkWidget	   *child,
							 const gchar	   *first_property_name,
							 va_list	    var_args);
238
GDK_AVAILABLE_IN_ALL
239 240 241 242
void	     gtk_container_child_set_property		(GtkContainer	   *container,
							 GtkWidget	   *child,
							 const gchar	   *property_name,
							 const GValue	   *value);
243
GDK_AVAILABLE_IN_ALL
244 245 246
void	     gtk_container_child_get_property		(GtkContainer	   *container,
							 GtkWidget	   *child,
							 const gchar	   *property_name,
247 248
	                                                 GValue		   *value);

249
GDK_AVAILABLE_IN_3_2
250 251
void gtk_container_child_notify (GtkContainer *container,
                                 GtkWidget    *child,
252
                                 const gchar  *child_property);
Tim Janik's avatar
Tim Janik committed
253

254 255
/**
 * GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID:
256
 * @object: the #GObject on which set_child_property() or get_child_property()
257 258 259 260 261
 *  was called
 * @property_id: the numeric id of the property
 * @pspec: the #GParamSpec of the property
 *
 * This macro should be used to emit a standard warning about unexpected
262
 * properties in set_child_property() and get_child_property() implementations.
263
 */
Tim Janik's avatar
Tim Janik committed
264
#define GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID(object, property_id, pspec) \
265
    G_OBJECT_WARN_INVALID_PSPEC ((object), "child property", (property_id), (pspec))
266

Tim Janik's avatar
Tim Janik committed
267

268
GDK_AVAILABLE_IN_ALL
269 270 271
void    gtk_container_forall		     (GtkContainer *container,
					      GtkCallback   callback,
					      gpointer	    callback_data);
272

273
GDK_AVAILABLE_IN_ALL
274 275
void    gtk_container_class_handle_border_width (GtkContainerClass *klass);

276
GDK_AVAILABLE_IN_ALL
277 278 279
GtkWidgetPath * gtk_container_get_path_for_child (GtkContainer      *container,
                                                  GtkWidget         *child);

280
G_END_DECLS
Elliot Lee's avatar
Elliot Lee committed
281 282

#endif /* __GTK_CONTAINER_H__ */