gtkwidget.c 164 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/. 
 */

Elliot Lee's avatar
Elliot Lee committed
27
28
#include <stdarg.h>
#include <string.h>
29
#include <locale.h>
Elliot Lee's avatar
Elliot Lee committed
30
#include "gtkcontainer.h"
31
#include "gtkiconfactory.h"
32
#include "gtkintl.h"
Elliot Lee's avatar
Elliot Lee committed
33
34
35
#include "gtkmain.h"
#include "gtkrc.h"
#include "gtkselection.h"
36
#include "gtksettings.h"
37
#include "gtksizegroup.h"
Elliot Lee's avatar
Elliot Lee committed
38
39
40
#include "gtksignal.h"
#include "gtkwidget.h"
#include "gtkwindow.h"
Tim Janik's avatar
Tim Janik committed
41
#include "gtkbindings.h"
42
#include "gtkprivate.h"
Elliot Lee's avatar
Elliot Lee committed
43
#include "gdk/gdk.h"
44
#include "gdk/gdkprivate.h" /* Used in gtk_reset_shapes_recurse to avoid copy */
45
#include "gobject/gvaluecollector.h"
Owen Taylor's avatar
Owen Taylor committed
46
#include "gdk/gdkkeysyms.h"
Alexander Larsson's avatar
Alexander Larsson committed
47
#include "gtkintl.h"
48
#include "gtkaccessible.h"
Elliot Lee's avatar
Elliot Lee committed
49

50
#define WIDGET_CLASS(w)	 GTK_WIDGET_GET_CLASS (w)
Tim Janik's avatar
Tim Janik committed
51
#define	INIT_PATH_SIZE	(512)
Elliot Lee's avatar
Elliot Lee committed
52
53
54
55
56
57
58
59
60
61
62
63


enum {
  SHOW,
  HIDE,
  MAP,
  UNMAP,
  REALIZE,
  UNREALIZE,
  SIZE_REQUEST,
  SIZE_ALLOCATE,
  STATE_CHANGED,
64
  PARENT_SET,
Owen Taylor's avatar
Owen Taylor committed
65
  HIERARCHY_CHANGED,
66
  STYLE_SET,
67
  DIRECTION_CHANGED,
Tim Janik's avatar
Tim Janik committed
68
  ADD_ACCELERATOR,
Elliot Lee's avatar
Elliot Lee committed
69
  REMOVE_ACCELERATOR,
70
  ACTIVATE_MNEMONIC,
71
  GRAB_FOCUS,
72
  FOCUS,
Elliot Lee's avatar
Elliot Lee committed
73
74
75
  EVENT,
  BUTTON_PRESS_EVENT,
  BUTTON_RELEASE_EVENT,
76
  SCROLL_EVENT,
Elliot Lee's avatar
Elliot Lee committed
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
  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,
94
  SELECTION_GET,
Elliot Lee's avatar
Elliot Lee committed
95
96
97
  SELECTION_RECEIVED,
  PROXIMITY_IN_EVENT,
  PROXIMITY_OUT_EVENT,
98
99
100
101
102
103
104
105
  DRAG_BEGIN,
  DRAG_END,
  DRAG_DATA_DELETE,
  DRAG_LEAVE,
  DRAG_MOTION,
  DRAG_DROP,
  DRAG_DATA_GET,
  DRAG_DATA_RECEIVED,
106
  CLIENT_EVENT,
107
  NO_EXPOSE_EVENT,
108
  VISIBILITY_NOTIFY_EVENT,
Havoc Pennington's avatar
Havoc Pennington committed
109
  WINDOW_STATE_EVENT,
Owen Taylor's avatar
Owen Taylor committed
110
  POPUP_MENU,
Elliot Lee's avatar
Elliot Lee committed
111
112
113
  LAST_SIGNAL
};

114
enum {
Alexander Larsson's avatar
Alexander Larsson committed
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
  PROP_0,
  PROP_NAME,
  PROP_PARENT,
  PROP_X,
  PROP_Y,
  PROP_WIDTH,
  PROP_HEIGHT,
  PROP_VISIBLE,
  PROP_SENSITIVE,
  PROP_APP_PAINTABLE,
  PROP_CAN_FOCUS,
  PROP_HAS_FOCUS,
  PROP_CAN_DEFAULT,
  PROP_HAS_DEFAULT,
  PROP_RECEIVES_DEFAULT,
  PROP_COMPOSITE_CHILD,
  PROP_STYLE,
  PROP_EVENTS,
  PROP_EXTENSION_EVENTS
134
135
};

136
137
138
139
140
typedef	struct	_GtkStateData	 GtkStateData;

struct _GtkStateData
{
  GtkStateType  state;
141
  guint		state_restoration : 1;
142
  guint         parent_sensitive : 1;
143
  guint		use_forall : 1;
144
};
Elliot Lee's avatar
Elliot Lee committed
145

146
147
static void gtk_widget_class_init		 (GtkWidgetClass    *klass);
static void gtk_widget_init			 (GtkWidget	    *widget);
Alexander Larsson's avatar
Alexander Larsson committed
148
149
150
151
152
153
154
155
static void gtk_widget_set_property		 (GObject           *object,
						  guint              prop_id,
						  const GValue      *value,
						  GParamSpec        *pspec);
static void gtk_widget_get_property		 (GObject           *object,
						  guint              prop_id,
						  GValue            *value,
						  GParamSpec        *pspec);
156
static void gtk_widget_shutdown			 (GObject	    *object);
157
static void gtk_widget_real_destroy		 (GtkObject	    *object);
158
static void gtk_widget_finalize			 (GObject	    *object);
159
160
161
162
163
164
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);
165
166
static void gtk_widget_real_size_request	 (GtkWidget	    *widget,
						  GtkRequisition    *requisition);
167
static void gtk_widget_real_size_allocate	 (GtkWidget	    *widget,
168
						  GtkAllocation	    *allocation);
169
170
171
172
173
174
175
176
177
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);

178
179
static void gtk_widget_style_set		 (GtkWidget	    *widget,
						  GtkStyle          *previous_style);
180
181
static void gtk_widget_direction_changed	 (GtkWidget	    *widget,
						  GtkTextDirection   previous_direction);
182
static void gtk_widget_real_grab_focus           (GtkWidget         *focus_widget);
183
184
static gboolean gtk_widget_real_focus            (GtkWidget         *widget,
                                                  GtkDirectionType   direction);
185

