gtkwidget.c 348 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
15 16 17
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
Elliot Lee's avatar
Elliot Lee committed
18
 */
19 20

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

27 28
#undef GDK_DISABLE_DEPRECATED /* gdk_input_set_extension_events() */

29
#include "config.h"
Elliot Lee's avatar
Elliot Lee committed
30 31
#include <stdarg.h>
#include <string.h>
32
#include <locale.h>
Elliot Lee's avatar
Elliot Lee committed
33
#include "gtkcontainer.h"
34
#include "gtkaccelmap.h"
35
#include "gtkclipboard.h"
36
#include "gtkiconfactory.h"
37
#include "gtkintl.h"
Elliot Lee's avatar
Elliot Lee committed
38
#include "gtkmain.h"
39
#include "gtkmarshalers.h"
Elliot Lee's avatar
Elliot Lee committed
40 41
#include "gtkrc.h"
#include "gtkselection.h"
42
#include "gtksettings.h"
43
#include "gtksizegroup.h"
Elliot Lee's avatar
Elliot Lee committed
44 45
#include "gtkwidget.h"
#include "gtkwindow.h"
Tim Janik's avatar
Tim Janik committed
46
#include "gtkbindings.h"
47
#include "gtkprivate.h"
Elliot Lee's avatar
Elliot Lee committed
48
#include "gdk/gdk.h"
49
#include "gdk/gdkprivate.h" /* Used in gtk_reset_shapes_recurse to avoid copy */
Tim Janik's avatar
Tim Janik committed
50 51
#include <gobject/gvaluecollector.h>
#include <gobject/gobjectnotifyqueue.c>
Owen Taylor's avatar
Owen Taylor committed
52
#include "gdk/gdkkeysyms.h"
53
#include "gtkaccessible.h"
Kristian Rietveld's avatar
Kristian Rietveld committed
54
#include "gtktooltip.h"
55
#include "gtkinvisible.h"
Johan Dahlin's avatar
Johan Dahlin committed
56
#include "gtkbuildable.h"
57
#include "gtkbuilderprivate.h"
58
#include "gtksizerequest.h"
59
#include "gtkalias.h"
Elliot Lee's avatar
Elliot Lee committed
60

61 62 63 64 65 66 67
/**
 * SECTION:gtkwidget
 * @Short_description: Base class for all widgets
 * @Title: GtkWidget
 *
 * GtkWidget is the base class all widgets in GTK+ derive from. It manages the
 * widget lifecycle, states and style.
68
 *
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
 * <refsect2 id="style-properties">
 * <para>
 * <structname>GtkWidget</structname> introduces <firstterm>style
 * properties</firstterm> - these are basically object properties that are stored
 * not on the object, but in the style object associated to the widget. Style
 * properties are set in <link linkend="gtk-Resource-Files">resource files</link>.
 * This mechanism is used for configuring such things as the location of the
 * scrollbar arrows through the theme, giving theme authors more control over the
 * look of applications without the need to write a theme engine in C.
 * </para>
 * <para>
 * Use gtk_widget_class_install_style_property() to install style properties for
 * a widget class, gtk_widget_class_find_style_property() or
 * gtk_widget_class_list_style_properties() to get information about existing
 * style properties and gtk_widget_style_get_property(), gtk_widget_style_get() or
 * gtk_widget_style_get_valist() to obtain the value of a style property.
 * </para>
 * </refsect2>
 * <refsect2 id="GtkWidget-BUILDER-UI">
 * <title>GtkWidget as GtkBuildable</title>
 * <para>
 * The GtkWidget implementation of the GtkBuildable interface supports a
 * custom &lt;accelerator&gt; element, which has attributes named key,
 * modifiers and signal and allows to specify accelerators.
 * </para>
 * <example>
 * <title>A UI definition fragment specifying an accelerator</title>
 * <programlisting><![CDATA[
 * <object class="GtkButton">
 *   <accelerator key="q" modifiers="GDK_CONTROL_MASK" signal="clicked"/>
 * </object>
 * ]]></programlisting>
 * </example>
 * <para>
 * In addition to accelerators, <structname>GtkWidget</structname> also support a
 * custom &lt;accessible&gt; element, which supports actions and relations.
 * Properties on the accessible implementation of an object can be set by accessing the
 * internal child "accessible" of a <structname>GtkWidget</structname>.
 * </para>
 * <example>
 * <title>A UI definition fragment specifying an accessible</title>
 * <programlisting><![CDATA[
 * <object class="GtkButton" id="label1"/>
 *   <property name="label">I am a Label for a Button</property>
 * </object>
 * <object class="GtkButton" id="button1">
 *   <accessibility>
 *     <action action_name="click" translatable="yes">Click the button.</action>
 *     <relation target="label1" type="labelled-by"/>
 *   </accessibility>
 *   <child internal-child="accessible">
 *     <object class="AtkObject" id="a11y-button1">
 *       <property name="AtkObject::name">Clickable Button</property>
 *     </object>
 *   </child>
 * </object>
 * ]]></programlisting>
 * </example>
 * </refsect2>
 */

130
#define WIDGET_CLASS(w)	 GTK_WIDGET_GET_CLASS (w)
Tim Janik's avatar
Tim Janik committed
131
#define	INIT_PATH_SIZE	(512)
Elliot Lee's avatar
Elliot Lee committed
132 133 134 135 136 137 138 139 140 141 142 143


