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