186
187
188
static GdkColormap*  gtk_widget_peek_colormap      (void);
static GtkStyle*     gtk_widget_peek_style         (void);
static PangoContext *gtk_widget_peek_pango_context (GtkWidget *widget);
Elliot Lee's avatar
Elliot Lee committed
189

190
191
static void gtk_widget_reparent_container_child  (GtkWidget     *widget,
						  gpointer       client_data);
192
193
194
static void gtk_widget_propagate_state		 (GtkWidget	*widget,
						  GtkStateData 	*data);
static void gtk_widget_set_style_internal	 (GtkWidget	*widget,
195
196
						  GtkStyle	*style,
						  gboolean	 initial_emission);
197
198
static void gtk_widget_set_style_recurse	 (GtkWidget	*widget,
						  gpointer	 client_data);
199
200
static gint gtk_widget_event_internal            (GtkWidget     *widget,
						  GdkEvent      *event);
Elliot Lee's avatar
Elliot Lee committed
201

Owen Taylor's avatar
Owen Taylor committed
202
203
static void gtk_widget_propagate_hierarchy_changed (GtkWidget *widget,
						    gpointer   client_data);
204
static gboolean gtk_widget_real_mnemonic_activate  (GtkWidget *widget,
205
						    gboolean   group_cycling);
Owen Taylor's avatar
Owen Taylor committed
206

207
static void		 gtk_widget_aux_info_destroy (GtkWidgetAuxInfo *aux_info);
Elliot Lee's avatar
Elliot Lee committed
208

209
static void  gtk_widget_do_uposition (GtkWidget *widget);
210
211
212
213
214

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

215
216
static gpointer         parent_class = NULL;
static guint            widget_signals[LAST_SIGNAL] = { 0 };
Elliot Lee's avatar
Elliot Lee committed
217

218
219
220
221
222
223
224
225
static GMemChunk       *aux_info_mem_chunk = NULL;
static GdkColormap     *default_colormap = NULL;
static GtkStyle        *gtk_default_style = NULL;
static GSList          *colormap_stack = NULL;
static GSList          *style_stack = NULL;
static guint            composite_child_stack = 0;
static GtkTextDirection gtk_default_direction = GTK_TEXT_DIR_LTR;
static GParamSpecPool  *style_property_spec_pool = NULL;
Elliot Lee's avatar
Elliot Lee committed
226

227
228
229
230
231
232
233
234
235
236
static GQuark quark_property_parser = 0;
static GQuark quark_aux_info = 0;
static GQuark quark_event_mask = 0;
static GQuark quark_extension_event_mode = 0;
static GQuark quark_parent_window = 0;
static GQuark quark_saved_default_style = 0;
static GQuark quark_shape_info = 0;
static GQuark quark_colormap = 0;
static GQuark quark_pango_context = 0;
static GQuark quark_rc_style = 0;
237
static GQuark quark_accessible_object = 0;
Elliot Lee's avatar
Elliot Lee committed
238

239

Elliot Lee's avatar
Elliot Lee committed
240
241
242
243
244
245
246
247
/*****************************************
 * gtk_widget_get_type:
 *
 *   arguments:
 *
 *   results:
 *****************************************/

248
GtkType
249
gtk_widget_get_type (void)
Elliot Lee's avatar
Elliot Lee committed
250
{
251
  static GtkType widget_type = 0;
252
  
Elliot Lee's avatar
Elliot Lee committed
253
254
  if (!widget_type)
    {
255
      static const GtkTypeInfo widget_info =
Elliot Lee's avatar
Elliot Lee committed
256
257
258
259
260
261
      {
	"GtkWidget",
	sizeof (GtkWidget),
	sizeof (GtkWidgetClass),
	(GtkClassInitFunc) gtk_widget_class_init,
	(GtkObjectInitFunc) gtk_widget_init,
262
263
        /* reserved_1 */ NULL,
	/* reserved_2 */ NULL,
264
	(GtkClassInitFunc) NULL,
Elliot Lee's avatar
Elliot Lee committed
265
      };
266
      
267
268
269
270
271
272
273
274
      static const GInterfaceInfo accessibility_info =
      {
        (GInterfaceInitFunc) gtk_widget_accessible_interface_init,
        (GInterfaceFinalizeFunc) NULL,
        NULL /* interface data */
      };

 
275
      widget_type = gtk_type_unique (GTK_TYPE_OBJECT, &widget_info);
276
277
278
279

      g_type_add_interface_static (widget_type, ATK_TYPE_IMPLEMENTOR,
                                   &accessibility_info) ;

Elliot Lee's avatar
Elliot Lee committed
280
    }
281
  
Elliot Lee's avatar
Elliot Lee committed
282
283
284
285
286
287
288
289
290
291
292
293
294
  return widget_type;
}

/*****************************************
 * gtk_widget_class_init:
 *
 *   arguments:
 *
 *   results:
 *****************************************/