enum {
  SHOW,
  HIDE,
  MAP,
  UNMAP,
  REALIZE,
  UNREALIZE,
  SIZE_REQUEST,
  SIZE_ALLOCATE,
  STATE_CHANGED,
144
  PARENT_SET,
Owen Taylor's avatar
Owen Taylor committed
145
  HIERARCHY_CHANGED,
146
  STYLE_SET,
147
  DIRECTION_CHANGED,
148
  GRAB_NOTIFY,
Tim Janik's avatar
Tim Janik committed
149
  CHILD_NOTIFY,
150
  MNEMONIC_ACTIVATE,
151
  GRAB_FOCUS,
152
  FOCUS,
153
  MOVE_FOCUS,
Elliot Lee's avatar
Elliot Lee committed
154
  EVENT,
155
  EVENT_AFTER,
Elliot Lee's avatar
Elliot Lee committed
156 157
  BUTTON_PRESS_EVENT,
  BUTTON_RELEASE_EVENT,
158
  SCROLL_EVENT,
Elliot Lee's avatar
Elliot Lee committed
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
  MOTION_NOTIFY_EVENT,
  DELETE_EVENT,
  DESTROY_EVENT,
  EXPOSE_EVENT,
  KEY_PRESS_EVENT,
  KEY_RELEASE_EVENT,
  ENTER_NOTIFY_EVENT,
  LEAVE_NOTIFY_EVENT,
  CONFIGURE_EVENT,
  FOCUS_IN_EVENT,
  FOCUS_OUT_EVENT,
  MAP_EVENT,
  UNMAP_EVENT,
  PROPERTY_NOTIFY_EVENT,
  SELECTION_CLEAR_EVENT,
  SELECTION_REQUEST_EVENT,
  SELECTION_NOTIFY_EVENT,
176
  SELECTION_GET,
Elliot Lee's avatar
Elliot Lee committed
177 178 179
  SELECTION_RECEIVED,
  PROXIMITY_IN_EVENT,
  PROXIMITY_OUT_EVENT,
180 181 182 183 184 185 186 187
  DRAG_BEGIN,
  DRAG_END,
  DRAG_DATA_DELETE,
  DRAG_LEAVE,
  DRAG_MOTION,
  DRAG_DROP,
  DRAG_DATA_GET,
  DRAG_DATA_RECEIVED,
188
  CLIENT_EVENT,
189
  NO_EXPOSE_EVENT,
190
  VISIBILITY_NOTIFY_EVENT,
Havoc Pennington's avatar
Havoc Pennington committed
191
  WINDOW_STATE_EVENT,
Owen Taylor's avatar
Owen Taylor committed
192
  POPUP_MENU,
193
  SHOW_HELP,
194
  ACCEL_CLOSURES_CHANGED,
Owen Taylor's avatar
Owen Taylor committed
195
  SCREEN_CHANGED,
196
  CAN_ACTIVATE_ACCEL,
197
  GRAB_BROKEN,
Søren Sandmann's avatar
Søren Sandmann committed
198
  COMPOSITED_CHANGED,
Kristian Rietveld's avatar
Kristian Rietveld committed
199
  QUERY_TOOLTIP,
200
  KEYNAV_FAILED,
201
  DRAG_FAILED,
202
  DAMAGE_EVENT,
Elliot Lee's avatar
Elliot Lee committed
203 204 205
  LAST_SIGNAL
};

206
enum {
Alexander Larsson's avatar
Alexander Larsson committed
207 208 209
  PROP_0,
  PROP_NAME,
  PROP_PARENT,
Havoc Pennington's avatar
Havoc Pennington committed
210 211
  PROP_WIDTH_REQUEST,
  PROP_HEIGHT_REQUEST,
Alexander Larsson's avatar
Alexander Larsson committed
212 213 214 215 216
  PROP_VISIBLE,
  PROP_SENSITIVE,
  PROP_APP_PAINTABLE,
  PROP_CAN_FOCUS,
  PROP_HAS_FOCUS,
217
  PROP_IS_FOCUS,
Alexander Larsson's avatar
Alexander Larsson committed
218 219 220 221 222 223
  PROP_CAN_DEFAULT,
  PROP_HAS_DEFAULT,
  PROP_RECEIVES_DEFAULT,
  PROP_COMPOSITE_CHILD,
  PROP_STYLE,
  PROP_EVENTS,
224
  PROP_EXTENSION_EVENTS,
Kristian Rietveld's avatar
Kristian Rietveld committed
225 226
  PROP_NO_SHOW_ALL,
  PROP_HAS_TOOLTIP,
227
  PROP_TOOLTIP_MARKUP,
Tim Janik's avatar
Tim Janik committed
228
  PROP_TOOLTIP_TEXT,
229 230
  PROP_WINDOW,
  PROP_DOUBLE_BUFFERED
231 232
};

233 234 235 236 237
typedef	struct	_GtkStateData	 GtkStateData;

struct _GtkStateData
{
  GtkStateType  state;
238
  guint		state_restoration : 1;
239
  guint         parent_sensitive : 1;
240
  guint		use_forall : 1;
241
};
Elliot Lee's avatar
Elliot Lee committed
242

Tim Janik's avatar
Tim Janik committed
243
/* --- prototypes --- */
244 245 246
static void	gtk_widget_class_init		(GtkWidgetClass     *klass);
static void	gtk_widget_base_class_finalize	(GtkWidgetClass     *klass);
static void	gtk_widget_init			(GtkWidget          *widget);
Tim Janik's avatar
Tim Janik committed
247
static void	gtk_widget_set_property		 (GObject           *object,
Alexander Larsson's avatar
Alexander Larsson committed
248 249 250
						  guint              prop_id,
						  const GValue      *value,
						  GParamSpec        *pspec);
Tim Janik's avatar
Tim Janik committed
251
static void	gtk_widget_get_property		 (GObject           *object,
Alexander Larsson's avatar
Alexander Larsson committed
252 253 254
						  guint              prop_id,
						  GValue            *value,
						  GParamSpec        *pspec);
Tim Janik's avatar
Tim Janik committed
255
static void	gtk_widget_dispose		 (GObject	    *object);
Tim Janik's avatar
Tim Janik committed
256 257 258 259 260 261 262 263 264
static void	gtk_widget_real_destroy		 (GtkObject	    *object);
static void	gtk_widget_finalize		 (GObject	    *object);
static void	gtk_widget_real_show		 (GtkWidget	    *widget);
static void	gtk_widget_real_hide		 (GtkWidget	    *widget);
static void	gtk_widget_real_map		 (GtkWidget	    *widget);
static void	gtk_widget_real_unmap		 (GtkWidget	    *widget);
static void	gtk_widget_real_realize		 (GtkWidget	    *widget);
static void	gtk_widget_real_unrealize	 (GtkWidget	    *widget);
static void	gtk_widget_real_size_request	 (GtkWidget	    *widget,
265
						  GtkRequisition    *requisition);
Tim Janik's avatar
Tim Janik committed
266
static void	gtk_widget_real_size_allocate	 (GtkWidget	    *widget,
267
						  GtkAllocation	    *allocation);
268 269 270 271
static void	gtk_widget_real_style_set        (GtkWidget         *widget,
                                                  GtkStyle          *previous_style);
