]> Pileus Git - ~andy/gtk/blob - gtk/gtkwidget.h
6e0a96c598fe10fe70fa30f3d3ae06a4e2e12b97
[~andy/gtk] / gtk / gtkwidget.h
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * 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.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 /*
21  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
22  * file for a list of people on the GTK+ Team.  See the ChangeLog
23  * files for a list of changes.  These files are distributed with
24  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
25  */
26
27 #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
28 #error "Only <gtk/gtk.h> can be included directly."
29 #endif
30
31 #ifndef __GTK_WIDGET_H__
32 #define __GTK_WIDGET_H__
33
34 #include <gdk/gdk.h>
35 #include <gtk/gtkaccelgroup.h>
36 #include <gtk/gtkobject.h>
37 #include <gtk/gtkadjustment.h>
38 #include <gtk/gtkstyle.h>
39 #include <gtk/gtksettings.h>
40 #include <atk/atk.h>
41
42 G_BEGIN_DECLS
43
44 /**
45  * GtkWidgetFlags:
46  * @GTK_TOPLEVEL: widgets without a real parent, as there are #GtkWindow<!-- -->s and
47  *  #GtkMenu<!-- -->s have this flag set throughout their lifetime.
48  *  Toplevel widgets always contain their own #GdkWindow.
49  * @GTK_NO_WINDOW: Indicative for a widget that does not provide its own #GdkWindow.
50  *  Visible action (e.g. drawing) is performed on the parent's #GdkWindow.
51  * @GTK_REALIZED: Set by gtk_widget_realize(), unset by gtk_widget_unrealize().
52  *  A realized widget has an associated #GdkWindow.
53  * @GTK_MAPPED: Set by gtk_widget_map(), unset by gtk_widget_unmap().
54  *  Only realized widgets can be mapped. It means that gdk_window_show()
55  *  has been called on the widgets window(s).
56  * @GTK_VISIBLE: Set by gtk_widget_show(), unset by gtk_widget_hide(). Implies that a
57  *  widget will be mapped as soon as its parent is mapped.
58  * @GTK_SENSITIVE: Set and unset by gtk_widget_set_sensitive().
59  *  The sensitivity of a widget determines whether it will receive
60  *  certain events (e.g. button or key presses). One premise for
61  *  the widget's sensitivity is to have this flag set.
62  * @GTK_PARENT_SENSITIVE: Set and unset by gtk_widget_set_sensitive() operations on the
63  *  parents of the widget.
64  *  This is the second premise for the widget's sensitivity. Once
65  *  it has %GTK_SENSITIVE and %GTK_PARENT_SENSITIVE set, its state is
66  *  effectively sensitive. This is expressed (and can be examined) by
67  *  the #GTK_WIDGET_IS_SENSITIVE macro.
68  * @GTK_CAN_FOCUS: Determines whether a widget is able to handle focus grabs.
69  * @GTK_HAS_FOCUS: Set by gtk_widget_grab_focus() for widgets that also
70  *  have %GTK_CAN_FOCUS set. The flag will be unset once another widget
71  *  grabs the focus.
72  * @GTK_CAN_DEFAULT: The widget is allowed to receive the default action via
73  *  gtk_widget_grab_default() and will reserve space to draw the default if possible
74  * @GTK_HAS_DEFAULT: The widget currently is receiving the default action and
75  *  should be drawn appropriately if possible
76  * @GTK_HAS_GRAB: Set by gtk_grab_add(), unset by gtk_grab_remove(). It means that the
77  *  widget is in the grab_widgets stack, and will be the preferred one for
78  *  receiving events other than ones of cosmetic value.
79  * @GTK_RC_STYLE: Indicates that the widget's style has been looked up through the rc
80  *  mechanism. It does not imply that the widget actually had a style
81  *  defined through the rc mechanism.
82  * @GTK_COMPOSITE_CHILD: Indicates that the widget is a composite child of its parent; see
83  *  gtk_widget_push_composite_child(), gtk_widget_pop_composite_child().
84  * @GTK_NO_REPARENT: Unused since before GTK+ 1.2, will be removed in a future version.
85  * @GTK_APP_PAINTABLE: Set and unset by gtk_widget_set_app_paintable().
86  *  Must be set on widgets whose window the application directly draws on,
87  *  in order to keep GTK+ from overwriting the drawn stuff.  See
88  *  <xref linkend="app-paintable-widgets"/> for a detailed
89  *  description of this flag.
90  * @GTK_RECEIVES_DEFAULT: The widget when focused will receive the default action and have
91  *  %GTK_HAS_DEFAULT set even if there is a different widget set as default.
92  * @GTK_DOUBLE_BUFFERED: Set and unset by gtk_widget_set_double_buffered().
93  *  Indicates that exposes done on the widget should be
94  *  double-buffered.  See <xref linkend="double-buffering"/> for a
95  *  detailed discussion of how double-buffering works in GTK+ and
96  *  why you may want to disable it for special cases.
97  * @GTK_NO_SHOW_ALL:
98  *
99  * Tells about certain properties of the widget.
100  */
101 typedef enum
102 {
103   GTK_TOPLEVEL         = 1 << 4,
104   GTK_NO_WINDOW        = 1 << 5,
105   GTK_REALIZED         = 1 << 6,
106   GTK_MAPPED           = 1 << 7,
107   GTK_VISIBLE          = 1 << 8,
108   GTK_SENSITIVE        = 1 << 9,
109   GTK_PARENT_SENSITIVE = 1 << 10,
110   GTK_CAN_FOCUS        = 1 << 11,
111   GTK_HAS_FOCUS        = 1 << 12,
112   GTK_CAN_DEFAULT      = 1 << 13,
113   GTK_HAS_DEFAULT      = 1 << 14,
114   GTK_HAS_GRAB         = 1 << 15,
115   GTK_RC_STYLE         = 1 << 16,
116   GTK_COMPOSITE_CHILD  = 1 << 17,
117   GTK_NO_REPARENT      = 1 << 18,
118   GTK_APP_PAINTABLE    = 1 << 19,
119   GTK_RECEIVES_DEFAULT = 1 << 20,
120   GTK_DOUBLE_BUFFERED  = 1 << 21,
121   GTK_NO_SHOW_ALL      = 1 << 22
122 } GtkWidgetFlags;
123
124 /* Kinds of widget-specific help */
125 typedef enum
126 {
127   GTK_WIDGET_HELP_TOOLTIP,
128   GTK_WIDGET_HELP_WHATS_THIS
129 } GtkWidgetHelpType;
130
131 /* Macro for casting a pointer to a GtkWidget or GtkWidgetClass pointer.
132  * Macros for testing whether `widget' or `klass' are of type GTK_TYPE_WIDGET.
133  */
134 #define GTK_TYPE_WIDGET                   (gtk_widget_get_type ())
135 #define GTK_WIDGET(widget)                (G_TYPE_CHECK_INSTANCE_CAST ((widget), GTK_TYPE_WIDGET, GtkWidget))
136 #define GTK_WIDGET_CLASS(klass)           (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_WIDGET, GtkWidgetClass))
137 #define GTK_IS_WIDGET(widget)             (G_TYPE_CHECK_INSTANCE_TYPE ((widget), GTK_TYPE_WIDGET))
138 #define GTK_IS_WIDGET_CLASS(klass)        (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WIDGET))
139 #define GTK_WIDGET_GET_CLASS(obj)         (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_WIDGET, GtkWidgetClass))
140
141 /* Macros for extracting various fields from GtkWidget and GtkWidgetClass.
142  */
143 #ifndef GTK_DISABLE_DEPRECATED
144 /**
145  * GTK_WIDGET_TYPE:
146  * @wid: a #GtkWidget.
147  *
148  * Gets the type of a widget.
149  *
150  * Deprecated: 2.20: Use G_OBJECT_TYPE() instead.
151  */
152 #define GTK_WIDGET_TYPE(wid)              (GTK_OBJECT_TYPE (wid))
153 #endif
154
155 /**
156  * GTK_WIDGET_STATE:
157  * @wid: a #GtkWidget.
158  *
159  * Returns the current state of the widget, as a #GtkStateType.
160  *
161  * Deprecated: 2.20: Use gtk_widget_get_state() instead.
162  */
163 #define GTK_WIDGET_STATE(wid)             (GTK_WIDGET (wid)->state)
164 /* FIXME: Deprecating GTK_WIDGET_STATE requires fixing GTK internals. */
165
166 #ifndef GTK_DISABLE_DEPRECATED
167 /**
168  * GTK_WIDGET_SAVED_STATE:
169  * @wid: a #GtkWidget.
170  *
171  * Returns the saved state of the widget, as a #GtkStateType.
172  *
173  * The saved state will be restored when a widget gets sensitive
174  * again, after it has been made insensitive with gtk_widget_set_state()
175  * or gtk_widget_set_sensitive().
176  *
177  * Deprecated: 2.20: Do not used it.
178  */
179 #define GTK_WIDGET_SAVED_STATE(wid)       (GTK_WIDGET (wid)->saved_state)
180 #endif
181
182
183 /* Macros for extracting the widget flags from GtkWidget.
184  */
185 /**
186  * GTK_WIDGET_FLAGS:
187  * @wid: a #GtkWidget.
188  *
189  * Returns the widget flags from @wid.
190  *
191  * Deprecated: 2.20: Do not use it.
192  */
193 #define GTK_WIDGET_FLAGS(wid)             (GTK_OBJECT_FLAGS (wid))
194 /* FIXME: Deprecating GTK_WIDGET_FLAGS requires fixing GTK internals. */
195
196 #ifndef GTK_DISABLE_DEPRECATED
197 /**
198  * GTK_WIDGET_TOPLEVEL:
199  * @wid: a #GtkWidget.
200  *
201  * Evaluates to %TRUE if the widget is a toplevel widget.
202  *
203  * Deprecated: 2.20: Use gtk_widget_is_toplevel() instead.
204  */
205 #define GTK_WIDGET_TOPLEVEL(wid)          ((GTK_WIDGET_FLAGS (wid) & GTK_TOPLEVEL) != 0)
206 #endif
207
208 #ifndef GTK_DISABLE_DEPRECATED
209 /**
210  * GTK_WIDGET_NO_WINDOW:
211  * @wid: a #GtkWidget.
212  *
213  * Evaluates to %TRUE if the widget doesn't have an own #GdkWindow.
214  *
215  * Deprecated: 2.20: Use gtk_widget_get_has_window() instead.
216  */
217 #define GTK_WIDGET_NO_WINDOW(wid)         ((GTK_WIDGET_FLAGS (wid) & GTK_NO_WINDOW) != 0)
218 #endif
219
220 /**
221  * GTK_WIDGET_REALIZED:
222  * @wid: a #GtkWidget.
223  *
224  * Evaluates to %TRUE if the widget is realized.
225  */
226 #define GTK_WIDGET_REALIZED(wid)          ((GTK_WIDGET_FLAGS (wid) & GTK_REALIZED) != 0)
227
228 /**
229  * GTK_WIDGET_MAPPED:
230  * @wid: a #GtkWidget.
231  *
232  * Evaluates to %TRUE if the widget is mapped.
233  */
234 #define GTK_WIDGET_MAPPED(wid)            ((GTK_WIDGET_FLAGS (wid) & GTK_MAPPED) != 0)
235
236 #ifndef GTK_DISABLE_DEPRECATED
237 /**
238  * GTK_WIDGET_VISIBLE:
239  * @wid: a #GtkWidget.
240  *
241  * Evaluates to %TRUE if the widget is visible.
242  *
243  * Deprecated: 2.20: Use gtk_widget_get_visible() instead.
244  */
245 #define GTK_WIDGET_VISIBLE(wid)           ((GTK_WIDGET_FLAGS (wid) & GTK_VISIBLE) != 0)
246 #endif
247
248 #ifndef GTK_DISABLE_DEPRECATED
249 /**
250  * GTK_WIDGET_DRAWABLE:
251  * @wid: a #GtkWidget.
252  *
253  * Evaluates to %TRUE if the widget is mapped and visible.
254  *
255  * Deprecated: 2.20: Use gtk_widget_is_drawable() instead.
256  */
257 #define GTK_WIDGET_DRAWABLE(wid)          (GTK_WIDGET_VISIBLE (wid) && GTK_WIDGET_MAPPED (wid))
258 #endif
259
260 #ifndef GTK_DISABLE_DEPRECATED
261 /**
262  * GTK_WIDGET_SENSITIVE:
263  * @wid: a #GtkWidget.
264  *
265  * Evaluates to %TRUE if the #GTK_SENSITIVE flag has be set on the widget.
266  */
267 #define GTK_WIDGET_SENSITIVE(wid)         ((GTK_WIDGET_FLAGS (wid) & GTK_SENSITIVE) != 0)
268 #endif
269
270 #ifndef GTK_DISABLE_DEPRECATED
271 /**
272  * GTK_WIDGET_PARENT_SENSITIVE:
273  * @wid: a #GtkWidget.
274  *
275  * Evaluates to %TRUE if the #GTK_PARENT_SENSITIVE flag has be set on the widget.
276  *
277  * Deprecated: 2.20: Use gtk_widget_get_sensitive() on the parent widget instead.
278  */
279 #define GTK_WIDGET_PARENT_SENSITIVE(wid)  ((GTK_WIDGET_FLAGS (wid) & GTK_PARENT_SENSITIVE) != 0)
280 #endif
281
282 #ifndef GTK_DISABLE_DEPRECATED
283 /**
284  * GTK_WIDGET_IS_SENSITIVE:
285  * @wid: a #GtkWidget.
286  *
287  * Evaluates to %TRUE if the widget is effectively sensitive.
288  *
289  * Deprecated: 2.20: Use gtk_widget_is_sensitive() instead.
290  */
291 #define GTK_WIDGET_IS_SENSITIVE(wid)      (GTK_WIDGET_SENSITIVE (wid) && \
292                                            GTK_WIDGET_PARENT_SENSITIVE (wid))
293 #endif
294
295 #ifndef GTK_DISABLE_DEPRECATED
296 /**
297  * GTK_WIDGET_CAN_FOCUS:
298  * @wid: a #GtkWidget.
299  *
300  * Evaluates to %TRUE if the widget is able to handle focus grabs.
301  *
302  * Deprecated: 2.20: Use gtk_widget_get_can_focus() instead.
303  */
304 #define GTK_WIDGET_CAN_FOCUS(wid)         ((GTK_WIDGET_FLAGS (wid) & GTK_CAN_FOCUS) != 0)
305 #endif
306
307 #ifndef GTK_DISABLE_DEPRECATED
308 /**
309  * GTK_WIDGET_HAS_FOCUS:
310  * @wid: a #GtkWidget.
311  *
312  * Evaluates to %TRUE if the widget has grabbed the focus and no other
313  * widget has done so more recently.
314  *
315  * Deprecated: 2.20: Use gtk_widget_has_focus() instead.
316  */
317 #define GTK_WIDGET_HAS_FOCUS(wid)         ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_FOCUS) != 0)
318 #endif
319
320 #ifndef GTK_DISABLE_DEPRECATED
321 /**
322  * GTK_WIDGET_CAN_DEFAULT:
323  * @wid: a #GtkWidget.
324  *
325  * Evaluates to %TRUE if the widget is allowed to receive the default action
326  * via gtk_widget_grab_default().
327  *
328  * Deprecated: 2.20: Use gtk_widget_get_can_default() instead.
329  */
330 #define GTK_WIDGET_CAN_DEFAULT(wid)       ((GTK_WIDGET_FLAGS (wid) & GTK_CAN_DEFAULT) != 0)
331 #endif
332
333 #ifndef GTK_DISABLE_DEPRECATED
334 /**
335  * GTK_WIDGET_HAS_DEFAULT:
336  * @wid: a #GtkWidget.
337  *
338  * Evaluates to %TRUE if the widget currently is receiving the default action.
339  *
340  * Deprecated: 2.20: Use gtk_widget_has_default() instead.
341  */
342 #define GTK_WIDGET_HAS_DEFAULT(wid)       ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_DEFAULT) != 0)
343 #endif
344
345 #ifndef GTK_DISABLE_DEPRECATED
346 /**
347  * GTK_WIDGET_HAS_GRAB:
348  * @wid: a #GtkWidget.
349  *
350  * Evaluates to %TRUE if the widget is in the grab_widgets stack, and will be
351  * the preferred one for receiving events other than ones of cosmetic value.
352  *
353  * Deprecated: 2.20: Use gtk_widget_has_grab() instead.
354  */
355 #define GTK_WIDGET_HAS_GRAB(wid)          ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_GRAB) != 0)
356 #endif
357
358 #ifndef GTK_DISABLE_DEPRECATED
359 /**
360  * GTK_WIDGET_RC_STYLE:
361  * @wid: a #GtkWidget.
362  *
363  * Evaluates to %TRUE if the widget's style has been looked up through the rc
364  * mechanism.
365  *
366  * Deprecated: 2.20: Use gtk_widget_has_rc_style() instead.
367  */
368 #define GTK_WIDGET_RC_STYLE(wid)          ((GTK_WIDGET_FLAGS (wid) & GTK_RC_STYLE) != 0)
369 #endif
370
371 #ifndef GTK_DISABLE_DEPRECATED
372 /**
373  * GTK_WIDGET_COMPOSITE_CHILD:
374  * @wid: a #GtkWidget.
375  *
376  * Evaluates to %TRUE if the widget is a composite child of its parent.
377  *
378  * Deprecated: 2.20: Use the #GtkWidget:composite-child property instead.
379  */
380 #define GTK_WIDGET_COMPOSITE_CHILD(wid)   ((GTK_WIDGET_FLAGS (wid) & GTK_COMPOSITE_CHILD) != 0)
381 #endif
382
383 #ifndef GTK_DISABLE_DEPRECATED
384 /**
385  * GTK_WIDGET_APP_PAINTABLE:
386  * @wid: a #GtkWidget.
387  *
388  * Evaluates to %TRUE if the #GTK_APP_PAINTABLE flag has been set on the widget.
389  *
390  * Deprecated: 2.20: Use gtk_widget_get_app_paintable() instead.
391  */
392 #define GTK_WIDGET_APP_PAINTABLE(wid)     ((GTK_WIDGET_FLAGS (wid) & GTK_APP_PAINTABLE) != 0)
393 #endif
394
395 #ifndef GTK_DISABLE_DEPRECATED
396 /**
397  * GTK_WIDGET_RECEIVES_DEFAULT:
398  * @wid: a #GtkWidget.
399  *
400  * Evaluates to %TRUE if the widget when focused will receive the default action
401  * even if there is a different widget set as default.
402  *
403  * Deprecated: 2.20: Use gtk_widget_get_receives_default() instead.
404  */
405 #define GTK_WIDGET_RECEIVES_DEFAULT(wid)  ((GTK_WIDGET_FLAGS (wid) & GTK_RECEIVES_DEFAULT) != 0)
406 #endif
407
408 #ifndef GTK_DISABLE_DEPRECATED
409 /**
410  * GTK_WIDGET_DOUBLE_BUFFERED:
411  * @wid: a #GtkWidget.
412  *
413  * Evaluates to %TRUE if the #GTK_DOUBLE_BUFFERED flag has been set on the widget.
414  *
415  * Deprecated: 2.20: Use gtk_widget_get_double_buffered() instead.
416  */
417 #define GTK_WIDGET_DOUBLE_BUFFERED(wid)   ((GTK_WIDGET_FLAGS (wid) & GTK_DOUBLE_BUFFERED) != 0)
418 #endif
419
420
421 /* Macros for setting and clearing widget flags.
422  */
423 /**
424  * GTK_WIDGET_SET_FLAGS:
425  * @wid: a #GtkWidget.
426  * @flag: the flags to set.
427  *
428  * Turns on certain widget flags.
429  */
430 #define GTK_WIDGET_SET_FLAGS(wid,flag)    G_STMT_START{ (GTK_WIDGET_FLAGS (wid) |= (flag)); }G_STMT_END
431
432 /**
433  * GTK_WIDGET_UNSET_FLAGS:
434  * @wid: a #GtkWidget.
435  * @flag: the flags to unset.
436  *
437  * Turns off certain widget flags.
438  */
439 #define GTK_WIDGET_UNSET_FLAGS(wid,flag)  G_STMT_START{ (GTK_WIDGET_FLAGS (wid) &= ~(flag)); }G_STMT_END
440
441 #define GTK_TYPE_REQUISITION              (gtk_requisition_get_type ())
442
443 /* forward declaration to avoid excessive includes (and concurrent includes)
444  */
445 typedef struct _GtkRequisition     GtkRequisition;
446 typedef struct _GtkSelectionData   GtkSelectionData;
447 typedef struct _GtkWidgetClass     GtkWidgetClass;
448 typedef struct _GtkWidgetAuxInfo   GtkWidgetAuxInfo;
449 typedef struct _GtkWidgetShapeInfo GtkWidgetShapeInfo;
450 typedef struct _GtkClipboard       GtkClipboard;
451 typedef struct _GtkTooltip         GtkTooltip;
452 typedef struct _GtkWindow          GtkWindow;
453
454 /**
455  * GtkAllocation:
456  * @x: the X position of the widget's area relative to its parents allocation.
457  * @y: the Y position of the widget's area relative to its parents allocation.
458  * @width: the width of the widget's allocated area.
459  * @height: the height of the widget's allocated area.
460  *
461  * A <structname>GtkAllocation</structname> of a widget represents region which has been allocated to the
462  * widget by its parent. It is a subregion of its parents allocation. See
463  * <xref linkend="size-allocation"/> for more information.
464  */
465 typedef         GdkRectangle       GtkAllocation;
466
467 /**
468  * GtkCallback:
469  * @widget: the widget to operate on
470  * @data: user-supplied data
471  *
472  * The type of the callback functions used for e.g. iterating over
473  * the children of a container, see gtk_container_foreach().
474  */
475 typedef void    (*GtkCallback)     (GtkWidget        *widget,
476                                     gpointer          data);
477
478 /**
479  * GtkRequisition:
480  * @width: the widget's desired width
481  * @height: the widget's desired height
482  *
483  * A <structname>GtkRequisition</structname> represents the desired size of a widget. See
484  * <xref linkend="size-requisition"/> for more information.
485  */
486 struct _GtkRequisition
487 {
488   gint width;
489   gint height;
490 };
491
492 /* The widget is the base of the tree for displayable objects.
493  *  (A displayable object is one which takes up some amount
494  *  of screen real estate). It provides a common base and interface
495  *  which actual widgets must adhere to.
496  */
497 struct _GtkWidget
498 {
499   /* The object structure needs to be the first
500    *  element in the widget structure in order for
501    *  the object mechanism to work correctly. This
502    *  allows a GtkWidget pointer to be cast to a
503    *  GtkObject pointer.
504    */
505   GtkObject object;
506   
507   /* 16 bits of internally used private flags.
508    * this will be packed into the same 4 byte alignment frame that
509    * state and saved_state go. we therefore don't waste any new
510    * space on this.
511    */
512   guint16 GSEAL (private_flags);
513   
514   /* The state of the widget. There are actually only
515    *  5 widget states (defined in "gtkenums.h").
516    */
517   guint8 GSEAL (state);
518   
519   /* The saved state of the widget. When a widget's state
520    *  is changed to GTK_STATE_INSENSITIVE via
521    *  "gtk_widget_set_state" or "gtk_widget_set_sensitive"
522    *  the old state is kept around in this field. The state
523    *  will be restored once the widget gets sensitive again.
524    */
525   guint8 GSEAL (saved_state);
526   
527   /* The widget's name. If the widget does not have a name
528    *  (the name is NULL), then its name (as returned by
529    *  "gtk_widget_get_name") is its class's name.
530    * Among other things, the widget name is used to determine
531    *  the style to use for a widget.
532    */
533   gchar *GSEAL (name);
534   
535   /*< public >*/
536
537   /* The style for the widget. The style contains the
538    *  colors the widget should be drawn in for each state
539    *  along with graphics contexts used to draw with and
540    *  the font to use for text.
541    */
542   GtkStyle *GSEAL (style);
543   
544   /* The widget's desired size.
545    */
546   GtkRequisition GSEAL (requisition);
547   
548   /* The widget's allocated size.
549    */
550   GtkAllocation GSEAL (allocation);
551   
552   /* The widget's window or its parent window if it does
553    *  not have a window. (Which will be indicated by the
554    *  GTK_NO_WINDOW flag being set).
555    */
556   GdkWindow *GSEAL (window);
557   
558   /* The widget's parent.
559    */
560   GtkWidget *GSEAL (parent);
561 };
562
563 /**
564  * GtkWidgetClass:
565  * @parent_class:
566  * @activate_signal:
567  * @set_scroll_adjustments_signal:
568  *
569  * <structfield>activate_signal</structfield>
570  * The signal to emit when a widget of this class is activated,
571  * gtk_widget_activate() handles the emission. Implementation of this
572  * signal is optional.
573  *
574  *
575  * <structfield>set_scroll_adjustment_signal</structfield>
576  * This signal is emitted  when a widget of this class is added
577  * to a scrolling aware parent, gtk_widget_set_scroll_adjustments()
578  * handles the emission.
579  * Implementation of this signal is optional.
580  */
581 struct _GtkWidgetClass
582 {
583   /* The object class structure needs to be the first
584    *  element in the widget class structure in order for
585    *  the class mechanism to work correctly. This allows a
586    *  GtkWidgetClass pointer to be cast to a GtkObjectClass
587    *  pointer.
588    */
589   GtkObjectClass parent_class;
590
591   /*< public >*/
592   
593   guint activate_signal;
594
595   guint set_scroll_adjustments_signal;
596
597   /*< private >*/
598   
599   /* seldomly overidden */
600   void (*dispatch_child_properties_changed) (GtkWidget   *widget,
601                                              guint        n_pspecs,
602                                              GParamSpec **pspecs);
603
604   /* basics */
605   void (* show)                (GtkWidget        *widget);
606   void (* show_all)            (GtkWidget        *widget);
607   void (* hide)                (GtkWidget        *widget);
608   void (* hide_all)            (GtkWidget        *widget);
609   void (* map)                 (GtkWidget        *widget);
610   void (* unmap)               (GtkWidget        *widget);
611   void (* realize)             (GtkWidget        *widget);
612   void (* unrealize)           (GtkWidget        *widget);
613   void (* size_request)        (GtkWidget        *widget,
614                                 GtkRequisition   *requisition);
615   void (* size_allocate)       (GtkWidget        *widget,
616                                 GtkAllocation    *allocation);
617   void (* state_changed)       (GtkWidget        *widget,
618                                 GtkStateType      previous_state);
619   void (* parent_set)          (GtkWidget        *widget,
620                                 GtkWidget        *previous_parent);
621   void (* hierarchy_changed)   (GtkWidget        *widget,
622                                 GtkWidget        *previous_toplevel);
623   void (* style_set)           (GtkWidget        *widget,
624                                 GtkStyle         *previous_style);
625   void (* direction_changed)   (GtkWidget        *widget,
626                                 GtkTextDirection  previous_direction);
627   void (* grab_notify)         (GtkWidget        *widget,
628                                 gboolean          was_grabbed);
629   void (* child_notify)        (GtkWidget        *widget,
630                                 GParamSpec       *pspec);
631   
632   /* Mnemonics */
633   gboolean (* mnemonic_activate) (GtkWidget    *widget,
634                                   gboolean      group_cycling);
635   
636   /* explicit focus */
637   void     (* grab_focus)      (GtkWidget        *widget);
638   gboolean (* focus)           (GtkWidget        *widget,
639                                 GtkDirectionType  direction);
640   
641   /* events */
642   gboolean (* event)                    (GtkWidget           *widget,
643                                          GdkEvent            *event);
644   gboolean (* button_press_event)       (GtkWidget           *widget,
645                                          GdkEventButton      *event);
646   gboolean (* button_release_event)     (GtkWidget           *widget,
647                                          GdkEventButton      *event);
648   gboolean (* scroll_event)             (GtkWidget           *widget,
649                                          GdkEventScroll      *event);
650   gboolean (* motion_notify_event)      (GtkWidget           *widget,
651                                          GdkEventMotion      *event);
652   gboolean (* delete_event)             (GtkWidget           *widget,
653                                          GdkEventAny         *event);
654   gboolean (* destroy_event)            (GtkWidget           *widget,
655                                          GdkEventAny         *event);
656   gboolean (* expose_event)             (GtkWidget           *widget,
657                                          GdkEventExpose      *event);
658   gboolean (* key_press_event)          (GtkWidget           *widget,
659                                          GdkEventKey         *event);
660   gboolean (* key_release_event)        (GtkWidget           *widget,
661                                          GdkEventKey         *event);
662   gboolean (* enter_notify_event)       (GtkWidget           *widget,
663                                          GdkEventCrossing    *event);
664   gboolean (* leave_notify_event)       (GtkWidget           *widget,
665                                          GdkEventCrossing    *event);
666   gboolean (* configure_event)          (GtkWidget           *widget,
667                                          GdkEventConfigure   *event);
668   gboolean (* focus_in_event)           (GtkWidget           *widget,
669                                          GdkEventFocus       *event);
670   gboolean (* focus_out_event)          (GtkWidget           *widget,
671                                          GdkEventFocus       *event);
672   gboolean (* map_event)                (GtkWidget           *widget,
673                                          GdkEventAny         *event);
674   gboolean (* unmap_event)              (GtkWidget           *widget,
675                                          GdkEventAny         *event);
676   gboolean (* property_notify_event)    (GtkWidget           *widget,
677                                          GdkEventProperty    *event);
678   gboolean (* selection_clear_event)    (GtkWidget           *widget,
679                                          GdkEventSelection   *event);
680   gboolean (* selection_request_event)  (GtkWidget           *widget,
681                                          GdkEventSelection   *event);
682   gboolean (* selection_notify_event)   (GtkWidget           *widget,
683                                          GdkEventSelection   *event);
684   gboolean (* proximity_in_event)       (GtkWidget           *widget,
685                                          GdkEventProximity   *event);
686   gboolean (* proximity_out_event)      (GtkWidget           *widget,
687                                          GdkEventProximity   *event);
688   gboolean (* visibility_notify_event)  (GtkWidget           *widget,
689                                          GdkEventVisibility  *event);
690   gboolean (* client_event)             (GtkWidget           *widget,
691                                          GdkEventClient      *event);
692   gboolean (* no_expose_event)          (GtkWidget           *widget,
693                                          GdkEventAny         *event);
694   gboolean (* window_state_event)       (GtkWidget           *widget,
695                                          GdkEventWindowState *event);
696   
697   /* selection */
698   void (* selection_get)           (GtkWidget          *widget,
699                                     GtkSelectionData   *selection_data,
700                                     guint               info,
701                                     guint               time_);
702   void (* selection_received)      (GtkWidget          *widget,
703                                     GtkSelectionData   *selection_data,
704                                     guint               time_);
705
706   /* Source side drag signals */
707   void (* drag_begin)              (GtkWidget          *widget,
708                                     GdkDragContext     *context);
709   void (* drag_end)                (GtkWidget          *widget,
710                                     GdkDragContext     *context);
711   void (* drag_data_get)           (GtkWidget          *widget,
712                                     GdkDragContext     *context,
713                                     GtkSelectionData   *selection_data,
714                                     guint               info,
715                                     guint               time_);
716   void (* drag_data_delete)        (GtkWidget          *widget,
717                                     GdkDragContext     *context);
718
719   /* Target side drag signals */
720   void (* drag_leave)              (GtkWidget          *widget,
721                                     GdkDragContext     *context,
722                                     guint               time_);
723   gboolean (* drag_motion)         (GtkWidget          *widget,
724                                     GdkDragContext     *context,
725                                     gint                x,
726                                     gint                y,
727                                     guint               time_);
728   gboolean (* drag_drop)           (GtkWidget          *widget,
729                                     GdkDragContext     *context,
730                                     gint                x,
731                                     gint                y,
732                                     guint               time_);
733   void (* drag_data_received)      (GtkWidget          *widget,
734                                     GdkDragContext     *context,
735                                     gint                x,
736                                     gint                y,
737                                     GtkSelectionData   *selection_data,
738                                     guint               info,
739                                     guint               time_);
740
741   /* Signals used only for keybindings */
742   gboolean (* popup_menu)          (GtkWidget          *widget);
743
744   /* If a widget has multiple tooltips/whatsthis, it should show the
745    * one for the current focus location, or if that doesn't make
746    * sense, should cycle through them showing each tip alongside
747    * whatever piece of the widget it applies to.
748    */
749   gboolean (* show_help)           (GtkWidget          *widget,
750                                     GtkWidgetHelpType   help_type);
751   
752   /* accessibility support 
753    */
754   AtkObject*   (*get_accessible)     (GtkWidget *widget);
755
756   void         (*screen_changed)     (GtkWidget *widget,
757                                       GdkScreen *previous_screen);
758   gboolean     (*can_activate_accel) (GtkWidget *widget,
759                                       guint      signal_id);
760
761   /* Sent when a grab is broken. */
762   gboolean (*grab_broken_event) (GtkWidget           *widget,
763                                  GdkEventGrabBroken  *event);
764
765   void         (* composited_changed) (GtkWidget *widget);
766
767   gboolean     (* query_tooltip)      (GtkWidget  *widget,
768                                        gint        x,
769                                        gint        y,
770                                        gboolean    keyboard_tooltip,
771                                        GtkTooltip *tooltip);
772   /* Signals without a C default handler class slot:
773    * gboolean   (*damage_event) (GtkWidget      *widget,
774    *                             GdkEventExpose *event);
775    */
776
777   /* Padding for future expansion */
778   void (*_gtk_reserved5) (void);
779   void (*_gtk_reserved6) (void);
780   void (*_gtk_reserved7) (void);
781 };
782
783 struct _GtkWidgetAuxInfo
784 {
785   gint x;
786   gint y;
787   gint width;
788   gint height;
789   guint x_set : 1;
790   guint y_set : 1;
791 };
792
793 struct _GtkWidgetShapeInfo
794 {
795   gint16     offset_x;
796   gint16     offset_y;
797   GdkBitmap *shape_mask;
798 };
799
800 GType      gtk_widget_get_type            (void) G_GNUC_CONST;
801 GtkWidget* gtk_widget_new                 (GType                type,
802                                            const gchar         *first_property_name,
803                                            ...);
804 void       gtk_widget_destroy             (GtkWidget           *widget);
805 void       gtk_widget_destroyed           (GtkWidget           *widget,
806                                            GtkWidget          **widget_pointer);
807 #ifndef GTK_DISABLE_DEPRECATED
808 GtkWidget* gtk_widget_ref                 (GtkWidget           *widget);
809 void       gtk_widget_unref               (GtkWidget           *widget);
810 void       gtk_widget_set                 (GtkWidget           *widget,
811                                            const gchar         *first_property_name,
812                                            ...) G_GNUC_NULL_TERMINATED;
813 #endif /* GTK_DISABLE_DEPRECATED */
814 void       gtk_widget_unparent            (GtkWidget           *widget);
815 void       gtk_widget_show                (GtkWidget           *widget);
816 void       gtk_widget_show_now            (GtkWidget           *widget);
817 void       gtk_widget_hide                (GtkWidget           *widget);
818 void       gtk_widget_show_all            (GtkWidget           *widget);
819 void       gtk_widget_hide_all            (GtkWidget           *widget);
820 void       gtk_widget_set_no_show_all     (GtkWidget           *widget,
821                                            gboolean             no_show_all);
822 gboolean   gtk_widget_get_no_show_all     (GtkWidget           *widget);
823 void       gtk_widget_map                 (GtkWidget           *widget);
824 void       gtk_widget_unmap               (GtkWidget           *widget);
825 void       gtk_widget_realize             (GtkWidget           *widget);
826 void       gtk_widget_unrealize           (GtkWidget           *widget);
827
828 /* Queuing draws */
829 void       gtk_widget_queue_draw          (GtkWidget           *widget);
830 void       gtk_widget_queue_draw_area     (GtkWidget           *widget,
831                                            gint                 x,
832                                            gint                 y,
833                                            gint                 width,
834                                            gint                 height);
835 #ifndef GTK_DISABLE_DEPRECATED
836 void       gtk_widget_queue_clear         (GtkWidget           *widget);
837 void       gtk_widget_queue_clear_area    (GtkWidget           *widget,
838                                            gint                 x,
839                                            gint                 y,
840                                            gint                 width,
841                                            gint                 height);
842 #endif /* GTK_DISABLE_DEPRECATED */
843
844
845 void       gtk_widget_queue_resize        (GtkWidget           *widget);
846 void       gtk_widget_queue_resize_no_redraw (GtkWidget *widget);
847 #ifndef GTK_DISABLE_DEPRECATED
848 void       gtk_widget_draw                (GtkWidget           *widget,
849                                            const GdkRectangle  *area);
850 #endif /* GTK_DISABLE_DEPRECATED */
851 void       gtk_widget_size_request        (GtkWidget           *widget,
852                                            GtkRequisition      *requisition);
853 void       gtk_widget_size_allocate       (GtkWidget           *widget,
854                                            GtkAllocation       *allocation);
855 void       gtk_widget_get_child_requisition (GtkWidget         *widget,
856                                              GtkRequisition    *requisition);
857 void       gtk_widget_add_accelerator     (GtkWidget           *widget,
858                                            const gchar         *accel_signal,
859                                            GtkAccelGroup       *accel_group,
860                                            guint                accel_key,
861                                            GdkModifierType      accel_mods,
862                                            GtkAccelFlags        accel_flags);
863 gboolean   gtk_widget_remove_accelerator  (GtkWidget           *widget,
864                                            GtkAccelGroup       *accel_group,
865                                            guint                accel_key,
866                                            GdkModifierType      accel_mods);
867 void       gtk_widget_set_accel_path      (GtkWidget           *widget,
868                                            const gchar         *accel_path,
869                                            GtkAccelGroup       *accel_group);
870 const gchar* _gtk_widget_get_accel_path   (GtkWidget           *widget,
871                                            gboolean            *locked);
872 GList*     gtk_widget_list_accel_closures (GtkWidget           *widget);
873 gboolean   gtk_widget_can_activate_accel  (GtkWidget           *widget,
874                                            guint                signal_id);
875 gboolean   gtk_widget_mnemonic_activate   (GtkWidget           *widget,
876                                            gboolean             group_cycling);
877 gboolean   gtk_widget_event               (GtkWidget           *widget,
878                                            GdkEvent            *event);
879 gint       gtk_widget_send_expose         (GtkWidget           *widget,
880                                            GdkEvent            *event);
881
882 gboolean   gtk_widget_activate               (GtkWidget        *widget);
883 gboolean   gtk_widget_set_scroll_adjustments (GtkWidget        *widget,
884                                               GtkAdjustment    *hadjustment,
885                                               GtkAdjustment    *vadjustment);
886      
887 void       gtk_widget_reparent            (GtkWidget           *widget,
888                                            GtkWidget           *new_parent);
889 gboolean   gtk_widget_intersect           (GtkWidget           *widget,
890                                            const GdkRectangle  *area,
891                                            GdkRectangle        *intersection);
892 GdkRegion *gtk_widget_region_intersect    (GtkWidget           *widget,
893                                            const GdkRegion     *region);
894
895 void    gtk_widget_freeze_child_notify    (GtkWidget           *widget);
896 void    gtk_widget_child_notify           (GtkWidget           *widget,
897                                            const gchar         *child_property);
898 void    gtk_widget_thaw_child_notify      (GtkWidget           *widget);
899
900 void       gtk_widget_set_can_focus       (GtkWidget           *widget,
901                                            gboolean             can_focus);
902 gboolean   gtk_widget_get_can_focus       (GtkWidget           *widget);
903 gboolean   gtk_widget_has_focus           (GtkWidget           *widget);
904 gboolean   gtk_widget_is_focus            (GtkWidget           *widget);
905 void       gtk_widget_grab_focus          (GtkWidget           *widget);
906
907 void       gtk_widget_set_can_default     (GtkWidget           *widget,
908                                            gboolean             can_default);
909 gboolean   gtk_widget_get_can_default     (GtkWidget           *widget);
910 gboolean   gtk_widget_has_default         (GtkWidget           *widget);
911 void       gtk_widget_grab_default        (GtkWidget           *widget);
912
913 void      gtk_widget_set_receives_default (GtkWidget           *widget,
914                                            gboolean             receives_default);
915 gboolean  gtk_widget_get_receives_default (GtkWidget           *widget);
916
917 gboolean   gtk_widget_has_grab            (GtkWidget           *widget);
918
919 void                  gtk_widget_set_name               (GtkWidget    *widget,
920                                                          const gchar  *name);
921 G_CONST_RETURN gchar* gtk_widget_get_name               (GtkWidget    *widget);
922
923 void                  gtk_widget_set_state              (GtkWidget    *widget,
924                                                          GtkStateType  state);
925 GtkStateType          gtk_widget_get_state              (GtkWidget    *widget);
926
927 void                  gtk_widget_set_sensitive          (GtkWidget    *widget,
928                                                          gboolean      sensitive);
929 gboolean              gtk_widget_get_sensitive          (GtkWidget    *widget);
930 gboolean              gtk_widget_is_sensitive           (GtkWidget    *widget);
931
932 void                  gtk_widget_set_visible            (GtkWidget    *widget,
933                                                          gboolean      visible);
934 gboolean              gtk_widget_get_visible            (GtkWidget    *widget);
935
936 void                  gtk_widget_set_has_window         (GtkWidget    *widget,
937                                                          gboolean      has_window);
938 gboolean              gtk_widget_get_has_window         (GtkWidget    *widget);
939
940 gboolean              gtk_widget_is_toplevel            (GtkWidget    *widget);
941 gboolean              gtk_widget_is_drawable            (GtkWidget    *widget);
942 void                  gtk_widget_set_realized           (GtkWidget    *widget,
943                                                          gboolean      realized);
944 gboolean              gtk_widget_get_realized           (GtkWidget    *widget);
945 void                  gtk_widget_set_mapped             (GtkWidget    *widget,
946                                                          gboolean      mapped);
947 gboolean              gtk_widget_get_mapped             (GtkWidget    *widget);
948
949 void                  gtk_widget_set_app_paintable      (GtkWidget    *widget,
950                                                          gboolean      app_paintable);
951 gboolean              gtk_widget_get_app_paintable      (GtkWidget    *widget);
952
953 void                  gtk_widget_set_double_buffered    (GtkWidget    *widget,
954                                                          gboolean      double_buffered);
955 gboolean              gtk_widget_get_double_buffered    (GtkWidget    *widget);
956
957 void                  gtk_widget_set_redraw_on_allocate (GtkWidget    *widget,
958                                                          gboolean      redraw_on_allocate);
959
960 void                  gtk_widget_set_parent             (GtkWidget    *widget,
961                                                          GtkWidget    *parent);
962 GtkWidget           * gtk_widget_get_parent             (GtkWidget    *widget);
963
964 void                  gtk_widget_set_parent_window      (GtkWidget    *widget,
965                                                          GdkWindow    *parent_window);
966 GdkWindow           * gtk_widget_get_parent_window      (GtkWidget    *widget);
967
968 void                  gtk_widget_set_child_visible      (GtkWidget    *widget,
969                                                          gboolean      is_visible);
970 gboolean              gtk_widget_get_child_visible      (GtkWidget    *widget);
971
972 void                  gtk_widget_set_window             (GtkWidget    *widget,
973                                                          GdkWindow    *window);
974 GdkWindow           * gtk_widget_get_window             (GtkWidget    *widget);
975
976 void                  gtk_widget_get_allocation         (GtkWidget     *widget,
977                                                          GtkAllocation *allocation);
978 void                  gtk_widget_set_allocation         (GtkWidget     *widget,
979                                                          const GtkAllocation *allocation);
980
981 void                  gtk_widget_get_requisition        (GtkWidget     *widget,
982                                                          GtkRequisition *requisition);
983
984 gboolean   gtk_widget_child_focus         (GtkWidget           *widget,
985                                            GtkDirectionType     direction);
986 gboolean   gtk_widget_keynav_failed       (GtkWidget           *widget,
987                                            GtkDirectionType     direction);
988 void       gtk_widget_error_bell          (GtkWidget           *widget);
989
990 void       gtk_widget_set_size_request    (GtkWidget           *widget,
991                                            gint                 width,
992                                            gint                 height);
993 void       gtk_widget_get_size_request    (GtkWidget           *widget,
994                                            gint                *width,
995                                            gint                *height);
996 #ifndef GTK_DISABLE_DEPRECATED
997 void       gtk_widget_set_uposition       (GtkWidget           *widget,
998                                            gint                 x,
999                                            gint                 y);
1000 void       gtk_widget_set_usize           (GtkWidget           *widget,
1001                                            gint                 width,
1002                                            gint                 height);
1003 #endif
1004
1005 void       gtk_widget_set_events          (GtkWidget           *widget,
1006                                            gint                 events);
1007 void       gtk_widget_add_events          (GtkWidget           *widget,
1008                                            gint                 events);
1009 void       gtk_widget_set_extension_events (GtkWidget           *widget,
1010                                             GdkExtensionMode    mode);
1011
1012 GdkExtensionMode gtk_widget_get_extension_events (GtkWidget     *widget);
1013 GtkWidget*   gtk_widget_get_toplevel    (GtkWidget      *widget);
1014 GtkWidget*   gtk_widget_get_ancestor    (GtkWidget      *widget,
1015                                          GType           widget_type);
1016 GdkColormap* gtk_widget_get_colormap    (GtkWidget      *widget);
1017 GdkVisual*   gtk_widget_get_visual      (GtkWidget      *widget);
1018
1019 GdkScreen *   gtk_widget_get_screen      (GtkWidget *widget);
1020 gboolean      gtk_widget_has_screen      (GtkWidget *widget);
1021 GdkDisplay *  gtk_widget_get_display     (GtkWidget *widget);
1022 GdkWindow *   gtk_widget_get_root_window (GtkWidget *widget);
1023 GtkSettings*  gtk_widget_get_settings    (GtkWidget *widget);
1024 GtkClipboard *gtk_widget_get_clipboard   (GtkWidget *widget,
1025                                           GdkAtom    selection);
1026 GdkPixmap *   gtk_widget_get_snapshot    (GtkWidget    *widget,
1027                                           GdkRectangle *clip_rect);
1028
1029 #ifndef GTK_DISABLE_DEPRECATED
1030
1031 /**
1032  * gtk_widget_set_visual:
1033  * @widget: a #GtkWidget
1034  * @visual: a visual
1035  *
1036  * This function is deprecated; it does nothing.
1037  */
1038 #define gtk_widget_set_visual(widget,visual)  ((void) 0)
1039
1040 /**
1041  * gtk_widget_push_visual:
1042  * @visual: a visual
1043  *
1044  * This function is deprecated; it does nothing.
1045  */
1046 #define gtk_widget_push_visual(visual)        ((void) 0)
1047
1048 /**
1049  * gtk_widget_pop_visual:
1050  *
1051  * This function is deprecated; it does nothing.
1052  */
1053 #define gtk_widget_pop_visual()               ((void) 0)
1054
1055 /**
1056  * gtk_widget_set_default_visual:
1057  * @visual: a visual
1058  *
1059  * This function is deprecated; it does nothing.
1060  */
1061 #define gtk_widget_set_default_visual(visual) ((void) 0)
1062
1063 #endif /* GTK_DISABLE_DEPRECATED */
1064
1065 /* Accessibility support */
1066 AtkObject*       gtk_widget_get_accessible               (GtkWidget          *widget);
1067
1068 /* The following functions must not be called on an already
1069  * realized widget. Because it is possible that somebody
1070  * can call get_colormap() or get_visual() and save the
1071  * result, these functions are probably only safe to
1072  * call in a widget's init() function.
1073  */
1074 void         gtk_widget_set_colormap    (GtkWidget      *widget,
1075                                          GdkColormap    *colormap);
1076
1077 gint         gtk_widget_get_events      (GtkWidget      *widget);
1078 void         gtk_widget_get_pointer     (GtkWidget      *widget,
1079                                          gint           *x,
1080                                          gint           *y);
1081
1082 gboolean     gtk_widget_is_ancestor     (GtkWidget      *widget,
1083                                          GtkWidget      *ancestor);
1084
1085 gboolean     gtk_widget_translate_coordinates (GtkWidget  *src_widget,
1086                                                GtkWidget  *dest_widget,
1087                                                gint        src_x,
1088                                                gint        src_y,
1089                                                gint       *dest_x,
1090                                                gint       *dest_y);
1091
1092 /* Hide widget and return TRUE.
1093  */
1094 gboolean     gtk_widget_hide_on_delete  (GtkWidget      *widget);
1095
1096 /* Widget styles.
1097  */
1098 void        gtk_widget_style_attach       (GtkWidget            *style);
1099
1100 gboolean    gtk_widget_has_rc_style       (GtkWidget            *widget);
1101 void        gtk_widget_set_style          (GtkWidget            *widget,
1102                                            GtkStyle             *style);
1103 void        gtk_widget_ensure_style       (GtkWidget            *widget);
1104 GtkStyle *  gtk_widget_get_style          (GtkWidget            *widget);
1105
1106 void        gtk_widget_modify_style       (GtkWidget            *widget,
1107                                            GtkRcStyle           *style);
1108 GtkRcStyle *gtk_widget_get_modifier_style (GtkWidget            *widget);
1109 void        gtk_widget_modify_fg          (GtkWidget            *widget,
1110                                            GtkStateType          state,
1111                                            const GdkColor       *color);
1112 void        gtk_widget_modify_bg          (GtkWidget            *widget,
1113                                            GtkStateType          state,
1114                                            const GdkColor       *color);
1115 void        gtk_widget_modify_text        (GtkWidget            *widget,
1116                                            GtkStateType          state,
1117                                            const GdkColor       *color);
1118 void        gtk_widget_modify_base        (GtkWidget            *widget,
1119                                            GtkStateType          state,
1120                                            const GdkColor       *color);
1121 void        gtk_widget_modify_cursor      (GtkWidget            *widget,
1122                                            const GdkColor       *primary,
1123                                            const GdkColor       *secondary);
1124 void        gtk_widget_modify_font        (GtkWidget            *widget,
1125                                            PangoFontDescription *font_desc);
1126
1127 #ifndef GTK_DISABLE_DEPRECATED
1128
1129 /**
1130  * gtk_widget_set_rc_style:
1131  * @widget: a #GtkWidget.
1132  *
1133  * Equivalent to <literal>gtk_widget_set_style (widget, NULL)</literal>.
1134  *
1135  * Deprecated: 2.0: Use gtk_widget_set_style() with a %NULL @style argument instead.
1136  */
1137 #define gtk_widget_set_rc_style(widget)          (gtk_widget_set_style (widget, NULL))
1138
1139 /**
1140  * gtk_widget_restore_default_style:
1141  * @widget: a #GtkWidget.
1142  *
1143  * Equivalent to <literal>gtk_widget_set_style (widget, NULL)</literal>.
1144  *
1145  * Deprecated: 2.0: Use gtk_widget_set_style() with a %NULL @style argument instead.
1146  */
1147 #define gtk_widget_restore_default_style(widget) (gtk_widget_set_style (widget, NULL))
1148 #endif
1149
1150 PangoContext *gtk_widget_create_pango_context (GtkWidget   *widget);
1151 PangoContext *gtk_widget_get_pango_context    (GtkWidget   *widget);
1152 PangoLayout  *gtk_widget_create_pango_layout  (GtkWidget   *widget,
1153                                                const gchar *text);
1154
1155 GdkPixbuf    *gtk_widget_render_icon          (GtkWidget   *widget,
1156                                                const gchar *stock_id,
1157                                                GtkIconSize  size,
1158                                                const gchar *detail);
1159
1160 /* handle composite names for GTK_COMPOSITE_CHILD widgets,
1161  * the returned name is newly allocated.
1162  */
1163 void   gtk_widget_set_composite_name    (GtkWidget      *widget,
1164                                          const gchar    *name);
1165 gchar* gtk_widget_get_composite_name    (GtkWidget      *widget);
1166      
1167 /* Descend recursively and set rc-style on all widgets without user styles */
1168 void       gtk_widget_reset_rc_styles   (GtkWidget      *widget);
1169
1170 /* Push/pop pairs, to change default values upon a widget's creation.
1171  * This will override the values that got set by the
1172  * gtk_widget_set_default_* () functions.
1173  */
1174 void         gtk_widget_push_colormap        (GdkColormap *cmap);
1175 void         gtk_widget_push_composite_child (void);
1176 void         gtk_widget_pop_composite_child  (void);
1177 void         gtk_widget_pop_colormap         (void);
1178
1179 /* widget style properties
1180  */
1181 void gtk_widget_class_install_style_property        (GtkWidgetClass     *klass,
1182                                                      GParamSpec         *pspec);
1183 void gtk_widget_class_install_style_property_parser (GtkWidgetClass     *klass,
1184                                                      GParamSpec         *pspec,
1185                                                      GtkRcPropertyParser parser);
1186 GParamSpec*  gtk_widget_class_find_style_property   (GtkWidgetClass     *klass,
1187                                                      const gchar        *property_name);
1188 GParamSpec** gtk_widget_class_list_style_properties (GtkWidgetClass     *klass,
1189                                                      guint              *n_properties);
1190 void gtk_widget_style_get_property (GtkWidget        *widget,
1191                                     const gchar    *property_name,
1192                                     GValue           *value);
1193 void gtk_widget_style_get_valist   (GtkWidget        *widget,
1194                                     const gchar    *first_property_name,
1195                                     va_list         var_args);
1196 void gtk_widget_style_get          (GtkWidget        *widget,
1197                                     const gchar    *first_property_name,
1198                                     ...) G_GNUC_NULL_TERMINATED;
1199
1200
1201 /* Set certain default values to be used at widget creation time.
1202  */
1203 void         gtk_widget_set_default_colormap (GdkColormap *colormap);
1204 GtkStyle*    gtk_widget_get_default_style    (void);
1205 #ifndef GDK_MULTIHEAD_SAFE
1206 GdkColormap* gtk_widget_get_default_colormap (void);
1207 GdkVisual*   gtk_widget_get_default_visual   (void);
1208 #endif
1209
1210 /* Functions for setting directionality for widgets
1211  */
1212
1213 void             gtk_widget_set_direction         (GtkWidget        *widget,
1214                                                    GtkTextDirection  dir);
1215 GtkTextDirection gtk_widget_get_direction         (GtkWidget        *widget);
1216
1217 void             gtk_widget_set_default_direction (GtkTextDirection  dir);
1218 GtkTextDirection gtk_widget_get_default_direction (void);
1219
1220 /* Compositing manager functionality */
1221 gboolean gtk_widget_is_composited (GtkWidget *widget);
1222
1223 /* Counterpart to gdk_window_shape_combine_mask.
1224  */
1225 void         gtk_widget_shape_combine_mask (GtkWidget *widget,
1226                                             GdkBitmap *shape_mask,
1227                                             gint       offset_x,
1228                                             gint       offset_y);
1229 void         gtk_widget_input_shape_combine_mask (GtkWidget *widget,
1230                                                   GdkBitmap *shape_mask,
1231                                                   gint       offset_x,
1232                                                   gint       offset_y);
1233
1234 /* internal function */
1235 void         gtk_widget_reset_shapes       (GtkWidget *widget);
1236
1237 /* Compute a widget's path in the form "GtkWindow.MyLabel", and
1238  * return newly alocated strings.
1239  */
1240 void         gtk_widget_path               (GtkWidget *widget,
1241                                             guint     *path_length,
1242                                             gchar    **path,
1243                                             gchar    **path_reversed);
1244 void         gtk_widget_class_path         (GtkWidget *widget,
1245                                             guint     *path_length,
1246                                             gchar    **path,
1247                                             gchar    **path_reversed);
1248
1249 GList* gtk_widget_list_mnemonic_labels  (GtkWidget *widget);
1250 void   gtk_widget_add_mnemonic_label    (GtkWidget *widget,
1251                                          GtkWidget *label);
1252 void   gtk_widget_remove_mnemonic_label (GtkWidget *widget,
1253                                          GtkWidget *label);
1254
1255 void                  gtk_widget_set_tooltip_window    (GtkWidget   *widget,
1256                                                         GtkWindow   *custom_window);
1257 GtkWindow *gtk_widget_get_tooltip_window    (GtkWidget   *widget);
1258 void       gtk_widget_trigger_tooltip_query (GtkWidget   *widget);
1259 void       gtk_widget_set_tooltip_text      (GtkWidget   *widget,
1260                                              const gchar *text);
1261 gchar *    gtk_widget_get_tooltip_text      (GtkWidget   *widget);
1262 void       gtk_widget_set_tooltip_markup    (GtkWidget   *widget,
1263                                              const gchar *markup);
1264 gchar *    gtk_widget_get_tooltip_markup    (GtkWidget   *widget);
1265 void       gtk_widget_set_has_tooltip       (GtkWidget   *widget,
1266                                              gboolean     has_tooltip);
1267 gboolean   gtk_widget_get_has_tooltip       (GtkWidget   *widget);
1268
1269 GType           gtk_requisition_get_type (void) G_GNUC_CONST;
1270 GtkRequisition *gtk_requisition_copy     (const GtkRequisition *requisition);
1271 void            gtk_requisition_free     (GtkRequisition       *requisition);
1272
1273 #if     defined (GTK_TRACE_OBJECTS) && defined (__GNUC__)
1274 #  define gtk_widget_ref g_object_ref
1275 #  define gtk_widget_unref g_object_unref
1276 #endif  /* GTK_TRACE_OBJECTS && __GNUC__ */
1277
1278 void              _gtk_widget_grab_notify                 (GtkWidget    *widget,
1279                                                            gboolean     was_grabbed);
1280
1281 GtkWidgetAuxInfo *_gtk_widget_get_aux_info                (GtkWidget    *widget,
1282                                                            gboolean      create);
1283 void              _gtk_widget_propagate_hierarchy_changed (GtkWidget    *widget,
1284                                                            GtkWidget    *previous_toplevel);
1285 void              _gtk_widget_propagate_screen_changed    (GtkWidget    *widget,
1286                                                            GdkScreen    *previous_screen);
1287 void              _gtk_widget_propagate_composited_changed (GtkWidget    *widget);
1288
1289 void       _gtk_widget_set_pointer_window  (GtkWidget      *widget,
1290                                             GdkWindow      *pointer_window);
1291 GdkWindow *_gtk_widget_get_pointer_window  (GtkWidget      *widget);
1292 gboolean   _gtk_widget_is_pointer_widget   (GtkWidget      *widget);
1293 void       _gtk_widget_synthesize_crossing (GtkWidget      *from,
1294                                             GtkWidget      *to,
1295                                             GdkCrossingMode mode);
1296
1297 GdkColormap* _gtk_widget_peek_colormap (void);
1298
1299 void         _gtk_widget_buildable_finish_accelerator (GtkWidget *widget,
1300                                                        GtkWidget *toplevel,
1301                                                        gpointer   user_data);
1302
1303 G_END_DECLS
1304
1305 #endif /* __GTK_WIDGET_H__ */