static void
gtk_widget_class_init (GtkWidgetClass *klass)
{
295
296
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
  GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
Owen Taylor's avatar
Owen Taylor committed
297
  GtkBindingSet *binding_set;
298
  
299
300
301
302
  parent_class = gtk_type_class (GTK_TYPE_OBJECT);

  gobject_class->shutdown = gtk_widget_shutdown;
  gobject_class->finalize = gtk_widget_finalize;
Alexander Larsson's avatar
Alexander Larsson committed
303
304
  gobject_class->set_property = gtk_widget_set_property;
  gobject_class->get_property = gtk_widget_get_property;
305
306

  object_class->destroy = gtk_widget_real_destroy;
307
  
308
309
310
311
312
313
314
315
316
317
318
319
320
321
  klass->activate_signal = 0;
  klass->set_scroll_adjustments_signal = 0;
  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
322
  klass->hierarchy_changed = NULL;
323
  klass->style_set = gtk_widget_style_set;
324
  klass->direction_changed = gtk_widget_direction_changed;
325
326
  klass->add_accelerator = (void*) gtk_accel_group_handle_add;
  klass->remove_accelerator = (void*) gtk_accel_group_handle_remove;
327
  klass->mnemonic_activate = gtk_widget_real_mnemonic_activate;
328
  klass->grab_focus = gtk_widget_real_grab_focus;
329
  klass->focus = gtk_widget_real_focus;
330
331
332
333
334
335
336
337
338
339
340
341
  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;
342
343
  klass->focus_in_event = gtk_widget_real_focus_in_event;
  klass->focus_out_event = gtk_widget_real_focus_out_event;
344
345
  klass->map_event = NULL;
  klass->unmap_event = NULL;
Havoc Pennington's avatar
Havoc Pennington committed
346
  klass->window_state_event = NULL;
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
  klass->property_notify_event = gtk_selection_property_notify;
  klass->selection_clear_event = gtk_selection_clear;
  klass->selection_request_event = gtk_selection_request;
  klass->selection_notify_event = gtk_selection_notify;
  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;

362
363
364
  /* Accessibility support */
  klass->get_accessible = gtk_widget_real_get_accessible;

365
366
  klass->no_expose_event = NULL;

367
368
369
370
371
372
373
374
375
376
  quark_property_parser = g_quark_from_static_string ("gtk-rc-property-parser");
  quark_aux_info = g_quark_from_static_string ("gtk-aux-info");
  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_saved_default_style = g_quark_from_static_string ("gtk-saved-default-style");
  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");
377
  quark_accessible_object = g_quark_from_static_string ("gtk-accessible-object");
378
379
380

  style_property_spec_pool = g_param_spec_pool_new (FALSE);

Alexander Larsson's avatar
Alexander Larsson committed
381
382
383
384
385
386
387
  g_object_class_install_property (gobject_class,
				   PROP_NAME,
				   g_param_spec_string ("name",
 							_("Widget name"),
							_("The name of the widget"),
							NULL,
							G_PARAM_READWRITE));
388
  
Alexander Larsson's avatar
Alexander Larsson committed
389
390
391
392
393
394
395
396
397
398
399
400
401
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
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
  g_object_class_install_property (gobject_class,
				   PROP_PARENT,
				   g_param_spec_object ("parent",
							_("Parent widget"),
							_("The parent widget of this widget. Must be a Container widget."),
							GTK_TYPE_CONTAINER,
							G_PARAM_READWRITE));
 
  g_object_class_install_property (gobject_class,
				   PROP_X,
				   g_param_spec_int ("x",
 						     _("x coordinate"),
 						     _("The x coordinate of the top-left corner of the widget, or -1 if not set"),
 						     -G_MAXINT,
 						     G_MAXINT,
 						     -1,
 						     G_PARAM_READWRITE));
 
  g_object_class_install_property (gobject_class,
				   PROP_Y,
				   g_param_spec_int ("y",
 						     _("y coordinate"),
 						     _("The y coordinate of the top-left corner of the widget, or -1 if not set"),
 						     -G_MAXINT,
 						     G_MAXINT,
 						     -1,
 						     G_PARAM_READWRITE));
 
  g_object_class_install_property (gobject_class,
				   PROP_WIDTH,
				   g_param_spec_int ("width",
 						     _("Width"),
 						     _("The width of the widget, or -1 if unset."),
 						     -1,
 						     G_MAXINT,
 						     -1,
 						     G_PARAM_READWRITE));
 
  g_object_class_install_property (gobject_class,
				   PROP_HEIGHT,
				   g_param_spec_int ("height",
 						     _("Height"),
 						     _("The height of the widget, or -1 if unset."),
 						     -1,
 						     G_MAXINT,
 						     -1,
 						     G_PARAM_READWRITE));
 
  g_object_class_install_property (gobject_class,
				   PROP_VISIBLE,
				   g_param_spec_boolean ("visible",
 							 _("Visible"),
 							 _("Whether the widget is visible"),
 							 FALSE,
 							 G_PARAM_READWRITE));
 
  g_object_class_install_property (gobject_class,
				   PROP_SENSITIVE,
				   g_param_spec_boolean ("sensitive",
 							 _("Sensitive"),
 							 _("Whether the widget responds to input"),
 							 TRUE,
 							 G_PARAM_READWRITE));
 
  g_object_class_install_property (gobject_class,
				   PROP_APP_PAINTABLE,
				   g_param_spec_boolean ("app_paintable",
 							 _("Application paintable"),
 							 _("Whether the application will paint directly on the widget"),
 							 FALSE,
 							 G_PARAM_READWRITE));
 
  g_object_class_install_property (gobject_class,
				   PROP_CAN_FOCUS,
				   g_param_spec_boolean ("can_focus",
 							 _("Can focus"),
 							 _("Whether the widget can accept the input focus"),
 							 FALSE,
 							 G_PARAM_READWRITE));
 
  g_object_class_install_property (gobject_class,
				   PROP_HAS_FOCUS,
				   g_param_spec_boolean ("has_focus",
 							 _("Has focus"),
 							 _("Whether the widget has the input focus"),
 							 FALSE,
 							 G_PARAM_READWRITE));
 
  g_object_class_install_property (gobject_class,
				   PROP_CAN_DEFAULT,
				   g_param_spec_boolean ("can_default",
 							 _("Can default"),
 							 _("Whether the widget can be the default widget"),
 							 FALSE,
 							 G_PARAM_READWRITE));
 
  g_object_class_install_property (gobject_class,
				   PROP_HAS_DEFAULT,
				   g_param_spec_boolean ("has_default",
 							 _("Has default"),
 							 _("Whether the widget is the default widget"),
 							 FALSE,
 							 G_PARAM_READWRITE));
 
  g_object_class_install_property (gobject_class,
				   PROP_RECEIVES_DEFAULT,
				   g_param_spec_boolean ("receives_default",
 							 _("Receives default"),
 							 _("If TRUE, the widget will receive the default action when it is focused."),
 							 FALSE,
 							 G_PARAM_READWRITE));
 
  g_object_class_install_property (gobject_class,
				   PROP_COMPOSITE_CHILD,
				   g_param_spec_boolean ("composite_child",
 							 _("Composite child"),
 							 _("Whether the widget is composed of other widgets"),
 							 FALSE,
 							 G_PARAM_READWRITE));
 
 
  g_object_class_install_property (gobject_class,
				   PROP_STYLE,
				   g_param_spec_object ("style",
 							_("Style"),
 							_("The style of the widget, which contains information about how it will look (colors etc)."),
 							GTK_TYPE_STYLE,
 							G_PARAM_READWRITE));
 
  g_object_class_install_property (gobject_class,
				   PROP_EVENTS,
				   g_param_spec_flags ("events",
 						       _("Events"),
 						       _("The event mask that decides what kind of GdkEvents this widget gets."),
523
 						       GDK_TYPE_EVENT_MASK,
Alexander Larsson's avatar
Alexander Larsson committed
524
525
526
527
528
529
530
531
 						       GDK_STRUCTURE_MASK,
 						       G_PARAM_READWRITE));
 
  g_object_class_install_property (gobject_class,
				   PROP_EXTENSION_EVENTS,
				   g_param_spec_enum ("extension_events",
 						      _("Extension events"),
 						      _("The mask that decides what kind of extension events this widget gets."),
532
 						      GDK_TYPE_EXTENSION_MODE,
Alexander Larsson's avatar
Alexander Larsson committed
533
534
535
536
 						      GDK_EXTENSION_EVENTS_NONE,
 						      G_PARAM_READWRITE));


Elliot Lee's avatar
Elliot Lee committed
537
538
539
  widget_signals[SHOW] =
    gtk_signal_new ("show",
		    GTK_RUN_FIRST,
540
		    GTK_CLASS_TYPE (object_class),
Elliot Lee's avatar
Elliot Lee committed
541
		    GTK_SIGNAL_OFFSET (GtkWidgetClass, show),
542
		    gtk_marshal_VOID__VOID,
Elliot Lee's avatar
Elliot Lee committed
543
544
545
546
		    GTK_TYPE_NONE, 0);
  widget_signals[HIDE] =
    gtk_signal_new ("hide",
		    GTK_RUN_FIRST,
547
		    GTK_CLASS_TYPE (object_class),
Elliot Lee's avatar
Elliot Lee committed
548
		    GTK_SIGNAL_OFFSET (GtkWidgetClass, hide),
549
		    gtk_marshal_VOID__VOID,
Elliot Lee's avatar
Elliot Lee committed
550
551
552
553
		    GTK_TYPE_NONE, 0);
  widget_signals[MAP] =
    gtk_signal_new ("map",
		    GTK_RUN_FIRST,
554
		    GTK_CLASS_TYPE (object_class),
Elliot Lee's avatar
Elliot Lee committed
555
		    GTK_SIGNAL_OFFSET (GtkWidgetClass, map),
556
		    gtk_marshal_VOID__VOID,
Elliot Lee's avatar
Elliot Lee committed
557
558
559
560
		    GTK_TYPE_NONE, 0);
  widget_signals[UNMAP] =
    gtk_signal_new ("unmap",
		    GTK_RUN_FIRST,
561
		    GTK_CLASS_TYPE (object_class),
Elliot Lee's avatar
Elliot Lee committed
562
		    GTK_SIGNAL_OFFSET (GtkWidgetClass, unmap),
563
		    gtk_marshal_VOID__VOID,
Elliot Lee's avatar
Elliot Lee committed
564
565
566
567
		    GTK_TYPE_NONE, 0);
  widget_signals[REALIZE] =
    gtk_signal_new ("realize",
		    GTK_RUN_FIRST,
568
		    GTK_CLASS_TYPE (object_class),
Elliot Lee's avatar
Elliot Lee committed
569
		    GTK_SIGNAL_OFFSET (GtkWidgetClass, realize),
570
		    gtk_marshal_VOID__VOID,
Elliot Lee's avatar
Elliot Lee committed
571
572
573
574
		    GTK_TYPE_NONE, 0);
  widget_signals[UNREALIZE] =
    gtk_signal_new ("unrealize",
		    GTK_RUN_FIRST,
575
		    GTK_CLASS_TYPE (object_class),
Elliot Lee's avatar
Elliot Lee committed
576
		    GTK_SIGNAL_OFFSET (GtkWidgetClass, unrealize),
577
		    gtk_marshal_VOID__VOID,
Elliot Lee's avatar
Elliot Lee committed
578
579
		    GTK_TYPE_NONE, 0);
  widget_signals[SIZE_REQUEST] =
580
581
582
583
584
585
586
587
    g_signal_newc ("size_request",
		   G_OBJECT_CLASS_TYPE (object_class),
		   G_SIGNAL_RUN_FIRST,
		   G_STRUCT_OFFSET (GtkWidgetClass, size_request),
		   NULL, NULL,
		   gtk_marshal_VOID__BOXED,
		   GTK_TYPE_NONE, 1,
		   GTK_TYPE_REQUISITION | G_SIGNAL_TYPE_STATIC_SCOPE);
588
  widget_signals[SIZE_ALLOCATE] = 
Elliot Lee's avatar
Elliot Lee committed
589
590
    gtk_signal_new ("size_allocate",
		    GTK_RUN_FIRST,
591
		    GTK_CLASS_TYPE (object_class),
Elliot Lee's avatar
Elliot Lee committed
592
		    GTK_SIGNAL_OFFSET (GtkWidgetClass, size_allocate),
Owen Taylor's avatar
Owen Taylor committed
593
		    gtk_marshal_VOID__BOXED,
Elliot Lee's avatar
Elliot Lee committed
594
		    GTK_TYPE_NONE, 1,
Owen Taylor's avatar
Owen Taylor committed
595
		    GDK_TYPE_RECTANGLE | G_SIGNAL_TYPE_STATIC_SCOPE);
Elliot Lee's avatar
Elliot Lee committed
596
597
598
  widget_signals[STATE_CHANGED] =
    gtk_signal_new ("state_changed",
		    GTK_RUN_FIRST,
599
		    GTK_CLASS_TYPE (object_class),
Elliot Lee's avatar
Elliot Lee committed
600
		    GTK_SIGNAL_OFFSET (GtkWidgetClass, state_changed),
601
		    gtk_marshal_VOID__ENUM,
602
		    GTK_TYPE_NONE, 1,
603
		    GTK_TYPE_STATE_TYPE);
604
605
  widget_signals[PARENT_SET] =
    gtk_signal_new ("parent_set",
606
		    GTK_RUN_FIRST,
607
		    GTK_CLASS_TYPE (object_class),
608
		    GTK_SIGNAL_OFFSET (GtkWidgetClass, parent_set),
Tim Janik's avatar
Tim Janik committed
609
		    gtk_marshal_VOID__OBJECT,
610
611
		    GTK_TYPE_NONE, 1,
		    GTK_TYPE_OBJECT);
Owen Taylor's avatar
Owen Taylor committed
612
613
614
615
616
617
618
  widget_signals[HIERARCHY_CHANGED] =
    gtk_signal_new ("hierarchy_changed",
		    GTK_RUN_LAST,
		    GTK_CLASS_TYPE (object_class),
		    GTK_SIGNAL_OFFSET (GtkWidgetClass, hierarchy_changed),
		    gtk_marshal_NONE__NONE,
		    GTK_TYPE_NONE, 0);
619
620
621
  widget_signals[STYLE_SET] =
    gtk_signal_new ("style_set",
		    GTK_RUN_FIRST,
622
		    GTK_CLASS_TYPE (object_class),
623
		    GTK_SIGNAL_OFFSET (GtkWidgetClass, style_set),
Tim Janik's avatar
Tim Janik committed
624
		    gtk_marshal_VOID__OBJECT,
625
		    GTK_TYPE_NONE, 1,
626
		    GTK_TYPE_STYLE);
627
628
629
630
631
  widget_signals[DIRECTION_CHANGED] =
    gtk_signal_new ("direction_changed",
		    GTK_RUN_FIRST,
		    GTK_CLASS_TYPE (object_class),
		    GTK_SIGNAL_OFFSET (GtkWidgetClass, direction_changed),
632
		    gtk_marshal_VOID__ENUM,
633
634
		    GTK_TYPE_NONE, 1,
		    GTK_TYPE_TEXT_DIRECTION);
Tim Janik's avatar
Tim Janik committed
635
  widget_signals[ADD_ACCELERATOR] =
636
    gtk_accel_group_create_add (GTK_CLASS_TYPE (object_class), GTK_RUN_LAST,
Tim Janik's avatar
Tim Janik committed
637
				GTK_SIGNAL_OFFSET (GtkWidgetClass, add_accelerator));
Elliot Lee's avatar
Elliot Lee committed
638
  widget_signals[REMOVE_ACCELERATOR] =
639
    gtk_accel_group_create_remove (GTK_CLASS_TYPE (object_class), GTK_RUN_LAST,
Tim Janik's avatar
Tim Janik committed
640
				   GTK_SIGNAL_OFFSET (GtkWidgetClass, remove_accelerator));
641
  widget_signals[ACTIVATE_MNEMONIC] =
642
    g_signal_newc ("mnemonic_activate",
643
644
		   GTK_CLASS_TYPE (object_class),
		   GTK_RUN_LAST,
645
		   GTK_SIGNAL_OFFSET (GtkWidgetClass, mnemonic_activate),
646
		   _gtk_boolean_handled_accumulator, NULL,
647
648
649
		   gtk_marshal_BOOLEAN__BOOLEAN,
		   GTK_TYPE_BOOL, 1,
		   GTK_TYPE_BOOL);
650
651
  widget_signals[GRAB_FOCUS] =
    gtk_signal_new ("grab_focus",
652
		    GTK_RUN_LAST | GTK_RUN_ACTION,
653
		    GTK_CLASS_TYPE (object_class),
654
		    GTK_SIGNAL_OFFSET (GtkWidgetClass, grab_focus),
655
		    gtk_marshal_VOID__VOID,
656
		    GTK_TYPE_NONE, 0);
657
658
659
660
661
662
663
664
665
  widget_signals[FOCUS] =
    g_signal_newc ("focus",
                   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
666
  widget_signals[EVENT] =
667
668
669
670
671
672
673
674
    g_signal_newc ("event",
		   G_TYPE_FROM_CLASS(object_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);
Elliot Lee's avatar
Elliot Lee committed
675
  widget_signals[BUTTON_PRESS_EVENT] =
676
677
678
679
680
681
682
683
    g_signal_newc ("button_press_event",
		   G_TYPE_FROM_CLASS(object_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);
Elliot Lee's avatar
Elliot Lee committed
684
  widget_signals[BUTTON_RELEASE_EVENT] =
685
686
687
688
689
690
691
692
    g_signal_newc ("button_release_event",
		   G_TYPE_FROM_CLASS(object_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);
693
  widget_signals[SCROLL_EVENT] =
694
695
696
697
698
699
700
701
    g_signal_newc ("scroll_event",
		   G_TYPE_FROM_CLASS(object_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);
Elliot Lee's avatar
Elliot Lee committed
702
  widget_signals[MOTION_NOTIFY_EVENT] =
703
704
705
706
707
708
709
710
    g_signal_newc ("motion_notify_event",
		   G_TYPE_FROM_CLASS(object_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);
Elliot Lee's avatar
Elliot Lee committed
711
  widget_signals[DELETE_EVENT] =
712
713
714
715
716
717
718
719
    g_signal_newc ("delete_event",
		   G_TYPE_FROM_CLASS(object_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);
Elliot Lee's avatar
Elliot Lee committed
720
  widget_signals[DESTROY_EVENT] =
721
722
723
724
725
726
727
728
    g_signal_newc ("destroy_event",
		   G_TYPE_FROM_CLASS(object_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);
Elliot Lee's avatar
Elliot Lee committed
729
  widget_signals[EXPOSE_EVENT] =
730
731
732
733
734
735
736
737
    g_signal_newc ("expose_event",
		   G_TYPE_FROM_CLASS(object_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);
Elliot Lee's avatar
Elliot Lee committed
738
  widget_signals[KEY_PRESS_EVENT] =
739
740
741
742
743
744
745
746
    g_signal_newc ("key_press_event",
		   G_TYPE_FROM_CLASS(object_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);
Elliot Lee's avatar
Elliot Lee committed
747
  widget_signals[KEY_RELEASE_EVENT] =
748
749
750
751
752
753
754
755
    g_signal_newc ("key_release_event",
		   G_TYPE_FROM_CLASS(object_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);
Elliot Lee's avatar
Elliot Lee committed
756
  widget_signals[ENTER_NOTIFY_EVENT] =
757
758
759
760
761
762
763
764
    g_signal_newc ("enter_notify_event",
		   G_TYPE_FROM_CLASS(object_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);
Elliot Lee's avatar
Elliot Lee committed
765
  widget_signals[LEAVE_NOTIFY_EVENT] =
766
767
768
769
770
771
772
773
    g_signal_newc ("leave_notify_event",
		   G_TYPE_FROM_CLASS(object_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);
Elliot Lee's avatar
Elliot Lee committed
774
  widget_signals[CONFIGURE_EVENT] =
775
776
777
778
779
780
781
782
    g_signal_newc ("configure_event",
		   G_TYPE_FROM_CLASS(object_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);
Elliot Lee's avatar
Elliot Lee committed
783
  widget_signals[FOCUS_IN_EVENT] =
784
    g_signal_newc ("focus_in_event",
785
786
787
788
789
790
                  G_TYPE_FROM_CLASS(object_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,
791
                  GDK_TYPE_EVENT);
Elliot Lee's avatar
Elliot Lee committed
792
  widget_signals[FOCUS_OUT_EVENT] =
793
    g_signal_newc ("focus_out_event",
794
795
796
797
798
799
                  G_TYPE_FROM_CLASS(object_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,
800
                  GDK_TYPE_EVENT);
Elliot Lee's avatar
Elliot Lee committed
801
  widget_signals[MAP_EVENT] =
802
    g_signal_newc ("map_event",
803
804
805
806
807
808
                  G_TYPE_FROM_CLASS(object_class),
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET(GtkWidgetClass, map_event),
                  _gtk_boolean_handled_accumulator, NULL,
                  gtk_marshal_BOOLEAN__BOXED,
                  G_TYPE_BOOLEAN, 1,
809
                  GDK_TYPE_EVENT);
Elliot Lee's avatar
Elliot Lee committed
810
  widget_signals[UNMAP_EVENT] =
811
    g_signal_newc ("unmap_event",
812
813
814
815
816
817
                  G_TYPE_FROM_CLASS(object_class),
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET(GtkWidgetClass, unmap_event),
                  _gtk_boolean_handled_accumulator, NULL,
                  gtk_marshal_BOOLEAN__BOXED,
                  G_TYPE_BOOLEAN, 1,
818
                  GDK_TYPE_EVENT);
Elliot Lee's avatar
Elliot Lee committed
819
  widget_signals[PROPERTY_NOTIFY_EVENT] =
820
    g_signal_newc ("property_notify_event",
821
822
823
824
825
826
                  G_TYPE_FROM_CLASS(object_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,
827
                  GDK_TYPE_EVENT);
Elliot Lee's avatar
Elliot Lee committed
828
  widget_signals[SELECTION_CLEAR_EVENT] =
829
    g_signal_newc ("selection_clear_event",
830
831
832
833
834
835
                  G_TYPE_FROM_CLASS(object_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,
836
                  GDK_TYPE_EVENT);
Elliot Lee's avatar
Elliot Lee committed
837
  widget_signals[SELECTION_REQUEST_EVENT] =
838
    g_signal_newc ("selection_request_event",
839
840
841
842
843
844
                  G_TYPE_FROM_CLASS(object_class),
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET(GtkWidgetClass, selection_request_event),
                  _gtk_boolean_handled_accumulator, NULL,
                  gtk_marshal_BOOLEAN__BOXED,
                  G_TYPE_BOOLEAN, 1,
845
                  GDK_TYPE_EVENT);
Elliot Lee's avatar
Elliot Lee committed
846
  widget_signals[SELECTION_NOTIFY_EVENT] =
847
    g_signal_newc ("selection_notify_event",
848
849
850
851
852
853
                  G_TYPE_FROM_CLASS(object_class),
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET(GtkWidgetClass, selection_notify_event),
                  _gtk_boolean_handled_accumulator, NULL,
                  gtk_marshal_BOOLEAN__BOXED,
                  G_TYPE_BOOLEAN, 1,
854
                  GDK_TYPE_EVENT);
Elliot Lee's avatar
Elliot Lee committed
855
856
857
  widget_signals[SELECTION_RECEIVED] =
    gtk_signal_new ("selection_received",
		    GTK_RUN_LAST,
858
		    GTK_CLASS_TYPE (object_class),
Elliot Lee's avatar
Elliot Lee committed
859
		    GTK_SIGNAL_OFFSET (GtkWidgetClass, selection_received),
Tim Janik's avatar
Tim Janik committed
860
		    gtk_marshal_VOID__BOXED_UINT,
861
862
863
864
865
866
		    GTK_TYPE_NONE, 2,
		    GTK_TYPE_SELECTION_DATA,
		    GTK_TYPE_UINT);
  widget_signals[SELECTION_GET] =
    gtk_signal_new ("selection_get",
		    GTK_RUN_LAST,
867
		    GTK_CLASS_TYPE (object_class),
868
		    GTK_SIGNAL_OFFSET (GtkWidgetClass, selection_get),
Tim Janik's avatar
Tim Janik committed
869
		    gtk_marshal_VOID__BOXED_UINT_UINT,
870
		    GTK_TYPE_NONE, 3,
871
872
873
		    GTK_TYPE_SELECTION_DATA,
		    GTK_TYPE_UINT,
		    GTK_TYPE_UINT);
Elliot Lee's avatar
Elliot Lee committed
874
  widget_signals[PROXIMITY_IN_EVENT] =
875
    g_signal_newc ("proximity_in_event",
876
877
878
879
880
881
                  G_TYPE_FROM_CLASS(object_class),
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET(GtkWidgetClass, proximity_in_event),
                  _gtk_boolean_handled_accumulator, NULL,
                  gtk_marshal_BOOLEAN__BOXED,
                  G_TYPE_BOOLEAN, 1,
882
                  GDK_TYPE_EVENT);
Elliot Lee's avatar
Elliot Lee committed
883
  widget_signals[PROXIMITY_OUT_EVENT] =
884
    g_signal_newc ("proximity_out_event",
885
886
887
888
889
890
                  G_TYPE_FROM_CLASS(object_class),
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET(GtkWidgetClass, proximity_out_event),
                  _gtk_boolean_handled_accumulator, NULL,
                  gtk_marshal_BOOLEAN__BOXED,
                  G_TYPE_BOOLEAN, 1,
891
                  GDK_TYPE_EVENT);
892
893
  widget_signals[DRAG_LEAVE] =
    gtk_signal_new ("drag_leave",
Elliot Lee's avatar
Elliot Lee committed
894
		    GTK_RUN_LAST,
895
		    GTK_CLASS_TYPE (object_class),
896
		    GTK_SIGNAL_OFFSET (GtkWidgetClass, drag_leave),
897
		    gtk_marshal_VOID__OBJECT_UINT,
898
		    GTK_TYPE_NONE, 2,
899
		    GDK_TYPE_DRAG_CONTEXT,
900
901
902
		    GTK_TYPE_UINT);
  widget_signals[DRAG_BEGIN] =
    gtk_signal_new ("drag_begin",
Elliot Lee's avatar
Elliot Lee committed
903
		    GTK_RUN_LAST,
904
		    GTK_CLASS_TYPE (object_class),
905
		    GTK_SIGNAL_OFFSET (GtkWidgetClass, drag_begin),
906
		    gtk_marshal_VOID__OBJECT,
907
		    GTK_TYPE_NONE, 1,
908
		    GDK_TYPE_DRAG_CONTEXT);
909
910
  widget_signals[DRAG_END] =
    gtk_signal_new ("drag_end",
911
		    GTK_RUN_LAST,
912
		    GTK_CLASS_TYPE (object_class),
913
		    GTK_SIGNAL_OFFSET (GtkWidgetClass, drag_end),
914
		    gtk_marshal_VOID__OBJECT,
915
		    GTK_TYPE_NONE, 1,
916
		    GDK_TYPE_DRAG_CONTEXT);
917
918
  widget_signals[DRAG_DATA_DELETE] =
    gtk_signal_new ("drag_data_delete",
919
		    GTK_RUN_LAST,
920
		    GTK_CLASS_TYPE (object_class),
921
		    GTK_SIGNAL_OFFSET (GtkWidgetClass, drag_data_delete),
922
		    gtk_marshal_VOID__OBJECT,
923
		    GTK_TYPE_NONE, 1,
924
		    GDK_TYPE_DRAG_CONTEXT);
925
  widget_signals[DRAG_MOTION] =
926
    g_signal_newc ("drag_motion",
927
928
929
930
931
932
933
934
935
936
                  G_TYPE_FROM_CLASS(object_class),
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET(GtkWidgetClass, drag_motion),
                  _gtk_boolean_handled_accumulator, NULL,
		  gtk_marshal_BOOLEAN__OBJECT_INT_INT_UINT,
		  G_TYPE_BOOLEAN, 4,
		  GDK_TYPE_DRAG_CONTEXT,
		  G_TYPE_INT,
		  G_TYPE_INT,
		  G_TYPE_UINT);
937
  widget_signals[DRAG_DROP] =
938
    g_signal_newc ("drag_drop",
939
940
941
942
943
944
945
946
947
948
                  G_TYPE_FROM_CLASS(object_class),
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET(GtkWidgetClass, drag_drop),
                  _gtk_boolean_handled_accumulator, NULL,
		  gtk_marshal_BOOLEAN__OBJECT_INT_INT_UINT,
		  G_TYPE_BOOLEAN, 4,
		  GDK_TYPE_DRAG_CONTEXT,
		  G_TYPE_INT,
		  G_TYPE_INT,
		  G_TYPE_UINT);
949
950
951
  widget_signals[DRAG_DATA_GET] =
    gtk_signal_new ("drag_data_get",
		    GTK_RUN_LAST,
952
		    GTK_CLASS_TYPE (object_class),
953
		    GTK_SIGNAL_OFFSET (GtkWidgetClass, drag_data_get),
954
		    gtk_marshal_VOID__OBJECT_BOXED_UINT_UINT,
955
		    GTK_TYPE_NONE, 4,
956
		    GDK_TYPE_DRAG_CONTEXT,
957
958
959
960
961
962
		    GTK_TYPE_SELECTION_DATA,
		    GTK_TYPE_UINT,
		    GTK_TYPE_UINT);
  widget_signals[DRAG_DATA_RECEIVED] =
    gtk_signal_new ("drag_data_received",
		    GTK_RUN_LAST,
963
		    GTK_CLASS_TYPE (object_class),
964
		    GTK_SIGNAL_OFFSET (GtkWidgetClass, drag_data_received),
965
		    gtk_marshal_VOID__OBJECT_INT_INT_BOXED_UINT_UINT,
966
		    GTK_TYPE_NONE, 6,
967
		    GDK_TYPE_DRAG_CONTEXT,
968
969
		    GTK_TYPE_INT,
		    GTK_TYPE_INT,
970
971
972
		    GTK_TYPE_SELECTION_DATA,
		    GTK_TYPE_UINT,
		    GTK_TYPE_UINT);
Tim Janik's avatar
Tim Janik committed
973
  widget_signals[VISIBILITY_NOTIFY_EVENT] =
974
    g_signal_newc ("visibility_notify_event",
975
976
977
978
979
980
		  G_TYPE_FROM_CLASS(object_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET(GtkWidgetClass, visibility_notify_event),
                  _gtk_boolean_handled_accumulator, NULL,
		  gtk_marshal_BOOLEAN__BOXED,
		  G_TYPE_BOOLEAN, 1,
981
                  GDK_TYPE_EVENT);
982
  widget_signals[CLIENT_EVENT] =
983
    g_signal_newc ("client_event",
984
985
986
987
988
989
		  G_TYPE_FROM_CLASS(object_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET(GtkWidgetClass, client_event),
		  _gtk_boolean_handled_accumulator, NULL,
		  gtk_marshal_BOOLEAN__BOXED,
		  G_TYPE_BOOLEAN, 1,
990
		  GDK_TYPE_EVENT);
991
  widget_signals[NO_EXPOSE_EVENT] =
992
    g_signal_newc ("no_expose_event",
993
994
995
996
997
998
		  G_TYPE_FROM_CLASS(object_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET(GtkWidgetClass, no_expose_event),
		  _gtk_boolean_handled_accumulator, NULL,
		  gtk_marshal_BOOLEAN__BOXED,
		  G_TYPE_BOOLEAN, 1,
999
		  GDK_TYPE_EVENT);
Havoc Pennington's avatar
Havoc Pennington committed
1000
  widget_signals[WINDOW_STATE_EVENT] =
1001
    g_signal_newc ("window_state_event",
1002
1003
1004
1005
1006
1007
		  G_TYPE_FROM_CLASS(object_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET(GtkWidgetClass, window_state_event),
		  _gtk_boolean_handled_accumulator, NULL,
		  gtk_marshal_BOOLEAN__BOXED,
		  G_TYPE_BOOLEAN, 1,
1008
		  GDK_TYPE_EVENT);
Owen Taylor's avatar
Owen Taylor committed
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
  widget_signals[POPUP_MENU] =
    gtk_signal_new ("popup_menu",
		    GTK_RUN_LAST | GTK_RUN_ACTION,
		    GTK_CLASS_TYPE (object_class),
		    GTK_SIGNAL_OFFSET (GtkWidgetClass, popup_menu),
                    gtk_marshal_NONE__NONE,
		    GTK_TYPE_NONE, 0);
  
  binding_set = gtk_binding_set_by_class (klass);

  gtk_binding_entry_add_signal (binding_set, GDK_F10, GDK_SHIFT_MASK,
                                "popup_menu", 0);

  gtk_binding_entry_add_signal (binding_set, GDK_Menu, 0,
                                "popup_menu", 0);  
1024
1025
1026
1027
1028

  gtk_widget_class_install_style_property (klass,
					   g_param_spec_boolean ("interior_focus",
								 _("Interior Focus"),
								 _("Whether to draw the focus indicator inside widgets."),
1029
								 TRUE,
1030
								 G_PARAM_READABLE));
Elliot Lee's avatar
Elliot Lee committed
1031
1032
1033
}

static void
Alexander Larsson's avatar
Alexander Larsson committed
1034
1035
1036
1037
gtk_widget_set_property (GObject         *object,
			 guint            prop_id,
			 const GValue    *value,
			 GParamSpec      *pspec)
Elliot Lee's avatar
Elliot Lee committed
1038
{
1039
  GtkWidget *widget;
1040
  GtkWidgetAuxInfo *aux_info;
1041
1042

  widget = GTK_WIDGET (object);
1043

Alexander Larsson's avatar
Alexander Larsson committed
1044
  switch (prop_id)
Elliot Lee's avatar
Elliot Lee committed
1045
    {
1046
1047
      guint32 saved_flags;
      
Alexander Larsson's avatar
Alexander Larsson committed
1048
1049
    case PROP_NAME:
      gtk_widget_set_name (widget, g_value_get_string (value));
1050
      break;
Alexander Larsson's avatar
Alexander Larsson committed
1051
1052
    case PROP_PARENT:
      gtk_container_add (GTK_CONTAINER (g_value_get_object (value)), widget);
1053
      break;
Alexander Larsson's avatar
Alexander Larsson committed
1054
    case PROP_X:
1055
      aux_info = _gtk_widget_get_aux_info (widget, TRUE);
Alexander Larsson's avatar
Alexander Larsson committed
1056
      if (g_value_get_int (value) == -1)
1057
1058
1059
1060
	aux_info->x_set = FALSE;
      else
	{
	  aux_info->x_set = TRUE;
Alexander Larsson's avatar
Alexander Larsson committed
1061
	  aux_info->x = g_value_get_int (value);
1062
1063
	}
      gtk_widget_do_uposition (widget);
1064
      break;
Alexander Larsson's avatar
Alexander Larsson committed
1065
    case PROP_Y:
1066
      aux_info = _gtk_widget_get_aux_info (widget, TRUE);
Alexander Larsson's avatar
Alexander Larsson committed
1067
      if (g_value_get_int (value) == -1)
1068
1069
1070
1071
	aux_info->y_set = FALSE;
      else
	{
	  aux_info->y_set = TRUE;
Alexander Larsson's avatar
Alexander Larsson committed
1072
	  aux_info->y = g_value_get_int (value);
1073
1074
	}
      gtk_widget_do_uposition (widget);
1075
      break;
Alexander Larsson's avatar
Alexander Larsson committed
1076
1077
    case PROP_WIDTH:
      gtk_widget_set_usize (widget, g_value_get_int (value), -2);
1078
      break;
Alexander Larsson's avatar
Alexander Larsson committed
1079
1080
    case PROP_HEIGHT:
      gtk_widget_set_usize (widget, -2, g_value_get_int (value));
1081
      break;
Alexander Larsson's avatar
Alexander Larsson committed
1082
1083
    case PROP_VISIBLE:
      if (g_value_get_boolean (value))
1084
	gtk_widget_show (widget);
Elliot Lee's avatar
Elliot Lee committed
1085
      else
1086
	gtk_widget_hide (widget);
1087
      break;
Alexander Larsson's avatar
Alexander Larsson committed
1088
1089
    case PROP_SENSITIVE:
      gtk_widget_set_sensitive (widget, g_value_get_boolean (value));
1090
      break;
Alexander Larsson's avatar
Alexander Larsson committed
1091
1092
    case PROP_APP_PAINTABLE:
      gtk_widget_set_app_paintable (widget, g_value_get_boolean (value));
1093
      break;
Alexander Larsson's avatar
Alexander Larsson committed
1094
    case PROP_CAN_FOCUS:
1095
      saved_flags = GTK_WIDGET_FLAGS (widget);
Alexander Larsson's avatar
Alexander Larsson committed
1096
      if (g_value_get_boolean (value))
1097
1098
1099
	GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);
      else
	GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_FOCUS);
1100
1101
      if (saved_flags != GTK_WIDGET_FLAGS (widget))
	gtk_widget_queue_resize (widget);
1102
      break;
Alexander Larsson's avatar
Alexander Larsson committed
1103
1104
    case PROP_HAS_FOCUS:
      if (g_value_get_boolean (value))
1105
1106
	gtk_widget_grab_focus (widget);
      break;
Alexander Larsson's avatar
Alexander Larsson committed
1107
    case PROP_CAN_DEFAULT:
1108
      saved_flags = GTK_WIDGET_FLAGS (widget);
Alexander Larsson's avatar
Alexander Larsson committed
1109
      if (g_value_get_boolean (value))
1110
1111
1112
	GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_DEFAULT);
      else
	GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_DEFAULT);
1113
1114
      if (saved_flags != GTK_WIDGET_FLAGS (widget))
	gtk_widget_queue_resize (widget);
1115
      break;
Alexander Larsson's avatar
Alexander Larsson committed
1116
1117
    case PROP_HAS_DEFAULT:
      if (g_value_get_boolean (value))
1118
1119
	gtk_widget_grab_default (widget);
      break;
Alexander Larsson's avatar
Alexander Larsson committed
1120
1121
    case PROP_RECEIVES_DEFAULT:
      if (g_value_get_boolean (value))
1122
1123
1124
1125
	GTK_WIDGET_SET_FLAGS (widget, GTK_RECEIVES_DEFAULT);
      else
	GTK_WIDGET_UNSET_FLAGS (widget, GTK_RECEIVES_DEFAULT);
      break;
Alexander Larsson's avatar
Alexander Larsson committed
1126
1127
    case PROP_COMPOSITE_CHILD:
      if (g_value_get_boolean (value))
1128
1129
1130
1131
	GTK_WIDGET_SET_FLAGS (widget, GTK_COMPOSITE_CHILD);
      else
	GTK_WIDGET_UNSET_FLAGS (widget, GTK_COMPOSITE_CHILD);
      break;
Alexander Larsson's avatar
Alexander Larsson committed
1132
1133