gtkwidget.c 228 KB
Newer Older
Elliot Lee's avatar
Elliot Lee committed
1 2 3 4
/* GTK - The GIMP Toolkit
 * 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
#include <config.h>
Elliot Lee's avatar
Elliot Lee committed
28 29
#include <stdarg.h>
#include <string.h>
30
#include <locale.h>
Elliot Lee's avatar
Elliot Lee committed
31
#include "gtkcontainer.h"
32
#include "gtkaccelmap.h"
33
#include "gtkclipboard.h"
34
#include "gtkiconfactory.h"
35
#include "gtkintl.h"
Elliot Lee's avatar
Elliot Lee committed
36
#include "gtkmain.h"
37
#include "gtkmarshalers.h"
Elliot Lee's avatar
Elliot Lee committed
38 39
#include "gtkrc.h"
#include "gtkselection.h"
40
#include "gtksettings.h"
41
#include "gtksizegroup.h"
Elliot Lee's avatar
Elliot Lee committed
42 43
#include "gtkwidget.h"
#include "gtkwindow.h"
Tim Janik's avatar
Tim Janik committed
44
#include "gtkbindings.h"
45
#include "gtkprivate.h"
Elliot Lee's avatar
Elliot Lee committed
46
#include "gdk/gdk.h"
47
#include "gdk/gdkprivate.h" /* Used in gtk_reset_shapes_recurse to avoid copy */
Tim Janik's avatar
Tim Janik committed
48 49
#include <gobject/gvaluecollector.h>
#include <gobject/gobjectnotifyqueue.c>
Owen Taylor's avatar
Owen Taylor committed
50
#include "gdk/gdkkeysyms.h"
Alexander Larsson's avatar
Alexander Larsson committed
51
#include "gtkintl.h"
52
#include "gtkaccessible.h"
53
#include "gtktooltips.h"
54
#include "gtkinvisible.h"
55
#include "gtkalias.h"
Elliot Lee's avatar
Elliot Lee committed
56

57
#define WIDGET_CLASS(w)	 GTK_WIDGET_GET_CLASS (w)
Tim Janik's avatar
Tim Janik committed
58
#define	INIT_PATH_SIZE	(512)
Elliot Lee's avatar
Elliot Lee committed
59 60 61 62 63 64 65 66 67 68 69 70


enum {
  SHOW,
  HIDE,
  MAP,
  UNMAP,
  REALIZE,
  UNREALIZE,
  SIZE_REQUEST,
  SIZE_ALLOCATE,
  STATE_CHANGED,
71
  PARENT_SET,
Owen Taylor's avatar
Owen Taylor committed
72
  HIERARCHY_CHANGED,
73
  STYLE_SET,
74
  DIRECTION_CHANGED,
75
  GRAB_NOTIFY,
Tim Janik's avatar
Tim Janik committed
76
  CHILD_NOTIFY,
77
  MNEMONIC_ACTIVATE,
78
  GRAB_FOCUS,
79
  FOCUS,
Elliot Lee's avatar
Elliot Lee committed
80
  EVENT,
81
  EVENT_AFTER,
Elliot Lee's avatar
Elliot Lee committed
82 83
  BUTTON_PRESS_EVENT,
  BUTTON_RELEASE_EVENT,
84
  SCROLL_EVENT,
Elliot Lee's avatar
Elliot Lee committed
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
  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,
102
  SELECTION_GET,
Elliot Lee's avatar
Elliot Lee committed
103 104 105
  SELECTION_RECEIVED,
  PROXIMITY_IN_EVENT,
  PROXIMITY_OUT_EVENT,
106 107 108 109 110 111 112 113
  DRAG_BEGIN,
  DRAG_END,
  DRAG_DATA_DELETE,
  DRAG_LEAVE,
  DRAG_MOTION,
  DRAG_DROP,
  DRAG_DATA_GET,
  DRAG_DATA_RECEIVED,
114
  CLIENT_EVENT,
115
  NO_EXPOSE_EVENT,
116
  VISIBILITY_NOTIFY_EVENT,
Havoc Pennington's avatar
Havoc Pennington committed
117
  WINDOW_STATE_EVENT,
Owen Taylor's avatar
Owen Taylor committed
118
  POPUP_MENU,
119
  SHOW_HELP,
120
  ACCEL_CLOSURES_CHANGED,
Owen Taylor's avatar
Owen Taylor committed
121
  SCREEN_CHANGED,
122
  CAN_ACTIVATE_ACCEL,
123
  GRAB_BROKEN,
Elliot Lee's avatar
Elliot Lee committed
124 125 126
  LAST_SIGNAL
};

127
enum {
Alexander Larsson's avatar
Alexander Larsson committed
128 129 130
  PROP_0,
  PROP_NAME,
  PROP_PARENT,
Havoc Pennington's avatar
Havoc Pennington committed
131 132
  PROP_WIDTH_REQUEST,
  PROP_HEIGHT_REQUEST,
Alexander Larsson's avatar
Alexander Larsson committed
133 134 135 136 137
  PROP_VISIBLE,
  PROP_SENSITIVE,
  PROP_APP_PAINTABLE,
  PROP_CAN_FOCUS,
  PROP_HAS_FOCUS,
138
  PROP_IS_FOCUS,
Alexander Larsson's avatar
Alexander Larsson committed
139 140 141 142 143 144
  PROP_CAN_DEFAULT,
  PROP_HAS_DEFAULT,
  PROP_RECEIVES_DEFAULT,
  PROP_COMPOSITE_CHILD,
  PROP_STYLE,
  PROP_EVENTS,
145 146
  PROP_EXTENSION_EVENTS,
  PROP_NO_SHOW_ALL
147 148
};

