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