static void	gtk_widget_real_direction_changed(GtkWidget         *widget,
                                                  GtkTextDirection   previous_direction);
272

Tim Janik's avatar
Tim Janik committed
273
static void	gtk_widget_real_grab_focus	 (GtkWidget         *focus_widget);
Kristian Rietveld's avatar
Kristian Rietveld committed
274 275 276 277 278
static gboolean gtk_widget_real_query_tooltip    (GtkWidget         *widget,
						  gint               x,
						  gint               y,
						  gboolean           keyboard_tip,
						  GtkTooltip        *tooltip);
279
static gboolean gtk_widget_real_show_help        (GtkWidget         *widget,
280 281
                                                  GtkWidgetHelpType  help_type);

Tim Janik's avatar
Tim Janik committed
282 283 284 285 286 287 288 289 290 291 292 293 294
static void	gtk_widget_dispatch_child_properties_changed	(GtkWidget        *object,
								 guint             n_pspecs,
								 GParamSpec      **pspecs);
static gboolean		gtk_widget_real_key_press_event   	(GtkWidget        *widget,
								 GdkEventKey      *event);
static gboolean		gtk_widget_real_key_release_event 	(GtkWidget        *widget,
								 GdkEventKey      *event);
static gboolean		gtk_widget_real_focus_in_event   	 (GtkWidget       *widget,
								  GdkEventFocus   *event);
static gboolean		gtk_widget_real_focus_out_event   	(GtkWidget        *widget,
								 GdkEventFocus    *event);
static gboolean		gtk_widget_real_focus			(GtkWidget        *widget,
								 GtkDirectionType  direction);
295 296
static void             gtk_widget_real_move_focus              (GtkWidget        *widget,
                                                                 GtkDirectionType  direction);
297 298
static gboolean		gtk_widget_real_keynav_failed		(GtkWidget        *widget,
								 GtkDirectionType  direction);
Tim Janik's avatar
Tim Janik committed
299
static PangoContext*	gtk_widget_peek_pango_context		(GtkWidget	  *widget);
300
static void     	gtk_widget_update_pango_context		(GtkWidget	  *widget);
Tim Janik's avatar
Tim Janik committed
301 302
static void		gtk_widget_propagate_state		(GtkWidget	  *widget,
								 GtkStateData 	  *data);
303
static void             gtk_widget_reset_rc_style               (GtkWidget        *widget);
Tim Janik's avatar
Tim Janik committed
304 305 306 307 308 309 310 311 312 313 314
static void		gtk_widget_set_style_internal		(GtkWidget	  *widget,
								 GtkStyle	  *style,
								 gboolean	   initial_emission);
static gint		gtk_widget_event_internal		(GtkWidget	  *widget,
								 GdkEvent	  *event);
static gboolean		gtk_widget_real_mnemonic_activate	(GtkWidget	  *widget,
								 gboolean	   group_cycling);
static void		gtk_widget_aux_info_destroy		(GtkWidgetAuxInfo *aux_info);
static AtkObject*	gtk_widget_real_get_accessible		(GtkWidget	  *widget);
static void		gtk_widget_accessible_interface_init	(AtkImplementorIface *iface);
static AtkObject*	gtk_widget_ref_accessible		(AtkImplementor *implementor);
315 316
static void             gtk_widget_invalidate_widget_windows    (GtkWidget        *widget,
								 GdkRegion        *region);
317
static GdkScreen *      gtk_widget_get_screen_unchecked         (GtkWidget        *widget);
Soeren Sandmann's avatar
Soeren Sandmann committed
318
static void		gtk_widget_queue_shallow_draw		(GtkWidget        *widget);
319 320
static gboolean         gtk_widget_real_can_activate_accel      (GtkWidget *widget,
                                                                 guint      signal_id);
Kristian Rietveld's avatar
Kristian Rietveld committed
321

322
static void             gtk_widget_real_set_has_tooltip         (GtkWidget *widget,
Kristian Rietveld's avatar
Kristian Rietveld committed
323 324
								 gboolean   has_tooltip,
								 gboolean   force);
Johan Dahlin's avatar
Johan Dahlin committed
325 326 327 328
static void             gtk_widget_buildable_interface_init     (GtkBuildableIface *iface);
static void             gtk_widget_buildable_set_name           (GtkBuildable     *buildable,
                                                                 const gchar      *name);
static const gchar *    gtk_widget_buildable_get_name           (GtkBuildable     *buildable);
329 330 331
static GObject *        gtk_widget_buildable_get_internal_child (GtkBuildable *buildable,
								 GtkBuilder   *builder,
								 const gchar  *childname);
332 333 334 335
static void             gtk_widget_buildable_set_buildable_property (GtkBuildable     *buildable,
								     GtkBuilder       *builder,
								     const gchar      *name,
								     const GValue     *value);
Johan Dahlin's avatar
Johan Dahlin committed
336 337 338 339 340 341
static gboolean         gtk_widget_buildable_custom_tag_start   (GtkBuildable     *buildable,
                                                                 GtkBuilder       *builder,
                                                                 GObject          *child,
                                                                 const gchar      *tagname,
                                                                 GMarkupParser    *parser,
                                                                 gpointer         *data);
342
static void             gtk_widget_buildable_custom_finished    (GtkBuildable     *buildable,
Johan Dahlin's avatar
Johan Dahlin committed
343 344 345 346
                                                                 GtkBuilder       *builder,
                                                                 GObject          *child,
                                                                 const gchar      *tagname,
                                                                 gpointer          data);
347
static void             gtk_widget_buildable_parser_finished    (GtkBuildable     *buildable,
Johan Dahlin's avatar
Johan Dahlin committed
348 349
                                                                 GtkBuilder       *builder);

350 351
static void             gtk_widget_size_request_init            (GtkSizeRequestIface *iface);
static void             gtk_widget_real_get_width               (GtkSizeRequest    *widget,
352 353
                                                                 gint              *minimum_size,
                                                                 gint              *natural_size);
354
static void             gtk_widget_real_get_height              (GtkSizeRequest    *widget,
355 356
                                                                 gint              *minimum_size,
                                                                 gint              *natural_size);
357

Matthias Clasen's avatar
Matthias Clasen committed
358
static void             gtk_widget_queue_tooltip_query          (GtkWidget *widget);
359
     
