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