gtkwidget.c 253 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>
50
#include "gdk/gdkkeysyms.h"
51
#include "gtkaccessible.h"
52
#include "gtktooltips.h"
Kristian Rietveld's avatar
Kristian Rietveld committed
53
#include "gtktooltip.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,
117
  WINDOW_STATE_EVENT,
118
  POPUP_MENU,
119
  SHOW_HELP,
120
  ACCEL_CLOSURES_CHANGED,
121
  SCREEN_CHANGED,
122
  CAN_ACTIVATE_ACCEL,
123
  GRAB_BROKEN,
124
  COMPOSITED_CHANGED,
Kristian Rietveld's avatar
Kristian Rietveld committed
125
  QUERY_TOOLTIP,
126
  KEYNAV_FAILED,
127
  DRAG_FAILED,
Elliot Lee's avatar
Elliot Lee committed
128 129 130
  LAST_SIGNAL
};

131
enum {
Alexander Larsson's avatar
Alexander Larsson committed
132 133 134
  PROP_0,
  PROP_NAME,
  PROP_PARENT,
Havoc Pennington's avatar
Havoc Pennington committed
135 136
  PROP_WIDTH_REQUEST,
  PROP_HEIGHT_REQUEST,
Alexander Larsson's avatar
Alexander Larsson committed
137 138 139 140 141
  PROP_VISIBLE,
  PROP_SENSITIVE,
  PROP_APP_PAINTABLE,
  PROP_CAN_FOCUS,
  PROP_HAS_FOCUS,
142
  PROP_IS_FOCUS,
Alexander Larsson's avatar
Alexander Larsson committed
143 144 145 146 147 148
  PROP_CAN_DEFAULT,
  PROP_HAS_DEFAULT,
  PROP_RECEIVES_DEFAULT,
  PROP_COMPOSITE_CHILD,
  PROP_STYLE,
  PROP_EVENTS,
149
  PROP_EXTENSION_EVENTS,
Kristian Rietveld's avatar
Kristian Rietveld committed
150 151 152
  PROP_NO_SHOW_ALL,
  PROP_HAS_TOOLTIP,
  PROP_TOOLTIP_MARKUP
153 154
};

155 156 157 158 159
typedef	struct	_GtkStateData	 GtkStateData;

struct _GtkStateData
{
  GtkStateType  state;
160
  guint		state_restoration : 1;
161
  guint         parent_sensitive : 1;
162
  guint		use_forall : 1;
163
};
Elliot Lee's avatar
Elliot Lee committed
164

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

Tim Janik's avatar
Tim Janik committed
195
static void	gtk_widget_real_grab_focus	 (GtkWidget         *focus_widget);
Kristian Rietveld's avatar
Kristian Rietveld committed
196 197 198 199 200
static gboolean gtk_widget_real_query_tooltip    (GtkWidget         *widget,
						  gint               x,
						  gint               y,
						  gboolean           keyboard_tip,
						  GtkTooltip        *tooltip);
201
static gboolean gtk_widget_real_show_help        (GtkWidget         *widget,
202 203
                                                  GtkWidgetHelpType  help_type);

Tim Janik's avatar
Tim Janik committed
204 205 206 207 208 209 210 211 212 213 214 215 216
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);
217 218
static gboolean		gtk_widget_real_keynav_failed		(GtkWidget        *widget,
								 GtkDirectionType  direction);
Tim Janik's avatar
Tim Janik committed
219
static PangoContext*	gtk_widget_peek_pango_context		(GtkWidget	  *widget);
220
static void     	gtk_widget_update_pango_context		(GtkWidget	  *widget);
Tim Janik's avatar
Tim Janik committed
221 222
static void		gtk_widget_propagate_state		(GtkWidget	  *widget,
								 GtkStateData 	  *data);
223
static void             gtk_widget_reset_rc_style               (GtkWidget        *widget);
Tim Janik's avatar
Tim Janik committed
224 225 226 227 228 229 230 231 232 233 234
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);
235 236
static void             gtk_widget_invalidate_widget_windows    (GtkWidget        *widget,
								 GdkRegion        *region);
237
static GdkScreen *      gtk_widget_get_screen_unchecked         (GtkWidget        *widget);
Soeren Sandmann's avatar
Soeren Sandmann committed
238
static void		gtk_widget_queue_shallow_draw		(GtkWidget        *widget);
239 240
static gboolean         gtk_widget_real_can_activate_accel      (GtkWidget *widget,
                                                                 guint      signal_id);
Kristian Rietveld's avatar
Kristian Rietveld committed
241 242 243 244

static void             gtk_widget_set_has_tooltip              (GtkWidget *widget,
								 gboolean   has_tooltip,
								 gboolean   force);
245
     
246 247 248
static void gtk_widget_set_usize_internal (GtkWidget *widget,
					   gint       width,
					   gint       height);
249 250
static void gtk_widget_get_draw_rectangle (GtkWidget    *widget,
					   GdkRectangle *rect);
251

Tim Janik's avatar
Tim Janik committed
252 253

/* --- variables --- */
254
static gpointer         gtk_widget_parent_class = NULL;
255 256 257 258 259 260
static guint            widget_signals[LAST_SIGNAL] = { 0 };
static GtkStyle        *gtk_default_style = NULL;
static GSList          *colormap_stack = NULL;
static guint            composite_child_stack = 0;
static GtkTextDirection gtk_default_direction = GTK_TEXT_DIR_LTR;
static GParamSpecPool  *style_property_spec_pool = NULL;
261

Tim Janik's avatar
Tim Janik committed
262 263
static GQuark		quark_property_parser = 0;
static GQuark		quark_aux_info = 0;
264 265
static GQuark		quark_accel_path = 0;
static GQuark		quark_accel_closures = 0;
Tim Janik's avatar
Tim Janik committed
266 267 268 269
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;
270
static GQuark		quark_input_shape_info = 0;
Tim Janik's avatar
Tim Janik committed
271 272 273 274
static GQuark		quark_colormap = 0;
static GQuark		quark_pango_context = 0;
static GQuark		quark_rc_style = 0;
static GQuark		quark_accessible_object = 0;
275
static GQuark		quark_mnemonic_labels = 0;
Kristian Rietveld's avatar
Kristian Rietveld committed
276 277 278
static GQuark		quark_tooltip_markup = 0;
static GQuark		quark_has_tooltip = 0;
static GQuark		quark_tooltip_window = 0;
Tim Janik's avatar
Tim Janik committed
279 280 281 282
GParamSpecPool         *_gtk_widget_child_property_pool = NULL;
GObjectNotifyContext   *_gtk_widget_child_property_notify_context = NULL;

