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