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