]> Pileus Git - ~andy/gtk/blob - gtk/gtkwidget.h
When we find a match, stop searching. (Because we assume pspec != NULL in
[~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 Library 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  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19 #ifndef __GTK_WIDGET_H__
20 #define __GTK_WIDGET_H__
21
22 #include <gdk/gdk.h>
23 #include <gtk/gtkaccelgroup.h>
24 #include <gtk/gtkobject.h>
25 #include <gtk/gtkadjustment.h>
26 #include <gtk/gtkstyle.h>
27
28
29 #ifdef __cplusplus
30 extern "C" {
31 #endif /* __cplusplus */
32
33
34 /* The flags that are used by GtkWidget on top of the
35  * flags field of GtkObject.
36  */
37 typedef enum
38 {
39   GTK_TOPLEVEL         = 1 << 4,
40   GTK_NO_WINDOW        = 1 << 5,
41   GTK_REALIZED         = 1 << 6,
42   GTK_MAPPED           = 1 << 7,
43   GTK_VISIBLE          = 1 << 8,
44   GTK_SENSITIVE        = 1 << 9,
45   GTK_PARENT_SENSITIVE = 1 << 10,
46   GTK_CAN_FOCUS        = 1 << 11,
47   GTK_HAS_FOCUS        = 1 << 12,
48   GTK_CAN_DEFAULT      = 1 << 13,
49   GTK_HAS_DEFAULT      = 1 << 14,
50   GTK_HAS_GRAB         = 1 << 15,
51   GTK_RC_STYLE         = 1 << 16,
52   GTK_COMPOSITE_CHILD  = 1 << 17,
53   GTK_NO_REPARENT      = 1 << 18,
54   GTK_APP_PAINTABLE    = 1 << 19,
55   GTK_RECEIVES_DEFAULT = 1 << 20
56 } GtkWidgetFlags;
57
58 /* Macro for casting a pointer to a GtkWidget or GtkWidgetClass pointer.
59  * Macros for testing whether `widget' or `klass' are of type GTK_TYPE_WIDGET.
60  */
61 #define GTK_TYPE_WIDGET                   (gtk_widget_get_type ())
62 #define GTK_WIDGET(widget)                (GTK_CHECK_CAST ((widget), GTK_TYPE_WIDGET, GtkWidget))
63 #define GTK_WIDGET_CLASS(klass)           (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_WIDGET, GtkWidgetClass))
64 #define GTK_IS_WIDGET(widget)             (GTK_CHECK_TYPE ((widget), GTK_TYPE_WIDGET))
65 #define GTK_IS_WIDGET_CLASS(klass)        (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WIDGET))
66
67 /* Macros for extracting various fields from GtkWidget and GtkWidgetClass.
68  */
69 #define GTK_WIDGET_TYPE(wid)              (GTK_OBJECT_TYPE (wid))
70 #define GTK_WIDGET_STATE(wid)             (GTK_WIDGET (wid)->state)
71 #define GTK_WIDGET_SAVED_STATE(wid)       (GTK_WIDGET (wid)->saved_state)
72
73 /* Macros for extracting the widget flags from GtkWidget.
74  */
75 #define GTK_WIDGET_FLAGS(wid)             (GTK_OBJECT_FLAGS (wid))
76 #define GTK_WIDGET_TOPLEVEL(wid)          ((GTK_WIDGET_FLAGS (wid) & GTK_TOPLEVEL) != 0)
77 #define GTK_WIDGET_NO_WINDOW(wid)         ((GTK_WIDGET_FLAGS (wid) & GTK_NO_WINDOW) != 0)
78 #define GTK_WIDGET_REALIZED(wid)          ((GTK_WIDGET_FLAGS (wid) & GTK_REALIZED) != 0)
79 #define GTK_WIDGET_MAPPED(wid)            ((GTK_WIDGET_FLAGS (wid) & GTK_MAPPED) != 0)
80 #define GTK_WIDGET_VISIBLE(wid)           ((GTK_WIDGET_FLAGS (wid) & GTK_VISIBLE) != 0)
81 #define GTK_WIDGET_DRAWABLE(wid)          (GTK_WIDGET_VISIBLE (wid) && GTK_WIDGET_MAPPED (wid))
82 #define GTK_WIDGET_SENSITIVE(wid)         ((GTK_WIDGET_FLAGS (wid) & GTK_SENSITIVE) != 0)
83 #define GTK_WIDGET_PARENT_SENSITIVE(wid)  ((GTK_WIDGET_FLAGS (wid) & GTK_PARENT_SENSITIVE) != 0)
84 #define GTK_WIDGET_IS_SENSITIVE(wid)      (GTK_WIDGET_SENSITIVE (wid) && \
85                                            GTK_WIDGET_PARENT_SENSITIVE (wid))
86 #define GTK_WIDGET_CAN_FOCUS(wid)         ((GTK_WIDGET_FLAGS (wid) & GTK_CAN_FOCUS) != 0)
87 #define GTK_WIDGET_HAS_FOCUS(wid)         ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_FOCUS) != 0)
88 #define GTK_WIDGET_CAN_DEFAULT(wid)       ((GTK_WIDGET_FLAGS (wid) & GTK_CAN_DEFAULT) != 0)
89 #define GTK_WIDGET_HAS_DEFAULT(wid)       ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_DEFAULT) != 0)
90 #define GTK_WIDGET_HAS_GRAB(wid)          ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_GRAB) != 0)
91 #define GTK_WIDGET_RC_STYLE(wid)          ((GTK_WIDGET_FLAGS (wid) & GTK_RC_STYLE) != 0)
92 #define GTK_WIDGET_COMPOSITE_CHILD(wid)   ((GTK_WIDGET_FLAGS (wid) & GTK_COMPOSITE_CHILD) != 0)
93 #define GTK_WIDGET_APP_PAINTABLE(wid)     ((GTK_WIDGET_FLAGS (wid) & GTK_APP_PAINTABLE) != 0)
94 #define GTK_WIDGET_RECEIVES_DEFAULT(wid)  ((GTK_WIDGET_FLAGS (wid) & GTK_RECEIVES_DEFAULT) != 0)
95   
96 /* Macros for setting and clearing widget flags.
97  */
98 #define GTK_WIDGET_SET_FLAGS(wid,flag)    G_STMT_START{ (GTK_WIDGET_FLAGS (wid) |= (flag)); }G_STMT_END
99 #define GTK_WIDGET_UNSET_FLAGS(wid,flag)  G_STMT_START{ (GTK_WIDGET_FLAGS (wid) &= ~(flag)); }G_STMT_END
100   
101   
102   
103 typedef struct _GtkRequisition    GtkRequisition;
104 typedef struct _GtkAllocation     GtkAllocation;
105 typedef struct _GtkSelectionData GtkSelectionData;
106 typedef struct _GtkWidgetClass    GtkWidgetClass;
107 typedef struct _GtkWidgetAuxInfo  GtkWidgetAuxInfo;
108 typedef struct _GtkWidgetShapeInfo GtkWidgetShapeInfo;
109
110 typedef void (*GtkCallback) (GtkWidget *widget,
111                              gpointer   data);
112
113 /* A requisition is a desired amount of space which a
114  *  widget may request.
115  */
116 struct _GtkRequisition
117 {
118   gint16 width;
119   gint16 height;
120 };
121
122 /* An allocation is a size and position. Where a widget
123  *  can ask for a desired size, it is actually given
124  *  this amount of space at the specified position.
125  */
126 struct _GtkAllocation
127 {
128   gint16 x;
129   gint16 y;
130   guint16 width;
131   guint16 height;
132 };
133
134 /* The contents of a selection are returned in a GtkSelectionData
135    structure. selection/target identify the request. 
136    type specifies the type of the return; if length < 0, and
137    the data should be ignored. This structure has object semantics -
138    no fields should be modified directly, they should not be created
139    directly, and pointers to them should not be stored beyond the duration of
140    a callback. (If the last is changed, we'll need to add reference
141    counting.) The time field gives the timestamp at which the data was sent. */
142
143 struct _GtkSelectionData
144 {
145   GdkAtom selection;
146   GdkAtom target;
147   GdkAtom type;
148   gint    format;
149   guchar *data;
150   gint    length;
151 };
152
153 /* The widget is the base of the tree for displayable objects.
154  *  (A displayable object is one which takes up some amount
155  *  of screen real estate). It provides a common base and interface
156  *  which actual widgets must adhere to.
157  */
158 struct _GtkWidget
159 {
160   /* The object structure needs to be the first
161    *  element in the widget structure in order for
162    *  the object mechanism to work correctly. This
163    *  allows a GtkWidget pointer to be cast to a
164    *  GtkObject pointer.
165    */
166   GtkObject object;
167   
168   /* 16 bits of internally used private flags.
169    * this will be packed into the same 4 byte alignment frame that
170    * state and saved_state go. we therefore don't waste any new
171    * space on this.
172    */
173   guint16 private_flags;
174   
175   /* The state of the widget. There are actually only
176    *  5 widget states (defined in "gtkenums.h").
177    */
178   guint8 state;
179   
180   /* The saved state of the widget. When a widgets state
181    *  is changed to GTK_STATE_INSENSITIVE via
182    *  "gtk_widget_set_state" or "gtk_widget_set_sensitive"
183    *  the old state is kept around in this field. The state
184    *  will be restored once the widget gets sensitive again.
185    */
186   guint8 saved_state;
187   
188   /* The widgets name. If the widget does not have a name
189    *  (the name is NULL), then its name (as returned by
190    *  "gtk_widget_get_name") is its classes name.
191    * Among other things, the widget name is used to determine
192    *  the style to use for a widget.
193    */
194   gchar *name;
195   
196   /* The style for the widget. The style contains the
197    *  colors the widget should be drawn in for each state
198    *  along with graphics contexts used to draw with and
199    *  the font to use for text.
200    */
201   GtkStyle *style;
202   
203   /* The widgets desired size.
204    */
205   GtkRequisition requisition;
206   
207   /* The widgets allocated size.
208    */
209   GtkAllocation allocation;
210   
211   /* The widgets window or its parent window if it does
212    *  not have a window. (Which will be indicated by the
213    *  GTK_NO_WINDOW flag being set).
214    */
215   GdkWindow *window;
216   
217   /* The widgets parent.
218    */
219   GtkWidget *parent;
220 };
221
222 struct _GtkWidgetClass
223 {
224   /* The object class structure needs to be the first
225    *  element in the widget class structure in order for
226    *  the class mechanism to work correctly. This allows a
227    *  GtkWidgetClass pointer to be cast to a GtkObjectClass
228    *  pointer.
229    */
230   GtkObjectClass parent_class;
231   
232   /* The signal to emit when a widget of this class is activated,
233    * gtk_widget_activate() handles the emission.
234    * Implementation of this signal is optional.
235    */
236   guint activate_signal;
237
238   /* This signal is emitted  when a widget of this class is added
239    * to a scrolling aware parent, gtk_widget_set_scroll_adjustments()
240    * handles the emission.
241    * Implementation of this signal is optional.
242    */
243   guint set_scroll_adjustments_signal;
244   
245   /* basics */
246   void (* show)                (GtkWidget      *widget);
247   void (* show_all)            (GtkWidget      *widget);
248   void (* hide)                (GtkWidget      *widget);
249   void (* hide_all)            (GtkWidget      *widget);
250   void (* map)                 (GtkWidget      *widget);
251   void (* unmap)               (GtkWidget      *widget);
252   void (* realize)             (GtkWidget      *widget);
253   void (* unrealize)           (GtkWidget      *widget);
254   void (* draw)                (GtkWidget      *widget,
255                                 GdkRectangle   *area);
256   void (* draw_focus)          (GtkWidget      *widget);
257   void (* draw_default)        (GtkWidget      *widget);
258   void (* size_request)        (GtkWidget      *widget,
259                                 GtkRequisition *requisition);
260   void (* size_allocate)       (GtkWidget      *widget,
261                                 GtkAllocation  *allocation);
262   void (* state_changed)       (GtkWidget      *widget,
263                                 GtkStateType    previous_state);
264   void (* parent_set)          (GtkWidget      *widget,
265                                 GtkWidget      *previous_parent);
266   void (* style_set)           (GtkWidget      *widget,
267                                 GtkStyle       *previous_style);
268   
269   /* accelerators */
270   gint (* add_accelerator)     (GtkWidget      *widget,
271                                 guint           accel_signal_id,
272                                 GtkAccelGroup  *accel_group,
273                                 guint           accel_key,
274                                 GdkModifierType accel_mods,
275                                 GtkAccelFlags   accel_flags);
276   void (* remove_accelerator)  (GtkWidget      *widget,
277                                 GtkAccelGroup  *accel_group,
278                                 guint           accel_key,
279                                 GdkModifierType accel_mods);
280
281   /* explicit focus */
282   void (* grab_focus)          (GtkWidget      *widget);
283   
284   /* events */
285   gint (* event)                   (GtkWidget          *widget,
286                                     GdkEvent           *event);
287   gint (* button_press_event)      (GtkWidget          *widget,
288                                     GdkEventButton     *event);
289   gint (* button_release_event)    (GtkWidget          *widget,
290                                     GdkEventButton     *event);
291   gint (* motion_notify_event)     (GtkWidget          *widget,
292                                     GdkEventMotion     *event);
293   gint (* delete_event)            (GtkWidget          *widget,
294                                     GdkEventAny        *event);
295   gint (* destroy_event)           (GtkWidget          *widget,
296                                     GdkEventAny        *event);
297   gint (* expose_event)            (GtkWidget          *widget,
298                                     GdkEventExpose     *event);
299   gint (* key_press_event)         (GtkWidget          *widget,
300                                     GdkEventKey        *event);
301   gint (* key_release_event)       (GtkWidget          *widget,
302                                     GdkEventKey        *event);
303   gint (* enter_notify_event)      (GtkWidget          *widget,
304                                     GdkEventCrossing   *event);
305   gint (* leave_notify_event)      (GtkWidget          *widget,
306                                     GdkEventCrossing   *event);
307   gint (* configure_event)         (GtkWidget          *widget,
308                                     GdkEventConfigure  *event);
309   gint (* focus_in_event)          (GtkWidget          *widget,
310                                     GdkEventFocus      *event);
311   gint (* focus_out_event)         (GtkWidget          *widget,
312                                     GdkEventFocus      *event);
313   gint (* map_event)               (GtkWidget          *widget,
314                                     GdkEventAny        *event);
315   gint (* unmap_event)             (GtkWidget          *widget,
316                                     GdkEventAny        *event);
317   gint (* property_notify_event)   (GtkWidget          *widget,
318                                     GdkEventProperty   *event);
319   gint (* selection_clear_event)   (GtkWidget          *widget,
320                                     GdkEventSelection  *event);
321   gint (* selection_request_event) (GtkWidget          *widget,
322                                     GdkEventSelection  *event);
323   gint (* selection_notify_event)  (GtkWidget          *widget,
324                                     GdkEventSelection  *event);
325   gint (* proximity_in_event)      (GtkWidget          *widget,
326                                     GdkEventProximity  *event);
327   gint (* proximity_out_event)     (GtkWidget          *widget,
328                                     GdkEventProximity  *event);
329   gint (* visibility_notify_event)  (GtkWidget         *widget,
330                                      GdkEventVisibility *event);
331   gint (* client_event)            (GtkWidget          *widget,
332                                     GdkEventClient     *event);
333   gint (* no_expose_event)         (GtkWidget          *widget,
334                                     GdkEventAny        *event);
335
336   /* selection */
337   void (* selection_get)           (GtkWidget          *widget,
338                                     GtkSelectionData   *selection_data,
339                                     guint               info,
340                                     guint               time);
341   void (* selection_received)      (GtkWidget          *widget,
342                                     GtkSelectionData   *selection_data,
343                                     guint               time);
344
345   /* Source side drag signals */
346   void (* drag_begin)              (GtkWidget          *widget,
347                                     GdkDragContext     *context);
348   void (* drag_end)                (GtkWidget          *widget,
349                                     GdkDragContext     *context);
350   void (* drag_data_get)           (GtkWidget          *widget,
351                                     GdkDragContext     *context,
352                                     GtkSelectionData   *selection_data,
353                                     guint               info,
354                                     guint32             time);
355   void (* drag_data_delete)        (GtkWidget          *widget,
356                                     GdkDragContext     *context);
357
358   /* Target side drag signals */
359   void (* drag_leave)              (GtkWidget          *widget,
360                                     GdkDragContext     *context,
361                                     guint               time);
362   gboolean (* drag_motion)         (GtkWidget          *widget,
363                                     GdkDragContext     *context,
364                                     gint                x,
365                                     gint                y,
366                                     guint               time);
367   gboolean (* drag_drop)           (GtkWidget          *widget,
368                                     GdkDragContext     *context,
369                                     gint                x,
370                                     gint                y,
371                                     guint               time);
372   void (* drag_data_received)      (GtkWidget          *widget,
373                                     GdkDragContext     *context,
374                                     gint                x,
375                                     gint                y,
376                                     GtkSelectionData   *selection_data,
377                                     guint               info,
378                                     guint32             time);
379   
380   /* action signals */
381   void (* debug_msg)               (GtkWidget          *widget,
382                                     const gchar        *string);
383 };
384
385 struct _GtkWidgetAuxInfo
386 {
387   gint16  x;
388   gint16  y;
389   gint16 width;
390   gint16 height;
391 };
392
393 struct _GtkWidgetShapeInfo
394 {
395   gint16     offset_x;
396   gint16     offset_y;
397   GdkBitmap *shape_mask;
398 };
399
400
401 GtkType    gtk_widget_get_type            (void);
402 GtkWidget* gtk_widget_new                 (GtkType              type,
403                                            const gchar         *first_arg_name,
404                                            ...);
405 GtkWidget* gtk_widget_newv                (GtkType              type,
406                                            guint                nargs,
407                                            GtkArg              *args);
408 void       gtk_widget_ref                 (GtkWidget           *widget);
409 void       gtk_widget_unref               (GtkWidget           *widget);
410 void       gtk_widget_destroy             (GtkWidget           *widget);
411 void       gtk_widget_destroyed           (GtkWidget           *widget,
412                                            GtkWidget          **widget_pointer);
413 void       gtk_widget_get                 (GtkWidget           *widget,
414                                            GtkArg              *arg);
415 void       gtk_widget_getv                (GtkWidget           *widget,
416                                            guint                nargs,
417                                            GtkArg              *args);
418 void       gtk_widget_set                 (GtkWidget           *widget,
419                                            const gchar         *first_arg_name,
420                                            ...);
421 void       gtk_widget_setv                (GtkWidget           *widget,
422                                            guint                nargs,
423                                            GtkArg              *args);
424 void       gtk_widget_unparent            (GtkWidget           *widget);
425 void       gtk_widget_show                (GtkWidget           *widget);
426 void       gtk_widget_show_now            (GtkWidget           *widget);
427 void       gtk_widget_hide                (GtkWidget           *widget);
428 void       gtk_widget_show_all            (GtkWidget           *widget);
429 void       gtk_widget_hide_all            (GtkWidget           *widget);
430 void       gtk_widget_map                 (GtkWidget           *widget);
431 void       gtk_widget_unmap               (GtkWidget           *widget);
432 void       gtk_widget_realize             (GtkWidget           *widget);
433 void       gtk_widget_unrealize           (GtkWidget           *widget);
434
435 /* Queuing draws */
436 void       gtk_widget_queue_draw          (GtkWidget           *widget);
437 void       gtk_widget_queue_draw_area     (GtkWidget           *widget,
438                                            gint                 x,
439                                            gint                 y,
440                                            gint                 width,
441                                            gint                 height);
442 void       gtk_widget_queue_clear         (GtkWidget           *widget);
443 void       gtk_widget_queue_clear_area    (GtkWidget           *widget,
444                                            gint                 x,
445                                            gint                 y,
446                                            gint                 width,
447                                            gint                 height);
448
449
450 void       gtk_widget_queue_resize        (GtkWidget           *widget);
451 void       gtk_widget_draw                (GtkWidget           *widget,
452                                            GdkRectangle        *area);
453 void       gtk_widget_draw_focus          (GtkWidget           *widget);
454 void       gtk_widget_draw_default        (GtkWidget           *widget);
455 void       gtk_widget_size_request        (GtkWidget           *widget,
456                                            GtkRequisition      *requisition);
457 void       gtk_widget_size_allocate       (GtkWidget           *widget,
458                                            GtkAllocation       *allocation);
459 void       gtk_widget_get_child_requisition (GtkWidget         *widget,
460                                              GtkRequisition    *requisition);
461 void       gtk_widget_add_accelerator     (GtkWidget           *widget,
462                                            const gchar         *accel_signal,
463                                            GtkAccelGroup       *accel_group,
464                                            guint                accel_key,
465                                            guint                accel_mods,
466                                            GtkAccelFlags        accel_flags);
467 void       gtk_widget_remove_accelerator  (GtkWidget           *widget,
468                                            GtkAccelGroup       *accel_group,
469                                            guint                accel_key,
470                                            guint                accel_mods);
471 void       gtk_widget_remove_accelerators (GtkWidget           *widget,
472                                            const gchar         *accel_signal,
473                                            gboolean             visible_only);
474 guint      gtk_widget_accelerator_signal  (GtkWidget           *widget,
475                                            GtkAccelGroup       *accel_group,
476                                            guint                accel_key,
477                                            guint                accel_mods);
478 void       gtk_widget_lock_accelerators   (GtkWidget           *widget);
479 void       gtk_widget_unlock_accelerators (GtkWidget           *widget);
480 gint       gtk_widget_event               (GtkWidget           *widget,
481                                            GdkEvent            *event);
482
483 gboolean   gtk_widget_activate               (GtkWidget        *widget);
484 gboolean   gtk_widget_set_scroll_adjustments (GtkWidget        *widget,
485                                               GtkAdjustment    *hadjustment,
486                                               GtkAdjustment    *vadjustment);
487      
488 void       gtk_widget_reparent            (GtkWidget           *widget,
489                                            GtkWidget           *new_parent);
490 void       gtk_widget_popup               (GtkWidget           *widget,
491                                            gint                 x,
492                                            gint                 y);
493 gint       gtk_widget_intersect           (GtkWidget           *widget,
494                                            GdkRectangle        *area,
495                                            GdkRectangle        *intersection);
496
497 void       gtk_widget_grab_focus          (GtkWidget           *widget);
498 void       gtk_widget_grab_default        (GtkWidget           *widget);
499
500 void       gtk_widget_set_name            (GtkWidget           *widget,
501                                            const gchar         *name);
502 gchar*     gtk_widget_get_name            (GtkWidget           *widget);
503 void       gtk_widget_set_state           (GtkWidget           *widget,
504                                            GtkStateType         state);
505 void       gtk_widget_set_sensitive       (GtkWidget           *widget,
506                                            gboolean             sensitive);
507 void       gtk_widget_set_app_paintable   (GtkWidget           *widget,
508                                            gboolean             app_paintable);
509 void       gtk_widget_set_parent          (GtkWidget           *widget,
510                                            GtkWidget           *parent);
511 void       gtk_widget_set_parent_window   (GtkWidget           *widget,
512                                            GdkWindow           *parent_window);
513 GdkWindow *gtk_widget_get_parent_window   (GtkWidget           *widget);
514 void       gtk_widget_set_uposition       (GtkWidget           *widget,
515                                            gint                 x,
516                                            gint                 y);
517 void       gtk_widget_set_usize           (GtkWidget           *widget,
518                                            gint                 width,
519                                            gint                 height);
520 void       gtk_widget_set_events          (GtkWidget           *widget,
521                                            gint                 events);
522 void       gtk_widget_add_events          (GtkWidget           *widget,
523                                            gint                 events);
524 void       gtk_widget_set_extension_events (GtkWidget           *widget,
525                                             GdkExtensionMode    mode);
526
527 GdkExtensionMode gtk_widget_get_extension_events (GtkWidget     *widget);
528 GtkWidget*   gtk_widget_get_toplevel    (GtkWidget      *widget);
529 GtkWidget*   gtk_widget_get_ancestor    (GtkWidget      *widget,
530                                          GtkType        widget_type);
531 GdkColormap* gtk_widget_get_colormap    (GtkWidget      *widget);
532 GdkVisual*   gtk_widget_get_visual      (GtkWidget      *widget);
533
534 /* The following functions must not be called on an already
535  * realized widget. Because it is possible that somebody
536  * can call get_colormap() or get_visual() and save the
537  * result, these functions are probably only safe to
538  * call in a widget's init() function.
539  */
540 void         gtk_widget_set_colormap    (GtkWidget      *widget,
541                                          GdkColormap    *colormap);
542 void         gtk_widget_set_visual      (GtkWidget      *widget, 
543                                          GdkVisual      *visual);
544
545
546 gint         gtk_widget_get_events      (GtkWidget      *widget);
547 void         gtk_widget_get_pointer     (GtkWidget      *widget,
548                                          gint           *x,
549                                          gint           *y);
550
551 gint         gtk_widget_is_ancestor     (GtkWidget      *widget,
552                                          GtkWidget      *ancestor);
553
554 /* Hide widget and return TRUE.
555  */
556 gint       gtk_widget_hide_on_delete    (GtkWidget      *widget);
557
558 /* Widget styles.
559  */
560 void       gtk_widget_set_style         (GtkWidget      *widget,
561                                          GtkStyle       *style);
562 void       gtk_widget_set_rc_style      (GtkWidget      *widget);
563 void       gtk_widget_ensure_style      (GtkWidget      *widget);
564 GtkStyle*  gtk_widget_get_style         (GtkWidget      *widget);
565 void       gtk_widget_restore_default_style (GtkWidget  *widget);
566
567 void       gtk_widget_modify_style      (GtkWidget      *widget,
568                                          GtkRcStyle     *style);
569
570 /* handle composite names for GTK_COMPOSITE_CHILD widgets,
571  * the returned name is newly allocated.
572  */
573 void   gtk_widget_set_composite_name    (GtkWidget      *widget,
574                                          gchar          *name);
575 gchar* gtk_widget_get_composite_name    (GtkWidget      *widget);
576      
577 /* Descend recursively and set rc-style on all widgets without user styles */
578 void       gtk_widget_reset_rc_styles   (GtkWidget      *widget);
579
580 /* Push/pop pairs, to change default values upon a widget's creation.
581  * This will override the values that got set by the
582  * gtk_widget_set_default_* () functions.
583  */
584 void         gtk_widget_push_style           (GtkStyle   *style);
585 void         gtk_widget_push_colormap        (GdkColormap *cmap);
586 void         gtk_widget_push_visual          (GdkVisual  *visual);
587 void         gtk_widget_push_composite_child (void);
588 void         gtk_widget_pop_composite_child  (void);
589 void         gtk_widget_pop_style            (void);
590 void         gtk_widget_pop_colormap         (void);
591 void         gtk_widget_pop_visual           (void);
592
593 /* Set certain default values to be used at widget creation time.
594  */
595 void         gtk_widget_set_default_style    (GtkStyle    *style);
596 void         gtk_widget_set_default_colormap (GdkColormap *colormap);
597 void         gtk_widget_set_default_visual   (GdkVisual   *visual);
598 GtkStyle*    gtk_widget_get_default_style    (void);
599 GdkColormap* gtk_widget_get_default_colormap (void);
600 GdkVisual*   gtk_widget_get_default_visual   (void);
601
602 /* Counterpart to gdk_window_shape_combine_mask.
603  */
604 void         gtk_widget_shape_combine_mask (GtkWidget *widget,
605                                             GdkBitmap *shape_mask,
606                                             gint       offset_x,
607                                             gint       offset_y);
608
609 /* internal function */
610 void         gtk_widget_reset_shapes       (GtkWidget *widget);
611
612 /* Compute a widget's path in the form "GtkWindow.MyLabel", and
613  * return newly alocated strings.
614  */
615 void         gtk_widget_path               (GtkWidget *widget,
616                                             guint     *path_length,
617                                             gchar    **path,
618                                             gchar    **path_reversed);
619 void         gtk_widget_class_path         (GtkWidget *widget,
620                                             guint     *path_length,
621                                             gchar    **path,
622                                             gchar    **path_reversed);
623
624 #if     defined (GTK_TRACE_OBJECTS) && defined (__GNUC__)
625 #  define gtk_widget_ref gtk_object_ref
626 #  define gtk_widget_unref gtk_object_unref
627 #endif  /* GTK_TRACE_OBJECTS && __GNUC__ */
628
629
630
631 #ifdef __cplusplus
632 }
633 #endif /* __cplusplus */
634
635
636 #endif /* __GTK_WIDGET_H__ */