1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
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.
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.
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.
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/.
27 #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
28 #error "Only <gtk/gtk.h> can be included directly."
31 #ifndef __GTK_WIDGET_H__
32 #define __GTK_WIDGET_H__
35 #include <gtk/gtkaccelgroup.h>
36 #include <gtk/gtkobject.h>
37 #include <gtk/gtkadjustment.h>
38 #include <gtk/gtkstyle.h>
39 #include <gtk/gtksettings.h>
46 * @GTK_TOPLEVEL: widgets without a real parent, as there are #GtkWindow<!-- -->s and
47 * #GtkMenu<!-- -->s have this flag set throughout their lifetime.
48 * Toplevel widgets always contain their own #GdkWindow.
49 * @GTK_NO_WINDOW: Indicative for a widget that does not provide its own #GdkWindow.
50 * Visible action (e.g. drawing) is performed on the parent's #GdkWindow.
51 * @GTK_REALIZED: Set by gtk_widget_realize(), unset by gtk_widget_unrealize().
52 * A realized widget has an associated #GdkWindow.
53 * @GTK_MAPPED: Set by gtk_widget_map(), unset by gtk_widget_unmap().
54 * Only realized widgets can be mapped. It means that gdk_window_show()
55 * has been called on the widgets window(s).
56 * @GTK_VISIBLE: Set by gtk_widget_show(), unset by gtk_widget_hide(). Implies that a
57 * widget will be mapped as soon as its parent is mapped.
58 * @GTK_SENSITIVE: Set and unset by gtk_widget_set_sensitive().
59 * The sensitivity of a widget determines whether it will receive
60 * certain events (e.g. button or key presses). One premise for
61 * the widget's sensitivity is to have this flag set.
62 * @GTK_PARENT_SENSITIVE: Set and unset by gtk_widget_set_sensitive() operations on the
63 * parents of the widget.
64 * This is the second premise for the widget's sensitivity. Once
65 * it has %GTK_SENSITIVE and %GTK_PARENT_SENSITIVE set, its state is
66 * effectively sensitive. This is expressed (and can be examined) by
67 * the #GTK_WIDGET_IS_SENSITIVE macro.
68 * @GTK_CAN_FOCUS: Determines whether a widget is able to handle focus grabs.
69 * @GTK_HAS_FOCUS: Set by gtk_widget_grab_focus() for widgets that also
70 * have %GTK_CAN_FOCUS set. The flag will be unset once another widget
72 * @GTK_CAN_DEFAULT: The widget is allowed to receive the default action via
73 * gtk_widget_grab_default() and will reserve space to draw the default if possible
74 * @GTK_HAS_DEFAULT: The widget currently is receiving the default action and
75 * should be drawn appropriately if possible
76 * @GTK_HAS_GRAB: Set by gtk_grab_add(), unset by gtk_grab_remove(). It means that the
77 * widget is in the grab_widgets stack, and will be the preferred one for
78 * receiving events other than ones of cosmetic value.
79 * @GTK_RC_STYLE: Indicates that the widget's style has been looked up through the rc
80 * mechanism. It does not imply that the widget actually had a style
81 * defined through the rc mechanism.
82 * @GTK_COMPOSITE_CHILD: Indicates that the widget is a composite child of its parent; see
83 * gtk_widget_push_composite_child(), gtk_widget_pop_composite_child().
84 * @GTK_NO_REPARENT: Unused since before GTK+ 1.2, will be removed in a future version.
85 * @GTK_APP_PAINTABLE: Set and unset by gtk_widget_set_app_paintable().
86 * Must be set on widgets whose window the application directly draws on,
87 * in order to keep GTK+ from overwriting the drawn stuff. See
88 * <xref linkend="app-paintable-widgets"/> for a detailed
89 * description of this flag.
90 * @GTK_RECEIVES_DEFAULT: The widget when focused will receive the default action and have
91 * %GTK_HAS_DEFAULT set even if there is a different widget set as default.
92 * @GTK_DOUBLE_BUFFERED: Set and unset by gtk_widget_set_double_buffered().
93 * Indicates that exposes done on the widget should be
94 * double-buffered. See <xref linkend="double-buffering"/> for a
95 * detailed discussion of how double-buffering works in GTK+ and
96 * why you may want to disable it for special cases.
99 * Tells about certain properties of the widget.
103 GTK_TOPLEVEL = 1 << 4,
104 GTK_NO_WINDOW = 1 << 5,
105 GTK_REALIZED = 1 << 6,
107 GTK_VISIBLE = 1 << 8,
108 GTK_SENSITIVE = 1 << 9,
109 GTK_PARENT_SENSITIVE = 1 << 10,
110 GTK_CAN_FOCUS = 1 << 11,
111 GTK_HAS_FOCUS = 1 << 12,
112 GTK_CAN_DEFAULT = 1 << 13,
113 GTK_HAS_DEFAULT = 1 << 14,
114 GTK_HAS_GRAB = 1 << 15,
115 GTK_RC_STYLE = 1 << 16,
116 GTK_COMPOSITE_CHILD = 1 << 17,
117 GTK_NO_REPARENT = 1 << 18,
118 GTK_APP_PAINTABLE = 1 << 19,
119 GTK_RECEIVES_DEFAULT = 1 << 20,
120 GTK_DOUBLE_BUFFERED = 1 << 21,
121 GTK_NO_SHOW_ALL = 1 << 22
124 /* Kinds of widget-specific help */
127 GTK_WIDGET_HELP_TOOLTIP,
128 GTK_WIDGET_HELP_WHATS_THIS
131 /* Macro for casting a pointer to a GtkWidget or GtkWidgetClass pointer.
132 * Macros for testing whether `widget' or `klass' are of type GTK_TYPE_WIDGET.
134 #define GTK_TYPE_WIDGET (gtk_widget_get_type ())
135 #define GTK_WIDGET(widget) (G_TYPE_CHECK_INSTANCE_CAST ((widget), GTK_TYPE_WIDGET, GtkWidget))
136 #define GTK_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_WIDGET, GtkWidgetClass))
137 #define GTK_IS_WIDGET(widget) (G_TYPE_CHECK_INSTANCE_TYPE ((widget), GTK_TYPE_WIDGET))
138 #define GTK_IS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WIDGET))
139 #define GTK_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_WIDGET, GtkWidgetClass))
141 /* Macros for extracting various fields from GtkWidget and GtkWidgetClass.
143 #ifndef GTK_DISABLE_DEPRECATED
146 * @wid: a #GtkWidget.
148 * Gets the type of a widget.
150 * Deprecated: 2.20: Use G_OBJECT_TYPE() instead.
152 #define GTK_WIDGET_TYPE(wid) (GTK_OBJECT_TYPE (wid))
157 * @wid: a #GtkWidget.
159 * Returns the current state of the widget, as a #GtkStateType.
161 * Deprecated: 2.20: Use gtk_widget_get_state() instead.
163 #define GTK_WIDGET_STATE(wid) (GTK_WIDGET (wid)->state)
164 /* FIXME: Deprecating GTK_WIDGET_STATE requires fixing GTK internals. */
166 #ifndef GTK_DISABLE_DEPRECATED
168 * GTK_WIDGET_SAVED_STATE:
169 * @wid: a #GtkWidget.
171 * Returns the saved state of the widget, as a #GtkStateType.
173 * The saved state will be restored when a widget gets sensitive
174 * again, after it has been made insensitive with gtk_widget_set_state()
175 * or gtk_widget_set_sensitive().
177 * Deprecated: 2.20: Do not used it.
179 #define GTK_WIDGET_SAVED_STATE(wid) (GTK_WIDGET (wid)->saved_state)
183 /* Macros for extracting the widget flags from GtkWidget.
187 * @wid: a #GtkWidget.
189 * Returns the widget flags from @wid.
191 * Deprecated: 2.20: Do not use it.
193 #define GTK_WIDGET_FLAGS(wid) (GTK_OBJECT_FLAGS (wid))
194 /* FIXME: Deprecating GTK_WIDGET_FLAGS requires fixing GTK internals. */
196 #ifndef GTK_DISABLE_DEPRECATED
198 * GTK_WIDGET_TOPLEVEL:
199 * @wid: a #GtkWidget.
201 * Evaluates to %TRUE if the widget is a toplevel widget.
203 * Deprecated: 2.20: Use gtk_widget_is_toplevel() instead.
205 #define GTK_WIDGET_TOPLEVEL(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_TOPLEVEL) != 0)
208 #ifndef GTK_DISABLE_DEPRECATED
210 * GTK_WIDGET_NO_WINDOW:
211 * @wid: a #GtkWidget.
213 * Evaluates to %TRUE if the widget doesn't have an own #GdkWindow.
215 * Deprecated: 2.20: Use gtk_widget_get_has_window() instead.
217 #define GTK_WIDGET_NO_WINDOW(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_NO_WINDOW) != 0)
221 * GTK_WIDGET_REALIZED:
222 * @wid: a #GtkWidget.
224 * Evaluates to %TRUE if the widget is realized.
226 #define GTK_WIDGET_REALIZED(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_REALIZED) != 0)
230 * @wid: a #GtkWidget.
232 * Evaluates to %TRUE if the widget is mapped.
234 #define GTK_WIDGET_MAPPED(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_MAPPED) != 0)
237 * GTK_WIDGET_VISIBLE:
238 * @wid: a #GtkWidget.
240 * Evaluates to %TRUE if the widget is visible.
242 #define GTK_WIDGET_VISIBLE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_VISIBLE) != 0)
244 #ifndef GTK_DISABLE_DEPRECATED
246 * GTK_WIDGET_DRAWABLE:
247 * @wid: a #GtkWidget.
249 * Evaluates to %TRUE if the widget is mapped and visible.
251 * Deprecated: 2.20: Use gtk_widget_is_drawable() instead.
253 #define GTK_WIDGET_DRAWABLE(wid) (GTK_WIDGET_VISIBLE (wid) && GTK_WIDGET_MAPPED (wid))
256 #ifndef GTK_DISABLE_DEPRECATED
258 * GTK_WIDGET_SENSITIVE:
259 * @wid: a #GtkWidget.
261 * Evaluates to %TRUE if the #GTK_SENSITIVE flag has be set on the widget.
263 #define GTK_WIDGET_SENSITIVE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_SENSITIVE) != 0)
267 * GTK_WIDGET_PARENT_SENSITIVE:
268 * @wid: a #GtkWidget.
270 * Evaluates to %TRUE if the #GTK_PARENT_SENSITIVE flag has be set on the widget.
272 #define GTK_WIDGET_PARENT_SENSITIVE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_PARENT_SENSITIVE) != 0)
274 #ifndef GTK_DISABLE_DEPRECATED
276 * GTK_WIDGET_IS_SENSITIVE:
277 * @wid: a #GtkWidget.
279 * Evaluates to %TRUE if the widget is effectively sensitive.
281 * Deprecated: 2.20: Use gtk_widget_is_sensitive() instead.
283 #define GTK_WIDGET_IS_SENSITIVE(wid) (GTK_WIDGET_SENSITIVE (wid) && \
284 GTK_WIDGET_PARENT_SENSITIVE (wid))
287 #ifndef GTK_DISABLE_DEPRECATED
289 * GTK_WIDGET_CAN_FOCUS:
290 * @wid: a #GtkWidget.
292 * Evaluates to %TRUE if the widget is able to handle focus grabs.
294 * Deprecated: 2.20: Use gtk_widget_get_can_focus() instead.
296 #define GTK_WIDGET_CAN_FOCUS(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_CAN_FOCUS) != 0)
300 * GTK_WIDGET_HAS_FOCUS:
301 * @wid: a #GtkWidget.
303 * Evaluates to %TRUE if the widget has grabbed the focus and no other
304 * widget has done so more recently.
306 #define GTK_WIDGET_HAS_FOCUS(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_FOCUS) != 0)
308 #ifndef GTK_DISABLE_DEPRECATED
310 * GTK_WIDGET_CAN_DEFAULT:
311 * @wid: a #GtkWidget.
313 * Evaluates to %TRUE if the widget is allowed to receive the default action
314 * via gtk_widget_grab_default().
316 * Deprecated: 2.20: Use gtk_widget_get_can_default() instead.
318 #define GTK_WIDGET_CAN_DEFAULT(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_CAN_DEFAULT) != 0)
321 #ifndef GTK_DISABLE_DEPRECATED
323 * GTK_WIDGET_HAS_DEFAULT:
324 * @wid: a #GtkWidget.
326 * Evaluates to %TRUE if the widget currently is receiving the default action.
328 * Deprecated: 2.20: Use gtk_widget_has_default() instead.
330 #define GTK_WIDGET_HAS_DEFAULT(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_DEFAULT) != 0)
333 #ifndef GTK_DISABLE_DEPRECATED
335 * GTK_WIDGET_HAS_GRAB:
336 * @wid: a #GtkWidget.
338 * Evaluates to %TRUE if the widget is in the grab_widgets stack, and will be
339 * the preferred one for receiving events other than ones of cosmetic value.
341 * Deprecated: 2.20: Use gtk_widget_has_grab() instead.
343 #define GTK_WIDGET_HAS_GRAB(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_GRAB) != 0)
346 #ifndef GTK_DISABLE_DEPRECATED
348 * GTK_WIDGET_RC_STYLE:
349 * @wid: a #GtkWidget.
351 * Evaluates to %TRUE if the widget's style has been looked up through the rc
354 * Deprecated: 2.20: Use gtk_widget_has_rc_style() instead.
356 #define GTK_WIDGET_RC_STYLE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_RC_STYLE) != 0)
359 #ifndef GTK_DISABLE_DEPRECATED
361 * GTK_WIDGET_COMPOSITE_CHILD:
362 * @wid: a #GtkWidget.
364 * Evaluates to %TRUE if the widget is a composite child of its parent.
366 * Deprecated: 2.20: Use the #GtkWidget:composite-child property instead.
368 #define GTK_WIDGET_COMPOSITE_CHILD(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_COMPOSITE_CHILD) != 0)
371 #ifndef GTK_DISABLE_DEPRECATED
373 * GTK_WIDGET_APP_PAINTABLE:
374 * @wid: a #GtkWidget.
376 * Evaluates to %TRUE if the #GTK_APP_PAINTABLE flag has been set on the widget.
378 * Deprecated: 2.20: Use gtk_widget_get_app_paintable() instead.
380 #define GTK_WIDGET_APP_PAINTABLE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_APP_PAINTABLE) != 0)
383 #ifndef GTK_DISABLE_DEPRECATED
385 * GTK_WIDGET_RECEIVES_DEFAULT:
386 * @wid: a #GtkWidget.
388 * Evaluates to %TRUE if the widget when focused will receive the default action
389 * even if there is a different widget set as default.
391 * Deprecated: 2.20: Use gtk_widget_get_receives_default() instead.
393 #define GTK_WIDGET_RECEIVES_DEFAULT(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_RECEIVES_DEFAULT) != 0)
396 #ifndef GTK_DISABLE_DEPRECATED
398 * GTK_WIDGET_DOUBLE_BUFFERED:
399 * @wid: a #GtkWidget.
401 * Evaluates to %TRUE if the #GTK_DOUBLE_BUFFERED flag has been set on the widget.
403 * Deprecated: 2.20: Use gtk_widget_get_double_buffered() instead.
405 #define GTK_WIDGET_DOUBLE_BUFFERED(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_DOUBLE_BUFFERED) != 0)
409 /* Macros for setting and clearing widget flags.
412 * GTK_WIDGET_SET_FLAGS:
413 * @wid: a #GtkWidget.
414 * @flag: the flags to set.
416 * Turns on certain widget flags.
418 #define GTK_WIDGET_SET_FLAGS(wid,flag) G_STMT_START{ (GTK_WIDGET_FLAGS (wid) |= (flag)); }G_STMT_END
421 * GTK_WIDGET_UNSET_FLAGS:
422 * @wid: a #GtkWidget.
423 * @flag: the flags to unset.
425 * Turns off certain widget flags.
427 #define GTK_WIDGET_UNSET_FLAGS(wid,flag) G_STMT_START{ (GTK_WIDGET_FLAGS (wid) &= ~(flag)); }G_STMT_END
429 #define GTK_TYPE_REQUISITION (gtk_requisition_get_type ())
431 /* forward declaration to avoid excessive includes (and concurrent includes)
433 typedef struct _GtkRequisition GtkRequisition;
434 typedef struct _GtkSelectionData GtkSelectionData;
435 typedef struct _GtkWidgetClass GtkWidgetClass;
436 typedef struct _GtkWidgetAuxInfo GtkWidgetAuxInfo;
437 typedef struct _GtkWidgetShapeInfo GtkWidgetShapeInfo;
438 typedef struct _GtkClipboard GtkClipboard;
439 typedef struct _GtkTooltip GtkTooltip;
440 typedef struct _GtkWindow GtkWindow;
444 * @x: the X position of the widget's area relative to its parents allocation.
445 * @y: the Y position of the widget's area relative to its parents allocation.
446 * @width: the width of the widget's allocated area.
447 * @height: the height of the widget's allocated area.
449 * A <structname>GtkAllocation</structname> of a widget represents region which has been allocated to the
450 * widget by its parent. It is a subregion of its parents allocation. See
451 * <xref linkend="size-allocation"/> for more information.
453 typedef GdkRectangle GtkAllocation;
457 * @widget: the widget to operate on
458 * @data: user-supplied data
460 * The type of the callback functions used for e.g. iterating over
461 * the children of a container, see gtk_container_foreach().
463 typedef void (*GtkCallback) (GtkWidget *widget,
468 * @width: the widget's desired width
469 * @height: the widget's desired height
471 * A <structname>GtkRequisition</structname> represents the desired size of a widget. See
472 * <xref linkend="size-requisition"/> for more information.
474 struct _GtkRequisition
480 /* The widget is the base of the tree for displayable objects.
481 * (A displayable object is one which takes up some amount
482 * of screen real estate). It provides a common base and interface
483 * which actual widgets must adhere to.
487 /* The object structure needs to be the first
488 * element in the widget structure in order for
489 * the object mechanism to work correctly. This
490 * allows a GtkWidget pointer to be cast to a
495 /* 16 bits of internally used private flags.
496 * this will be packed into the same 4 byte alignment frame that
497 * state and saved_state go. we therefore don't waste any new
500 guint16 GSEAL (private_flags);
502 /* The state of the widget. There are actually only
503 * 5 widget states (defined in "gtkenums.h").
505 guint8 GSEAL (state);
507 /* The saved state of the widget. When a widget's state
508 * is changed to GTK_STATE_INSENSITIVE via
509 * "gtk_widget_set_state" or "gtk_widget_set_sensitive"
510 * the old state is kept around in this field. The state
511 * will be restored once the widget gets sensitive again.
513 guint8 GSEAL (saved_state);
515 /* The widget's name. If the widget does not have a name
516 * (the name is NULL), then its name (as returned by
517 * "gtk_widget_get_name") is its class's name.
518 * Among other things, the widget name is used to determine
519 * the style to use for a widget.
525 /* The style for the widget. The style contains the
526 * colors the widget should be drawn in for each state
527 * along with graphics contexts used to draw with and
528 * the font to use for text.
530 GtkStyle *GSEAL (style);
532 /* The widget's desired size.
534 GtkRequisition GSEAL (requisition);
536 /* The widget's allocated size.
538 GtkAllocation GSEAL (allocation);
540 /* The widget's window or its parent window if it does
541 * not have a window. (Which will be indicated by the
542 * GTK_NO_WINDOW flag being set).
544 GdkWindow *GSEAL (window);
546 /* The widget's parent.
548 GtkWidget *GSEAL (parent);
555 * @set_scroll_adjustments_signal:
557 * <structfield>activate_signal</structfield>
558 * The signal to emit when a widget of this class is activated,
559 * gtk_widget_activate() handles the emission. Implementation of this
560 * signal is optional.
563 * <structfield>set_scroll_adjustment_signal</structfield>
564 * This signal is emitted when a widget of this class is added
565 * to a scrolling aware parent, gtk_widget_set_scroll_adjustments()
566 * handles the emission.
567 * Implementation of this signal is optional.
569 struct _GtkWidgetClass
571 /* The object class structure needs to be the first
572 * element in the widget class structure in order for
573 * the class mechanism to work correctly. This allows a
574 * GtkWidgetClass pointer to be cast to a GtkObjectClass
577 GtkObjectClass parent_class;
581 guint activate_signal;
583 guint set_scroll_adjustments_signal;
587 /* seldomly overidden */
588 void (*dispatch_child_properties_changed) (GtkWidget *widget,
590 GParamSpec **pspecs);
593 void (* show) (GtkWidget *widget);
594 void (* show_all) (GtkWidget *widget);
595 void (* hide) (GtkWidget *widget);
596 void (* hide_all) (GtkWidget *widget);
597 void (* map) (GtkWidget *widget);
598 void (* unmap) (GtkWidget *widget);
599 void (* realize) (GtkWidget *widget);
600 void (* unrealize) (GtkWidget *widget);
601 void (* size_request) (GtkWidget *widget,
602 GtkRequisition *requisition);
603 void (* size_allocate) (GtkWidget *widget,
604 GtkAllocation *allocation);
605 void (* state_changed) (GtkWidget *widget,
606 GtkStateType previous_state);
607 void (* parent_set) (GtkWidget *widget,
608 GtkWidget *previous_parent);
609 void (* hierarchy_changed) (GtkWidget *widget,
610 GtkWidget *previous_toplevel);
611 void (* style_set) (GtkWidget *widget,
612 GtkStyle *previous_style);
613 void (* direction_changed) (GtkWidget *widget,
614 GtkTextDirection previous_direction);
615 void (* grab_notify) (GtkWidget *widget,
616 gboolean was_grabbed);
617 void (* child_notify) (GtkWidget *widget,
621 gboolean (* mnemonic_activate) (GtkWidget *widget,
622 gboolean group_cycling);
625 void (* grab_focus) (GtkWidget *widget);
626 gboolean (* focus) (GtkWidget *widget,
627 GtkDirectionType direction);
630 gboolean (* event) (GtkWidget *widget,
632 gboolean (* button_press_event) (GtkWidget *widget,
633 GdkEventButton *event);
634 gboolean (* button_release_event) (GtkWidget *widget,
635 GdkEventButton *event);
636 gboolean (* scroll_event) (GtkWidget *widget,
637 GdkEventScroll *event);
638 gboolean (* motion_notify_event) (GtkWidget *widget,
639 GdkEventMotion *event);
640 gboolean (* delete_event) (GtkWidget *widget,
642 gboolean (* destroy_event) (GtkWidget *widget,
644 gboolean (* expose_event) (GtkWidget *widget,
645 GdkEventExpose *event);
646 gboolean (* key_press_event) (GtkWidget *widget,
648 gboolean (* key_release_event) (GtkWidget *widget,
650 gboolean (* enter_notify_event) (GtkWidget *widget,
651 GdkEventCrossing *event);
652 gboolean (* leave_notify_event) (GtkWidget *widget,
653 GdkEventCrossing *event);
654 gboolean (* configure_event) (GtkWidget *widget,
655 GdkEventConfigure *event);
656 gboolean (* focus_in_event) (GtkWidget *widget,
657 GdkEventFocus *event);
658 gboolean (* focus_out_event) (GtkWidget *widget,
659 GdkEventFocus *event);
660 gboolean (* map_event) (GtkWidget *widget,
662 gboolean (* unmap_event) (GtkWidget *widget,
664 gboolean (* property_notify_event) (GtkWidget *widget,
665 GdkEventProperty *event);
666 gboolean (* selection_clear_event) (GtkWidget *widget,
667 GdkEventSelection *event);
668 gboolean (* selection_request_event) (GtkWidget *widget,
669 GdkEventSelection *event);
670 gboolean (* selection_notify_event) (GtkWidget *widget,
671 GdkEventSelection *event);
672 gboolean (* proximity_in_event) (GtkWidget *widget,
673 GdkEventProximity *event);
674 gboolean (* proximity_out_event) (GtkWidget *widget,
675 GdkEventProximity *event);
676 gboolean (* visibility_notify_event) (GtkWidget *widget,
677 GdkEventVisibility *event);
678 gboolean (* client_event) (GtkWidget *widget,
679 GdkEventClient *event);
680 gboolean (* no_expose_event) (GtkWidget *widget,
682 gboolean (* window_state_event) (GtkWidget *widget,
683 GdkEventWindowState *event);
686 void (* selection_get) (GtkWidget *widget,
687 GtkSelectionData *selection_data,
690 void (* selection_received) (GtkWidget *widget,
691 GtkSelectionData *selection_data,
694 /* Source side drag signals */
695 void (* drag_begin) (GtkWidget *widget,
696 GdkDragContext *context);
697 void (* drag_end) (GtkWidget *widget,
698 GdkDragContext *context);
699 void (* drag_data_get) (GtkWidget *widget,
700 GdkDragContext *context,
701 GtkSelectionData *selection_data,
704 void (* drag_data_delete) (GtkWidget *widget,
705 GdkDragContext *context);
707 /* Target side drag signals */
708 void (* drag_leave) (GtkWidget *widget,
709 GdkDragContext *context,
711 gboolean (* drag_motion) (GtkWidget *widget,
712 GdkDragContext *context,
716 gboolean (* drag_drop) (GtkWidget *widget,
717 GdkDragContext *context,
721 void (* drag_data_received) (GtkWidget *widget,
722 GdkDragContext *context,
725 GtkSelectionData *selection_data,
729 /* Signals used only for keybindings */
730 gboolean (* popup_menu) (GtkWidget *widget);
732 /* If a widget has multiple tooltips/whatsthis, it should show the
733 * one for the current focus location, or if that doesn't make
734 * sense, should cycle through them showing each tip alongside
735 * whatever piece of the widget it applies to.
737 gboolean (* show_help) (GtkWidget *widget,
738 GtkWidgetHelpType help_type);
740 /* accessibility support
742 AtkObject* (*get_accessible) (GtkWidget *widget);
744 void (*screen_changed) (GtkWidget *widget,
745 GdkScreen *previous_screen);
746 gboolean (*can_activate_accel) (GtkWidget *widget,
749 /* Sent when a grab is broken. */
750 gboolean (*grab_broken_event) (GtkWidget *widget,
751 GdkEventGrabBroken *event);
753 void (* composited_changed) (GtkWidget *widget);
755 gboolean (* query_tooltip) (GtkWidget *widget,
758 gboolean keyboard_tooltip,
759 GtkTooltip *tooltip);
760 /* Signals without a C default handler class slot:
761 * gboolean (*damage_event) (GtkWidget *widget,
762 * GdkEventExpose *event);
765 /* Padding for future expansion */
766 void (*_gtk_reserved5) (void);
767 void (*_gtk_reserved6) (void);
768 void (*_gtk_reserved7) (void);
771 struct _GtkWidgetAuxInfo
781 GtkRequisition natural_size;
784 struct _GtkWidgetShapeInfo
788 GdkBitmap *shape_mask;
791 GType gtk_widget_get_type (void) G_GNUC_CONST;
792 GtkWidget* gtk_widget_new (GType type,
793 const gchar *first_property_name,
795 void gtk_widget_destroy (GtkWidget *widget);
796 void gtk_widget_destroyed (GtkWidget *widget,
797 GtkWidget **widget_pointer);
798 #ifndef GTK_DISABLE_DEPRECATED
799 GtkWidget* gtk_widget_ref (GtkWidget *widget);
800 void gtk_widget_unref (GtkWidget *widget);
801 void gtk_widget_set (GtkWidget *widget,
802 const gchar *first_property_name,
803 ...) G_GNUC_NULL_TERMINATED;
804 #endif /* GTK_DISABLE_DEPRECATED */
805 void gtk_widget_unparent (GtkWidget *widget);
806 void gtk_widget_show (GtkWidget *widget);
807 void gtk_widget_show_now (GtkWidget *widget);
808 void gtk_widget_hide (GtkWidget *widget);
809 void gtk_widget_show_all (GtkWidget *widget);
810 void gtk_widget_hide_all (GtkWidget *widget);
811 void gtk_widget_set_no_show_all (GtkWidget *widget,
812 gboolean no_show_all);
813 gboolean gtk_widget_get_no_show_all (GtkWidget *widget);
814 void gtk_widget_map (GtkWidget *widget);
815 void gtk_widget_unmap (GtkWidget *widget);
816 void gtk_widget_realize (GtkWidget *widget);
817 void gtk_widget_unrealize (GtkWidget *widget);
820 void gtk_widget_queue_draw (GtkWidget *widget);
821 void gtk_widget_queue_draw_area (GtkWidget *widget,
826 #ifndef GTK_DISABLE_DEPRECATED
827 void gtk_widget_queue_clear (GtkWidget *widget);
828 void gtk_widget_queue_clear_area (GtkWidget *widget,
833 #endif /* GTK_DISABLE_DEPRECATED */
836 void gtk_widget_queue_resize (GtkWidget *widget);
837 void gtk_widget_queue_resize_no_redraw (GtkWidget *widget);
838 #ifndef GTK_DISABLE_DEPRECATED
839 void gtk_widget_draw (GtkWidget *widget,
840 const GdkRectangle *area);
841 #endif /* GTK_DISABLE_DEPRECATED */
842 void gtk_widget_size_request (GtkWidget *widget,
843 GtkRequisition *requisition);
844 void gtk_widget_size_allocate (GtkWidget *widget,
845 GtkAllocation *allocation);
846 void gtk_widget_get_desired_size (GtkWidget *widget,
847 GtkRequisition *minimum_size,
848 GtkRequisition *natural_size);
849 void gtk_widget_get_child_requisition (GtkWidget *widget,
850 GtkRequisition *requisition);
851 void gtk_widget_add_accelerator (GtkWidget *widget,
852 const gchar *accel_signal,
853 GtkAccelGroup *accel_group,
855 GdkModifierType accel_mods,
856 GtkAccelFlags accel_flags);
857 gboolean gtk_widget_remove_accelerator (GtkWidget *widget,
858 GtkAccelGroup *accel_group,
860 GdkModifierType accel_mods);
861 void gtk_widget_set_accel_path (GtkWidget *widget,
862 const gchar *accel_path,
863 GtkAccelGroup *accel_group);
864 const gchar* _gtk_widget_get_accel_path (GtkWidget *widget,
866 GList* gtk_widget_list_accel_closures (GtkWidget *widget);
867 gboolean gtk_widget_can_activate_accel (GtkWidget *widget,
869 gboolean gtk_widget_mnemonic_activate (GtkWidget *widget,
870 gboolean group_cycling);
871 gboolean gtk_widget_event (GtkWidget *widget,
873 gint gtk_widget_send_expose (GtkWidget *widget,
876 gboolean gtk_widget_activate (GtkWidget *widget);
877 gboolean gtk_widget_set_scroll_adjustments (GtkWidget *widget,
878 GtkAdjustment *hadjustment,
879 GtkAdjustment *vadjustment);
881 void gtk_widget_reparent (GtkWidget *widget,
882 GtkWidget *new_parent);
883 gboolean gtk_widget_intersect (GtkWidget *widget,
884 const GdkRectangle *area,
885 GdkRectangle *intersection);
886 GdkRegion *gtk_widget_region_intersect (GtkWidget *widget,
887 const GdkRegion *region);
889 void gtk_widget_freeze_child_notify (GtkWidget *widget);
890 void gtk_widget_child_notify (GtkWidget *widget,
891 const gchar *child_property);
892 void gtk_widget_thaw_child_notify (GtkWidget *widget);
894 void gtk_widget_set_can_focus (GtkWidget *widget,
896 gboolean gtk_widget_get_can_focus (GtkWidget *widget);
897 gboolean gtk_widget_has_focus (GtkWidget *widget);
898 gboolean gtk_widget_is_focus (GtkWidget *widget);
899 void gtk_widget_grab_focus (GtkWidget *widget);
901 void gtk_widget_set_can_default (GtkWidget *widget,
902 gboolean can_default);
903 gboolean gtk_widget_get_can_default (GtkWidget *widget);
904 gboolean gtk_widget_has_default (GtkWidget *widget);
905 void gtk_widget_grab_default (GtkWidget *widget);
907 void gtk_widget_set_receives_default (GtkWidget *widget,
908 gboolean receives_default);
909 gboolean gtk_widget_get_receives_default (GtkWidget *widget);
911 gboolean gtk_widget_has_grab (GtkWidget *widget);
913 void gtk_widget_set_name (GtkWidget *widget,
915 G_CONST_RETURN gchar* gtk_widget_get_name (GtkWidget *widget);
917 void gtk_widget_set_state (GtkWidget *widget,
919 GtkStateType gtk_widget_get_state (GtkWidget *widget);
921 void gtk_widget_set_sensitive (GtkWidget *widget,
923 gboolean gtk_widget_get_sensitive (GtkWidget *widget);
924 gboolean gtk_widget_is_sensitive (GtkWidget *widget);
926 void gtk_widget_set_visible (GtkWidget *widget,
928 gboolean gtk_widget_get_visible (GtkWidget *widget);
930 void gtk_widget_set_has_window (GtkWidget *widget,
931 gboolean has_window);
932 gboolean gtk_widget_get_has_window (GtkWidget *widget);
934 gboolean gtk_widget_is_toplevel (GtkWidget *widget);
935 gboolean gtk_widget_is_drawable (GtkWidget *widget);
936 void gtk_widget_set_realized (GtkWidget *widget,
938 gboolean gtk_widget_get_realized (GtkWidget *widget);
939 void gtk_widget_set_mapped (GtkWidget *widget,
941 gboolean gtk_widget_get_mapped (GtkWidget *widget);
943 void gtk_widget_set_app_paintable (GtkWidget *widget,
944 gboolean app_paintable);
945 gboolean gtk_widget_get_app_paintable (GtkWidget *widget);
947 void gtk_widget_set_double_buffered (GtkWidget *widget,
948 gboolean double_buffered);
949 gboolean gtk_widget_get_double_buffered (GtkWidget *widget);
951 void gtk_widget_set_redraw_on_allocate (GtkWidget *widget,
952 gboolean redraw_on_allocate);
954 void gtk_widget_set_parent (GtkWidget *widget,
956 GtkWidget * gtk_widget_get_parent (GtkWidget *widget);
958 void gtk_widget_set_parent_window (GtkWidget *widget,
959 GdkWindow *parent_window);
960 GdkWindow * gtk_widget_get_parent_window (GtkWidget *widget);
962 void gtk_widget_set_child_visible (GtkWidget *widget,
963 gboolean is_visible);
964 gboolean gtk_widget_get_child_visible (GtkWidget *widget);
966 void gtk_widget_set_window (GtkWidget *widget,
968 GdkWindow * gtk_widget_get_window (GtkWidget *widget);
970 void gtk_widget_get_allocation (GtkWidget *widget,
971 GtkAllocation *allocation);
972 void gtk_widget_set_allocation (GtkWidget *widget,
973 const GtkAllocation *allocation);
975 void gtk_widget_get_requisition (GtkWidget *widget,
976 GtkRequisition *requisition);
978 gboolean gtk_widget_child_focus (GtkWidget *widget,
979 GtkDirectionType direction);
980 gboolean gtk_widget_keynav_failed (GtkWidget *widget,
981 GtkDirectionType direction);
982 void gtk_widget_error_bell (GtkWidget *widget);
984 void gtk_widget_set_size_request (GtkWidget *widget,
987 void gtk_widget_get_size_request (GtkWidget *widget,
990 #ifndef GTK_DISABLE_DEPRECATED
991 void gtk_widget_set_uposition (GtkWidget *widget,
994 void gtk_widget_set_usize (GtkWidget *widget,
999 void gtk_widget_set_events (GtkWidget *widget,
1001 void gtk_widget_add_events (GtkWidget *widget,
1003 void gtk_widget_set_extension_events (GtkWidget *widget,
1004 GdkExtensionMode mode);
1006 GdkExtensionMode gtk_widget_get_extension_events (GtkWidget *widget);
1007 GtkWidget* gtk_widget_get_toplevel (GtkWidget *widget);
1008 GtkWidget* gtk_widget_get_ancestor (GtkWidget *widget,
1010 GdkColormap* gtk_widget_get_colormap (GtkWidget *widget);
1011 GdkVisual* gtk_widget_get_visual (GtkWidget *widget);
1013 GdkScreen * gtk_widget_get_screen (GtkWidget *widget);
1014 gboolean gtk_widget_has_screen (GtkWidget *widget);
1015 GdkDisplay * gtk_widget_get_display (GtkWidget *widget);
1016 GdkWindow * gtk_widget_get_root_window (GtkWidget *widget);
1017 GtkSettings* gtk_widget_get_settings (GtkWidget *widget);
1018 GtkClipboard *gtk_widget_get_clipboard (GtkWidget *widget,
1020 GdkPixmap * gtk_widget_get_snapshot (GtkWidget *widget,
1021 GdkRectangle *clip_rect);
1023 #ifndef GTK_DISABLE_DEPRECATED
1026 * gtk_widget_set_visual:
1027 * @widget: a #GtkWidget
1030 * This function is deprecated; it does nothing.
1032 #define gtk_widget_set_visual(widget,visual) ((void) 0)
1035 * gtk_widget_push_visual:
1038 * This function is deprecated; it does nothing.
1040 #define gtk_widget_push_visual(visual) ((void) 0)
1043 * gtk_widget_pop_visual:
1045 * This function is deprecated; it does nothing.
1047 #define gtk_widget_pop_visual() ((void) 0)
1050 * gtk_widget_set_default_visual:
1053 * This function is deprecated; it does nothing.
1055 #define gtk_widget_set_default_visual(visual) ((void) 0)
1057 #endif /* GTK_DISABLE_DEPRECATED */
1059 /* Accessibility support */
1060 AtkObject* gtk_widget_get_accessible (GtkWidget *widget);
1062 /* The following functions must not be called on an already
1063 * realized widget. Because it is possible that somebody
1064 * can call get_colormap() or get_visual() and save the
1065 * result, these functions are probably only safe to
1066 * call in a widget's init() function.
1068 void gtk_widget_set_colormap (GtkWidget *widget,
1069 GdkColormap *colormap);
1071 gint gtk_widget_get_events (GtkWidget *widget);
1072 void gtk_widget_get_pointer (GtkWidget *widget,
1076 gboolean gtk_widget_is_ancestor (GtkWidget *widget,
1077 GtkWidget *ancestor);
1079 gboolean gtk_widget_translate_coordinates (GtkWidget *src_widget,
1080 GtkWidget *dest_widget,
1086 /* Hide widget and return TRUE.
1088 gboolean gtk_widget_hide_on_delete (GtkWidget *widget);
1092 void gtk_widget_style_attach (GtkWidget *style);
1094 gboolean gtk_widget_has_rc_style (GtkWidget *widget);
1095 void gtk_widget_set_style (GtkWidget *widget,
1097 void gtk_widget_ensure_style (GtkWidget *widget);
1098 GtkStyle * gtk_widget_get_style (GtkWidget *widget);
1100 void gtk_widget_modify_style (GtkWidget *widget,
1102 GtkRcStyle *gtk_widget_get_modifier_style (GtkWidget *widget);
1103 void gtk_widget_modify_fg (GtkWidget *widget,
1105 const GdkColor *color);
1106 void gtk_widget_modify_bg (GtkWidget *widget,
1108 const GdkColor *color);
1109 void gtk_widget_modify_text (GtkWidget *widget,
1111 const GdkColor *color);
1112 void gtk_widget_modify_base (GtkWidget *widget,
1114 const GdkColor *color);
1115 void gtk_widget_modify_cursor (GtkWidget *widget,
1116 const GdkColor *primary,
1117 const GdkColor *secondary);
1118 void gtk_widget_modify_font (GtkWidget *widget,
1119 PangoFontDescription *font_desc);
1121 #ifndef GTK_DISABLE_DEPRECATED
1124 * gtk_widget_set_rc_style:
1125 * @widget: a #GtkWidget.
1127 * Equivalent to <literal>gtk_widget_set_style (widget, NULL)</literal>.
1129 * Deprecated: 2.0: Use gtk_widget_set_style() with a %NULL @style argument instead.
1131 #define gtk_widget_set_rc_style(widget) (gtk_widget_set_style (widget, NULL))
1134 * gtk_widget_restore_default_style:
1135 * @widget: a #GtkWidget.
1137 * Equivalent to <literal>gtk_widget_set_style (widget, NULL)</literal>.
1139 * Deprecated: 2.0: Use gtk_widget_set_style() with a %NULL @style argument instead.
1141 #define gtk_widget_restore_default_style(widget) (gtk_widget_set_style (widget, NULL))
1144 PangoContext *gtk_widget_create_pango_context (GtkWidget *widget);
1145 PangoContext *gtk_widget_get_pango_context (GtkWidget *widget);
1146 PangoLayout *gtk_widget_create_pango_layout (GtkWidget *widget,
1149 GdkPixbuf *gtk_widget_render_icon (GtkWidget *widget,
1150 const gchar *stock_id,
1152 const gchar *detail);
1154 /* handle composite names for GTK_COMPOSITE_CHILD widgets,
1155 * the returned name is newly allocated.
1157 void gtk_widget_set_composite_name (GtkWidget *widget,
1159 gchar* gtk_widget_get_composite_name (GtkWidget *widget);
1161 /* Descend recursively and set rc-style on all widgets without user styles */
1162 void gtk_widget_reset_rc_styles (GtkWidget *widget);
1164 /* Push/pop pairs, to change default values upon a widget's creation.
1165 * This will override the values that got set by the
1166 * gtk_widget_set_default_* () functions.
1168 void gtk_widget_push_colormap (GdkColormap *cmap);
1169 void gtk_widget_push_composite_child (void);
1170 void gtk_widget_pop_composite_child (void);
1171 void gtk_widget_pop_colormap (void);
1173 /* widget style properties
1175 void gtk_widget_class_install_style_property (GtkWidgetClass *klass,
1177 void gtk_widget_class_install_style_property_parser (GtkWidgetClass *klass,
1179 GtkRcPropertyParser parser);
1180 GParamSpec* gtk_widget_class_find_style_property (GtkWidgetClass *klass,
1181 const gchar *property_name);
1182 GParamSpec** gtk_widget_class_list_style_properties (GtkWidgetClass *klass,
1183 guint *n_properties);
1184 void gtk_widget_style_get_property (GtkWidget *widget,
1185 const gchar *property_name,
1187 void gtk_widget_style_get_valist (GtkWidget *widget,
1188 const gchar *first_property_name,
1190 void gtk_widget_style_get (GtkWidget *widget,
1191 const gchar *first_property_name,
1192 ...) G_GNUC_NULL_TERMINATED;
1195 /* Set certain default values to be used at widget creation time.
1197 void gtk_widget_set_default_colormap (GdkColormap *colormap);
1198 GtkStyle* gtk_widget_get_default_style (void);
1199 #ifndef GDK_MULTIHEAD_SAFE
1200 GdkColormap* gtk_widget_get_default_colormap (void);
1201 GdkVisual* gtk_widget_get_default_visual (void);
1204 /* Functions for setting directionality for widgets
1207 void gtk_widget_set_direction (GtkWidget *widget,
1208 GtkTextDirection dir);
1209 GtkTextDirection gtk_widget_get_direction (GtkWidget *widget);
1211 void gtk_widget_set_default_direction (GtkTextDirection dir);
1212 GtkTextDirection gtk_widget_get_default_direction (void);
1214 /* Compositing manager functionality */
1215 gboolean gtk_widget_is_composited (GtkWidget *widget);
1217 /* Counterpart to gdk_window_shape_combine_mask.
1219 void gtk_widget_shape_combine_mask (GtkWidget *widget,
1220 GdkBitmap *shape_mask,
1223 void gtk_widget_input_shape_combine_mask (GtkWidget *widget,
1224 GdkBitmap *shape_mask,
1228 /* internal function */
1229 void gtk_widget_reset_shapes (GtkWidget *widget);
1231 /* Compute a widget's path in the form "GtkWindow.MyLabel", and
1232 * return newly alocated strings.
1234 void gtk_widget_path (GtkWidget *widget,
1237 gchar **path_reversed);
1238 void gtk_widget_class_path (GtkWidget *widget,
1241 gchar **path_reversed);
1243 GList* gtk_widget_list_mnemonic_labels (GtkWidget *widget);
1244 void gtk_widget_add_mnemonic_label (GtkWidget *widget,
1246 void gtk_widget_remove_mnemonic_label (GtkWidget *widget,
1249 void gtk_widget_set_tooltip_window (GtkWidget *widget,
1250 GtkWindow *custom_window);
1251 GtkWindow *gtk_widget_get_tooltip_window (GtkWidget *widget);
1252 void gtk_widget_trigger_tooltip_query (GtkWidget *widget);
1253 void gtk_widget_set_tooltip_text (GtkWidget *widget,
1255 gchar * gtk_widget_get_tooltip_text (GtkWidget *widget);
1256 void gtk_widget_set_tooltip_markup (GtkWidget *widget,
1257 const gchar *markup);
1258 gchar * gtk_widget_get_tooltip_markup (GtkWidget *widget);
1259 void gtk_widget_set_has_tooltip (GtkWidget *widget,
1260 gboolean has_tooltip);
1261 gboolean gtk_widget_get_has_tooltip (GtkWidget *widget);
1263 GType gtk_requisition_get_type (void) G_GNUC_CONST;
1264 GtkRequisition *gtk_requisition_copy (const GtkRequisition *requisition);
1265 void gtk_requisition_free (GtkRequisition *requisition);
1267 #if defined (GTK_TRACE_OBJECTS) && defined (__GNUC__)
1268 # define gtk_widget_ref g_object_ref
1269 # define gtk_widget_unref g_object_unref
1270 #endif /* GTK_TRACE_OBJECTS && __GNUC__ */
1272 void _gtk_widget_grab_notify (GtkWidget *widget,
1273 gboolean was_grabbed);
1275 GtkWidgetAuxInfo *_gtk_widget_get_aux_info (GtkWidget *widget,
1277 void _gtk_widget_propagate_hierarchy_changed (GtkWidget *widget,
1278 GtkWidget *previous_toplevel);
1279 void _gtk_widget_propagate_screen_changed (GtkWidget *widget,
1280 GdkScreen *previous_screen);
1281 void _gtk_widget_propagate_composited_changed (GtkWidget *widget);
1283 void _gtk_widget_set_pointer_window (GtkWidget *widget,
1284 GdkWindow *pointer_window);
1285 GdkWindow *_gtk_widget_get_pointer_window (GtkWidget *widget);
1286 gboolean _gtk_widget_is_pointer_widget (GtkWidget *widget);
1287 void _gtk_widget_synthesize_crossing (GtkWidget *from,
1289 GdkCrossingMode mode);
1291 GdkColormap* _gtk_widget_peek_colormap (void);
1293 void _gtk_widget_buildable_finish_accelerator (GtkWidget *widget,
1294 GtkWidget *toplevel,
1295 gpointer user_data);
1299 #endif /* __GTK_WIDGET_H__ */