149 150 151 152 153
typedef	struct	_GtkStateData	 GtkStateData;

struct _GtkStateData
{
  GtkStateType  state;
154
  guint		state_restoration : 1;
155
  guint         parent_sensitive : 1;
156
  guint		use_forall : 1;
157
};
Elliot Lee's avatar
Elliot Lee committed
158

Tim Janik's avatar
Tim Janik committed
159 160 161 162 163

/* --- prototypes --- */
static void	gtk_widget_class_init		 (GtkWidgetClass    *klass);
static void	gtk_widget_init			 (GtkWidget	    *widget);
static void	gtk_widget_set_property		 (GObject           *object,
Alexander Larsson's avatar
Alexander Larsson committed
164 165 166
						  guint              prop_id,
						  const GValue      *value,
						  GParamSpec        *pspec);
Tim Janik's avatar
Tim Janik committed
167
static void	gtk_widget_get_property		 (GObject           *object,
Alexander Larsson's avatar
Alexander Larsson committed
168 169 170
						  guint              prop_id,
						  GValue            *value,
						  GParamSpec        *pspec);
Tim Janik's avatar
Tim Janik committed
171
static void	gtk_widget_dispose		 (GObject	    *object);
Tim Janik's avatar
Tim Janik committed
172 173 174 175 176 177 178 179 180
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,
181
						  GtkRequisition    *requisition);
Tim Janik's avatar
Tim Janik committed
182
static void	gtk_widget_real_size_allocate	 (GtkWidget	    *widget,
183
						  GtkAllocation	    *allocation);
Tim Janik's avatar
Tim Janik committed
184
static void	gtk_widget_style_set		 (GtkWidget	    *widget,
185
						  GtkStyle          *previous_style);
Tim Janik's avatar
Tim Janik committed
186
static void	gtk_widget_direction_changed	 (GtkWidget	    *widget,
187
						  GtkTextDirection   previous_direction);
188

Tim Janik's avatar
Tim Janik committed
189
static void	gtk_widget_real_grab_focus	 (GtkWidget         *focus_widget);
190
static gboolean gtk_widget_real_show_help        (GtkWidget         *widget,
191 192
                                                  GtkWidgetHelpType  help_type);

Tim Janik's avatar
Tim Janik committed
193 194 195 196 197 198 199 200 201 202 203 204 205 206
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);
static PangoContext*	gtk_widget_peek_pango_context		(GtkWidget	  *widget);
207
static void     	gtk_widget_update_pango_context		(GtkWidget	  *widget);
Tim Janik's avatar
Tim Janik committed
208 209
static void		gtk_widget_propagate_state		(GtkWidget	  *widget,
								 GtkStateData 	  *data);
210
static void             gtk_widget_reset_rc_style               (GtkWidget        *widget);
Tim Janik's avatar
Tim Janik committed
211 212 213 214 215 216 217 218 219 220 221
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);
222 223
static void             gtk_widget_invalidate_widget_windows    (GtkWidget        *widget,
								 GdkRegion        *region);
224
static GdkScreen *      gtk_widget_get_screen_unchecked         (GtkWidget        *widget);
Soeren Sandmann's avatar
Soeren Sandmann committed
225
static void		gtk_widget_queue_shallow_draw		(GtkWidget        *widget);
226 227 228
static gboolean         gtk_widget_real_can_activate_accel      (GtkWidget *widget,
                                                                 guint      signal_id);
     
229 230 231
static void gtk_widget_set_usize_internal (GtkWidget *widget,
					   gint       width,
					   gint       height);
232 233
static void gtk_widget_get_draw_rectangle (GtkWidget    *widget,
					   GdkRectangle *rect);
234

Tim Janik's avatar
Tim Janik committed
235 236

/* --- variables --- */
237 238 239 240 241 242 243 244
static gpointer         parent_class = NULL;
static guint            widget_signals[LAST_SIGNAL] = { 0 };
static GMemChunk       *aux_info_mem_chunk = NULL;
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;
245

Tim Janik's avatar
Tim Janik committed
246 247
static GQuark		quark_property_parser = 0;
static GQuark		quark_aux_info = 0;
248 249
static GQuark		quark_accel_path = 0;
static GQuark		quark_accel_closures = 0;
Tim Janik's avatar
Tim Janik committed
250 251 252 253 254 255 256 257
static GQuark		quark_event_mask = 0;
static GQuark		quark_extension_event_mode = 0;
static GQuark		quark_parent_window = 0;
static GQuark		quark_shape_info = 0;
static GQuark		quark_colormap = 0;
static GQuark		quark_pango_context = 0;
static GQuark		quark_rc_style = 0;
static GQuark		quark_accessible_object = 0;
258
static GQuark		quark_mnemonic_labels = 0;
Tim Janik's avatar
Tim Janik committed
259 260 261 262
GParamSpecPool         *_gtk_widget_child_property_pool = NULL;
GObjectNotifyContext   *_gtk_widget_child_property_notify_context = NULL;