/* --- functions --- */
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320
GType
gtk_widget_get_type (void)
{
  static GType widget_type = 0;

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

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

      widget_type = g_type_register_static (GTK_TYPE_OBJECT, "GtkWidget",
                                           &widget_info, G_TYPE_FLAG_ABSTRACT);

      g_type_add_interface_static (widget_type, ATK_TYPE_IMPLEMENTOR,
                                   &accessibility_info) ;

    }

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

Tim Janik's avatar
Tim Janik committed
322 323 324 325 326 327 328 329
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
330 331 332
static void
gtk_widget_class_init (GtkWidgetClass *klass)
{
Tim Janik's avatar
Tim Janik committed
333
  static GObjectNotifyContext cpn_context = { 0, NULL, NULL };
334 335
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
  GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
336
  GtkBindingSet *binding_set;
337 338 339

  gtk_widget_parent_class = g_type_class_peek_parent (klass);

Tim Janik's avatar
Tim Janik committed
340 341
  quark_property_parser = g_quark_from_static_string ("gtk-rc-property-parser");
  quark_aux_info = g_quark_from_static_string ("gtk-aux-info");
342 343
  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
344 345 346 347
  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");
348
  quark_input_shape_info = g_quark_from_static_string ("gtk-input-shape-info");
Tim Janik's avatar
Tim Janik committed
349 350 351 352
  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");
353
  quark_mnemonic_labels = g_quark_from_static_string ("gtk-mnemonic-labels");
Kristian Rietveld's avatar
Kristian Rietveld committed
354 355 356
  quark_tooltip_markup = g_quark_from_static_string ("gtk-tooltip-markup");
  quark_has_tooltip = g_quark_from_static_string ("gtk-has-tooltip");
  quark_tooltip_window = g_quark_from_static_string ("gtk-tooltip-window");
Tim Janik's avatar
Tim Janik committed
357 358 359 360 361 362

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

Tim Janik's avatar
Tim Janik committed
364
  gobject_class->dispose = gtk_widget_dispose;
365
  gobject_class->finalize = gtk_widget_finalize;
Alexander Larsson's avatar
Alexander Larsson committed
366 367
  gobject_class->set_property = gtk_widget_set_property;
  gobject_class->get_property = gtk_widget_get_property;
368 369

  object_class->destroy = gtk_widget_real_destroy;
370
  
371 372
  klass->activate_signal = 0;
  klass->set_scroll_adjustments_signal = 0;
Tim Janik's avatar
Tim Janik committed
373
  klass->dispatch_child_properties_changed = gtk_widget_dispatch_child_properties_changed;
374 375 376 377 378 379 380 381 382 383 384 385
  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
386
  klass->hierarchy_changed = NULL;
387
  klass->style_set = gtk_widget_style_set;
388
  klass->direction_changed = gtk_widget_direction_changed;
Tim Janik's avatar
Tim Janik committed
389 390
  klass->grab_notify = NULL;
  klass->child_notify = NULL;
391
  klass->mnemonic_activate = gtk_widget_real_mnemonic_activate;
392
  klass->grab_focus = gtk_widget_real_grab_focus;
393
  klass->focus = gtk_widget_real_focus;
394 395 396 397 398 399 400 401 402 403 404 405
  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;
406 407
  klass->focus_in_event = gtk_widget_real_focus_in_event;
  klass->focus_out_event = gtk_widget_real_focus_out_event;
408 409
  klass->map_event = NULL;
  klass->unmap_event = NULL;
410
  klass->window_state_event = NULL;
411
  klass->property_notify_event = _gtk_selection_property_notify;
412
  klass->selection_clear_event = gtk_selection_clear;
413 414
  klass->selection_request_event = _gtk_selection_request;
  klass->selection_notify_event = _gtk_selection_notify;
415 416 417 418 419 420 421 422 423 424
  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;
425
  klass->screen_changed = NULL;
426
  klass->can_activate_accel = gtk_widget_real_can_activate_accel;
427
  klass->grab_broken_event = NULL;
Kristian Rietveld's avatar
Kristian Rietveld committed
428
  klass->query_tooltip = gtk_widget_real_query_tooltip;
429 430 431 432 433 434

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

435 436
  klass->no_expose_event = NULL;

Alexander Larsson's avatar
Alexander Larsson committed
437 438 439
  g_object_class_install_property (gobject_class,
				   PROP_NAME,
				   g_param_spec_string ("name",
440 441
 							P_("Widget name"),
							P_("The name of the widget"),
Alexander Larsson's avatar
Alexander Larsson committed
442
							NULL,
443
							GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
444 445 446
  g_object_class_install_property (gobject_class,
				   PROP_PARENT,
				   g_param_spec_object ("parent",
447 448
							P_("Parent widget"), 
							P_("The parent widget of this widget. Must be a Container widget"),
Alexander Larsson's avatar
Alexander Larsson committed
449
							GTK_TYPE_CONTAINER,
450
							GTK_PARAM_READWRITE));
Havoc Pennington's avatar
Havoc Pennington committed
451

Alexander Larsson's avatar
Alexander Larsson committed
452
  g_object_class_install_property (gobject_class,
Havoc Pennington's avatar
Havoc Pennington committed
453
				   PROP_WIDTH_REQUEST,
Matthias Clasen's avatar
x  
Matthias Clasen committed
454
				   g_param_spec_int ("width-request",
455 456
 						     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
457 458 459
 						     -1,
 						     G_MAXINT,
 						     -1,
460
 						     GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
461
  g_object_class_install_property (gobject_class,
Havoc Pennington's avatar
Havoc Pennington committed
462
				   PROP_HEIGHT_REQUEST,
Matthias Clasen's avatar
x  
Matthias Clasen committed
463
				   g_param_spec_int ("height-request",
464 465
 						     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
466 467 468
 						     -1,
 						     G_MAXINT,
 						     -1,
469
 						     GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
470 471 472
  g_object_class_install_property (gobject_class,
				   PROP_VISIBLE,
				   g_param_spec_boolean ("visible",
473 474
 							 P_("Visible"),
 							 P_("Whether the widget is visible"),
Alexander Larsson's avatar
Alexander Larsson committed
475
 							 FALSE,
476
 							 GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
477 478 479
  g_object_class_install_property (gobject_class,
				   PROP_SENSITIVE,
				   g_param_spec_boolean ("sensitive",
480 481
 							 P_("Sensitive"),
 							 P_("Whether the widget responds to input"),
Alexander Larsson's avatar
Alexander Larsson committed
482
 							 TRUE,
483
 							 GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
484 485
  g_object_class_install_property (gobject_class,
				   PROP_APP_PAINTABLE,
Matthias Clasen's avatar
x  
Matthias Clasen committed
486
				   g_param_spec_boolean ("app-paintable",
487 488
 							 P_("Application paintable"),
 							 P_("Whether the application will paint directly on the widget"),
Alexander Larsson's avatar
Alexander Larsson committed
489
 							 FALSE,
490
 							 GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
491 492
  g_object_class_install_property (gobject_class,
				   PROP_CAN_FOCUS,
Matthias Clasen's avatar
x  
Matthias Clasen committed
493
				   g_param_spec_boolean ("can-focus",
494 495
 							 P_("Can focus"),
 							 P_("Whether the widget can accept the input focus"),
Alexander Larsson's avatar
Alexander Larsson committed
496
 							 FALSE,
497
 							 GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
498 499
  g_object_class_install_property (gobject_class,
				   PROP_HAS_FOCUS,
Matthias Clasen's avatar
x  
Matthias Clasen committed
500
				   g_param_spec_boolean ("has-focus",
501 502
 							 P_("Has focus"),
 							 P_("Whether the widget has the input focus"),
Alexander Larsson's avatar
Alexander Larsson committed
503
 							 FALSE,
504
 							 GTK_PARAM_READWRITE));
505
  g_object_class_install_property (gobject_class,
506
				   PROP_IS_FOCUS,
Matthias Clasen's avatar
x  
Matthias Clasen committed
507
				   g_param_spec_boolean ("is-focus",
508 509
 							 P_("Is focus"),
 							 P_("Whether the widget is the focus widget within the toplevel"),
510
 							 FALSE,
511
 							 GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
512 513
  g_object_class_install_property (gobject_class,
				   PROP_CAN_DEFAULT,
Matthias Clasen's avatar
x  
Matthias Clasen committed
514
				   g_param_spec_boolean ("can-default",
515 516
 							 P_("Can default"),
 							 P_("Whether the widget can be the default widget"),
Alexander Larsson's avatar
Alexander Larsson committed
517
 							 FALSE,
518
 							 GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
519 520
  g_object_class_install_property (gobject_class,
				   PROP_HAS_DEFAULT,
Matthias Clasen's avatar
x  
Matthias Clasen committed
521
				   g_param_spec_boolean ("has-default",
522 523
 							 P_("Has default"),
 							 P_("Whether the widget is the default widget"),
Alexander Larsson's avatar
Alexander Larsson committed
524
 							 FALSE,
525
 							 GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
526 527
  g_object_class_install_property (gobject_class,
				   PROP_RECEIVES_DEFAULT,
Matthias Clasen's avatar
x  
Matthias Clasen committed
528
				   g_param_spec_boolean ("receives-default",
529 530
 							 P_("Receives default"),
 							 P_("If TRUE, the widget will receive the default action when it is focused"),
Alexander Larsson's avatar
Alexander Larsson committed
531
 							 FALSE,
532
 							 GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
533 534
  g_object_class_install_property (gobject_class,
				   PROP_COMPOSITE_CHILD,
Matthias Clasen's avatar
x  
Matthias Clasen committed
535
				   g_param_spec_boolean ("composite-child",
536 537
 							 P_("Composite child"),
 							 P_("Whether the widget is part of a composite widget"),
Alexander Larsson's avatar
Alexander Larsson committed
538
 							 FALSE,
539
 							 GTK_PARAM_READABLE));
Alexander Larsson's avatar
Alexander Larsson committed
540 541 542
  g_object_class_install_property (gobject_class,
				   PROP_STYLE,
				   g_param_spec_object ("style",
543 544
 							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
545
 							GTK_TYPE_STYLE,
546
 							GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
547 548 549
  g_object_class_install_property (gobject_class,
				   PROP_EVENTS,
				   g_param_spec_flags ("events",
550 551
 						       P_("Events"),
 						       P_("The event mask that decides what kind of GdkEvents this widget gets"),
552
 						       GDK_TYPE_EVENT_MASK,
Alexander Larsson's avatar
Alexander Larsson committed
553
 						       GDK_STRUCTURE_MASK,
554
 						       GTK_PARAM_READWRITE));
Alexander Larsson's avatar
Alexander Larsson committed
555 556
  g_object_class_install_property (gobject_class,
				   PROP_EXTENSION_EVENTS,
Matthias Clasen's avatar
x  
Matthias Clasen committed
557
				   g_param_spec_enum ("extension-events",
558 559
 						      P_("Extension events"),
 						      P_("The mask that decides what kind of extension events this widget gets"),
560
 						      GDK_TYPE_EXTENSION_MODE,
Alexander Larsson's avatar
Alexander Larsson committed
561
 						      GDK_EXTENSION_EVENTS_NONE,
562
 						      GTK_PARAM_READWRITE));
563 564
  g_object_class_install_property (gobject_class,
				   PROP_NO_SHOW_ALL,
Matthias Clasen's avatar
x  
Matthias Clasen committed
565
				   g_param_spec_boolean ("no-show-all",
566 567
 							 P_("No show all"),
 							 P_("Whether gtk_widget_show_all() should not affect this widget"),
568
 							 FALSE,
569
 							 GTK_PARAM_READWRITE));
Kristian Rietveld's avatar
Kristian Rietveld committed
570 571 572 573

/**
 * GtkWidget:has-tooltip:
 *
574 575 576
 * Enables or disables the emission of #GtkWidget::query-tooltip on @widget.  
 * A value of %TRUE indicates that @widget can have a tooltip, in this case
 * the widget will be queried using #GtkWidget::query-tooltip to determine
Kristian Rietveld's avatar
Kristian Rietveld committed
577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596
 * whether it will provide a tooltip or not.
 *
 * Since: 2.12
 */
  g_object_class_install_property (gobject_class,
				   PROP_HAS_TOOLTIP,
				   g_param_spec_boolean ("has-tooltip",
 							 P_("Has tooltip"),
 							 P_("Whether this widget has a tooltip"),
 							 FALSE,
 							 GTK_PARAM_READWRITE));

/**
 * GtkWidget:tooltip-markup:
 *
 * Sets the text of tooltip to be the given string, which is marked up
 * with the <link linkend="PangoMarkupFormat">Pango text markup language</link>.
 * Also see gtk_tooltip_set_markup().
 *
 * This is a convenience property which will take care of getting the
597
 * tooltip shown if the given string is not %NULL: #GtkWidget:has-tooltip
Kristian Rietveld's avatar
Kristian Rietveld committed
598
 * will automatically be set to %TRUE and there will be taken care of
599
 * #GtkWidget::query-tooltip in the default signal handler.
Kristian Rietveld's avatar
Kristian Rietveld committed
600 601 602 603 604 605 606 607 608 609 610
 *
 * Since: 2.12
 */
  g_object_class_install_property (gobject_class,
				   PROP_TOOLTIP_MARKUP,
				   g_param_spec_string ("tooltip-markup",
 							P_("Tooltip markup"),
							P_("The contents of the tooltip for this widget"),
							NULL,
							GTK_PARAM_READWRITE));

Elliot Lee's avatar
Elliot Lee committed
611
  widget_signals[SHOW] =
612
    g_signal_new (I_("show"),
Manish Singh's avatar
Manish Singh committed
613 614 615 616 617 618
		  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
619
  widget_signals[HIDE] =
620
    g_signal_new (I_("hide"),
Manish Singh's avatar
Manish Singh committed
621 622 623 624 625 626
		  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
627
  widget_signals[MAP] =
628
    g_signal_new (I_("map"),
Manish Singh's avatar
Manish Singh committed
629 630 631 632 633 634
		  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
635
  widget_signals[UNMAP] =
636
    g_signal_new (I_("unmap"),
Manish Singh's avatar
Manish Singh committed
637 638 639 640 641 642
		  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
643
  widget_signals[REALIZE] =
644
    g_signal_new (I_("realize"),
Manish Singh's avatar
Manish Singh committed
645 646 647 648 649 650
		  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
651
  widget_signals[UNREALIZE] =
652
    g_signal_new (I_("unrealize"),
Manish Singh's avatar
Manish Singh committed
653 654 655 656 657 658
		  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
659
  widget_signals[SIZE_REQUEST] =
660
    g_signal_new (I_("size_request"),
Manish Singh's avatar
Manish Singh committed
661 662 663 664 665 666 667
		  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);
668
  widget_signals[SIZE_ALLOCATE] = 
669
    g_signal_new (I_("size_allocate"),
Manish Singh's avatar
Manish Singh committed
670 671 672 673 674 675 676
		  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
677
  widget_signals[STATE_CHANGED] =
678
    g_signal_new (I_("state_changed"),
Manish Singh's avatar
Manish Singh committed
679 680 681 682 683 684 685
		  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);
686 687 688 689 690 691 692

  /**
   * GtkWidget::parent-set:
   * @widget: the object on which the signal is emitted
   * @old_parent: the previous parent, or %NULL if the widget 
   *   just got its initial parent.
   *
693 694
   * The ::parent-set signal is emitted when a new parent 
   * has been set on a widget. 
695
   */
696
  widget_signals[PARENT_SET] =
697
    g_signal_new (I_("parent_set"),
Manish Singh's avatar
Manish Singh committed
698 699 700 701 702 703 704
		  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
705
  widget_signals[HIERARCHY_CHANGED] =
706
    g_signal_new (I_("hierarchy_changed"),
Manish Singh's avatar
Manish Singh committed
707 708 709 710 711 712 713
		  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);
714 715 716 717 718 719
  /**
   * 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 
   *
720
   * The ::style-set signal is emitted when a new style has been set 
721 722 723
   * on a widget. Note that style-modifying functions like 
   * gtk_widget_modify_base() also cause this signal to be emitted.
   */
724
  widget_signals[STYLE_SET] =
725
    g_signal_new (I_("style_set"),
Manish Singh's avatar
Manish Singh committed
726 727 728 729 730 731 732
		  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);
733
  widget_signals[DIRECTION_CHANGED] =
734
    g_signal_new (I_("direction_changed"),
Manish Singh's avatar
Manish Singh committed
735 736 737 738 739 740 741
		  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);
742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757

  /**
   * GtkWidget::grab-notify:
   * @widget: the object which received the signal
   * @was_grabbed: %FALSE if the widget becomes shadowed, %TRUE
   *               if it becomes unshadowed
   *
   * The ::grab-notify signal is emitted when a widget becomes
   * shadowed by a GTK+ grab (not a pointer or keyboard grab) on 
   * another widget, or when it becomes unshadowed due to a grab 
   * being removed.
   * 
   * A widget is shadowed by a gtk_grab_add() when the topmost 
   * grab widget in the grab stack of its window group is not 
   * its ancestor.
   */
758
  widget_signals[GRAB_NOTIFY] =
759
    g_signal_new (I_("grab_notify"),
Manish Singh's avatar
Manish Singh committed
760 761 762 763 764 765 766
		  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);
767 768 769

/**
 * GtkWidget::child-notify:
770 771
 * @widget: the object which received the signal
 * @pspec: the #GParamSpec of the changed child property
772
 *
773 774
 * The ::child-notify signal is emitted for each 
 * <link linkend="child-properties">child property</link>  that has
775 776
 * changed on an object. The signal's detail holds the property name. 
 */
Tim Janik's avatar
Tim Janik committed
777
  widget_signals[CHILD_NOTIFY] =
778
    g_signal_new (I_("child_notify"),
Manish Singh's avatar
Manish Singh committed
779
		   G_TYPE_FROM_CLASS (gobject_class),
Tim Janik's avatar
Tim Janik committed
780 781 782 783
		   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
784 785
		   G_TYPE_NONE, 1,
		   G_TYPE_PARAM);
786
  widget_signals[MNEMONIC_ACTIVATE] =
787
    g_signal_new (I_("mnemonic_activate"),
Manish Singh's avatar
Manish Singh committed
788 789 790 791 792 793 794
		  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);
795
  widget_signals[GRAB_FOCUS] =
796
    g_signal_new (I_("grab_focus"),
Manish Singh's avatar
Manish Singh committed
797 798 799 800 801 802
		  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);
803
  widget_signals[FOCUS] =
804
    g_signal_new (I_("focus"),
Manish Singh's avatar
Manish Singh committed
805 806 807 808 809 810 811
		  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
812
  widget_signals[EVENT] =
813
    g_signal_new (I_("event"),
Manish Singh's avatar
Manish Singh committed
814 815 816 817 818 819 820
		  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);
821
  widget_signals[EVENT_AFTER] =
822
    g_signal_new (I_("event_after"),
Manish Singh's avatar
Manish Singh committed
823 824 825 826 827 828 829
		  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
830
  widget_signals[BUTTON_PRESS_EVENT] =
831
    g_signal_new (I_("button_press_event"),
Manish Singh's avatar
Manish Singh committed
832 833 834 835 836 837 838
		  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
839
  widget_signals[BUTTON_RELEASE_EVENT] =
840
    g_signal_new (I_("button_release_event"),
Manish Singh's avatar
Manish Singh committed
841 842 843 844 845 846 847
		  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);
848
  widget_signals[SCROLL_EVENT] =
849
    g_signal_new (I_("scroll_event"),
Manish Singh's avatar
Manish Singh committed
850 851 852 853 854 855 856
		  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
857
  widget_signals[MOTION_NOTIFY_EVENT] =
858
    g_signal_new (I_("motion_notify_event"),
Manish Singh's avatar
Manish Singh committed
859 860 861 862 863 864 865
		  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);
866 867 868 869 870 871 872 873
  widget_signals[COMPOSITED_CHANGED] =
    g_signal_new (I_("composited_changed"),
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
		  G_STRUCT_OFFSET (GtkWidgetClass, composited_changed),
		  NULL, NULL,
		  _gtk_marshal_VOID__VOID,
		  G_TYPE_NONE, 0);
874

875 876
  /**
   * GtkWidget::keynav-failed:
877
   * @widget: the object which received the signal
878 879
   * @direction: the direction of movement
   *
880
   * Gets emitted if keyboard navigation fails. 
881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898
   * See gtk_widget_keynav_failed() for details.
   *
   * Returns: %TRUE if stopping keyboard navigation is fine, %FALSE
   *          if the emitting widget should try to handle the keyboard
   *          navigation attempt in its parent container(s).
   *
   * Since: 2.12
   **/
  widget_signals[KEYNAV_FAILED] =
    _gtk_binding_signal_new (I_("keynav-failed"),
                             G_TYPE_FROM_CLASS (gobject_class),
                             G_SIGNAL_RUN_LAST,
                             G_CALLBACK (gtk_widget_real_keynav_failed),
                             _gtk_boolean_handled_accumulator, NULL,
                             _gtk_marshal_BOOLEAN__ENUM,
                             G_TYPE_BOOLEAN, 1,
                             GTK_TYPE_DIRECTION_TYPE);

899 900
/**
 * GtkWidget::delete-event:
901
 * @widget: the object which received the signal
902 903 904 905 906 907 908 909 910 911 912
 * @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
913
  widget_signals[DELETE_EVENT] =
914
    g_signal_new (I_("delete_event"),
Manish Singh's avatar
Manish Singh committed
915 916 917 918 919 920 921
		  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);
922 923 924 925 926 927 928 929 930 931 932 933 934 935

/**
 * 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
936
  widget_signals[DESTROY_EVENT] =
937
    g_signal_new (I_("destroy_event"),
Manish Singh's avatar
Manish Singh committed
938 939 940 941 942 943 944
		  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
945
  widget_signals[EXPOSE_EVENT] =
946
    g_signal_new (I_("expose_event"),
Manish Singh's avatar
Manish Singh committed
947 948 949 950 951 952 953
		  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
954
  widget_signals[KEY_PRESS_EVENT] =
955
    g_signal_new (I_("key_press_event"),
Manish Singh's avatar
Manish Singh committed
956 957 958 959 960 961 962
		  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
963
  widget_signals[KEY_RELEASE_EVENT] =
964
    g_signal_new (I_("key_release_event"),
Manish Singh's avatar
Manish Singh committed
965 966 967 968 969 970 971
		  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
972
  widget_signals[ENTER_NOTIFY_EVENT] =
973
    g_signal_new (I_("enter_notify_event"),
Manish Singh's avatar
Manish Singh committed
974 975 976 977 978 979 980
		  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
981
  widget_signals[LEAVE_NOTIFY_EVENT] =
982
    g_signal_new (I_("leave_notify_event"),
Manish Singh's avatar
Manish Singh committed
983 984 985 986 987 988 989
		  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
990
  widget_signals[CONFIGURE_EVENT] =
991
    g_signal_new (I_("configure_event"),
Manish Singh's avatar
Manish Singh committed
992 993 994 995 996 997 998
		  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
999
  widget_signals[FOCUS_IN_EVENT] =
1000
    g_signal_new (I_("focus_in_event"),
Manish Singh's avatar
Manish Singh committed
1001 1002 1003 1004 1005 1006 1007
		  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
1008
  widget_signals[FOCUS_OUT_EVENT] =
1009
    g_signal_new (I_("focus_out_event"),
Manish Singh's avatar
Manish Singh committed
1010 1011 1012 1013 1014 1015 1016
		  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
1017
  widget_signals[MAP_EVENT] =
1018
    g_signal_new (I_("map_event"),
Manish Singh's avatar
Manish Singh committed
1019 1020 1021 1022 1023 1024 1025
		  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
1026
  widget_signals[UNMAP_EVENT] =
1027
    g_signal_new (I_("unmap_event"),
Manish Singh's avatar
Manish Singh committed
1028 1029 1030 1031 1032 1033 1034
		  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
1035
  widget_signals[PROPERTY_NOTIFY_EVENT] =
1036
    g_signal_new (I_("property_notify_event"),
Manish Singh's avatar
Manish Singh committed
1037 1038 1039 1040 1041 1042 1043
		  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
1044
  widget_signals[SELECTION_CLEAR_EVENT] =
1045
    g_signal_new (I_("selection_clear_event"),
Manish Singh's avatar
Manish Singh committed
1046 1047 1048 1049 1050 1051 1052
		  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
1053
  widget_signals[SELECTION_REQUEST_EVENT] =
1054
    g_signal_new (I_("selection_request_event"),
Manish Singh's avatar
Manish Singh committed
1055 1056 1057 1058 1059 1060 1061
		  G_TYPE_FROM_CLASS (gobject_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,
		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
Elliot Lee's avatar
Elliot Lee committed
1062
  widget_signals[SELECTION_NOTIFY_EVENT] =
1063
    g_signal_new (I_("selection_notify_event"),
Manish Singh's avatar
Manish Singh committed
1064 1065 1066 1067 1068 1069 1070
		  G_TYPE_FROM_CLASS (gobject_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,
		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
Elliot Lee's avatar
Elliot Lee committed
1071
  widget_signals[SELECTION_RECEIVED] =
1072
    g_signal_new (I_("selection_received"),
Manish Singh's avatar
Manish Singh committed
1073
		  G_TYPE_FROM_CLASS (gobject_class),
1074 1075 1076
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, selection_received),
		  NULL, NULL,
1077
		  _gtk_marshal_VOID__BOXED_UINT,
1078 1079 1080
		  G_TYPE_NONE, 2,
		  GTK_TYPE_SELECTION_DATA | G_SIGNAL_TYPE_STATIC_SCOPE,
		  G_TYPE_UINT);
1081
  widget_signals[SELECTION_GET] =
1082
    g_signal_new (I_("selection_get"),
Manish Singh's avatar
Manish Singh committed
1083
		  G_TYPE_FROM_CLASS (gobject_class),
1084 1085 1086
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, selection_get),
		  NULL, NULL,
1087
		  _gtk_marshal_VOID__BOXED_UINT_UINT,
1088 1089 1090 1091
		  G_TYPE_NONE, 3,
		  GTK_TYPE_SELECTION_DATA | G_SIGNAL_TYPE_STATIC_SCOPE,
		  G_TYPE_UINT,
		  G_TYPE_UINT);
Elliot Lee's avatar
Elliot Lee committed
1092
  widget_signals[PROXIMITY_IN_EVENT] =
1093
    g_signal_new (I_("proximity_in_event"),
Manish Singh's avatar
Manish Singh committed
1094 1095 1096 1097 1098 1099 1100
		  G_TYPE_FROM_CLASS (gobject_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,
		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
Elliot Lee's avatar
Elliot Lee committed
1101
  widget_signals[PROXIMITY_OUT_EVENT] =
1102
    g_signal_new (I_("proximity_out_event"),
Manish Singh's avatar
Manish Singh committed
1103 1104 1105 1106 1107 1108 1109
		  G_TYPE_FROM_CLASS (gobject_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,
		  GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
Matthias Clasen's avatar
Matthias Clasen committed
1110 1111 1112 1113 1114 1115 1116

  /**
   * GtkWidget::drag-leave:
   * @widget: the object which received the signal.
   * @drag_context: the drag context
   * @time: the timestamp of the motion event
   *
Matthias Clasen's avatar
Matthias Clasen committed
1117 1118
   * The ::drag-leave signal is emitted on the drop site when the cursor 
   * leaves the widget. A typical reason to connect to this signal is to 
1119 1120
   * undo things done in #GtkWidget::drag-motion, e.g. undo highlighting 
   * with gtk_drag_unhighlight()
Matthias Clasen's avatar
Matthias Clasen committed
1121
   */
1122
  widget_signals[DRAG_LEAVE] =
1123
    g_signal_new (I_("drag_leave"),
Manish Singh's avatar
Manish Singh committed
1124 1125 1126 1127 1128 1129 1130 1131
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, drag_leave),
		  NULL, NULL,
		  _gtk_marshal_VOID__OBJECT_UINT,
		  G_TYPE_NONE, 2,
		  GDK_TYPE_DRAG_CONTEXT,
		  G_TYPE_UINT);
Matthias Clasen's avatar
Matthias Clasen committed
1132 1133 1134

  /**
   * GtkWidget::drag-begin:
1135
   * @widget: the object which received the signal
Matthias Clasen's avatar
Matthias Clasen committed
1136 1137
   * @drag_context: the drag context
   *
1138 1139 1140
   * The ::drag-begin signal is emitted on the drag source when a drag is 
   * started. A typical reason to connect to this signal is to set up a 
   * custom drag icon with gtk_drag_source_set_icon().
Matthias Clasen's avatar
Matthias Clasen committed
1141
   */
1142
  widget_signals[DRAG_BEGIN] =
1143
    g_signal_new (I_("drag_begin"),
Manish Singh's avatar
Manish Singh committed
1144 1145 1146 1147 1148 1149 1150
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, drag_begin),
		  NULL, NULL,
		  _gtk_marshal_VOID__OBJECT,
		  G_TYPE_NONE, 1,
		  GDK_TYPE_DRAG_CONTEXT);
Matthias Clasen's avatar
Matthias Clasen committed
1151 1152 1153

  /**
   * GtkWidget::drag-end:
1154
   * @widget: the object which received the signal
Matthias Clasen's avatar
Matthias Clasen committed
1155 1156
   * @drag_context: the drag context
   *
1157 1158 1159
   * The ::drag-end signal is emitted on the drag source when a drag is 
   * finished.  A typical reason to connect to this signal is to undo 
   * things done in #GtkWidget::drag-begin.
Matthias Clasen's avatar
Matthias Clasen committed
1160
   */
1161
  widget_signals[DRAG_END] =
1162
    g_signal_new (I_("drag_end"),
Manish Singh's avatar
Manish Singh committed
1163 1164 1165 1166 1167 1168 1169
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, drag_end),
		  NULL, NULL,
		  _gtk_marshal_VOID__OBJECT,
		  G_TYPE_NONE, 1,
		  GDK_TYPE_DRAG_CONTEXT);
Matthias Clasen's avatar
Matthias Clasen committed
1170 1171 1172

  /**
   * GtkWidget::drag-data-delete:
1173
   * @widget: the object which received the signal
Matthias Clasen's avatar
Matthias Clasen committed
1174 1175
   * @drag_context: the drag context
   *
Matthias Clasen's avatar
Matthias Clasen committed
1176 1177 1178
   * The ::drag-data-delete signal is emitted on the drag source when a drag 
   * with the action %GDK_ACTION_MOVE is successfully completed. The signal 
   * handler is responsible for deleting the data that has been dropped. What 
1179
   * "delete" means depends on the context of the drag operation. 
Matthias Clasen's avatar
Matthias Clasen committed
1180
   */
1181
  widget_signals[DRAG_DATA_DELETE] =
1182
    g_signal_new (I_("drag_data_delete"),
Manish Singh's avatar
Manish Singh committed
1183 1184 1185 1186 1187 1188 1189
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, drag_data_delete),
		  NULL, NULL,
		  _gtk_marshal_VOID__OBJECT,
		  G_TYPE_NONE, 1,
		  GDK_TYPE_DRAG_CONTEXT);
Matthias Clasen's avatar
Matthias Clasen committed
1190

1191 1192
  /**
   * GtkWidget::drag-failed:
1193 1194 1195
   * @widget: the object which received the signal
   * @drag_context: the drag context
   * @result: the result of the drag operation
1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216
   *
   * The ::drag-failed signal is emitted on the drag source when a drag has
   * failed. The signal handler may hook custom code to handle a failed DND
   * operation based on the type of error, it returns %TRUE is the failure has
   * been already handled (not showing the default "drag operation failed"
   * animation), otherwise it returns %FALSE.
   *
   * Return value: %TRUE if the failed drag operation has been already handled.
   *
   * Since: 2.12
   */
  widget_signals[DRAG_FAILED] =
    g_signal_new (I_("drag_failed"),
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST,
		  0, _gtk_boolean_handled_accumulator, NULL,
		  _gtk_marshal_BOOLEAN__OBJECT_ENUM,
		  G_TYPE_BOOLEAN, 2,
		  GDK_TYPE_DRAG_CONTEXT,
		  GTK_TYPE_DRAG_RESULT);

Matthias Clasen's avatar
Matthias Clasen committed
1217 1218
  /**
   * GtkWidget::drag-motion:
1219
   * @widget: the object which received the signal
Matthias Clasen's avatar
Matthias Clasen committed
1220 1221 1222 1223
   * @drag_context: the drag context
   * @x: the x coordinate of the current cursor position
   * @y: the y coordinate of the current cursor position
   * @time: the timestamp of the motion event
1224
   * @returns: whether the cursor position is in a drop zone
Matthias Clasen's avatar
Matthias Clasen committed
1225
   *
Matthias Clasen's avatar
Matthias Clasen committed
1226 1227 1228 1229 1230 1231 1232 1233 1234 1235
   * The ::drag-motion signal is emitted on the drop site when the user 
   * moves the cursor over the widget during a drag. The signal handler 
   * must determine whether the cursor position is in a drop zone or not. 
   * If it is not in a drop zone, it returns %FALSE and no further processing 
   * is necessary. Otherwise, the handler returns %TRUE. In this case, the 
   * handler is responsible for providing the necessary information for 
   * displaying feedback to the user, by calling gdk_drag_status(). If the 
   * decision whether the drop will be accepted or rejected can't be made
   * based solely on the cursor position and the type of the data, the handler 
   * may inspect the dragged data by calling gtk_drag_get_data() and defer the 
1236
   * gdk_drag_status() call to the #GtkWidget::drag-data-received handler. 
Matthias Clasen's avatar
Matthias Clasen committed
1237
   *
1238 1239 1240 1241 1242
   * Note that there is no drag-enter signal. The drag receiver has to keep 
   * track of whether he has received any drag-motion signals since the last 
   * #GtkWidget::drag-leave and if not, treat the drag-motion signal as an 
   * "enter" signal. Upon an "enter", the handler will typically highlight 
   * the drop site with gtk_drag_highlight().
Matthias Clasen's avatar
Matthias Clasen committed
1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269
   *
   * <informalexample><programlisting> 
   * static void
   * drag_motion (GtkWidget *widget,
   *       	  GdkDragContext *context,
   *              gint x,
   *              gint y,
   *              guint time)
   * {
   *   GdkAtom target;
   *  
   *   PrivateData *private_data = GET_PRIVATE_DATA (widget);
   *  
   *   if (!private_data->drag_highlight) 
   *    {
   *      private_data->drag_highlight = 1;
   *      gtk_drag_highlight (widget);
   *    }
   *  
   *   target = gtk_drag_dest_find_target (widget, context, NULL);
   *   if (target == GDK_NONE)
   *     gdk_drag_status (context, 0, time);
   *   else 
   *    {
   *      private_data->pending_status = context->suggested_action;
   *      gtk_drag_get_data (widget, context, target, time);
   *    }
1270
   *  
1271
   *   return TRUE;
Matthias Clasen's avatar
Matthias Clasen committed
1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290
   * }
   *   
   * static void
   * drag_data_received (GtkWidget        *widget,
   *                     GdkDragContext   *context,
   *                     gint              x,
   *                     gint              y,
   *                     GtkSelectionData *selection_data,
   *                     guint             info,
   *                     guint             time)
   * {
   *   PrivateData *private_data = GET_PRIVATE_DATA (widget);
   *   
   *   if (private_data->suggested_action) 
   *    {
   *      private_data->suggested_action = 0;
   *      
   *     /<!-- -->* We are getting this data due to a request in drag_motion,
   *      * rather than due to a request in drag_drop, so we are just
Matthias Clasen's avatar
Matthias Clasen committed
1291 1292
   *      * supposed to call gdk_drag_status(<!-- -->), not actually paste in 
   *      * the data.
Matthias Clasen's avatar
Matthias Clasen committed
1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306
   *      *<!-- -->/
   *      str = gtk_selection_data_get_text (selection_data);
   *      if (!data_is_acceptable (str)) 
   *        gdk_drag_status (context, 0, time);
   *      else
   *        gdk_drag_status (context, private_data->suggested_action, time);
   *    }
   *   else
   *    {
   *      /<!-- -->* accept the drop *<!-- -->/
   *    }
   * }
   * </programlisting></informalexample>
   */
1307
  widget_signals[DRAG_MOTION] =
1308
    g_signal_new (I_("drag_motion"),
Manish Singh's avatar
Manish Singh committed
1309 1310 1311 1312
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, drag_motion),
		  _gtk_boolean_handled_accumulator, NULL,
1313
		  _gtk_marshal_BOOLEAN__OBJECT_INT_INT_UINT,
1314 1315 1316 1317 1318
		  G_TYPE_BOOLEAN, 4,
		  GDK_TYPE_DRAG_CONTEXT,
		  G_TYPE_INT,
		  G_TYPE_INT,
		  G_TYPE_UINT);
Matthias Clasen's avatar
Matthias Clasen committed
1319 1320 1321

  /**
   * GtkWidget::drag-drop:
1322
   * @widget: the object which received the signal
Matthias Clasen's avatar
Matthias Clasen committed
1323 1324 1325 1326
   * @drag_context: the drag context
   * @x: the x coordinate of the current cursor position
   * @y: the y coordinate of the current cursor position
   * @time: the timestamp of the motion event
1327
   * @returns: whether the cursor position is in a drop zone
Matthias Clasen's avatar
Matthias Clasen committed
1328
   *
1329 1330 1331 1332 1333 1334 1335 1336 1337 1338
   * The ::drag-drop signal is emitted on the drop site when the user drops 
   * the data onto the widget. The signal handler must determine whether 
   * the cursor position is in a drop zone or not. If it is not in a drop 
   * zone, it returns %FALSE and no further processing is necessary. 
   * Otherwise, the handler returns %TRUE. In this case, the handler must 
   * ensure that gtk_drag_finish() is called to let the source know that 
   * the drop is done. The call to gtk_drag_finish() can be done either 
   * directly or in a #GtkWidget::drag-data-received handler which gets 
   * triggered by calling gtk_drag_get_data() to receive the data for one 
   * or more of the supported targets.
Matthias Clasen's avatar
Matthias Clasen committed
1339
   */
1340
  widget_signals[DRAG_DROP] =
1341
    g_signal_new (I_("drag_drop"),
Manish Singh's avatar
Manish Singh committed
1342 1343 1344 1345
		  G_TYPE_FROM_CLASS (gobject_class),
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, drag_drop),
		  _gtk_boolean_handled_accumulator, NULL,
1346
		  _gtk_marshal_BOOLEAN__OBJECT_INT_INT_UINT,
1347 1348 1349 1350 1351
		  G_TYPE_BOOLEAN, 4,
		  GDK_TYPE_DRAG_CONTEXT,
		  G_TYPE_INT,
		  G_TYPE_INT,
		  G_TYPE_UINT);
Matthias Clasen's avatar
Matthias Clasen committed
1352 1353 1354

  /** 
   * GtkWidget::drag-data-get:
1355
   * @widget: the object which received the signal
Matthias Clasen's avatar
Matthias Clasen committed
1356 1357
   * @drag_context: the drag context
   * @data: the #GtkSelectionData to be filled with the dragged data
1358 1359
   * @info: the info that has been registered with the target in the 
   *        #GtkTargetList
Matthias Clasen's avatar
Matthias Clasen committed
1360 1361
   * @time: the timestamp at which the data was requested
   *
1362 1363 1364 1365 1366
   * The ::drag-data-get signal is emitted on the drag source when the drop 
   * site requests the data which is dragged. It is the responsibility of 
   * the signal handler to fill @data with the data in the format which 
   * is indicated by @info. See gtk_selection_data_set() and 
   * gtk_selection_data_set_text().
Matthias Clasen's avatar
Matthias Clasen committed
1367
   */
1368
  widget_signals[DRAG_DATA_GET] =
1369
    g_signal_new (I_("drag_data_get"),
Manish Singh's avatar
Manish Singh committed
1370
		  G_TYPE_FROM_CLASS (gobject_class),
1371 1372 1373
		  G_SIGNAL_RUN_LAST,
		  G_STRUCT_OFFSET (GtkWidgetClass, drag_data_get),
		  NULL, NULL,
1374
		  _gtk_marshal_VOID__OBJECT_BOXED_UINT_UINT,
1375 1376 1377 1378 1379
		  G_TYPE_NONE, 4,
		  GDK_TYPE_DRAG_CONTEXT,
		  GTK_TYPE_SELECTION_DATA | G_SIGNAL_TYPE_STATIC_SCOPE,
		  G_TYPE_UINT,
		  G_TYPE_UINT);
1380 1381 1382

/**
 * GtkWidget::drag-data-received:
1383
 * @widget: the object which received the signal
1384 1385 1386 1387
 * @drag_context: the drag context
 * @x: where the drop happened
 * @y: where the drop happened
 * @data: the received data
1388 1389
 * @info: the info that has been registered with the target in the 
 *        #GtkTargetList
1390 1391
 * @time: the timestamp at which the data was received
 *
Matthias Clasen's avatar
Matthias Clasen committed
1392
 * The ::drag-data-received signal is emitted on the drop site when the dragged 
1393 1394 1395 1396 1397 1398 1399
 * data has been received. If the data was received in order to determine 
 * whether the drop will be accepted, the handler is expected to call 
 * gdk_drag_status() and <emphasis>not</emphasis> finish the drag. If the 
 * data was received in response to a #GtkWidget::drag-drop signal (and this 
 * is the last target to be received), the handler for this signal is expected 
 * to process the received data and then call gtk_drag_finish(), setting the 
 * @success parameter depending on whether the data was processed successfully. 
1400
 * 
Matthias Clasen's avatar
Matthias Clasen committed
1401
 * The handler may inspect and modify @drag_context->action before calling 
1402 1403
 * gtk_drag_finish(), e.g. to implement %GDK_ACTION_ASK as shown in the 
 * following example:
1404 1405 1406
 * <informalexample><programlisting>
 * void  
 * drag_data_received (GtkWidget          *widget,
1407
 *                     GdkDragContext     *drag_context,
1408