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