/* --- functions --- */
Manish Singh's avatar
Manish Singh committed
263
GType
264
gtk_widget_get_type (void)
Elliot Lee's avatar
Elliot Lee committed
265
{
Manish Singh's avatar
Manish Singh committed
266
  static GType widget_type = 0;
267
  
Elliot Lee's avatar
Elliot Lee committed
268 269
  if (!widget_type)
    {
270
      static const GTypeInfo widget_info =
Elliot Lee's avatar
Elliot Lee committed
271 272
      {
	sizeof (GtkWidgetClass),
Manish Singh's avatar
Manish Singh committed
273 274
	NULL,		/* base_init */
	NULL,		/* base_finalize */
275
	(GClassInitFunc) gtk_widget_class_init,
Manish Singh's avatar
Manish Singh committed
276 277
	NULL,		/* class_finalize */
	NULL,		/* class_init */
278
	sizeof (GtkWidget),
Manish Singh's avatar
Manish Singh committed
279
	0,		/* n_preallocs */
280
	(GInstanceInitFunc) gtk_widget_init,
Manish Singh's avatar
Manish Singh committed
281
	NULL,		/* value_table */
Elliot Lee's avatar
Elliot Lee committed
282
      };
283
      
284 285 286 287 288 289 290
      static const GInterfaceInfo accessibility_info =
      {
        (GInterfaceInitFunc) gtk_widget_accessible_interface_init,
        (GInterfaceFinalizeFunc) NULL,
        NULL /* interface data */
      };

Matthias Clasen's avatar
Matthias Clasen committed
291
      widget_type = g_type_register_static (GTK_TYPE_OBJECT, I_("GtkWidget"), 
292
					    &widget_info, G_TYPE_FLAG_ABSTRACT);
293 294 295 296

      g_type_add_interface_static (widget_type, ATK_TYPE_IMPLEMENTOR,
                                   &accessibility_info) ;

Elliot Lee's avatar
Elliot Lee committed
297
    }
298
  
Elliot Lee's avatar
Elliot Lee committed
299 300 301
  return widget_type;
}

