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