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