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