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