Tim Janik's avatar
Tim Janik committed
302 303 304 305 306 307 308 309
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
310 311 312
static void
gtk_widget_class_init (GtkWidgetClass *klass)
{
Tim Janik's avatar
Tim Janik committed
313
  static GObjectNotifyContext cpn_context = { 0, NULL, NULL };
314 315
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
  GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
Owen Taylor's avatar
Owen Taylor committed
316
  GtkBindingSet *binding_set;
317
  
Tim Janik's avatar
Tim Janik committed
318 319 320 321
  parent_class = g_type_class_peek_parent (klass);

  quark_property_parser = g_quark_from_static_string ("gtk-rc-property-parser");
  quark_aux_info = g_quark_from_static_string ("gtk-aux-info");
322 323
  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
324 325 326 327 328 329 330 331
  quark_event_mask = g_quark_from_static_string ("gtk-event-mask");
  quark_extension_event_mode = g_quark_from_static_string ("gtk-extension-event-mode");
  quark_parent_window = g_quark_from_static_string ("gtk-parent-window");
  quark_shape_info = g_quark_from_static_string ("gtk-shape-info");
  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");
332
  quark_mnemonic_labels = g_quark_from_static_string ("gtk-mnemonic-labels");
Tim Janik's avatar
Tim Janik committed
333 334 335 336 337 338

  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;
339

Tim Janik's avatar
Tim Janik committed
340
  gobject_class->dispose = gtk_widget_dispose;
341
  gobject_class->finalize = gtk_widget_finalize;
Alexander Larsson's avatar
Alexander Larsson committed
342 343
  gobject_class->set_property = gtk_widget_set_property;
  gobject_class->get_property = gtk_widget_get_property;
344 345

  object_class->destroy = gtk_widget_real_destroy;
346
  
347 348
  klass->activate_signal = 0;
  klass->set_scroll_adjustments_signal = 0;
Tim Janik's avatar
Tim Janik committed
349
  klass->dispatch_child_properties_changed = gtk_widget_dispatch_child_properties_changed;
350 351 352 353 354 355 356 357 358 359 360 361
  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
362
  klass->hierarchy_changed = NULL;
363
  klass->style_set = gtk_widget_style_set;
364
  klass->direction_changed = gtk_widget_direction_changed;
Tim Janik's avatar
Tim Janik committed
365 366
  klass->grab_notify = NULL;
  klass->child_notify = NULL;
367
  klass->mnemonic_activate = gtk_widget_real_mnemonic_activate;
368
  klass->grab_focus = gtk_widget_real_grab_focus;
369
  klass->focus = gtk_widget_real_focus;
370 371 372 373 374 375 376 377 378 379 380 381
  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;
382 383
  klass->focus_in_event = gtk_widget_real_focus_in_event;
  klass->focus_out_event = gtk_widget_real_focus_out_event;
384 385
  klass->map_event = NULL;
  klass->unmap_event = NULL;
Havoc Pennington's avatar
Havoc Pennington committed
386
  klass->window_state_event = NULL;
387
  klass->property_notify_event = _gtk_selection_property_notify;
388
  klass->selection_clear_event = gtk_selection_clear;
389 390
  klass->selection_request_event = _gtk_selection_request;
  klass->selection_notify_event = _gtk_selection_notify;
391 392 393 394 395 396 397 398 399 400
  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
401
  klass->screen_changed = NULL;
402
  klass->can_activate_accel = gtk_widget_real_can_activate_accel;
403
  klass->grab_broken_event = NULL;
404 405 406 407 408 409

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

410 411
  klass->no_expose_event = NULL;

Alexander Larsson's avatar
Alexander Larsson committed
412 413 414
  g_object_class_install_property (gobject_class,
				   PROP_NAME,
				   g_param_spec_string ("name",
415 416
 							P_("Widget name"),
							P_("The name of the widget"),
Alexander Larsson's avatar
Alexander Larsson committed
417
							NULL,
418
							GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
419 420 421
  g_object_class_install_property (gobject_class,
				   PROP_PARENT,
				   g_param_spec_object ("parent",
422 423
							P_("Parent widget"), 
							P_("The parent widget of this widget. Must be a Container widget"),
Alexander Larsson's avatar
Alexander Larsson committed
424
							GTK_TYPE_CONTAINER,
425
							GTK_PARAM_READWRITE));
Havoc Pennington's avatar
Havoc Pennington committed
426

Alexander Larsson's avatar
Alexander Larsson committed
427
  g_object_class_install_property (gobject_class,
Havoc Pennington's avatar
Havoc Pennington committed
428
				   PROP_WIDTH_REQUEST,
Matthias Clasen's avatar
x  
Matthias Clasen committed
429
				   g_param_spec_int ("width-request",
430 431
 						     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
432 433 434
 						     -1,
 						     G_MAXINT,
 						     -1,
435
 						     GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
436
  g_object_class_install_property (gobject_class,
Havoc Pennington's avatar
Havoc Pennington committed
437
				   PROP_HEIGHT_REQUEST,
Matthias Clasen's avatar
x  
Matthias Clasen committed
438
				   g_param_spec_int ("height-request",
439 440
 						     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
441 442 443
 						     -1,
 						     G_MAXINT,
 						     -1,
444
 						     GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
445 446 447
  g_object_class_install_property (gobject_class,
				   PROP_VISIBLE,
				   g_param_spec_boolean ("visible",
448 449
 							 P_("Visible"),
 							 P_("Whether the widget is visible"),
Alexander Larsson's avatar
Alexander Larsson committed
450
 							 FALSE,
451
 							 GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
452 453 454
  g_object_class_install_property (gobject_class,
				   PROP_SENSITIVE,
				   g_param_spec_boolean ("sensitive",
455 456
 							 P_("Sensitive"),
 							 P_("Whether the widget responds to input"),
Alexander Larsson's avatar
Alexander Larsson committed
457
 							 TRUE,
458
 							 GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
459 460
  g_object_class_install_property (gobject_class,
				   PROP_APP_PAINTABLE,
Matthias Clasen's avatar
x  
Matthias Clasen committed
461
				   g_param_spec_boolean ("app-paintable",
462 463
 							 P_("Application paintable"),
 							 P_("Whether the application will paint directly on the widget"),
Alexander Larsson's avatar
Alexander Larsson committed
464
 							 FALSE,
465
 							 GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
466 467
  g_object_class_install_property (gobject_class,
				   PROP_CAN_FOCUS,
Matthias Clasen's avatar
x  
Matthias Clasen committed
468
				   g_param_spec_boolean ("can-focus",
469 470
 							 P_("Can focus"),
 							 P_("Whether the widget can accept the input focus"),
Alexander Larsson's avatar
Alexander Larsson committed
471
 							 FALSE,
472
 							 GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
473 474
  g_object_class_install_property (gobject_class,
				   PROP_HAS_FOCUS,
Matthias Clasen's avatar
x  
Matthias Clasen committed
475
				   g_param_spec_boolean ("has-focus",
476 477
 							 P_("Has focus"),
 							 P_("Whether the widget has the input focus"),
Alexander Larsson's avatar
Alexander Larsson committed
478
 							 FALSE,
479
 							 GTK_PARAM_READWRITE));
480
  g_object_class_install_property (gobject_class,
481
				   PROP_IS_FOCUS,
Matthias Clasen's avatar
x  
Matthias Clasen committed
482
				   g_param_spec_boolean ("is-focus",
483 484
 							 P_("Is focus"),
 							 P_("Whether the widget is the focus widget within the toplevel"),
485
 							 FALSE,
486
 							 GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
487 488
  g_object_class_install_property (gobject_class,
				   PROP_CAN_DEFAULT,
Matthias Clasen's avatar
x  
Matthias Clasen committed
489
				   g_param_spec_boolean ("can-default",
490 491
 							 P_("Can default"),
 							 P_("Whether the widget can be the default widget"),
Alexander Larsson's avatar
Alexander Larsson committed
492
 							 FALSE,
493
 							 GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
494 495
  g_object_class_install_property (gobject_class,
				   PROP_HAS_DEFAULT,
Matthias Clasen's avatar
x  
Matthias Clasen committed
496
				   g_param_spec_boolean ("has-default",
497 498
 							 P_("Has default"),
 							 P_("Whether the widget is the default widget"),
Alexander Larsson's avatar
Alexander Larsson committed
499
 							 FALSE,
500
 							 GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
501 502
  g_object_class_install_property (gobject_class,
				   PROP_RECEIVES_DEFAULT,
Matthias Clasen's avatar
x  
Matthias Clasen committed
503
				   g_param_spec_boolean ("receives-default",
504 505
 							 P_("Receives default"),
 							 P_("If TRUE, the widget will receive the default action when it is focused"),
Alexander Larsson's avatar
Alexander Larsson committed
506
 							 FALSE,
507
 							 GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
508 509
  g_object_class_install_property (gobject_class,
				   PROP_COMPOSITE_CHILD,
Matthias Clasen's avatar
x  
Matthias Clasen committed
510
				   g_param_spec_boolean ("composite-child",
511 512
 							 P_("Composite child"),
 							 P_("Whether the widget is part of a composite widget"),
Alexander Larsson's avatar
Alexander Larsson committed
513
 							 FALSE,
514
 							 GTK_PARAM_READABLE));
Alexander Larsson's avatar
Alexander Larsson committed
515 516 517
  g_object_class_install_property (gobject_class,
				   PROP_STYLE,
				   g_param_spec_object ("style",
518 519
 							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
520
 							GTK_TYPE_STYLE,
521
 							GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
522 523 524
  g_object_class_install_property (gobject_class,
				   PROP_EVENTS,
				   g_param_spec_flags ("events",
525 526
 						       P_("Events"),
 						       P_("The event mask that decides what kind of GdkEvents this widget gets"),
527
 						       GDK_TYPE_EVENT_MASK,
Alexander Larsson's avatar
Alexander Larsson committed
528
 						       GDK_STRUCTURE_MASK,
529
 						       GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
530 531
  g_object_class_install_property (gobject_class,
				   PROP_EXTENSION_EVENTS,
Matthias Clasen's avatar
x  
Matthias Clasen committed
532
				   g_param_spec_enum ("extension-events",
533 534
 						      P_("Extension events"),
 						      P_("The mask that decides what kind of extension events this widget gets"),
535
 						      GDK_TYPE_EXTENSION_MODE,
Alexander Larsson's avatar
Alexander Larsson committed
536
 						      GDK_EXTENSION_EVENTS_NONE,
537
 						      GTK_PARAM_READWRITE));
538 539
  g_object_class_install_property (gobject_class,
				   PROP_NO_SHOW_ALL,
Matthias Clasen's avatar
x  
Matthias Clasen committed
540
				   g_param_spec_boolean ("no-show-all",
541 542
 							 P_("No show all"),
 							 P_("Whether gtk_widget_show_all() should not affect this widget"),
543
 							 FALSE,
544
 							 GTK_PARAM_READWRITE));
Elliot Lee's avatar
Elliot Lee committed
545
  widget_signals[SHOW] =
Matthias Clasen's avatar
Matthias Clasen committed
546
    g_signal_new (I_("show"),
Manish Singh's avatar
Manish Singh committed
547 548 549 550 551 552
		  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);
Elliot Lee's avatar
Elliot Lee committed
553
  widget_signals[HIDE] =
Matthias Clasen's avatar
Matthias Clasen committed
554
    g_signal_new (I_("hide"),
Manish Singh's avatar
Manish Singh committed
555 556 557 558 559 560
		  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);
Elliot Lee's avatar
Elliot Lee committed
561
  widget_signals[MAP] =
Matthias Clasen's avatar
Matthias Clasen committed
562
    g_signal_new (I_("map"),
Manish Singh's avatar
Manish Singh committed
563 564 565 566 567 568
		  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);
Elliot Lee's avatar
Elliot Lee committed
569
  widget_signals[UNMAP] =
Matthias Clasen's avatar
Matthias Clasen committed
570
    g_signal_new (I_("unmap"),
Manish Singh's avatar
Manish Singh committed
571 572 573 574 575 576
		  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);
Elliot Lee's avatar
Elliot Lee committed
577
  widget_signals[REALIZE] =
Matthias Clasen's avatar
Matthias Clasen committed
578
    g_signal_new (I_("realize"),
Manish Singh's avatar
Manish Singh committed
579 580 581 582 583 584
		  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);
Elliot Lee's avatar
Elliot Lee committed
585
  widget_signals[UNREALIZE] =
Matthias Clasen's avatar
Matthias Clasen committed
586
    g_signal_new (I_("unrealize"),
Manish Singh's avatar
Manish Singh committed
587 588 589 590 591 592
		  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);
Elliot Lee's avatar
Elliot Lee committed
593
  widget_signals[SIZE_REQUEST] =
Matthias Clasen's avatar
Matthias Clasen committed
594
    g_signal_new (I_("size_request"),
Manish Singh's avatar
Manish Singh committed
595 596 597 598 599 600 601
		  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);
602
  widget_signals[SIZE_ALLOCATE] = 
Matthias Clasen's avatar
Matthias Clasen committed
603
    g_signal_new (I_("size_allocate"),
Manish Singh's avatar
Manish Singh committed
604 605 606 607 608 609 610
		  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);
Elliot Lee's avatar
Elliot Lee committed
611
  widget_signals[STATE_CHANGED] =
Matthias Clasen's avatar
Matthias Clasen committed
612
    g_signal_new (I_("state_changed"),
Manish Singh's avatar
Manish Singh committed
613 614 615 616 617 618 619
		  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);
620
  widget_signals[PARENT_SET] =
Matthias Clasen's avatar
Matthias Clasen committed
621
    g_signal_new (I_("parent_set"),
Manish Singh's avatar
Manish Singh committed
622 623 624 625 626 627 628
		  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);
Owen Taylor's avatar
Owen Taylor committed
629
  widget_signals[HIERARCHY_CHANGED] =
Matthias Clasen's avatar
Matthias Clasen committed
630
    g_signal_new (I_("hierarchy_changed"),
Manish Singh's avatar
Manish Singh committed
631 632 633 634 635 636 637
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, hierarchy_changed),
		  NULL, NULL,
		  _gtk_marshal_VOID__OBJECT,
		  G_TYPE_NONE, 1,
		  GTK_TYPE_WIDGET);
638 639 640 641 642 643 644 645 646 647
  /**
   * GtkWidget::style-set:
   * @widget: the object on which the signal is emitted
   * @previous_style: the previous style, or %NULL if the widget 
   *   just got its initial style 
   *
   * The style-set signal is emitted when a new style has been set 
   * on a widget. Note that style-modifying functions like 
   * gtk_widget_modify_base() also cause this signal to be emitted.
   */
648
  widget_signals[STYLE_SET] =
Matthias Clasen's avatar
Matthias Clasen committed
649
    g_signal_new (I_("style_set"),
Manish Singh's avatar
Manish Singh committed
650 651 652 653 654 655 656
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_FIRST,
		  G_STRUCT_OFFSET (GtkWidgetClass, style_set),
		  NULL, NULL,
		  _gtk_marshal_VOID__OBJECT,
		  G_TYPE_NONE, 1,
		  GTK_TYPE_STYLE);
657
  widget_signals[DIRECTION_CHANGED] =
Matthias Clasen's avatar
Matthias Clasen committed
658
    g_signal_new (I_("direction_changed"),
Manish Singh's avatar
Manish Singh committed
659 660 661 662 663 664 665
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_FIRST,
		  G_STRUCT_OFFSET (GtkWidgetClass, direction_changed),
		  NULL, NULL,
		  _gtk_marshal_VOID__ENUM,
		  G_TYPE_NONE, 1,
		  GTK_TYPE_TEXT_DIRECTION);
666
  widget_signals[GRAB_NOTIFY] =
Matthias Clasen's avatar
Matthias Clasen committed
667
    g_signal_new (I_("grab_notify"),
Manish Singh's avatar
Manish Singh committed
668 669 670 671 672 673 674
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_FIRST,
                  G_STRUCT_OFFSET (GtkWidgetClass, grab_notify),
		  NULL, NULL,
		  _gtk_marshal_VOID__BOOLEAN,
		  G_TYPE_NONE, 1,
		  G_TYPE_BOOLEAN);
675 676 677 678 679 680 681 682 683

/**
 * GtkWidget::child-notify:
 * @widget: the object which received the signal.
 * @pspec: the #GParamSpec of the changed child property.
 *
 * The ::child-notify signal is emitted for each child property that has 
 * changed on an object. The signal's detail holds the property name. 
 */
Tim Janik's avatar
Tim Janik committed
684
  widget_signals[CHILD_NOTIFY] =
Matthias Clasen's avatar
Matthias Clasen committed
685
    g_signal_new (I_("child_notify"),
Manish Singh's avatar
Manish Singh committed
686
		   G_TYPE_FROM_CLASS (gobject_class),
Tim Janik's avatar
Tim Janik committed
687 688 689 690
		   G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE | G_SIGNAL_DETAILED | G_SIGNAL_NO_HOOKS,
		   G_STRUCT_OFFSET (GtkWidgetClass, child_notify),
		   NULL, NULL,
		   g_cclosure_marshal_VOID__PARAM,
Manish Singh's avatar
Manish Singh committed
691 692
		   G_TYPE_NONE, 1,
		   G_TYPE_PARAM);
693
  widget_signals[MNEMONIC_ACTIVATE] =
Matthias Clasen's avatar
Matthias Clasen committed
694
    g_signal_new (I_("mnemonic_activate"),
Manish Singh's avatar
Manish Singh committed
695 696 697 698 699 700 701
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, mnemonic_activate),
		  _gtk_boolean_handled_accumulator, NULL,
		  _gtk_marshal_BOOLEAN__BOOLEAN,
		  G_TYPE_BOOLEAN, 1,
		  G_TYPE_BOOLEAN);
702
  widget_signals[GRAB_FOCUS] =
Matthias Clasen's avatar
Matthias Clasen committed
703
    g_signal_new (I_("grab_focus"),
Manish Singh's avatar
Manish Singh committed
704 705 706 707 708 709
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
		  G_STRUCT_OFFSET (GtkWidgetClass, grab_focus),
		  NULL, NULL,
		  _gtk_marshal_VOID__VOID,
		  G_TYPE_NONE, 0);
710
  widget_signals[FOCUS] =
Matthias Clasen's avatar
Matthias Clasen committed
711
    g_signal_new (I_("focus"),
Manish Singh's avatar
Manish Singh committed
712 713 714 715 716 717 718
		  G_TYPE_FROM_CLASS (object_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, focus),
		  _gtk_boolean_handled_accumulator, NULL,
		  _gtk_marshal_BOOLEAN__ENUM,
		  G_TYPE_BOOLEAN, 1,
		  GTK_TYPE_DIRECTION_TYPE);
Elliot Lee's avatar
Elliot Lee committed
719
  widget_signals[EVENT] =
Matthias Clasen's avatar
Matthias Clasen committed
720
    g_signal_new (I_("event"),
Manish Singh's avatar
Manish Singh committed
721 722 723 724 725 726 727
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, event),
		  _gtk_boolean_handled_accumulator, NULL,
		  _gtk_marshal_BOOLEAN__BOXED,
		  G_TYPE_BOOLEAN, 1,
		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
728
  widget_signals[EVENT_AFTER] =
Matthias Clasen's avatar
Matthias Clasen committed
729
    g_signal_new (I_("event-after"),
Manish Singh's avatar
Manish Singh committed
730 731 732 733 734 735 736
		  G_TYPE_FROM_CLASS (gobject_class),
		  0,
		  0,
		  NULL, NULL,
		  _gtk_marshal_VOID__BOXED,
		  G_TYPE_NONE, 1,
		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
Elliot Lee's avatar
Elliot Lee committed
737
  widget_signals[BUTTON_PRESS_EVENT] =
Matthias Clasen's avatar
Matthias Clasen committed
738
    g_signal_new (I_("button_press_event"),
Manish Singh's avatar
Manish Singh committed
739 740 741 742 743 744 745
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, button_press_event),
		  _gtk_boolean_handled_accumulator, NULL,
		  _gtk_marshal_BOOLEAN__BOXED,
		  G_TYPE_BOOLEAN, 1,
		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
Elliot Lee's avatar
Elliot Lee committed
746
  widget_signals[BUTTON_RELEASE_EVENT] =
Matthias Clasen's avatar
Matthias Clasen committed
747
    g_signal_new (I_("button_release_event"),
Manish Singh's avatar
Manish Singh committed
748 749 750 751 752 753 754
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, button_release_event),
		  _gtk_boolean_handled_accumulator, NULL,
		  _gtk_marshal_BOOLEAN__BOXED,
		  G_TYPE_BOOLEAN, 1,
		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
755
  widget_signals[SCROLL_EVENT] =
Matthias Clasen's avatar
Matthias Clasen committed
756
    g_signal_new (I_("scroll_event"),
Manish Singh's avatar
Manish Singh committed
757 758 759 760 761 762 763
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, scroll_event),
		  _gtk_boolean_handled_accumulator, NULL,
		  _gtk_marshal_BOOLEAN__BOXED,
		  G_TYPE_BOOLEAN, 1,
		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
Elliot Lee's avatar
Elliot Lee committed
764
  widget_signals[MOTION_NOTIFY_EVENT] =
Matthias Clasen's avatar
Matthias Clasen committed
765
    g_signal_new (I_("motion_notify_event"),
Manish Singh's avatar
Manish Singh committed
766 767 768 769 770 771 772
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, motion_notify_event),
		  _gtk_boolean_handled_accumulator, NULL,
		  _gtk_marshal_BOOLEAN__BOXED,
		  G_TYPE_BOOLEAN, 1,
		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
773 774 775 776 777 778 779 780 781 782 783 784 785 786 787

/**
 * GtkWidget::delete-event:
 * @widget: the object which received the signal.
 * @event: the event which triggered this signal
 *
 * The ::delete-event signal is emitted if a user requests that
 * a toplevel window is closed. The default handler for this signal
 * destroys the window. Connecting gtk_widget_hide_on_delete() to
 * this signal will cause the window to be hidden instead, so that
 * it can later be shown again without reconstructing it.
 *
 * Returns: %TRUE to stop other handlers from being invoked for the event. 
 *   %FALSE to propagate the event further.
 */
Elliot Lee's avatar
Elliot Lee committed
788
  widget_signals[DELETE_EVENT] =
Matthias Clasen's avatar
Matthias Clasen committed
789
    g_signal_new (I_("delete_event"),
Manish Singh's avatar
Manish Singh committed
790 791 792 793 794 795 796
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, delete_event),
		  _gtk_boolean_handled_accumulator, NULL,
		  _gtk_marshal_BOOLEAN__BOXED,
		  G_TYPE_BOOLEAN, 1,
		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
797 798 799 800 801 802 803 804 805 806 807 808 809 810

/**
 * GtkWidget::destroy-event:
 * @widget: the object which received the signal.
 * @event: the event which triggered this signal
 *
 * The ::destroy-event signal is emitted when a #GdkWindow is destroyed.
 * You rarely get this signal, because most widgets disconnect themselves 
 * from their window before they destroy it, so no widget owns the 
 * window at destroy time.
 * 
 * Returns: %TRUE to stop other handlers from being invoked for the event. 
 *   %FALSE to propagate the event further.
 */
Elliot Lee's avatar
Elliot Lee committed
811
  widget_signals[DESTROY_EVENT] =
Matthias Clasen's avatar
Matthias Clasen committed
812
    g_signal_new (I_("destroy_event"),
Manish Singh's avatar
Manish Singh committed
813 814 815 816 817 818 819
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, destroy_event),
		  _gtk_boolean_handled_accumulator, NULL,
		  _gtk_marshal_BOOLEAN__BOXED,
		  G_TYPE_BOOLEAN, 1,
		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
Elliot Lee's avatar
Elliot Lee committed
820
  widget_signals[EXPOSE_EVENT] =
Matthias Clasen's avatar
Matthias Clasen committed
821
    g_signal_new (I_("expose_event"),
Manish Singh's avatar
Manish Singh committed
822 823 824 825 826 827 828
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, expose_event),
		  _gtk_boolean_handled_accumulator, NULL,
		  _gtk_marshal_BOOLEAN__BOXED,
		  G_TYPE_BOOLEAN, 1,
		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
Elliot Lee's avatar
Elliot Lee committed
829
  widget_signals[KEY_PRESS_EVENT] =
Matthias Clasen's avatar
Matthias Clasen committed
830
    g_signal_new (I_("key_press_event"),
Manish Singh's avatar
Manish Singh committed
831 832 833 834 835 836 837
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, key_press_event),
		  _gtk_boolean_handled_accumulator, NULL,
		  _gtk_marshal_BOOLEAN__BOXED,
		  G_TYPE_BOOLEAN, 1,
		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
Elliot Lee's avatar
Elliot Lee committed
838
  widget_signals[KEY_RELEASE_EVENT] =
Matthias Clasen's avatar
Matthias Clasen committed
839
    g_signal_new (I_("key_release_event"),
Manish Singh's avatar
Manish Singh committed
840 841 842 843 844 845 846
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, key_release_event),
		  _gtk_boolean_handled_accumulator, NULL,
		  _gtk_marshal_BOOLEAN__BOXED,
		  G_TYPE_BOOLEAN, 1,
		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
Elliot Lee's avatar
Elliot Lee committed
847
  widget_signals[ENTER_NOTIFY_EVENT] =
Matthias Clasen's avatar
Matthias Clasen committed
848
    g_signal_new (I_("enter_notify_event"),
Manish Singh's avatar
Manish Singh committed
849 850 851 852 853 854 855
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, enter_notify_event),
		  _gtk_boolean_handled_accumulator, NULL,
		  _gtk_marshal_BOOLEAN__BOXED,
		  G_TYPE_BOOLEAN, 1,
		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
Elliot Lee's avatar
Elliot Lee committed
856
  widget_signals[LEAVE_NOTIFY_EVENT] =
Matthias Clasen's avatar
Matthias Clasen committed
857
    g_signal_new (I_("leave_notify_event"),
Manish Singh's avatar
Manish Singh committed
858 859 860 861 862 863 864
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, leave_notify_event),
		  _gtk_boolean_handled_accumulator, NULL,
		  _gtk_marshal_BOOLEAN__BOXED,
		  G_TYPE_BOOLEAN, 1,
		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
Elliot Lee's avatar
Elliot Lee committed
865
  widget_signals[CONFIGURE_EVENT] =
Matthias Clasen's avatar
Matthias Clasen committed
866
    g_signal_new (I_("configure_event"),
Manish Singh's avatar
Manish Singh committed
867 868 869 870 871 872 873
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, configure_event),
		  _gtk_boolean_handled_accumulator, NULL,
		  _gtk_marshal_BOOLEAN__BOXED,
		  G_TYPE_BOOLEAN, 1,
		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
Elliot Lee's avatar
Elliot Lee committed
874
  widget_signals[FOCUS_IN_EVENT] =
Matthias Clasen's avatar
Matthias Clasen committed
875
    g_signal_new (I_("focus_in_event"),
Manish Singh's avatar
Manish Singh committed
876 877 878 879 880 881 882
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, focus_in_event),
		  _gtk_boolean_handled_accumulator, NULL,
		  _gtk_marshal_BOOLEAN__BOXED,
		  G_TYPE_BOOLEAN, 1,
		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
Elliot Lee's avatar
Elliot Lee committed
883
  widget_signals[FOCUS_OUT_EVENT] =
Matthias Clasen's avatar
Matthias Clasen committed
884
    g_signal_new (I_("focus_out_event"),
Manish Singh's avatar
Manish Singh committed
885 886 887 888 889 890 891
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, focus_out_event),
		  _gtk_boolean_handled_accumulator, NULL,
		  _gtk_marshal_BOOLEAN__BOXED,
		  G_TYPE_BOOLEAN, 1,
		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
Elliot Lee's avatar
Elliot Lee committed
892
  widget_signals[MAP_EVENT] =
Matthias Clasen's avatar
Matthias Clasen committed
893
    g_signal_new (I_("map_event"),
Manish Singh's avatar
Manish Singh committed
894 895 896 897 898 899 900
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, map_event),
		  _gtk_boolean_handled_accumulator, NULL,
		  _gtk_marshal_BOOLEAN__BOXED,
		  G_TYPE_BOOLEAN, 1,
		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
Elliot Lee's avatar
Elliot Lee committed
901
  widget_signals[UNMAP_EVENT] =
Matthias Clasen's avatar
Matthias Clasen committed
902
    g_signal_new (I_("unmap_event"),
Manish Singh's avatar
Manish Singh committed
903 904 905 906 907 908 909
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, unmap_event),
		  _gtk_boolean_handled_accumulator, NULL,
		  _gtk_marshal_BOOLEAN__BOXED,
		  G_TYPE_BOOLEAN, 1,
		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
Elliot Lee's avatar
Elliot Lee committed
910
  widget_signals[PROPERTY_NOTIFY_EVENT] =
Matthias Clasen's avatar
Matthias Clasen committed
911
    g_signal_new (I_("property_notify_event"),
Manish Singh's avatar
Manish Singh committed
912 913 914 915 916 917 918
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, property_notify_event),
		  _gtk_boolean_handled_accumulator, NULL,
		  _gtk_marshal_BOOLEAN__BOXED,
		  G_TYPE_BOOLEAN, 1,
		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
Elliot Lee's avatar
Elliot Lee committed
919
  widget_signals[SELECTION_CLEAR_EVENT] =
Matthias Clasen's avatar
Matthias Clasen committed
920
    g_signal_new (I_("selection_clear_event"),
Manish Singh's avatar
Manish Singh committed
921 922 923 924 925 926 927
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, selection_clear_event),
		  _gtk_boolean_handled_accumulator, NULL,
		  _gtk_marshal_BOOLEAN__BOXED,
		  G_TYPE_BOOLEAN, 1,
		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
Elliot Lee's avatar
Elliot Lee committed
928