]> Pileus Git - ~andy/gtk/blob - gtk/gtkwidget.h
Change FSF Address
[~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, see <http://www.gnu.org/licenses/>.
16  */
17
18 /*
19  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
20  * file for a list of people on the GTK+ Team.  See the ChangeLog
21  * files for a list of changes.  These files are distributed with
22  * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
23  */
24
25 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
26 #error "Only <gtk/gtk.h> can be included directly."
27 #endif
28
29 #ifndef __GTK_WIDGET_H__
30 #define __GTK_WIDGET_H__
31
32 #include <gdk/gdk.h>
33 #include <gtk/gtkaccelgroup.h>
34 #include <gtk/gtkadjustment.h>
35 #include <gtk/gtkborder.h>
36 #include <gtk/gtksettings.h>
37 #include <gtk/gtkstylecontext.h>
38 #include <gtk/gtkwidgetpath.h>
39 #include <atk/atk.h>
40
41 G_BEGIN_DECLS
42
43 /* Kinds of widget-specific help */
44 typedef enum
45 {
46   GTK_WIDGET_HELP_TOOLTIP,
47   GTK_WIDGET_HELP_WHATS_THIS
48 } GtkWidgetHelpType;
49
50 /* Macro for casting a pointer to a GtkWidget or GtkWidgetClass pointer.
51  * Macros for testing whether `widget' or `klass' are of type GTK_TYPE_WIDGET.
52  */
53 #define GTK_TYPE_WIDGET                   (gtk_widget_get_type ())
54 #define GTK_WIDGET(widget)                (G_TYPE_CHECK_INSTANCE_CAST ((widget), GTK_TYPE_WIDGET, GtkWidget))
55 #define GTK_WIDGET_CLASS(klass)           (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_WIDGET, GtkWidgetClass))
56 #define GTK_IS_WIDGET(widget)             (G_TYPE_CHECK_INSTANCE_TYPE ((widget), GTK_TYPE_WIDGET))
57 #define GTK_IS_WIDGET_CLASS(klass)        (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WIDGET))
58 #define GTK_WIDGET_GET_CLASS(obj)         (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_WIDGET, GtkWidgetClass))
59
60 #define GTK_TYPE_REQUISITION              (gtk_requisition_get_type ())
61
62 /* forward declaration to avoid excessive includes (and concurrent includes)
63  */
64 typedef struct _GtkRequisition         GtkRequisition;
65 typedef struct _GtkSelectionData       GtkSelectionData;
66 typedef struct _GtkWidgetPrivate       GtkWidgetPrivate;
67 typedef struct _GtkWidgetClass         GtkWidgetClass;
68 typedef struct _GtkWidgetClassPrivate  GtkWidgetClassPrivate;
69 typedef struct _GtkWidgetAuxInfo       GtkWidgetAuxInfo;
70 typedef struct _GtkClipboard           GtkClipboard;
71 typedef struct _GtkTooltip             GtkTooltip;
72 typedef struct _GtkWindow              GtkWindow;
73
74 /**
75  * GtkAllocation:
76  * @x: the X position of the widget's area relative to its parents allocation.
77  * @y: the Y position of the widget's area relative to its parents allocation.
78  * @width: the width of the widget's allocated area.
79  * @height: the height of the widget's allocated area.
80  *
81  * A <structname>GtkAllocation</structname> of a widget represents region
82  * which has been allocated to the widget by its parent. It is a subregion
83  * of its parents allocation. See <xref linkend="geometry-management"/> for
84  * more information.
85  */
86 typedef         GdkRectangle       GtkAllocation;
87
88 /**
89  * GtkCallback:
90  * @widget: the widget to operate on
91  * @data: user-supplied data
92  *
93  * The type of the callback functions used for e.g. iterating over
94  * the children of a container, see gtk_container_foreach().
95  */
96 typedef void    (*GtkCallback)     (GtkWidget        *widget,
97                                     gpointer          data);
98
99 /**
100  * GtkRequisition:
101  * @width: the widget's desired width
102  * @height: the widget's desired height
103  *
104  * A <structname>GtkRequisition</structname> represents the desired size of a widget. See
105  * <xref linkend="geometry-management"/> for more information.
106  */
107 struct _GtkRequisition
108 {
109   gint width;
110   gint height;
111 };
112
113 /* The widget is the base of the tree for displayable objects.
114  *  (A displayable object is one which takes up some amount
115  *  of screen real estate). It provides a common base and interface
116  *  which actual widgets must adhere to.
117  */
118 struct _GtkWidget
119 {
120   GInitiallyUnowned parent_instance;
121
122   GtkWidgetPrivate *priv;
123 };
124
125 /**
126  * GtkWidgetClass:
127  * @parent_class: The object class structure needs to be the first
128  *   element in the widget class structure in order for the class mechanism
129  *   to work correctly. This allows a GtkWidgetClass pointer to be cast to
130  *   a GObjectClass pointer.
131  * @activate_signal: The signal to emit when a widget of this class is
132  *   activated, gtk_widget_activate() handles the emission.
133  *   Implementation of this signal is optional.
134  * @get_request_mode: This allows a widget to tell its parent container whether
135  *   it prefers to be allocated in %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH or
136  *   %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT mode.
137  *   %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH means the widget prefers to have
138  *   #GtkWidgetClass.get_preferred_width() called and then
139  *   #GtkWidgetClass.get_preferred_height_for_width().
140  *   %GTK_SIZE_REQUEST_CONSTANT_SIZE disables any height-for-width or
141  *   width-for-height geometry management for a said widget and is the
142  *   default return.
143  *   It's important to note (as described below) that any widget
144  *   which trades height-for-width or width-for-height must respond properly 
145  *   to both of the virtual methods #GtkWidgetClass.get_preferred_height_for_width()
146  *   and #GtkWidgetClass.get_preferred_width_for_height() since it might be 
147  *   queried in either #GtkSizeRequestMode by its parent container.
148  * @get_preferred_height: This is called by containers to obtain the minimum
149  *   and natural height of a widget. A widget that does not actually trade
150  *   any height for width or width for height only has to implement these
151  *   two virtual methods (#GtkWidgetClass.get_preferred_width() and
152  *   #GtkWidgetClass.get_preferred_height()).
153  * @get_preferred_width_for_height: This is analogous to
154  *   #GtkWidgetClass.get_preferred_height_for_width() except that it
155  *   operates in the oposite orientation. It's rare that a widget actually
156  *   does %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT requests but this can happen
157  *   when, for example, a widget or container gets additional columns to
158  *   compensate for a smaller allocated height.
159  * @get_preferred_width: This is called by containers to obtain the minimum
160  *   and natural width of a widget. A widget will never be allocated a width
161  *   less than its minimum and will only ever be allocated a width greater
162  *   than the natural width once all of the said widget's siblings have
163  *   received their natural widths.
164  *   Furthermore, a widget will only ever be allocated a width greater than
165  *   its natural width if it was configured to receive extra expand space
166  *   from its parent container.
167  * @get_preferred_height_for_width: This is similar to
168  *   #GtkWidgetClass.get_preferred_height() except that it is passed a
169  *   contextual width to request height for. By implementing this virtual
170  *   method it is possible for a #GtkLabel to tell its parent how much height
171  *   would be required if the label were to be allocated a said width.
172  * @adjust_size_request: Convert an initial size request from a widget's
173  *   #GtkSizeRequest virtual method implementations into a size request to
174  *   be used by parent containers in laying out the widget.
175  *   adjust_size_request adjusts <emphasis>from</emphasis> a child widget's
176  *   original request <emphasis>to</emphasis> what a parent container should
177  *   use for layout. The @for_size argument will be -1 if the request should
178  *   not be for a particular size in the opposing orientation, i.e. if the
179  *   request is not height-for-width or width-for-height. If @for_size is
180  *   greater than -1, it is the proposed allocation in the opposing
181  *   orientation that we need the request for. Implementations of
182  *   adjust_size_request should chain up to the default implementation,
183  *   which applies #GtkWidget's margin properties and imposes any values
184  *   from gtk_widget_set_size_request(). Chaining up should be last,
185  *   <emphasis>after</emphasis> your subclass adjusts the request, so
186  *   #GtkWidget can apply constraints and add the margin properly.
187  * @adjust_size_allocation: Convert an initial size allocation assigned
188  *   by a #GtkContainer using gtk_widget_size_allocate(), into an actual
189  *   size allocation to be used by the widget. adjust_size_allocation
190  *   adjusts <emphasis>to</emphasis> a child widget's actual allocation
191  *   <emphasis>from</emphasis> what a parent container computed for the
192  *   child. The adjusted allocation must be entirely within the original
193  *   allocation. In any custom implementation, chain up to the default
194  *   #GtkWidget implementation of this method, which applies the margin
195  *   and alignment properties of #GtkWidget. Chain up
196  *   <emphasis>before</emphasis> performing your own adjustments so your
197  *   own adjustments remove more allocation after the #GtkWidget base
198  *   class has already removed margin and alignment. The natural size
199  *   passed in should be adjusted in the same way as the allocated size,
200  *   which allows adjustments to perform alignments or other changes
201  *   based on natural size.
202  */
203 struct _GtkWidgetClass
204 {
205   GInitiallyUnownedClass parent_class;
206
207   /*< public >*/
208
209   guint activate_signal;
210
211   /* seldomly overidden */
212   void (*dispatch_child_properties_changed) (GtkWidget   *widget,
213                                              guint        n_pspecs,
214                                              GParamSpec **pspecs);
215
216   /* basics */
217   void (* destroy)             (GtkWidget        *widget);
218   void (* show)                (GtkWidget        *widget);
219   void (* show_all)            (GtkWidget        *widget);
220   void (* hide)                (GtkWidget        *widget);
221   void (* map)                 (GtkWidget        *widget);
222   void (* unmap)               (GtkWidget        *widget);
223   void (* realize)             (GtkWidget        *widget);
224   void (* unrealize)           (GtkWidget        *widget);
225   void (* size_allocate)       (GtkWidget        *widget,
226                                 GtkAllocation    *allocation);
227   void (* state_changed)       (GtkWidget        *widget,
228                                 GtkStateType      previous_state);
229   void (* state_flags_changed) (GtkWidget        *widget,
230                                 GtkStateFlags     previous_state_flags);
231   void (* parent_set)          (GtkWidget        *widget,
232                                 GtkWidget        *previous_parent);
233   void (* hierarchy_changed)   (GtkWidget        *widget,
234                                 GtkWidget        *previous_toplevel);
235   void (* style_set)           (GtkWidget        *widget,
236                                 GtkStyle         *previous_style);
237   void (* direction_changed)   (GtkWidget        *widget,
238                                 GtkTextDirection  previous_direction);
239   void (* grab_notify)         (GtkWidget        *widget,
240                                 gboolean          was_grabbed);
241   void (* child_notify)        (GtkWidget        *widget,
242                                 GParamSpec       *pspec);
243   gboolean (* draw)            (GtkWidget        *widget,
244                                 cairo_t          *cr);
245
246   /* size requests */
247   GtkSizeRequestMode (* get_request_mode)               (GtkWidget      *widget);
248
249   void               (* get_preferred_height)           (GtkWidget       *widget,
250                                                          gint            *minimum_height,
251                                                          gint            *natural_height);
252   void               (* get_preferred_width_for_height) (GtkWidget       *widget,
253                                                          gint             height,
254                                                          gint            *minimum_width,
255                                                          gint            *natural_width);
256   void               (* get_preferred_width)            (GtkWidget       *widget,
257                                                          gint            *minimum_width,
258                                                          gint            *natural_width);
259   void               (* get_preferred_height_for_width) (GtkWidget       *widget,
260                                                          gint             width,
261                                                          gint            *minimum_height,
262                                                          gint            *natural_height);
263
264   /* Mnemonics */
265   gboolean (* mnemonic_activate)        (GtkWidget           *widget,
266                                          gboolean             group_cycling);
267
268   /* explicit focus */
269   void     (* grab_focus)               (GtkWidget           *widget);
270   gboolean (* focus)                    (GtkWidget           *widget,
271                                          GtkDirectionType     direction);
272
273   /* keyboard navigation */
274   void     (* move_focus)               (GtkWidget           *widget,
275                                          GtkDirectionType     direction);
276   gboolean (* keynav_failed)            (GtkWidget           *widget,
277                                          GtkDirectionType     direction);
278
279   /* events */
280   gboolean (* event)                    (GtkWidget           *widget,
281                                          GdkEvent            *event);
282   gboolean (* button_press_event)       (GtkWidget           *widget,
283                                          GdkEventButton      *event);
284   gboolean (* button_release_event)     (GtkWidget           *widget,
285                                          GdkEventButton      *event);
286   gboolean (* scroll_event)             (GtkWidget           *widget,
287                                          GdkEventScroll      *event);
288   gboolean (* motion_notify_event)      (GtkWidget           *widget,
289                                          GdkEventMotion      *event);
290   gboolean (* delete_event)             (GtkWidget           *widget,
291                                          GdkEventAny         *event);
292   gboolean (* destroy_event)            (GtkWidget           *widget,
293                                          GdkEventAny         *event);
294   gboolean (* key_press_event)          (GtkWidget           *widget,
295                                          GdkEventKey         *event);
296   gboolean (* key_release_event)        (GtkWidget           *widget,
297                                          GdkEventKey         *event);
298   gboolean (* enter_notify_event)       (GtkWidget           *widget,
299                                          GdkEventCrossing    *event);
300   gboolean (* leave_notify_event)       (GtkWidget           *widget,
301                                          GdkEventCrossing    *event);
302   gboolean (* configure_event)          (GtkWidget           *widget,
303                                          GdkEventConfigure   *event);
304   gboolean (* focus_in_event)           (GtkWidget           *widget,
305                                          GdkEventFocus       *event);
306   gboolean (* focus_out_event)          (GtkWidget           *widget,
307                                          GdkEventFocus       *event);
308   gboolean (* map_event)                (GtkWidget           *widget,
309                                          GdkEventAny         *event);
310   gboolean (* unmap_event)              (GtkWidget           *widget,
311                                          GdkEventAny         *event);
312   gboolean (* property_notify_event)    (GtkWidget           *widget,
313                                          GdkEventProperty    *event);
314   gboolean (* selection_clear_event)    (GtkWidget           *widget,
315                                          GdkEventSelection   *event);
316   gboolean (* selection_request_event)  (GtkWidget           *widget,
317                                          GdkEventSelection   *event);
318   gboolean (* selection_notify_event)   (GtkWidget           *widget,
319                                          GdkEventSelection   *event);
320   gboolean (* proximity_in_event)       (GtkWidget           *widget,
321                                          GdkEventProximity   *event);
322   gboolean (* proximity_out_event)      (GtkWidget           *widget,
323                                          GdkEventProximity   *event);
324   gboolean (* visibility_notify_event)  (GtkWidget           *widget,
325                                          GdkEventVisibility  *event);
326   gboolean (* window_state_event)       (GtkWidget           *widget,
327                                          GdkEventWindowState *event);
328   gboolean (* damage_event)             (GtkWidget           *widget,
329                                          GdkEventExpose      *event);
330   gboolean (* grab_broken_event)        (GtkWidget           *widget,
331                                          GdkEventGrabBroken  *event);
332
333   /* selection */
334   void     (* selection_get)       (GtkWidget          *widget,
335                                     GtkSelectionData   *selection_data,
336                                     guint               info,
337                                     guint               time_);
338   void     (* selection_received)  (GtkWidget          *widget,
339                                     GtkSelectionData   *selection_data,
340                                     guint               time_);
341
342   /* Source side drag signals */
343   void     (* drag_begin)          (GtkWidget         *widget,
344                                     GdkDragContext     *context);
345   void     (* drag_end)            (GtkWidget          *widget,
346                                     GdkDragContext     *context);
347   void     (* drag_data_get)       (GtkWidget          *widget,
348                                     GdkDragContext     *context,
349                                     GtkSelectionData   *selection_data,
350                                     guint               info,
351                                     guint               time_);
352   void     (* drag_data_delete)    (GtkWidget          *widget,
353                                     GdkDragContext     *context);
354
355   /* Target side drag signals */
356   void     (* drag_leave)          (GtkWidget          *widget,
357                                     GdkDragContext     *context,
358                                     guint               time_);
359   gboolean (* drag_motion)         (GtkWidget          *widget,
360                                     GdkDragContext     *context,
361                                     gint                x,
362                                     gint                y,
363                                     guint               time_);
364   gboolean (* drag_drop)           (GtkWidget          *widget,
365                                     GdkDragContext     *context,
366                                     gint                x,
367                                     gint                y,
368                                     guint               time_);
369   void     (* drag_data_received)  (GtkWidget          *widget,
370                                     GdkDragContext     *context,
371                                     gint                x,
372                                     gint                y,
373                                     GtkSelectionData   *selection_data,
374                                     guint               info,
375                                     guint               time_);
376   gboolean (* drag_failed)         (GtkWidget          *widget,
377                                     GdkDragContext     *context,
378                                     GtkDragResult       result);
379
380   /* Signals used only for keybindings */
381   gboolean (* popup_menu)          (GtkWidget          *widget);
382
383   /* If a widget has multiple tooltips/whatsthis, it should show the
384    * one for the current focus location, or if that doesn't make
385    * sense, should cycle through them showing each tip alongside
386    * whatever piece of the widget it applies to.
387    */
388   gboolean (* show_help)           (GtkWidget          *widget,
389                                     GtkWidgetHelpType   help_type);
390
391   /* accessibility support
392    */
393   AtkObject *  (* get_accessible)     (GtkWidget *widget);
394
395   void         (* screen_changed)     (GtkWidget *widget,
396                                        GdkScreen *previous_screen);
397   gboolean     (* can_activate_accel) (GtkWidget *widget,
398                                        guint      signal_id);
399
400
401   void         (* composited_changed) (GtkWidget *widget);
402
403   gboolean     (* query_tooltip)      (GtkWidget  *widget,
404                                        gint        x,
405                                        gint        y,
406                                        gboolean    keyboard_tooltip,
407                                        GtkTooltip *tooltip);
408
409   void         (* compute_expand)     (GtkWidget  *widget,
410                                        gboolean   *hexpand_p,
411                                        gboolean   *vexpand_p);
412
413   void         (* adjust_size_request)    (GtkWidget         *widget,
414                                            GtkOrientation     orientation,
415                                            gint              *minimum_size,
416                                            gint              *natural_size);
417   void         (* adjust_size_allocation) (GtkWidget         *widget,
418                                            GtkOrientation     orientation,
419                                            gint              *minimum_size,
420                                            gint              *natural_size,
421                                            gint              *allocated_pos,
422                                            gint              *allocated_size);
423
424   void         (* style_updated)          (GtkWidget *widget);
425
426   /*< private >*/
427
428   GtkWidgetClassPrivate *priv;
429
430   /* Padding for future expansion */
431   void (*_gtk_reserved2) (void);
432   void (*_gtk_reserved3) (void);
433   void (*_gtk_reserved4) (void);
434   void (*_gtk_reserved5) (void);
435   void (*_gtk_reserved6) (void);
436   void (*_gtk_reserved7) (void);
437   void (*_gtk_reserved8) (void);
438 };
439
440 struct _GtkWidgetAuxInfo
441 {
442   gint width;
443   gint height;
444
445   guint   halign : 4;
446   guint   valign : 4;
447
448   GtkBorder margin;
449 };
450
451 GType      gtk_widget_get_type            (void) G_GNUC_CONST;
452 GtkWidget* gtk_widget_new                 (GType                type,
453                                            const gchar         *first_property_name,
454                                            ...);
455 void       gtk_widget_destroy             (GtkWidget           *widget);
456 void       gtk_widget_destroyed           (GtkWidget           *widget,
457                                            GtkWidget          **widget_pointer);
458 void       gtk_widget_unparent            (GtkWidget           *widget);
459 void       gtk_widget_show                (GtkWidget           *widget);
460 void       gtk_widget_hide                (GtkWidget           *widget);
461 void       gtk_widget_show_now            (GtkWidget           *widget);
462 void       gtk_widget_show_all            (GtkWidget           *widget);
463 void       gtk_widget_set_no_show_all     (GtkWidget           *widget,
464                                            gboolean             no_show_all);
465 gboolean   gtk_widget_get_no_show_all     (GtkWidget           *widget);
466 void       gtk_widget_map                 (GtkWidget           *widget);
467 void       gtk_widget_unmap               (GtkWidget           *widget);
468 void       gtk_widget_realize             (GtkWidget           *widget);
469 void       gtk_widget_unrealize           (GtkWidget           *widget);
470
471 void       gtk_widget_draw                (GtkWidget           *widget,
472                                            cairo_t             *cr);
473 /* Queuing draws */
474 void       gtk_widget_queue_draw          (GtkWidget           *widget);
475 void       gtk_widget_queue_draw_area     (GtkWidget           *widget,
476                                            gint                 x,
477                                            gint                 y,
478                                            gint                 width,
479                                            gint                 height);
480 void       gtk_widget_queue_draw_region   (GtkWidget           *widget,
481                                            const cairo_region_t*region);
482 void       gtk_widget_queue_resize        (GtkWidget           *widget);
483 void       gtk_widget_queue_resize_no_redraw (GtkWidget *widget);
484 GDK_DEPRECATED_IN_3_0_FOR(gtk_widget_get_preferred_size)
485 void       gtk_widget_size_request        (GtkWidget           *widget,
486                                            GtkRequisition      *requisition);
487 void       gtk_widget_size_allocate       (GtkWidget           *widget,
488                                            GtkAllocation       *allocation);
489
490 GtkSizeRequestMode  gtk_widget_get_request_mode               (GtkWidget      *widget);
491 void                gtk_widget_get_preferred_width            (GtkWidget      *widget,
492                                                                gint           *minimum_width,
493                                                                gint           *natural_width);
494 void                gtk_widget_get_preferred_height_for_width (GtkWidget      *widget,
495                                                                gint            width,
496                                                                gint           *minimum_height,
497                                                                gint           *natural_height);
498 void                gtk_widget_get_preferred_height           (GtkWidget      *widget,
499                                                                gint           *minimum_height,
500                                                                gint           *natural_height);
501 void                gtk_widget_get_preferred_width_for_height (GtkWidget      *widget,
502                                                                gint            height,
503                                                                gint           *minimum_width,
504                                                                gint           *natural_width);
505 void                gtk_widget_get_preferred_size             (GtkWidget      *widget,
506                                                                GtkRequisition *minimum_size,
507                                                                GtkRequisition *natural_size);
508
509 GDK_DEPRECATED_IN_3_0_FOR(gtk_widget_get_preferred_size)
510 void       gtk_widget_get_child_requisition (GtkWidget         *widget,
511                                              GtkRequisition    *requisition);
512 void       gtk_widget_add_accelerator     (GtkWidget           *widget,
513                                            const gchar         *accel_signal,
514                                            GtkAccelGroup       *accel_group,
515                                            guint                accel_key,
516                                            GdkModifierType      accel_mods,
517                                            GtkAccelFlags        accel_flags);
518 gboolean   gtk_widget_remove_accelerator  (GtkWidget           *widget,
519                                            GtkAccelGroup       *accel_group,
520                                            guint                accel_key,
521                                            GdkModifierType      accel_mods);
522 void       gtk_widget_set_accel_path      (GtkWidget           *widget,
523                                            const gchar         *accel_path,
524                                            GtkAccelGroup       *accel_group);
525 GList*     gtk_widget_list_accel_closures (GtkWidget           *widget);
526 gboolean   gtk_widget_can_activate_accel  (GtkWidget           *widget,
527                                            guint                signal_id);
528 gboolean   gtk_widget_mnemonic_activate   (GtkWidget           *widget,
529                                            gboolean             group_cycling);
530 gboolean   gtk_widget_event               (GtkWidget           *widget,
531                                            GdkEvent            *event);
532 gint       gtk_widget_send_expose         (GtkWidget           *widget,
533                                            GdkEvent            *event);
534 gboolean   gtk_widget_send_focus_change   (GtkWidget           *widget,
535                                            GdkEvent            *event);
536
537 gboolean   gtk_widget_activate               (GtkWidget        *widget);
538      
539 void       gtk_widget_reparent            (GtkWidget           *widget,
540                                            GtkWidget           *new_parent);
541 gboolean   gtk_widget_intersect           (GtkWidget           *widget,
542                                            const GdkRectangle  *area,
543                                            GdkRectangle        *intersection);
544 cairo_region_t *gtk_widget_region_intersect       (GtkWidget           *widget,
545                                            const cairo_region_t     *region);
546
547 void    gtk_widget_freeze_child_notify    (GtkWidget           *widget);
548 void    gtk_widget_child_notify           (GtkWidget           *widget,
549                                            const gchar         *child_property);
550 void    gtk_widget_thaw_child_notify      (GtkWidget           *widget);
551
552 void       gtk_widget_set_can_focus       (GtkWidget           *widget,
553                                            gboolean             can_focus);
554 gboolean   gtk_widget_get_can_focus       (GtkWidget           *widget);
555 gboolean   gtk_widget_has_focus           (GtkWidget           *widget);
556 gboolean   gtk_widget_is_focus            (GtkWidget           *widget);
557 GDK_AVAILABLE_IN_3_2
558 gboolean   gtk_widget_has_visible_focus   (GtkWidget           *widget);
559 void       gtk_widget_grab_focus          (GtkWidget           *widget);
560
561 void       gtk_widget_set_can_default     (GtkWidget           *widget,
562                                            gboolean             can_default);
563 gboolean   gtk_widget_get_can_default     (GtkWidget           *widget);
564 gboolean   gtk_widget_has_default         (GtkWidget           *widget);
565 void       gtk_widget_grab_default        (GtkWidget           *widget);
566
567 void      gtk_widget_set_receives_default (GtkWidget           *widget,
568                                            gboolean             receives_default);
569 gboolean  gtk_widget_get_receives_default (GtkWidget           *widget);
570
571 gboolean   gtk_widget_has_grab            (GtkWidget           *widget);
572
573 gboolean   gtk_widget_device_is_shadowed  (GtkWidget           *widget,
574                                            GdkDevice           *device);
575
576
577 void                  gtk_widget_set_name               (GtkWidget    *widget,
578                                                          const gchar  *name);
579 const gchar *         gtk_widget_get_name               (GtkWidget    *widget);
580
581 void                  gtk_widget_set_state              (GtkWidget    *widget,
582                                                          GtkStateType  state);
583 GtkStateType          gtk_widget_get_state              (GtkWidget    *widget);
584
585 void                  gtk_widget_set_state_flags        (GtkWidget     *widget,
586                                                          GtkStateFlags  flags,
587                                                          gboolean       clear);
588 void                  gtk_widget_unset_state_flags      (GtkWidget     *widget,
589                                                          GtkStateFlags  flags);
590 GtkStateFlags         gtk_widget_get_state_flags        (GtkWidget     *widget);
591
592 void                  gtk_widget_set_sensitive          (GtkWidget    *widget,
593                                                          gboolean      sensitive);
594 gboolean              gtk_widget_get_sensitive          (GtkWidget    *widget);
595 gboolean              gtk_widget_is_sensitive           (GtkWidget    *widget);
596
597 void                  gtk_widget_set_visible            (GtkWidget    *widget,
598                                                          gboolean      visible);
599 gboolean              gtk_widget_get_visible            (GtkWidget    *widget);
600
601 void                  gtk_widget_set_has_window         (GtkWidget    *widget,
602                                                          gboolean      has_window);
603 gboolean              gtk_widget_get_has_window         (GtkWidget    *widget);
604
605 gboolean              gtk_widget_is_toplevel            (GtkWidget    *widget);
606 gboolean              gtk_widget_is_drawable            (GtkWidget    *widget);
607 void                  gtk_widget_set_realized           (GtkWidget    *widget,
608                                                          gboolean      realized);
609 gboolean              gtk_widget_get_realized           (GtkWidget    *widget);
610 void                  gtk_widget_set_mapped             (GtkWidget    *widget,
611                                                          gboolean      mapped);
612 gboolean              gtk_widget_get_mapped             (GtkWidget    *widget);
613
614 void                  gtk_widget_set_app_paintable      (GtkWidget    *widget,
615                                                          gboolean      app_paintable);
616 gboolean              gtk_widget_get_app_paintable      (GtkWidget    *widget);
617
618 void                  gtk_widget_set_double_buffered    (GtkWidget    *widget,
619                                                          gboolean      double_buffered);
620 gboolean              gtk_widget_get_double_buffered    (GtkWidget    *widget);
621
622 void                  gtk_widget_set_redraw_on_allocate (GtkWidget    *widget,
623                                                          gboolean      redraw_on_allocate);
624
625 void                  gtk_widget_set_parent             (GtkWidget    *widget,
626                                                          GtkWidget    *parent);
627 GtkWidget           * gtk_widget_get_parent             (GtkWidget    *widget);
628
629 void                  gtk_widget_set_parent_window      (GtkWidget    *widget,
630                                                          GdkWindow    *parent_window);
631 GdkWindow           * gtk_widget_get_parent_window      (GtkWidget    *widget);
632
633 void                  gtk_widget_set_child_visible      (GtkWidget    *widget,
634                                                          gboolean      is_visible);
635 gboolean              gtk_widget_get_child_visible      (GtkWidget    *widget);
636
637 void                  gtk_widget_set_window             (GtkWidget    *widget,
638                                                          GdkWindow    *window);
639 GdkWindow           * gtk_widget_get_window             (GtkWidget    *widget);
640
641 int                   gtk_widget_get_allocated_width    (GtkWidget     *widget);
642 int                   gtk_widget_get_allocated_height   (GtkWidget     *widget);
643
644 void                  gtk_widget_get_allocation         (GtkWidget     *widget,
645                                                          GtkAllocation *allocation);
646 void                  gtk_widget_set_allocation         (GtkWidget     *widget,
647                                                          const GtkAllocation *allocation);
648
649 void                  gtk_widget_get_requisition        (GtkWidget     *widget,
650                                                          GtkRequisition *requisition);
651
652 gboolean   gtk_widget_child_focus         (GtkWidget           *widget,
653                                            GtkDirectionType     direction);
654 gboolean   gtk_widget_keynav_failed       (GtkWidget           *widget,
655                                            GtkDirectionType     direction);
656 void       gtk_widget_error_bell          (GtkWidget           *widget);
657
658 void       gtk_widget_set_size_request    (GtkWidget           *widget,
659                                            gint                 width,
660                                            gint                 height);
661 void       gtk_widget_get_size_request    (GtkWidget           *widget,
662                                            gint                *width,
663                                            gint                *height);
664 void       gtk_widget_set_events          (GtkWidget           *widget,
665                                            gint                 events);
666 void       gtk_widget_add_events          (GtkWidget           *widget,
667                                            gint                 events);
668 void       gtk_widget_set_device_events   (GtkWidget           *widget,
669                                            GdkDevice           *device,
670                                            GdkEventMask         events);
671 void       gtk_widget_add_device_events   (GtkWidget           *widget,
672                                            GdkDevice           *device,
673                                            GdkEventMask         events);
674
675 void       gtk_widget_set_device_enabled  (GtkWidget    *widget,
676                                            GdkDevice    *device,
677                                            gboolean      enabled);
678 gboolean   gtk_widget_get_device_enabled  (GtkWidget    *widget,
679                                            GdkDevice    *device);
680
681 GtkWidget*   gtk_widget_get_toplevel    (GtkWidget      *widget);
682 GtkWidget*   gtk_widget_get_ancestor    (GtkWidget      *widget,
683                                          GType           widget_type);
684 GdkVisual*   gtk_widget_get_visual      (GtkWidget      *widget);
685 void         gtk_widget_set_visual      (GtkWidget      *widget,
686                                          GdkVisual      *visual);
687
688 GdkScreen *   gtk_widget_get_screen      (GtkWidget *widget);
689 gboolean      gtk_widget_has_screen      (GtkWidget *widget);
690 GdkDisplay *  gtk_widget_get_display     (GtkWidget *widget);
691 GdkWindow *   gtk_widget_get_root_window (GtkWidget *widget);
692 GtkSettings*  gtk_widget_get_settings    (GtkWidget *widget);
693 GtkClipboard *gtk_widget_get_clipboard   (GtkWidget *widget,
694                                           GdkAtom    selection);
695
696
697 /* Expand flags and related support */
698 gboolean gtk_widget_get_hexpand          (GtkWidget      *widget);
699 void     gtk_widget_set_hexpand          (GtkWidget      *widget,
700                                           gboolean        expand);
701 gboolean gtk_widget_get_hexpand_set      (GtkWidget      *widget);
702 void     gtk_widget_set_hexpand_set      (GtkWidget      *widget,
703                                           gboolean        set);
704 gboolean gtk_widget_get_vexpand          (GtkWidget      *widget);
705 void     gtk_widget_set_vexpand          (GtkWidget      *widget,
706                                           gboolean        expand);
707 gboolean gtk_widget_get_vexpand_set      (GtkWidget      *widget);
708 void     gtk_widget_set_vexpand_set      (GtkWidget      *widget,
709                                           gboolean        set);
710 void     gtk_widget_queue_compute_expand (GtkWidget      *widget);
711 gboolean gtk_widget_compute_expand       (GtkWidget      *widget,
712                                           GtkOrientation  orientation);
713
714
715 /* Multidevice support */
716 gboolean         gtk_widget_get_support_multidevice (GtkWidget      *widget);
717 void             gtk_widget_set_support_multidevice (GtkWidget      *widget,
718                                                      gboolean        support_multidevice);
719
720 /* Accessibility support */
721 GDK_AVAILABLE_IN_3_2
722 void             gtk_widget_class_set_accessible_type    (GtkWidgetClass     *widget_class,
723                                                           GType               type);
724 GDK_AVAILABLE_IN_3_2
725 void             gtk_widget_class_set_accessible_role    (GtkWidgetClass     *widget_class,
726                                                           AtkRole             role);
727 AtkObject*       gtk_widget_get_accessible               (GtkWidget          *widget);
728
729
730 /* Margin and alignment */
731 GtkAlign gtk_widget_get_halign        (GtkWidget *widget);
732 void     gtk_widget_set_halign        (GtkWidget *widget,
733                                        GtkAlign   align);
734 GtkAlign gtk_widget_get_valign        (GtkWidget *widget);
735 void     gtk_widget_set_valign        (GtkWidget *widget,
736                                        GtkAlign   align);
737 gint     gtk_widget_get_margin_left   (GtkWidget *widget);
738 void     gtk_widget_set_margin_left   (GtkWidget *widget,
739                                        gint       margin);
740 gint     gtk_widget_get_margin_right  (GtkWidget *widget);
741 void     gtk_widget_set_margin_right  (GtkWidget *widget,
742                                        gint       margin);
743 gint     gtk_widget_get_margin_top    (GtkWidget *widget);
744 void     gtk_widget_set_margin_top    (GtkWidget *widget,
745                                        gint       margin);
746 gint     gtk_widget_get_margin_bottom (GtkWidget *widget);
747 void     gtk_widget_set_margin_bottom (GtkWidget *widget,
748                                        gint       margin);
749
750
751 gint         gtk_widget_get_events      (GtkWidget      *widget);
752 GdkEventMask gtk_widget_get_device_events (GtkWidget    *widget,
753                                            GdkDevice    *device);
754 GDK_DEPRECATED_IN_3_0_FOR(gdk_window_get_device_position)
755 void         gtk_widget_get_pointer     (GtkWidget      *widget,
756                                          gint           *x,
757                                          gint           *y);
758
759 gboolean     gtk_widget_is_ancestor     (GtkWidget      *widget,
760                                          GtkWidget      *ancestor);
761
762 gboolean     gtk_widget_translate_coordinates (GtkWidget  *src_widget,
763                                                GtkWidget  *dest_widget,
764                                                gint        src_x,
765                                                gint        src_y,
766                                                gint       *dest_x,
767                                                gint       *dest_y);
768
769 /* Hide widget and return TRUE.
770  */
771 gboolean     gtk_widget_hide_on_delete  (GtkWidget      *widget);
772
773 /* Functions to override widget styling */
774 void         gtk_widget_override_color            (GtkWidget     *widget,
775                                                    GtkStateFlags  state,
776                                                    const GdkRGBA *color);
777 void         gtk_widget_override_background_color (GtkWidget     *widget,
778                                                    GtkStateFlags  state,
779                                                    const GdkRGBA *color);
780
781 void         gtk_widget_override_font             (GtkWidget                  *widget,
782                                                    const PangoFontDescription *font_desc);
783
784 void         gtk_widget_override_symbolic_color   (GtkWidget     *widget,
785                                                    const gchar   *name,
786                                                    const GdkRGBA *color);
787 void         gtk_widget_override_cursor           (GtkWidget       *widget,
788                                                    const GdkRGBA   *cursor,
789                                                    const GdkRGBA   *secondary_cursor);
790
791 void       gtk_widget_reset_style       (GtkWidget      *widget);
792
793 PangoContext *gtk_widget_create_pango_context (GtkWidget   *widget);
794 PangoContext *gtk_widget_get_pango_context    (GtkWidget   *widget);
795 PangoLayout  *gtk_widget_create_pango_layout  (GtkWidget   *widget,
796                                                const gchar *text);
797
798 GdkPixbuf    *gtk_widget_render_icon_pixbuf   (GtkWidget   *widget,
799                                                const gchar *stock_id,
800                                                GtkIconSize  size);
801
802 /* handle composite names for GTK_COMPOSITE_CHILD widgets,
803  * the returned name is newly allocated.
804  */
805 void   gtk_widget_set_composite_name    (GtkWidget      *widget,
806                                          const gchar    *name);
807 gchar* gtk_widget_get_composite_name    (GtkWidget      *widget);
808      
809 /* Push/pop pairs, to change default values upon a widget's creation.
810  * This will override the values that got set by the
811  * gtk_widget_set_default_* () functions.
812  */
813 void         gtk_widget_push_composite_child (void);
814 void         gtk_widget_pop_composite_child  (void);
815
816 /* widget style properties
817  */
818 void gtk_widget_class_install_style_property        (GtkWidgetClass     *klass,
819                                                      GParamSpec         *pspec);
820 void gtk_widget_class_install_style_property_parser (GtkWidgetClass     *klass,
821                                                      GParamSpec         *pspec,
822                                                      GtkRcPropertyParser parser);
823 GParamSpec*  gtk_widget_class_find_style_property   (GtkWidgetClass     *klass,
824                                                      const gchar        *property_name);
825 GParamSpec** gtk_widget_class_list_style_properties (GtkWidgetClass     *klass,
826                                                      guint              *n_properties);
827 void gtk_widget_style_get_property (GtkWidget        *widget,
828                                     const gchar    *property_name,
829                                     GValue           *value);
830 void gtk_widget_style_get_valist   (GtkWidget        *widget,
831                                     const gchar    *first_property_name,
832                                     va_list         var_args);
833 void gtk_widget_style_get          (GtkWidget        *widget,
834                                     const gchar    *first_property_name,
835                                     ...) G_GNUC_NULL_TERMINATED;
836
837 /* Functions for setting directionality for widgets */
838
839 void             gtk_widget_set_direction         (GtkWidget        *widget,
840                                                    GtkTextDirection  dir);
841 GtkTextDirection gtk_widget_get_direction         (GtkWidget        *widget);
842
843 void             gtk_widget_set_default_direction (GtkTextDirection  dir);
844 GtkTextDirection gtk_widget_get_default_direction (void);
845
846 /* Compositing manager functionality */
847 gboolean gtk_widget_is_composited (GtkWidget *widget);
848
849 /* Counterpart to gdk_window_shape_combine_region.
850  */
851 void         gtk_widget_shape_combine_region (GtkWidget *widget,
852                                               cairo_region_t *region);
853 void         gtk_widget_input_shape_combine_region (GtkWidget *widget,
854                                                     cairo_region_t *region);
855
856 GList* gtk_widget_list_mnemonic_labels  (GtkWidget *widget);
857 void   gtk_widget_add_mnemonic_label    (GtkWidget *widget,
858                                          GtkWidget *label);
859 void   gtk_widget_remove_mnemonic_label (GtkWidget *widget,
860                                          GtkWidget *label);
861
862 void                  gtk_widget_set_tooltip_window    (GtkWidget   *widget,
863                                                         GtkWindow   *custom_window);
864 GtkWindow *gtk_widget_get_tooltip_window    (GtkWidget   *widget);
865 void       gtk_widget_trigger_tooltip_query (GtkWidget   *widget);
866 void       gtk_widget_set_tooltip_text      (GtkWidget   *widget,
867                                              const gchar *text);
868 gchar *    gtk_widget_get_tooltip_text      (GtkWidget   *widget);
869 void       gtk_widget_set_tooltip_markup    (GtkWidget   *widget,
870                                              const gchar *markup);
871 gchar *    gtk_widget_get_tooltip_markup    (GtkWidget   *widget);
872 void       gtk_widget_set_has_tooltip       (GtkWidget   *widget,
873                                              gboolean     has_tooltip);
874 gboolean   gtk_widget_get_has_tooltip       (GtkWidget   *widget);
875
876 gboolean   gtk_cairo_should_draw_window     (cairo_t     *cr,
877                                              GdkWindow   *window);
878 void       gtk_cairo_transform_to_window    (cairo_t     *cr,
879                                              GtkWidget   *widget,
880                                              GdkWindow   *window);
881
882 GType           gtk_requisition_get_type (void) G_GNUC_CONST;
883 GtkRequisition *gtk_requisition_new      (void) G_GNUC_MALLOC;
884 GtkRequisition *gtk_requisition_copy     (const GtkRequisition *requisition);
885 void            gtk_requisition_free     (GtkRequisition       *requisition);
886
887 gboolean     gtk_widget_in_destruction (GtkWidget *widget);
888
889 GtkStyleContext * gtk_widget_get_style_context (GtkWidget *widget);
890
891 GtkWidgetPath *   gtk_widget_get_path (GtkWidget *widget);
892
893 GDK_AVAILABLE_IN_3_4
894 GdkModifierType   gtk_widget_get_modifier_mask (GtkWidget         *widget,
895                                                 GdkModifierIntent  intent);
896
897
898 G_END_DECLS
899
900 #endif /* __GTK_WIDGET_H__ */