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