360 361 362
static void gtk_widget_set_usize_internal (GtkWidget *widget,
					   gint       width,
					   gint       height);
363 364
static void gtk_widget_get_draw_rectangle (GtkWidget    *widget,
					   GdkRectangle *rect);
365

366 367 368
static void gtk_widget_add_events_internal (GtkWidget *widget,
                                            GdkDevice *device,
                                            gint       events);
Tim Janik's avatar
Tim Janik committed
369 370

/* --- variables --- */
371
static gpointer         gtk_widget_parent_class = NULL;
372 373 374 375 376 377
static guint            widget_signals[LAST_SIGNAL] = { 0 };
static GtkStyle        *gtk_default_style = NULL;
static GSList          *colormap_stack = NULL;
static guint            composite_child_stack = 0;
static GtkTextDirection gtk_default_direction = GTK_TEXT_DIR_LTR;
static GParamSpecPool  *style_property_spec_pool = NULL;
378

Tim Janik's avatar
Tim Janik committed
379 380
static GQuark		quark_property_parser = 0;
static GQuark		quark_aux_info = 0;
381 382
static GQuark		quark_accel_path = 0;
static GQuark		quark_accel_closures = 0;
Tim Janik's avatar
Tim Janik committed
383
static GQuark		quark_event_mask = 0;
384
static GQuark           quark_device_event_mask = 0;
Tim Janik's avatar
Tim Janik committed
385 386
static GQuark		quark_extension_event_mode = 0;
static GQuark		quark_parent_window = 0;
387
static GQuark		quark_pointer_window = 0;
Tim Janik's avatar
Tim Janik committed
388
static GQuark		quark_shape_info = 0;
389
static GQuark		quark_input_shape_info = 0;
Tim Janik's avatar
Tim Janik committed
390 391 392 393
static GQuark		quark_colormap = 0;
static GQuark		quark_pango_context = 0;
static GQuark		quark_rc_style = 0;
static GQuark		quark_accessible_object = 0;
394
static GQuark		quark_mnemonic_labels = 0;
Kristian Rietveld's avatar
Kristian Rietveld committed
395 396 397
static GQuark		quark_tooltip_markup = 0;
static GQuark		quark_has_tooltip = 0;
static GQuark		quark_tooltip_window = 0;
Tim Janik's avatar
Tim Janik committed
398 399 400 401
GParamSpecPool         *_gtk_widget_child_property_pool = NULL;
GObjectNotifyContext   *_gtk_widget_child_property_notify_context = NULL;

/* --- functions --- */
402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429
GType
gtk_widget_get_type (void)
{
  static GType widget_type = 0;

  if (G_UNLIKELY (widget_type == 0))
    {
      const GTypeInfo widget_info =
      {
	sizeof (GtkWidgetClass),
	NULL,		/* base_init */
	(GBaseFinalizeFunc) gtk_widget_base_class_finalize,
	(GClassInitFunc) gtk_widget_class_init,
	NULL,		/* class_finalize */
	NULL,		/* class_init */
	sizeof (GtkWidget),
	0,		/* n_preallocs */
	(GInstanceInitFunc) gtk_widget_init,
	NULL,		/* value_table */
      };

      const GInterfaceInfo accessibility_info =
      {
	(GInterfaceInitFunc) gtk_widget_accessible_interface_init,
	(GInterfaceFinalizeFunc) NULL,
	NULL /* interface data */
      };

Johan Dahlin's avatar
Johan Dahlin committed
430 431 432 433 434 435 436
      const GInterfaceInfo buildable_info =
      {
	(GInterfaceInitFunc) gtk_widget_buildable_interface_init,
	(GInterfaceFinalizeFunc) NULL,
	NULL /* interface data */
      };

437 438
      const GInterfaceInfo layout_info =
      {
439
	(GInterfaceInitFunc) gtk_widget_size_request_init,
440 441 442 443
	(GInterfaceFinalizeFunc) NULL,
	NULL /* interface data */
      };

444 445 446 447 448
      widget_type = g_type_register_static (GTK_TYPE_OBJECT, "GtkWidget",
                                           &widget_info, G_TYPE_FLAG_ABSTRACT);

      g_type_add_interface_static (widget_type, ATK_TYPE_IMPLEMENTOR,
                                   &accessibility_info) ;
Johan Dahlin's avatar
Johan Dahlin committed
449 450
      g_type_add_interface_static (widget_type, GTK_TYPE_BUILDABLE,
                                   &buildable_info) ;
451
      g_type_add_interface_static (widget_type, GTK_TYPE_SIZE_REQUEST,
452
                                   &layout_info) ;
453 454 455 456
    }

  return widget_type;
}
Elliot Lee's avatar
Elliot Lee committed
457

Tim Janik's avatar
Tim Janik committed
458 459 460 461 462 463 464 465
static void
child_property_notify_dispatcher (GObject     *object,
				  guint        n_pspecs,
				  GParamSpec **pspecs)
{
  GTK_WIDGET_GET_CLASS (object)->dispatch_child_properties_changed (GTK_WIDGET (object), n_pspecs, pspecs);
}

