]> Pileus Git - ~andy/gtk/blob - gtk/gtkwidget.h
Add GdkFrameClock
[~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 GdkFrameClock* gtk_widget_get_frame_clock (GtkWidget           *widget);
477
478 GDK_DEPRECATED_IN_3_0_FOR(gtk_widget_get_preferred_size)
479 void       gtk_widget_size_request        (GtkWidget           *widget,
480                                            GtkRequisition      *requisition);
481 void       gtk_widget_size_allocate       (GtkWidget           *widget,
482                                            GtkAllocation       *allocation);
483
484 GtkSizeRequestMode  gtk_widget_get_request_mode               (GtkWidget      *widget);
485 void                gtk_widget_get_preferred_width            (GtkWidget      *widget,
486                                                                gint           *minimum_width,
487                                                                gint           *natural_width);
488 void                gtk_widget_get_preferred_height_for_width (GtkWidget      *widget,
489                                                                gint            width,
490                                                                gint           *minimum_height,
491                                                                gint           *natural_height);
492 void                gtk_widget_get_preferred_height           (GtkWidget      *widget,
493                                                                gint           *minimum_height,
494                                                                gint           *natural_height);
495 void                gtk_widget_get_preferred_width_for_height (GtkWidget      *widget,
496                                                                gint            height,
497                                                                gint           *minimum_width,
498                                                                gint           *natural_width);
499 void                gtk_widget_get_preferred_size             (GtkWidget      *widget,
500                                                                GtkRequisition *minimum_size,
501                                                                GtkRequisition *natural_size);
502
503 GDK_DEPRECATED_IN_3_0_FOR(gtk_widget_get_preferred_size)
504 void       gtk_widget_get_child_requisition (GtkWidget         *widget,
505                                              GtkRequisition    *requisition);
506 void       gtk_widget_add_accelerator     (GtkWidget           *widget,
507                                            const gchar         *accel_signal,
508                                            GtkAccelGroup       *accel_group,
509                                            guint                accel_key,
510                                            GdkModifierType      accel_mods,
511                                            GtkAccelFlags        accel_flags);
512 gboolean   gtk_widget_remove_accelerator  (GtkWidget           *widget,
513                                            GtkAccelGroup       *accel_group,
514                                            guint                accel_key,
515                                            GdkModifierType      accel_mods);
516 void       gtk_widget_set_accel_path      (GtkWidget           *widget,
517                                            const gchar         *accel_path,
518                                            GtkAccelGroup       *accel_group);
519 GList*     gtk_widget_list_accel_closures (GtkWidget           *widget);
520 gboolean   gtk_widget_can_activate_accel  (GtkWidget           *widget,
521                                            guint                signal_id);
522 gboolean   gtk_widget_mnemonic_activate   (GtkWidget           *widget,
523                                            gboolean             group_cycling);
524 gboolean   gtk_widget_event               (GtkWidget           *widget,
525                                            GdkEvent            *event);
526 gint       gtk_widget_send_expose         (GtkWidget           *widget,
527                                            GdkEvent            *event);
528 gboolean   gtk_widget_send_focus_change   (GtkWidget           *widget,
529                                            GdkEvent            *event);
530
531 gboolean   gtk_widget_activate               (GtkWidget        *widget);
532      
533 void       gtk_widget_reparent            (GtkWidget           *widget,
534                                            GtkWidget           *new_parent);
535 gboolean   gtk_widget_intersect           (GtkWidget           *widget,
536                                            const GdkRectangle  *area,
537                                            GdkRectangle        *intersection);
538 cairo_region_t *gtk_widget_region_intersect       (GtkWidget           *widget,
539                                            const cairo_region_t     *region);
540
541 void    gtk_widget_freeze_child_notify    (GtkWidget           *widget);
542 void    gtk_widget_child_notify           (GtkWidget           *widget,
543                                            const gchar         *child_property);
544 void    gtk_widget_thaw_child_notify      (GtkWidget           *widget);
545
546 void       gtk_widget_set_can_focus       (GtkWidget           *widget,
547                                            gboolean             can_focus);
548 gboolean   gtk_widget_get_can_focus       (GtkWidget           *widget);
549 gboolean   gtk_widget_has_focus           (GtkWidget           *widget);
550 gboolean   gtk_widget_is_focus            (GtkWidget           *widget);
551 GDK_AVAILABLE_IN_3_2
552 gboolean   gtk_widget_has_visible_focus   (GtkWidget           *widget);
553 void       gtk_widget_grab_focus          (GtkWidget           *widget);
554
555 void       gtk_widget_set_can_default     (GtkWidget           *widget,
556                                            gboolean             can_default);
557 gboolean   gtk_widget_get_can_default     (GtkWidget           *widget);
558 gboolean   gtk_widget_has_default         (GtkWidget           *widget);
559 void       gtk_widget_grab_default        (GtkWidget           *widget);
560
561 void      gtk_widget_set_receives_default (GtkWidget           *widget,
562                                            gboolean             receives_default);
563 gboolean  gtk_widget_get_receives_default (GtkWidget           *widget);
564
565 gboolean   gtk_widget_has_grab            (GtkWidget           *widget);
566
567 gboolean   gtk_widget_device_is_shadowed  (GtkWidget           *widget,
568                                            GdkDevice           *device);
569
570
571 void                  gtk_widget_set_name               (GtkWidget    *widget,
572                                                          const gchar  *name);
573 const gchar *         gtk_widget_get_name               (GtkWidget    *widget);
574
575 void                  gtk_widget_set_state              (GtkWidget    *widget,
576                                                          GtkStateType  state);
577 GtkStateType          gtk_widget_get_state              (GtkWidget    *widget);
578
579 void                  gtk_widget_set_state_flags        (GtkWidget     *widget,
580                                                          GtkStateFlags  flags,
581                                                          gboolean       clear);
582 void                  gtk_widget_unset_state_flags      (GtkWidget     *widget,
583                                                          GtkStateFlags  flags);
584 GtkStateFlags         gtk_widget_get_state_flags        (GtkWidget     *widget);
585
586 void                  gtk_widget_set_sensitive          (GtkWidget    *widget,
587                                                          gboolean      sensitive);
588 gboolean              gtk_widget_get_sensitive          (GtkWidget    *widget);
589 gboolean              gtk_widget_is_sensitive           (GtkWidget    *widget);
590
591 void                  gtk_widget_set_visible            (GtkWidget    *widget,
592                                                          gboolean      visible);
593 gboolean              gtk_widget_get_visible            (GtkWidget    *widget);
594 gboolean              gtk_widget_is_visible             (GtkWidget    *widget);
595
596 void                  gtk_widget_set_has_window         (GtkWidget    *widget,
597                                                          gboolean      has_window);
598 gboolean              gtk_widget_get_has_window         (GtkWidget    *widget);
599
600 gboolean              gtk_widget_is_toplevel            (GtkWidget    *widget);
601 gboolean              gtk_widget_is_drawable            (GtkWidget    *widget);
602 void                  gtk_widget_set_realized           (GtkWidget    *widget,
603                                                          gboolean      realized);
604 gboolean              gtk_widget_get_realized           (GtkWidget    *widget);
605 void                  gtk_widget_set_mapped             (GtkWidget    *widget,
606                                                          gboolean      mapped);
607 gboolean              gtk_widget_get_mapped             (GtkWidget    *widget);
608
609 void                  gtk_widget_set_app_paintable      (GtkWidget    *widget,
610                                                          gboolean      app_paintable);
611 gboolean              gtk_widget_get_app_paintable      (GtkWidget    *widget);
612
613 void                  gtk_widget_set_double_buffered    (GtkWidget    *widget,
614                                                          gboolean      double_buffered);
615 gboolean              gtk_widget_get_double_buffered    (GtkWidget    *widget);
616
617 void                  gtk_widget_set_redraw_on_allocate (GtkWidget    *widget,
618                                                          gboolean      redraw_on_allocate);
619
620 void                  gtk_widget_set_parent             (GtkWidget    *widget,
621                                                          GtkWidget    *parent);
622 GtkWidget           * gtk_widget_get_parent             (GtkWidget    *widget);
623
624 void                  gtk_widget_set_parent_window      (GtkWidget    *widget,
625                                                          GdkWindow    *parent_window);
626 GdkWindow           * gtk_widget_get_parent_window      (GtkWidget    *widget);
627
628 void                  gtk_widget_set_child_visible      (GtkWidget    *widget,
629                                                          gboolean      is_visible);
630 gboolean              gtk_widget_get_child_visible      (GtkWidget    *widget);
631
632 void                  gtk_widget_set_window             (GtkWidget    *widget,
633                                                          GdkWindow    *window);
634 GdkWindow           * gtk_widget_get_window             (GtkWidget    *widget);
635 GDK_AVAILABLE_IN_3_8
636 void                  gtk_widget_register_window        (GtkWidget    *widget,
637                                                          GdkWindow    *window);
638 GDK_AVAILABLE_IN_3_8
639 void                  gtk_widget_unregister_window      (GtkWidget    *widget,
640                                                          GdkWindow    *window);
641
642 int                   gtk_widget_get_allocated_width    (GtkWidget     *widget);
643 int                   gtk_widget_get_allocated_height   (GtkWidget     *widget);
644
645 void                  gtk_widget_get_allocation         (GtkWidget     *widget,
646                                                          GtkAllocation *allocation);
647 void                  gtk_widget_set_allocation         (GtkWidget     *widget,
648                                                          const GtkAllocation *allocation);
649
650 void                  gtk_widget_get_requisition        (GtkWidget     *widget,
651                                                          GtkRequisition *requisition);
652
653 gboolean   gtk_widget_child_focus         (GtkWidget           *widget,
654                                            GtkDirectionType     direction);
655 gboolean   gtk_widget_keynav_failed       (GtkWidget           *widget,
656                                            GtkDirectionType     direction);
657 void       gtk_widget_error_bell          (GtkWidget           *widget);
658
659 void       gtk_widget_set_size_request    (GtkWidget           *widget,
660                                            gint                 width,
661                                            gint                 height);
662 void       gtk_widget_get_size_request    (GtkWidget           *widget,
663                                            gint                *width,
664                                            gint                *height);
665 void       gtk_widget_set_events          (GtkWidget           *widget,
666                                            gint                 events);
667 void       gtk_widget_add_events          (GtkWidget           *widget,
668                                            gint                 events);
669 void       gtk_widget_set_device_events   (GtkWidget           *widget,
670                                            GdkDevice           *device,
671                                            GdkEventMask         events);
672 void       gtk_widget_add_device_events   (GtkWidget           *widget,
673                                            GdkDevice           *device,
674                                            GdkEventMask         events);
675 GDK_AVAILABLE_IN_3_8
676 void       gtk_widget_set_opacity         (GtkWidget           *widget,
677                                            double               opacity);
678 GDK_AVAILABLE_IN_3_8
679 double     gtk_widget_get_opacity         (GtkWidget           *widget);
680
681 void       gtk_widget_set_device_enabled  (GtkWidget    *widget,
682                                            GdkDevice    *device,
683                                            gboolean      enabled);
684 gboolean   gtk_widget_get_device_enabled  (GtkWidget    *widget,
685                                            GdkDevice    *device);
686
687 GtkWidget*   gtk_widget_get_toplevel    (GtkWidget      *widget);
688 GtkWidget*   gtk_widget_get_ancestor    (GtkWidget      *widget,
689                                          GType           widget_type);
690 GdkVisual*   gtk_widget_get_visual      (GtkWidget      *widget);
691 void         gtk_widget_set_visual      (GtkWidget      *widget,
692                                          GdkVisual      *visual);
693
694 GdkScreen *   gtk_widget_get_screen      (GtkWidget *widget);
695 gboolean      gtk_widget_has_screen      (GtkWidget *widget);
696 GdkDisplay *  gtk_widget_get_display     (GtkWidget *widget);
697 GdkWindow *   gtk_widget_get_root_window (GtkWidget *widget);
698 GtkSettings*  gtk_widget_get_settings    (GtkWidget *widget);
699 GtkClipboard *gtk_widget_get_clipboard   (GtkWidget *widget,
700                                           GdkAtom    selection);
701
702
703 /* Expand flags and related support */
704 gboolean gtk_widget_get_hexpand          (GtkWidget      *widget);
705 void     gtk_widget_set_hexpand          (GtkWidget      *widget,
706                                           gboolean        expand);
707 gboolean gtk_widget_get_hexpand_set      (GtkWidget      *widget);
708 void     gtk_widget_set_hexpand_set      (GtkWidget      *widget,
709                                           gboolean        set);
710 gboolean gtk_widget_get_vexpand          (GtkWidget      *widget);
711 void     gtk_widget_set_vexpand          (GtkWidget      *widget,
712                                           gboolean        expand);
713 gboolean gtk_widget_get_vexpand_set      (GtkWidget      *widget);
714 void     gtk_widget_set_vexpand_set      (GtkWidget      *widget,
715                                           gboolean        set);
716 void     gtk_widget_queue_compute_expand (GtkWidget      *widget);
717 gboolean gtk_widget_compute_expand       (GtkWidget      *widget,
718                                           GtkOrientation  orientation);
719
720
721 /* Multidevice support */
722 gboolean         gtk_widget_get_support_multidevice (GtkWidget      *widget);
723 void             gtk_widget_set_support_multidevice (GtkWidget      *widget,
724                                                      gboolean        support_multidevice);
725
726 /* Accessibility support */
727 GDK_AVAILABLE_IN_3_2
728 void             gtk_widget_class_set_accessible_type    (GtkWidgetClass     *widget_class,
729                                                           GType               type);
730 GDK_AVAILABLE_IN_3_2
731 void             gtk_widget_class_set_accessible_role    (GtkWidgetClass     *widget_class,
732                                                           AtkRole             role);
733 AtkObject*       gtk_widget_get_accessible               (GtkWidget          *widget);
734
735
736 /* Margin and alignment */
737 GtkAlign gtk_widget_get_halign        (GtkWidget *widget);
738 void     gtk_widget_set_halign        (GtkWidget *widget,
739                                        GtkAlign   align);
740 GtkAlign gtk_widget_get_valign        (GtkWidget *widget);
741 void     gtk_widget_set_valign        (GtkWidget *widget,
742                                        GtkAlign   align);
743 gint     gtk_widget_get_margin_left   (GtkWidget *widget);
744 void     gtk_widget_set_margin_left   (GtkWidget *widget,
745                                        gint       margin);
746 gint     gtk_widget_get_margin_right  (GtkWidget *widget);
747 void     gtk_widget_set_margin_right  (GtkWidget *widget,
748                                        gint       margin);
749 gint     gtk_widget_get_margin_top    (GtkWidget *widget);
750 void     gtk_widget_set_margin_top    (GtkWidget *widget,
751                                        gint       margin);
752 gint     gtk_widget_get_margin_bottom (GtkWidget *widget);
753 void     gtk_widget_set_margin_bottom (GtkWidget *widget,
754                                        gint       margin);
755
756
757 gint         gtk_widget_get_events      (GtkWidget      *widget);
758 GdkEventMask gtk_widget_get_device_events (GtkWidget    *widget,
759                                            GdkDevice    *device);
760 GDK_DEPRECATED_IN_3_4_FOR(gdk_window_get_device_position)
761 void         gtk_widget_get_pointer     (GtkWidget      *widget,
762                                          gint           *x,
763                                          gint           *y);
764
765 gboolean     gtk_widget_is_ancestor     (GtkWidget      *widget,
766                                          GtkWidget      *ancestor);
767
768 gboolean     gtk_widget_translate_coordinates (GtkWidget  *src_widget,
769                                                GtkWidget  *dest_widget,
770                                                gint        src_x,
771                                                gint        src_y,
772                                                gint       *dest_x,
773                                                gint       *dest_y);
774
775 /* Hide widget and return TRUE.
776  */
777 gboolean     gtk_widget_hide_on_delete  (GtkWidget      *widget);
778
779 /* Functions to override widget styling */
780 void         gtk_widget_override_color            (GtkWidget     *widget,
781                                                    GtkStateFlags  state,
782                                                    const GdkRGBA *color);
783 void         gtk_widget_override_background_color (GtkWidget     *widget,
784                                                    GtkStateFlags  state,
785                                                    const GdkRGBA *color);
786
787 void         gtk_widget_override_font             (GtkWidget                  *widget,
788                                                    const PangoFontDescription *font_desc);
789
790 void         gtk_widget_override_symbolic_color   (GtkWidget     *widget,
791                                                    const gchar   *name,
792                                                    const GdkRGBA *color);
793 void         gtk_widget_override_cursor           (GtkWidget       *widget,
794                                                    const GdkRGBA   *cursor,
795                                                    const GdkRGBA   *secondary_cursor);
796
797 void       gtk_widget_reset_style       (GtkWidget      *widget);
798
799 PangoContext *gtk_widget_create_pango_context (GtkWidget   *widget);
800 PangoContext *gtk_widget_get_pango_context    (GtkWidget   *widget);
801 PangoLayout  *gtk_widget_create_pango_layout  (GtkWidget   *widget,
802                                                const gchar *text);
803
804 GdkPixbuf    *gtk_widget_render_icon_pixbuf   (GtkWidget   *widget,
805                                                const gchar *stock_id,
806                                                GtkIconSize  size);
807
808 /* handle composite names for GTK_COMPOSITE_CHILD widgets,
809  * the returned name is newly allocated.
810  */
811 void   gtk_widget_set_composite_name    (GtkWidget      *widget,
812                                          const gchar    *name);
813 gchar* gtk_widget_get_composite_name    (GtkWidget      *widget);
814      
815 /* Push/pop pairs, to change default values upon a widget's creation.
816  * This will override the values that got set by the
817  * gtk_widget_set_default_* () functions.
818  */
819 void         gtk_widget_push_composite_child (void);
820 void         gtk_widget_pop_composite_child  (void);
821
822 /* widget style properties
823  */
824 void gtk_widget_class_install_style_property        (GtkWidgetClass     *klass,
825                                                      GParamSpec         *pspec);
826 void gtk_widget_class_install_style_property_parser (GtkWidgetClass     *klass,
827                                                      GParamSpec         *pspec,
828                                                      GtkRcPropertyParser parser);
829 GParamSpec*  gtk_widget_class_find_style_property   (GtkWidgetClass     *klass,
830                                                      const gchar        *property_name);
831 GParamSpec** gtk_widget_class_list_style_properties (GtkWidgetClass     *klass,
832                                                      guint              *n_properties);
833 void gtk_widget_style_get_property (GtkWidget        *widget,
834                                     const gchar    *property_name,
835                                     GValue           *value);
836 void gtk_widget_style_get_valist   (GtkWidget        *widget,
837                                     const gchar    *first_property_name,
838                                     va_list         var_args);
839 void gtk_widget_style_get          (GtkWidget        *widget,
840                                     const gchar    *first_property_name,
841                                     ...) G_GNUC_NULL_TERMINATED;
842
843 /* Functions for setting directionality for widgets */
844
845 void             gtk_widget_set_direction         (GtkWidget        *widget,
846                                                    GtkTextDirection  dir);
847 GtkTextDirection gtk_widget_get_direction         (GtkWidget        *widget);
848
849 void             gtk_widget_set_default_direction (GtkTextDirection  dir);
850 GtkTextDirection gtk_widget_get_default_direction (void);
851
852 /* Compositing manager functionality */
853 gboolean gtk_widget_is_composited (GtkWidget *widget);
854
855 /* Counterpart to gdk_window_shape_combine_region.
856  */
857 void         gtk_widget_shape_combine_region (GtkWidget *widget,
858                                               cairo_region_t *region);
859 void         gtk_widget_input_shape_combine_region (GtkWidget *widget,
860                                                     cairo_region_t *region);
861
862 GList* gtk_widget_list_mnemonic_labels  (GtkWidget *widget);
863 void   gtk_widget_add_mnemonic_label    (GtkWidget *widget,
864                                          GtkWidget *label);
865 void   gtk_widget_remove_mnemonic_label (GtkWidget *widget,
866                                          GtkWidget *label);
867
868 void                  gtk_widget_set_tooltip_window    (GtkWidget   *widget,
869                                                         GtkWindow   *custom_window);
870 GtkWindow *gtk_widget_get_tooltip_window    (GtkWidget   *widget);
871 void       gtk_widget_trigger_tooltip_query (GtkWidget   *widget);
872 void       gtk_widget_set_tooltip_text      (GtkWidget   *widget,
873                                              const gchar *text);
874 gchar *    gtk_widget_get_tooltip_text      (GtkWidget   *widget);
875 void       gtk_widget_set_tooltip_markup    (GtkWidget   *widget,
876                                              const gchar *markup);
877 gchar *    gtk_widget_get_tooltip_markup    (GtkWidget   *widget);
878 void       gtk_widget_set_has_tooltip       (GtkWidget   *widget,
879                                              gboolean     has_tooltip);
880 gboolean   gtk_widget_get_has_tooltip       (GtkWidget   *widget);
881
882 gboolean   gtk_cairo_should_draw_window     (cairo_t     *cr,
883                                              GdkWindow   *window);
884 void       gtk_cairo_transform_to_window    (cairo_t     *cr,
885                                              GtkWidget   *widget,
886                                              GdkWindow   *window);
887
888 GType           gtk_requisition_get_type (void) G_GNUC_CONST;
889 GtkRequisition *gtk_requisition_new      (void) G_GNUC_MALLOC;
890 GtkRequisition *gtk_requisition_copy     (const GtkRequisition *requisition);
891 void            gtk_requisition_free     (GtkRequisition       *requisition);
892
893 gboolean     gtk_widget_in_destruction (GtkWidget *widget);
894
895 GtkStyleContext * gtk_widget_get_style_context (GtkWidget *widget);
896
897 GtkWidgetPath *   gtk_widget_get_path (GtkWidget *widget);
898
899 GDK_AVAILABLE_IN_3_4
900 GdkModifierType   gtk_widget_get_modifier_mask (GtkWidget         *widget,
901                                                 GdkModifierIntent  intent);
902
903 GDK_AVAILABLE_IN_3_6
904 void                    gtk_widget_insert_action_group                  (GtkWidget    *widget,
905                                                                          const gchar  *name,
906                                                                          GActionGroup *group);
907
908 G_END_DECLS
909
910 #endif /* __GTK_WIDGET_H__ */