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