Elliot Lee's avatar
Elliot Lee committed
466 467 468
static void
gtk_widget_class_init (GtkWidgetClass *klass)
{
Tim Janik's avatar
Tim Janik committed
469
  static GObjectNotifyContext cpn_context = { 0, NULL, NULL };
470 471
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
  GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
Owen Taylor's avatar
Owen Taylor committed
472
  GtkBindingSet *binding_set;
473 474 475

  gtk_widget_parent_class = g_type_class_peek_parent (klass);

Tim Janik's avatar
Tim Janik committed
476 477
  quark_property_parser = g_quark_from_static_string ("gtk-rc-property-parser");
  quark_aux_info = g_quark_from_static_string ("gtk-aux-info");
478 479
  quark_accel_path = g_quark_from_static_string ("gtk-accel-path");
  quark_accel_closures = g_quark_from_static_string ("gtk-accel-closures");
Tim Janik's avatar
Tim Janik committed
480
  quark_event_mask = g_quark_from_static_string ("gtk-event-mask");
481
  quark_device_event_mask = g_quark_from_static_string ("gtk-device-event-mask");
Tim Janik's avatar
Tim Janik committed
482 483
  quark_extension_event_mode = g_quark_from_static_string ("gtk-extension-event-mode");
  quark_parent_window = g_quark_from_static_string ("gtk-parent-window");
484
  quark_pointer_window = g_quark_from_static_string ("gtk-pointer-window");
Tim Janik's avatar
Tim Janik committed
485
  quark_shape_info = g_quark_from_static_string ("gtk-shape-info");
486
  quark_input_shape_info = g_quark_from_static_string ("gtk-input-shape-info");
Tim Janik's avatar
Tim Janik committed
487 488 489 490
  quark_colormap = g_quark_from_static_string ("gtk-colormap");
  quark_pango_context = g_quark_from_static_string ("gtk-pango-context");
  quark_rc_style = g_quark_from_static_string ("gtk-rc-style");
  quark_accessible_object = g_quark_from_static_string ("gtk-accessible-object");
491
  quark_mnemonic_labels = g_quark_from_static_string ("gtk-mnemonic-labels");
Kristian Rietveld's avatar
Kristian Rietveld committed
492 493 494
  quark_tooltip_markup = g_quark_from_static_string ("gtk-tooltip-markup");
  quark_has_tooltip = g_quark_from_static_string ("gtk-has-tooltip");
  quark_tooltip_window = g_quark_from_static_string ("gtk-tooltip-window");
Tim Janik's avatar
Tim Janik committed
495 496 497 498 499 500

  style_property_spec_pool = g_param_spec_pool_new (FALSE);
  _gtk_widget_child_property_pool = g_param_spec_pool_new (TRUE);
  cpn_context.quark_notify_queue = g_quark_from_static_string ("GtkWidget-child-property-notify-queue");
  cpn_context.dispatcher = child_property_notify_dispatcher;
  _gtk_widget_child_property_notify_context = &cpn_context;
501

Tim Janik's avatar
Tim Janik committed
502
  gobject_class->dispose = gtk_widget_dispose;
503
  gobject_class->finalize = gtk_widget_finalize;
Alexander Larsson's avatar
Alexander Larsson committed
504 505
  gobject_class->set_property = gtk_widget_set_property;
  gobject_class->get_property = gtk_widget_get_property;
506 507

  object_class->destroy = gtk_widget_real_destroy;
508
  
509 510
  klass->activate_signal = 0;
  klass->set_scroll_adjustments_signal = 0;
Tim Janik's avatar
Tim Janik committed
511
  klass->dispatch_child_properties_changed = gtk_widget_dispatch_child_properties_changed;
512 513 514 515 516 517 518 519 520 521 522 523
  klass->show = gtk_widget_real_show;
  klass->show_all = gtk_widget_show;
  klass->hide = gtk_widget_real_hide;
  klass->hide_all = gtk_widget_hide;
  klass->map = gtk_widget_real_map;
  klass->unmap = gtk_widget_real_unmap;
  klass->realize = gtk_widget_real_realize;
  klass->unrealize = gtk_widget_real_unrealize;
  klass->size_request = gtk_widget_real_size_request;
  klass->size_allocate = gtk_widget_real_size_allocate;
  klass->state_changed = NULL;
  klass->parent_set = NULL;
Owen Taylor's avatar
Owen Taylor committed
524
  klass->hierarchy_changed = NULL;
525 526
  klass->style_set = gtk_widget_real_style_set;
  klass->direction_changed = gtk_widget_real_direction_changed;
Tim Janik's avatar
Tim Janik committed
527 528
  klass->grab_notify = NULL;
  klass->child_notify = NULL;
529
  klass->mnemonic_activate = gtk_widget_real_mnemonic_activate;
530
  klass->grab_focus = gtk_widget_real_grab_focus;
531
  klass->focus = gtk_widget_real_focus;
532 533 534 535 536 537 538 539 540 541 542 543
  klass->event = NULL;
  klass->button_press_event = NULL;
  klass->button_release_event = NULL;
  klass->motion_notify_event = NULL;
  klass->delete_event = NULL;
  klass->destroy_event = NULL;
  klass->expose_event = NULL;
  klass->key_press_event = gtk_widget_real_key_press_event;
  klass->key_release_event = gtk_widget_real_key_release_event;
  klass->enter_notify_event = NULL;
  klass->leave_notify_event = NULL;
  klass->configure_event = NULL;
544 545
  klass->focus_in_event = gtk_widget_real_focus_in_event;
  klass->focus_out_event = gtk_widget_real_focus_out_event;
546 547
  klass->map_event = NULL;
  klass->unmap_event = NULL;
Havoc Pennington's avatar
Havoc Pennington committed
548
  klass->window_state_event = NULL;
549
  klass->property_notify_event = _gtk_selection_property_notify;
550
  klass->selection_clear_event = _gtk_selection_clear;
551 552
  klass->selection_request_event = _gtk_selection_request;
  klass->selection_notify_event = _gtk_selection_notify;
553 554 555 556 557 558 559 560 561 562
  klass->selection_received = NULL;
  klass->proximity_in_event = NULL;
  klass->proximity_out_event = NULL;
  klass->drag_begin = NULL;
  klass->drag_end = NULL;
  klass->drag_data_delete = NULL;
  klass->drag_leave = NULL;
  klass->drag_motion = NULL;
  klass->drag_drop = NULL;
  klass->drag_data_received = NULL;
Owen Taylor's avatar
Owen Taylor committed
563
  klass->screen_changed = NULL;
564
  klass->can_activate_accel = gtk_widget_real_can_activate_accel;
565
  klass->grab_broken_event = NULL;
Kristian Rietveld's avatar
Kristian Rietveld committed
566
  klass->query_tooltip = gtk_widget_real_query_tooltip;
567 568 569 570 571 572

  klass->show_help = gtk_widget_real_show_help;
  
  /* Accessibility support */
  klass->get_accessible = gtk_widget_real_get_accessible;

573 574
  klass->no_expose_event = NULL;

Alexander Larsson's avatar
Alexander Larsson committed
575 576 577
  g_object_class_install_property (gobject_class,
				   PROP_NAME,
				   g_param_spec_string ("name",
578 579
 							P_("Widget name"),
							P_("The name of the widget"),
Alexander Larsson's avatar
Alexander Larsson committed
580
							NULL,
581
							GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
582 583 584
  g_object_class_install_property (gobject_class,
				   PROP_PARENT,
				   g_param_spec_object ("parent",
585 586
							P_("Parent widget"), 
							P_("The parent widget of this widget. Must be a Container widget"),
Alexander Larsson's avatar
Alexander Larsson committed
587
							GTK_TYPE_CONTAINER,
588
							GTK_PARAM_READWRITE));
Havoc Pennington's avatar
Havoc Pennington committed
589

Alexander Larsson's avatar
Alexander Larsson committed
590
  g_object_class_install_property (gobject_class,
Havoc Pennington's avatar
Havoc Pennington committed
591
				   PROP_WIDTH_REQUEST,
Matthias Clasen's avatar
x  
Matthias Clasen committed
592
				   g_param_spec_int ("width-request",
593 594
 						     P_("Width request"),
 						     P_("Override for width request of the widget, or -1 if natural request should be used"),
Alexander Larsson's avatar
Alexander Larsson committed
595 596 597
 						     -1,
 						     G_MAXINT,
 						     -1,
598
 						     GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
599
  g_object_class_install_property (gobject_class,
Havoc Pennington's avatar
Havoc Pennington committed
600
				   PROP_HEIGHT_REQUEST,
Matthias Clasen's avatar
x  
Matthias Clasen committed
601
				   g_param_spec_int ("height-request",
602 603
 						     P_("Height request"),
 						     P_("Override for height request of the widget, or -1 if natural request should be used"),
Alexander Larsson's avatar
Alexander Larsson committed
604 605 606
 						     -1,
 						     G_MAXINT,
 						     -1,
607
 						     GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
608 609 610
  g_object_class_install_property (gobject_class,
				   PROP_VISIBLE,
				   g_param_spec_boolean ("visible",
611 612
 							 P_("Visible"),
 							 P_("Whether the widget is visible"),
Alexander Larsson's avatar
Alexander Larsson committed
613
 							 FALSE,
614
 							 GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
615 616 617
  g_object_class_install_property (gobject_class,
				   PROP_SENSITIVE,
				   g_param_spec_boolean ("sensitive",
618 619
 							 P_("Sensitive"),
 							 P_("Whether the widget responds to input"),
Alexander Larsson's avatar
Alexander Larsson committed
620
 							 TRUE,
621
 							 GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
622 623
  g_object_class_install_property (gobject_class,
				   PROP_APP_PAINTABLE,
Matthias Clasen's avatar
x  
Matthias Clasen committed
624
				   g_param_spec_boolean ("app-paintable",
625 626
 							 P_("Application paintable"),
 							 P_("Whether the application will paint directly on the widget"),
Alexander Larsson's avatar
Alexander Larsson committed
627
 							 FALSE,
628
 							 GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
629 630
  g_object_class_install_property (gobject_class,
				   PROP_CAN_FOCUS,
Matthias Clasen's avatar
x  
Matthias Clasen committed
631
				   g_param_spec_boolean ("can-focus",
632 633
 							 P_("Can focus"),
 							 P_("Whether the widget can accept the input focus"),
Alexander Larsson's avatar
Alexander Larsson committed
634
 							 FALSE,
635
 							 GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
636 637
  g_object_class_install_property (gobject_class,
				   PROP_HAS_FOCUS,
Matthias Clasen's avatar
x  
Matthias Clasen committed
638
				   g_param_spec_boolean ("has-focus",
639 640
 							 P_("Has focus"),
 							 P_("Whether the widget has the input focus"),
Alexander Larsson's avatar
Alexander Larsson committed
641
 							 FALSE,
642
 							 GTK_PARAM_READWRITE));
643
  g_object_class_install_property (gobject_class,
644
				   PROP_IS_FOCUS,
Matthias Clasen's avatar
x  
Matthias Clasen committed
645
				   g_param_spec_boolean ("is-focus",
646 647
 							 P_("Is focus"),
 							 P_("Whether the widget is the focus widget within the toplevel"),
648
 							 FALSE,
649
 							 GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
650 651
  g_object_class_install_property (gobject_class,
				   PROP_CAN_DEFAULT,
Matthias Clasen's avatar
x  
Matthias Clasen committed
652
				   g_param_spec_boolean ("can-default",
653 654
 							 P_("Can default"),
 							 P_("Whether the widget can be the default widget"),
Alexander Larsson's avatar
Alexander Larsson committed
655
 							 FALSE,
656
 							 GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
657 658
  g_object_class_install_property (gobject_class,
				   PROP_HAS_DEFAULT,
Matthias Clasen's avatar
x  
Matthias Clasen committed
659
				   g_param_spec_boolean ("has-default",
660 661
 							 P_("Has default"),
 							 P_("Whether the widget is the default widget"),
Alexander Larsson's avatar
Alexander Larsson committed
662
 							 FALSE,
663
 							 GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
664 665
  g_object_class_install_property (gobject_class,
				   PROP_RECEIVES_DEFAULT,
Matthias Clasen's avatar
x  
Matthias Clasen committed
666
				   g_param_spec_boolean ("receives-default",
667 668
 							 P_("Receives default"),
 							 P_("If TRUE, the widget will receive the default action when it is focused"),
Alexander Larsson's avatar
Alexander Larsson committed
669
 							 FALSE,
670
 							 GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
671 672
  g_object_class_install_property (gobject_class,
				   PROP_COMPOSITE_CHILD,
Matthias Clasen's avatar
x  
Matthias Clasen committed
673
				   g_param_spec_boolean ("composite-child",
674 675
 							 P_("Composite child"),
 							 P_("Whether the widget is part of a composite widget"),
Alexander Larsson's avatar
Alexander Larsson committed
676
 							 FALSE,
677
 							 GTK_PARAM_READABLE));
Alexander Larsson's avatar
Alexander Larsson committed
678 679 680
  g_object_class_install_property (gobject_class,
				   PROP_STYLE,
				   g_param_spec_object ("style",
681 682
 							P_("Style"),
 							P_("The style of the widget, which contains information about how it will look (colors etc)"),
Alexander Larsson's avatar
Alexander Larsson committed
683
 							GTK_TYPE_STYLE,
684
 							GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
685 686 687
  g_object_class_install_property (gobject_class,
				   PROP_EVENTS,
				   g_param_spec_flags ("events",
688 689
 						       P_("Events"),
 						       P_("The event mask that decides what kind of GdkEvents this widget gets"),
690
 						       GDK_TYPE_EVENT_MASK,
Alexander Larsson's avatar
Alexander Larsson committed
691
 						       GDK_STRUCTURE_MASK,
692
 						       GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
693 694
  g_object_class_install_property (gobject_class,
				   PROP_EXTENSION_EVENTS,
Matthias Clasen's avatar
x  
Matthias Clasen committed
695
				   g_param_spec_enum ("extension-events",
696 697
 						      P_("Extension events"),
 						      P_("The mask that decides what kind of extension events this widget gets"),
698
 						      GDK_TYPE_EXTENSION_MODE,
Alexander Larsson's avatar
Alexander Larsson committed
699
 						      GDK_EXTENSION_EVENTS_NONE,
700
 						      GTK_PARAM_READWRITE));
701 702
  g_object_class_install_property (gobject_class,
				   PROP_NO_SHOW_ALL,
Matthias Clasen's avatar
x  
Matthias Clasen committed
703
				   g_param_spec_boolean ("no-show-all",
704 705
 							 P_("No show all"),
 							 P_("Whether gtk_widget_show_all() should not affect this widget"),
706
 							 FALSE,
707
 							 GTK_PARAM_READWRITE));
Kristian Rietveld's avatar
Kristian Rietveld committed
708 709 710 711

/**
 * GtkWidget:has-tooltip:
 *
712 713 714
 * Enables or disables the emission of #GtkWidget::query-tooltip on @widget.  
 * A value of %TRUE indicates that @widget can have a tooltip, in this case
 * the widget will be queried using #GtkWidget::query-tooltip to determine
Kristian Rietveld's avatar
Kristian Rietveld committed
715 716
 * whether it will provide a tooltip or not.
 *
717 718 719 720 721
 * Note that setting this property to %TRUE for the first time will change
 * the event masks of the GdkWindows of this widget to include leave-notify
 * and motion-notify events.  This cannot and will not be undone when the
 * property is set to %FALSE again.
 *
Kristian Rietveld's avatar
Kristian Rietveld committed
722 723 724 725 726 727 728 729 730
 * Since: 2.12
 */
  g_object_class_install_property (gobject_class,
				   PROP_HAS_TOOLTIP,
				   g_param_spec_boolean ("has-tooltip",
 							 P_("Has tooltip"),
 							 P_("Whether this widget has a tooltip"),
 							 FALSE,
 							 GTK_PARAM_READWRITE));
731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765
  /**
   * GtkWidget:tooltip-text:
   *
   * Sets the text of tooltip to be the given string.
   *
   * Also see gtk_tooltip_set_text().
   *
   * This is a convenience property which will take care of getting the
   * tooltip shown if the given string is not %NULL: #GtkWidget:has-tooltip
   * will automatically be set to %TRUE and there will be taken care of
   * #GtkWidget::query-tooltip in the default signal handler.
   *
   * Since: 2.12
   */
  g_object_class_install_property (gobject_class,
                                   PROP_TOOLTIP_TEXT,
                                   g_param_spec_string ("tooltip-text",
                                                        P_("Tooltip Text"),
                                                        P_("The contents of the tooltip for this widget"),
                                                        NULL,
                                                        GTK_PARAM_READWRITE));
  /**
   * GtkWidget:tooltip-markup:
   *
   * Sets the text of tooltip to be the given string, which is marked up
   * with the <link linkend="PangoMarkupFormat">Pango text markup language</link>.
   * Also see gtk_tooltip_set_markup().
   *
   * This is a convenience property which will take care of getting the
   * tooltip shown if the given string is not %NULL: #GtkWidget:has-tooltip
   * will automatically be set to %TRUE and there will be taken care of
   * #GtkWidget::query-tooltip in the default signal handler.
   *
   * Since: 2.12
   */
Kristian Rietveld's avatar
Kristian Rietveld committed
766 767 768 769 770 771 772 773
  g_object_class_install_property (gobject_class,
				   PROP_TOOLTIP_MARKUP,
				   g_param_spec_string ("tooltip-markup",
 							P_("Tooltip markup"),
							P_("The contents of the tooltip for this widget"),
							NULL,
							GTK_PARAM_READWRITE));

Tim Janik's avatar
Tim Janik committed
774 775 776
  /**
   * GtkWidget:window:
   *
777
   * The widget's window if it is realized, %NULL otherwise.
Tim Janik's avatar
Tim Janik committed
778
   *
779
   * Since: 2.14
Tim Janik's avatar
Tim Janik committed
780 781 782 783 784
   */
  g_object_class_install_property (gobject_class,
				   PROP_WINDOW,
				   g_param_spec_object ("window",
 							P_("Window"),
785
							P_("The widget's window if it is realized"),
Tim Janik's avatar
Tim Janik committed
786 787 788
							GDK_TYPE_WINDOW,
							GTK_PARAM_READABLE));

789
  /**
790
   * GtkWidget:double-buffered
791 792 793 794 795 796 797 798 799 800 801 802 803
   *
   * Whether or not the widget is double buffered.
   *
   * Since: 2.18
   */
  g_object_class_install_property (gobject_class,
                                   PROP_DOUBLE_BUFFERED,
                                   g_param_spec_boolean ("double-buffered",
                                                         P_("Double Buffered"),
                                                         P_("Whether or not the widget is double buffered"),
                                                         TRUE,
                                                         GTK_PARAM_READWRITE));

804 805 806 807
  /**
   * GtkWidget::show:
   * @widget: the object which received the signal.
   */
Elliot Lee's avatar
Elliot Lee committed
808
  widget_signals[SHOW] =
Matthias Clasen's avatar
Matthias Clasen committed
809
    g_signal_new (I_("show"),
Manish Singh's avatar
Manish Singh committed
810 811 812 813 814 815
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_FIRST,
		  G_STRUCT_OFFSET (GtkWidgetClass, show),
		  NULL, NULL,
		  _gtk_marshal_VOID__VOID,
		  G_TYPE_NONE, 0);
816 817 818 819 820

  /**
   * GtkWidget::hide:
   * @widget: the object which received the signal.
   */
Elliot Lee's avatar
Elliot Lee committed
821
  widget_signals[HIDE] =
Matthias Clasen's avatar
Matthias Clasen committed
822
    g_signal_new (I_("hide"),
Manish Singh's avatar
Manish Singh committed
823 824 825 826 827 828
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_FIRST,
		  G_STRUCT_OFFSET (GtkWidgetClass, hide),
		  NULL, NULL,
		  _gtk_marshal_VOID__VOID,
		  G_TYPE_NONE, 0);
829 830 831 832 833

  /**
   * GtkWidget::map:
   * @widget: the object which received the signal.
   */
Elliot Lee's avatar
Elliot Lee committed
834
  widget_signals[MAP] =
Matthias Clasen's avatar
Matthias Clasen committed
835
    g_signal_new (I_("map"),
Manish Singh's avatar
Manish Singh committed
836 837 838 839 840 841
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_FIRST,
		  G_STRUCT_OFFSET (GtkWidgetClass, map),
		  NULL, NULL,
		  _gtk_marshal_VOID__VOID,
		  G_TYPE_NONE, 0);
842 843 844 845 846

  /**
   * GtkWidget::unmap:
   * @widget: the object which received the signal.
   */
Elliot Lee's avatar
Elliot Lee committed
847
  widget_signals[UNMAP] =
Matthias Clasen's avatar
Matthias Clasen committed
848
    g_signal_new (I_("unmap"),
Manish Singh's avatar
Manish Singh committed
849 850 851 852 853 854
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_FIRST,
		  G_STRUCT_OFFSET (GtkWidgetClass, unmap),
		  NULL, NULL,
		  _gtk_marshal_VOID__VOID,
		  G_TYPE_NONE, 0);
855 856 857 858 859

  /**
   * GtkWidget::realize:
   * @widget: the object which received the signal.
   */
Elliot Lee's avatar
Elliot Lee committed
860
  widget_signals[REALIZE] =
Matthias Clasen's avatar
Matthias Clasen committed
861
    g_signal_new (I_("realize"),
Manish Singh's avatar
Manish Singh committed
862 863 864 865 866 867
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_FIRST,
		  G_STRUCT_OFFSET (GtkWidgetClass, realize),
		  NULL, NULL,
		  _gtk_marshal_VOID__VOID,
		  G_TYPE_NONE, 0);
868 869 870 871 872

  /**
   * GtkWidget::unrealize:
   * @widget: the object which received the signal.
   */
Elliot Lee's avatar
Elliot Lee committed
873
  widget_signals[UNREALIZE] =
Matthias Clasen's avatar
Matthias Clasen committed
874
    g_signal_new (I_("unrealize"),
Manish Singh's avatar
Manish Singh committed
875 876 877 878 879 880
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, unrealize),
		  NULL, NULL,
		  _gtk_marshal_VOID__VOID,
		  G_TYPE_NONE, 0);
881 882 883 884 885 886

  /**
   * GtkWidget::size-request:
   * @widget: the object which received the signal.
   * @requisition:
   */
Elliot Lee's avatar
Elliot Lee committed
887
  widget_signals[SIZE_REQUEST] =
Sven Neumann's avatar
Sven Neumann committed
888
    g_signal_new (I_("size-request"),
Manish Singh's avatar
Manish Singh committed
889 890 891 892 893 894 895
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_FIRST,
		  G_STRUCT_OFFSET (GtkWidgetClass, size_request),
		  NULL, NULL,
		  _gtk_marshal_VOID__BOXED,
		  G_TYPE_NONE, 1,
		  GTK_TYPE_REQUISITION | G_SIGNAL_TYPE_STATIC_SCOPE);
896 897 898 899 900 901

  /**
   * GtkWidget::size-allocate:
   * @widget: the object which received the signal.
   * @allocation:
   */
902
  widget_signals[SIZE_ALLOCATE] = 
Sven Neumann's avatar
Sven Neumann committed
903
    g_signal_new (I_("size-allocate"),
Manish Singh's avatar
Manish Singh committed
904 905 906 907 908 909 910
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_FIRST,
		  G_STRUCT_OFFSET (GtkWidgetClass, size_allocate),
		  NULL, NULL,
		  _gtk_marshal_VOID__BOXED,
		  G_TYPE_NONE, 1,
		  GDK_TYPE_RECTANGLE | G_SIGNAL_TYPE_STATIC_SCOPE);
Matthias Clasen's avatar
Matthias Clasen committed
911

912 913 914
  /**
   * GtkWidget::state-changed:
   * @widget: the object which received the signal.
915 916 917 918
   * @state: the previous state
   *
   * The ::state-changed signal is emitted when the widget state changes.
   * See gtk_widget_get_state().
919
   */
Elliot Lee's avatar
Elliot Lee committed
920
  widget_signals[STATE_CHANGED] =
Sven Neumann's avatar
Sven Neumann committed
921
    g_signal_new (I_("state-changed"),
Manish Singh's avatar
Manish Singh committed
922 923 924 925 926 927 928
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_FIRST,
		  G_STRUCT_OFFSET (GtkWidgetClass, state_changed),
		  NULL, NULL,
		  _gtk_marshal_VOID__ENUM,
		  G_TYPE_NONE, 1,
		  GTK_TYPE_STATE_TYPE);
929 930 931 932

  /**
   * GtkWidget::parent-set:
   * @widget: the object on which the signal is emitted
Johan Dahlin's avatar
Johan Dahlin committed
933
   * @old_parent: (allow-none): the previous parent, or %NULL if the widget
934 935
   *   just got its initial parent.
   *
936 937
   * The ::parent-set signal is emitted when a new parent 
   * has been set on a widget. 
938
   */
939
  widget_signals[PARENT_SET] =
Sven Neumann's avatar
Sven Neumann committed
940
    g_signal_new (I_("parent-set"),
Manish Singh's avatar
Manish Singh committed
941 942 943 944 945 946 947
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_FIRST,
		  G_STRUCT_OFFSET (GtkWidgetClass, parent_set),
		  NULL, NULL,
		  _gtk_marshal_VOID__OBJECT,
		  G_TYPE_NONE, 1,
		  GTK_TYPE_WIDGET);
Matthias Clasen's avatar
Matthias Clasen committed
948 949 950 951

  /**
   * GtkWidget::hierarchy-changed:
   * @widget: the object on which the signal is emitted
Johan Dahlin's avatar
Johan Dahlin committed
952
   * @previous_toplevel: (allow-none): the previous toplevel ancestor, or %NULL
Matthias Clasen's avatar
Matthias Clasen committed
953 954 955
   *   if the widget was previously unanchored
   *
   * The ::hierarchy-changed signal is emitted when the
956