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_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/gtkadjustment.h>
37 #include <gtk/gtkstyle.h>
38 #include <gtk/gtksettings.h>
43 /* Kinds of widget-specific help */
46 GTK_WIDGET_HELP_TOOLTIP,
47 GTK_WIDGET_HELP_WHATS_THIS
50 /* Macro for casting a pointer to a GtkWidget or GtkWidgetClass pointer.
51 * Macros for testing whether `widget' or `klass' are of type GTK_TYPE_WIDGET.
53 #define GTK_TYPE_WIDGET (gtk_widget_get_type ())
54 #define GTK_WIDGET(widget) (G_TYPE_CHECK_INSTANCE_CAST ((widget), GTK_TYPE_WIDGET, GtkWidget))
55 #define GTK_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_WIDGET, GtkWidgetClass))
56 #define GTK_IS_WIDGET(widget) (G_TYPE_CHECK_INSTANCE_TYPE ((widget), GTK_TYPE_WIDGET))
57 #define GTK_IS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WIDGET))
58 #define GTK_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_WIDGET, GtkWidgetClass))
60 #define GTK_TYPE_REQUISITION (gtk_requisition_get_type ())
62 /* forward declaration to avoid excessive includes (and concurrent includes)
64 typedef struct _GtkRequisition GtkRequisition;
65 typedef struct _GtkSelectionData GtkSelectionData;
66 typedef struct _GtkWidgetPrivate GtkWidgetPrivate;
67 typedef struct _GtkWidgetClass GtkWidgetClass;
68 typedef struct _GtkWidgetAuxInfo GtkWidgetAuxInfo;
69 typedef struct _GtkClipboard GtkClipboard;
70 typedef struct _GtkTooltip GtkTooltip;
71 typedef struct _GtkWindow GtkWindow;
76 * @x: the X position of the widget's area relative to its parents allocation.
77 * @y: the Y position of the widget's area relative to its parents allocation.
78 * @width: the width of the widget's allocated area.
79 * @height: the height of the widget's allocated area.
81 * A <structname>GtkAllocation</structname> of a widget represents region
82 * which has been allocated to the widget by its parent. It is a subregion
83 * of its parents allocation. See <xref linkend="geometry-management"/> for
86 typedef GdkRectangle GtkAllocation;
90 * @widget: the widget to operate on
91 * @data: user-supplied data
93 * The type of the callback functions used for e.g. iterating over
94 * the children of a container, see gtk_container_foreach().
96 typedef void (*GtkCallback) (GtkWidget *widget,
101 * @width: the widget's desired width
102 * @height: the widget's desired height
104 * A <structname>GtkRequisition</structname> represents the desired size of a widget. See
105 * <xref linkend="geometry-management"/> for more information.
107 struct _GtkRequisition
113 /* The widget is the base of the tree for displayable objects.
114 * (A displayable object is one which takes up some amount
115 * of screen real estate). It provides a common base and interface
116 * which actual widgets must adhere to.
120 GInitiallyUnowned parent_instance;
122 GtkWidgetPrivate *priv;
127 * @parent_class: The object class structure needs to be the first
128 * element in the widget class structure in order for the class mechanism
129 * to work correctly. This allows a GtkWidgetClass pointer to be cast to
130 * a GObjectClass pointer.
131 * @activate_signal: The signal to emit when a widget of this class is
132 * activated, gtk_widget_activate() handles the emission.
133 * Implementation of this signal is optional.
134 * @get_request_mode: This allows a widget to tell its parent container whether
135 * it prefers to be allocated in %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH or
136 * %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT mode.
137 * %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH means the widget prefers to have
138 * #GtkWidgetClass.get_preferred_width() called and then
139 * #GtkWidgetClass.get_preferred_height_for_width() and is the default
140 * return for unimplemented cases.
141 * However it's important to note (as described below) that any widget
142 * which trades height-for-width must respond properly to both
143 * #GtkSizeRequestModes since it might be queried in either orientation
144 * by its parent container.
145 * @get_preferred_height: This is called by containers to obtain the minimum
146 * and natural height of a widget. A widget that does not actually trade
147 * any height for width or width for height only has to implement these
148 * two virtual methods (#GtkWidgetClass.get_preferred_width() and
149 * #GtkWidgetClass.get_preferred_height()).
150 * @get_preferred_width_for_height: This is analogous to
151 * #GtkWidgetClass.get_preferred_height_for_width() except that it
152 * operates in the oposite orientation. It's rare that a widget actually
153 * does %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT requests but this can happen
154 * when, for example, a widget or container gets additional columns to
155 * compensate for a smaller allocated height.
156 * @get_preferred_width: This is called by containers to obtain the minimum
157 * and natural width of a widget. A widget will never be allocated a width
158 * less than its minimum and will only ever be allocated a width greater
159 * than the natural width once all of the said widget's siblings have
160 * received their natural widths.
161 * Furthermore, a widget will only ever be allocated a width greater than
162 * its natural width if it was configured to receive extra expand space
163 * from its parent container.
164 * @get_preferred_height_for_width: This is similar to
165 * #GtkWidgetClass.get_preferred_height() except that it is passed a
166 * contextual width to request height for. By implementing this virtual
167 * method it is possible for a #GtkLabel to tell its parent how much height
168 * would be required if the label were to be allocated a said width.
169 * @adjust_size_request: Convert an initial size request from a widget's
170 * #GtkSizeRequest virtual method implementations into a size request to
171 * be used by parent containers in laying out the widget.
172 * adjust_size_request adjusts <emphasis>from</emphasis> a child widget's
173 * original request <emphasis>to</emphasis> what a parent container should
174 * use for layout. The @for_size argument will be -1 if the request should
175 * not be for a particular size in the opposing orientation, i.e. if the
176 * request is not height-for-width or width-for-height. If @for_size is
177 * greater than -1, it is the proposed allocation in the opposing
178 * orientation that we need the request for. Implementations of
179 * adjust_size_request should chain up to the default implementation,
180 * which applies #GtkWidget's margin properties and imposes any values
181 * from gtk_widget_set_size_request(). Chaining up should be last,
182 * <emphasis>after</emphasis> your subclass adjusts the request, so
183 * #GtkWidget can apply constraints and add the margin properly.
184 * @adjust_size_allocation: Convert an initial size allocation assigned
185 * by a #GtkContainer using gtk_widget_size_allocate(), into an actual
186 * size allocation to be used by the widget. adjust_size_allocation
187 * adjusts <emphasis>to</emphasis> a child widget's actual allocation
188 * <emphasis>from</emphasis> what a parent container computed for the
189 * child. The adjusted allocation must be entirely within the original
190 * allocation. In any custom implementation, chain up to the default
191 * #GtkWidget implementation of this method, which applies the margin
192 * and alignment properties of #GtkWidget. Chain up
193 * <emphasis>before</emphasis> performing your own adjustments so your
194 * own adjustments remove more allocation after the #GtkWidget base
195 * class has already removed margin and alignment. The natural size
196 * passed in should be adjusted in the same way as the allocated size,
197 * which allows adjustments to perform alignments or other changes
198 * based on natural size.
200 struct _GtkWidgetClass
202 GInitiallyUnownedClass parent_class;
206 guint activate_signal;
208 /* seldomly overidden */
209 void (*dispatch_child_properties_changed) (GtkWidget *widget,
211 GParamSpec **pspecs);
214 void (* destroy) (GtkWidget *widget);
215 void (* show) (GtkWidget *widget);
216 void (* show_all) (GtkWidget *widget);
217 void (* hide) (GtkWidget *widget);
218 void (* map) (GtkWidget *widget);
219 void (* unmap) (GtkWidget *widget);
220 void (* realize) (GtkWidget *widget);
221 void (* unrealize) (GtkWidget *widget);
222 void (* size_allocate) (GtkWidget *widget,
223 GtkAllocation *allocation);
224 void (* state_changed) (GtkWidget *widget,
225 GtkStateType previous_state);
226 void (* parent_set) (GtkWidget *widget,
227 GtkWidget *previous_parent);
228 void (* hierarchy_changed) (GtkWidget *widget,
229 GtkWidget *previous_toplevel);
230 void (* style_set) (GtkWidget *widget,
231 GtkStyle *previous_style);
232 void (* direction_changed) (GtkWidget *widget,
233 GtkTextDirection previous_direction);
234 void (* grab_notify) (GtkWidget *widget,
235 gboolean was_grabbed);
236 void (* child_notify) (GtkWidget *widget,
238 gboolean (* draw) (GtkWidget *widget,
242 GtkSizeRequestMode (* get_request_mode) (GtkWidget *widget);
244 void (* get_preferred_height) (GtkWidget *widget,
245 gint *minimum_height,
246 gint *natural_height);
247 void (* get_preferred_width_for_height) (GtkWidget *widget,
250 gint *natural_width);
251 void (* get_preferred_width) (GtkWidget *widget,
253 gint *natural_width);
254 void (* get_preferred_height_for_width) (GtkWidget *widget,
256 gint *minimum_height,
257 gint *natural_height);
260 gboolean (* mnemonic_activate) (GtkWidget *widget,
261 gboolean group_cycling);
264 void (* grab_focus) (GtkWidget *widget);
265 gboolean (* focus) (GtkWidget *widget,
266 GtkDirectionType direction);
268 /* keyboard navigation */
269 void (* move_focus) (GtkWidget *widget,
270 GtkDirectionType direction);
271 gboolean (* keynav_failed) (GtkWidget *widget,
272 GtkDirectionType direction);
275 gboolean (* event) (GtkWidget *widget,
277 gboolean (* button_press_event) (GtkWidget *widget,
278 GdkEventButton *event);
279 gboolean (* button_release_event) (GtkWidget *widget,
280 GdkEventButton *event);
281 gboolean (* scroll_event) (GtkWidget *widget,
282 GdkEventScroll *event);
283 gboolean (* motion_notify_event) (GtkWidget *widget,
284 GdkEventMotion *event);
285 gboolean (* delete_event) (GtkWidget *widget,
287 gboolean (* destroy_event) (GtkWidget *widget,
289 gboolean (* key_press_event) (GtkWidget *widget,
291 gboolean (* key_release_event) (GtkWidget *widget,
293 gboolean (* enter_notify_event) (GtkWidget *widget,
294 GdkEventCrossing *event);
295 gboolean (* leave_notify_event) (GtkWidget *widget,
296 GdkEventCrossing *event);
297 gboolean (* configure_event) (GtkWidget *widget,
298 GdkEventConfigure *event);
299 gboolean (* focus_in_event) (GtkWidget *widget,
300 GdkEventFocus *event);
301 gboolean (* focus_out_event) (GtkWidget *widget,
302 GdkEventFocus *event);
303 gboolean (* map_event) (GtkWidget *widget,
305 gboolean (* unmap_event) (GtkWidget *widget,
307 gboolean (* property_notify_event) (GtkWidget *widget,
308 GdkEventProperty *event);
309 gboolean (* selection_clear_event) (GtkWidget *widget,
310 GdkEventSelection *event);
311 gboolean (* selection_request_event) (GtkWidget *widget,
312 GdkEventSelection *event);
313 gboolean (* selection_notify_event) (GtkWidget *widget,
314 GdkEventSelection *event);
315 gboolean (* proximity_in_event) (GtkWidget *widget,
316 GdkEventProximity *event);
317 gboolean (* proximity_out_event) (GtkWidget *widget,
318 GdkEventProximity *event);
319 gboolean (* visibility_notify_event) (GtkWidget *widget,
320 GdkEventVisibility *event);
321 gboolean (* client_event) (GtkWidget *widget,
322 GdkEventClient *event);
323 gboolean (* no_expose_event) (GtkWidget *widget,
325 gboolean (* window_state_event) (GtkWidget *widget,
326 GdkEventWindowState *event);
327 gboolean (* damage_event) (GtkWidget *widget,
328 GdkEventExpose *event);
329 gboolean (* grab_broken_event) (GtkWidget *widget,
330 GdkEventGrabBroken *event);
333 void (* selection_get) (GtkWidget *widget,
334 GtkSelectionData *selection_data,
337 void (* selection_received) (GtkWidget *widget,
338 GtkSelectionData *selection_data,
341 /* Source side drag signals */
342 void (* drag_begin) (GtkWidget *widget,
343 GdkDragContext *context);
344 void (* drag_end) (GtkWidget *widget,
345 GdkDragContext *context);
346 void (* drag_data_get) (GtkWidget *widget,
347 GdkDragContext *context,
348 GtkSelectionData *selection_data,
351 void (* drag_data_delete) (GtkWidget *widget,
352 GdkDragContext *context);
354 /* Target side drag signals */
355 void (* drag_leave) (GtkWidget *widget,
356 GdkDragContext *context,
358 gboolean (* drag_motion) (GtkWidget *widget,
359 GdkDragContext *context,
363 gboolean (* drag_drop) (GtkWidget *widget,
364 GdkDragContext *context,
368 void (* drag_data_received) (GtkWidget *widget,
369 GdkDragContext *context,
372 GtkSelectionData *selection_data,
376 /* Signals used only for keybindings */
377 gboolean (* popup_menu) (GtkWidget *widget);
379 /* If a widget has multiple tooltips/whatsthis, it should show the
380 * one for the current focus location, or if that doesn't make
381 * sense, should cycle through them showing each tip alongside
382 * whatever piece of the widget it applies to.
384 gboolean (* show_help) (GtkWidget *widget,
385 GtkWidgetHelpType help_type);
387 /* accessibility support
389 AtkObject * (* get_accessible) (GtkWidget *widget);
391 void (* screen_changed) (GtkWidget *widget,
392 GdkScreen *previous_screen);
393 gboolean (* can_activate_accel) (GtkWidget *widget,
397 void (* composited_changed) (GtkWidget *widget);
399 gboolean (* query_tooltip) (GtkWidget *widget,
402 gboolean keyboard_tooltip,
403 GtkTooltip *tooltip);
405 void (* compute_expand) (GtkWidget *widget,
407 gboolean *vexpand_p);
409 void (* adjust_size_request) (GtkWidget *widget,
410 GtkOrientation orientation,
413 void (* adjust_size_allocation) (GtkWidget *widget,
414 GtkOrientation orientation,
417 gint *allocated_size);
421 /* Padding for future expansion */
422 void (*_gtk_reserved1) (void);
423 void (*_gtk_reserved2) (void);
424 void (*_gtk_reserved3) (void);
425 void (*_gtk_reserved4) (void);
426 void (*_gtk_reserved5) (void);
427 void (*_gtk_reserved6) (void);
428 void (*_gtk_reserved7) (void);
429 void (*_gtk_reserved8) (void);
432 struct _GtkWidgetAuxInfo
443 GType gtk_widget_get_type (void) G_GNUC_CONST;
444 GtkWidget* gtk_widget_new (GType type,
445 const gchar *first_property_name,
447 void gtk_widget_destroy (GtkWidget *widget);
448 void gtk_widget_destroyed (GtkWidget *widget,
449 GtkWidget **widget_pointer);
450 void gtk_widget_unparent (GtkWidget *widget);
451 void gtk_widget_show (GtkWidget *widget);
452 void gtk_widget_hide (GtkWidget *widget);
453 void gtk_widget_show_now (GtkWidget *widget);
454 void gtk_widget_show_all (GtkWidget *widget);
455 void gtk_widget_set_no_show_all (GtkWidget *widget,
456 gboolean no_show_all);
457 gboolean gtk_widget_get_no_show_all (GtkWidget *widget);
458 void gtk_widget_map (GtkWidget *widget);
459 void gtk_widget_unmap (GtkWidget *widget);
460 void gtk_widget_realize (GtkWidget *widget);
461 void gtk_widget_unrealize (GtkWidget *widget);
463 void gtk_widget_draw (GtkWidget *widget,
466 void gtk_widget_queue_draw (GtkWidget *widget);
467 void gtk_widget_queue_draw_area (GtkWidget *widget,
472 void gtk_widget_queue_draw_region (GtkWidget *widget,
473 cairo_region_t *region);
474 void gtk_widget_queue_resize (GtkWidget *widget);
475 void gtk_widget_queue_resize_no_redraw (GtkWidget *widget);
476 #ifndef GTK_DISABLE_DEPRECATED
477 void gtk_widget_size_request (GtkWidget *widget,
478 GtkRequisition *requisition);
480 void gtk_widget_size_allocate (GtkWidget *widget,
481 GtkAllocation *allocation);
483 GtkSizeRequestMode gtk_widget_get_request_mode (GtkWidget *widget);
484 void gtk_widget_get_preferred_width (GtkWidget *widget,
486 gint *natural_width);
487 void gtk_widget_get_preferred_height_for_width (GtkWidget *widget,
489 gint *minimum_height,
490 gint *natural_height);
491 void gtk_widget_get_preferred_height (GtkWidget *widget,
492 gint *minimum_height,
493 gint *natural_height);
494 void gtk_widget_get_preferred_width_for_height (GtkWidget *widget,
497 gint *natural_width);
498 void gtk_widget_get_preferred_size (GtkWidget *widget,
499 GtkRequisition *minimum_size,
500 GtkRequisition *natural_size);
502 #ifndef GTK_DISABLE_DEPRECATED
503 void gtk_widget_get_child_requisition (GtkWidget *widget,
504 GtkRequisition *requisition);
506 void gtk_widget_add_accelerator (GtkWidget *widget,
507 const gchar *accel_signal,
508 GtkAccelGroup *accel_group,
510 GdkModifierType accel_mods,
511 GtkAccelFlags accel_flags);
512 gboolean gtk_widget_remove_accelerator (GtkWidget *widget,
513 GtkAccelGroup *accel_group,
515 GdkModifierType accel_mods);
516 void gtk_widget_set_accel_path (GtkWidget *widget,
517 const gchar *accel_path,
518 GtkAccelGroup *accel_group);
519 const gchar* _gtk_widget_get_accel_path (GtkWidget *widget,
521 GList* gtk_widget_list_accel_closures (GtkWidget *widget);
522 gboolean gtk_widget_can_activate_accel (GtkWidget *widget,
524 gboolean gtk_widget_mnemonic_activate (GtkWidget *widget,
525 gboolean group_cycling);
526 gboolean gtk_widget_event (GtkWidget *widget,
528 gint gtk_widget_send_expose (GtkWidget *widget,
530 gboolean gtk_widget_send_focus_change (GtkWidget *widget,
533 gboolean gtk_widget_activate (GtkWidget *widget);
535 void gtk_widget_reparent (GtkWidget *widget,
536 GtkWidget *new_parent);
537 gboolean gtk_widget_intersect (GtkWidget *widget,
538 const GdkRectangle *area,
539 GdkRectangle *intersection);
540 cairo_region_t *gtk_widget_region_intersect (GtkWidget *widget,
541 const cairo_region_t *region);
543 void gtk_widget_freeze_child_notify (GtkWidget *widget);
544 void gtk_widget_child_notify (GtkWidget *widget,
545 const gchar *child_property);
546 void gtk_widget_thaw_child_notify (GtkWidget *widget);
548 void gtk_widget_set_can_focus (GtkWidget *widget,
550 gboolean gtk_widget_get_can_focus (GtkWidget *widget);
551 gboolean gtk_widget_has_focus (GtkWidget *widget);
552 gboolean gtk_widget_is_focus (GtkWidget *widget);
553 void gtk_widget_grab_focus (GtkWidget *widget);
555 void gtk_widget_set_can_default (GtkWidget *widget,
556 gboolean can_default);
557 gboolean gtk_widget_get_can_default (GtkWidget *widget);
558 gboolean gtk_widget_has_default (GtkWidget *widget);
559 void gtk_widget_grab_default (GtkWidget *widget);
561 void gtk_widget_set_receives_default (GtkWidget *widget,
562 gboolean receives_default);
563 gboolean gtk_widget_get_receives_default (GtkWidget *widget);
565 gboolean gtk_widget_has_grab (GtkWidget *widget);
567 gboolean gtk_widget_device_is_shadowed (GtkWidget *widget,
571 void gtk_widget_set_name (GtkWidget *widget,
573 G_CONST_RETURN gchar* gtk_widget_get_name (GtkWidget *widget);
575 void gtk_widget_set_state (GtkWidget *widget,
577 GtkStateType gtk_widget_get_state (GtkWidget *widget);
579 void gtk_widget_set_sensitive (GtkWidget *widget,
581 gboolean gtk_widget_get_sensitive (GtkWidget *widget);
582 gboolean gtk_widget_is_sensitive (GtkWidget *widget);
584 void gtk_widget_set_visible (GtkWidget *widget,
586 gboolean gtk_widget_get_visible (GtkWidget *widget);
588 void gtk_widget_set_has_window (GtkWidget *widget,
589 gboolean has_window);
590 gboolean gtk_widget_get_has_window (GtkWidget *widget);
592 gboolean gtk_widget_is_toplevel (GtkWidget *widget);
593 gboolean gtk_widget_is_drawable (GtkWidget *widget);
594 void gtk_widget_set_realized (GtkWidget *widget,
596 gboolean gtk_widget_get_realized (GtkWidget *widget);
597 void gtk_widget_set_mapped (GtkWidget *widget,
599 gboolean gtk_widget_get_mapped (GtkWidget *widget);
601 void gtk_widget_set_app_paintable (GtkWidget *widget,
602 gboolean app_paintable);
603 gboolean gtk_widget_get_app_paintable (GtkWidget *widget);
605 void gtk_widget_set_double_buffered (GtkWidget *widget,
606 gboolean double_buffered);
607 gboolean gtk_widget_get_double_buffered (GtkWidget *widget);
609 void gtk_widget_set_redraw_on_allocate (GtkWidget *widget,
610 gboolean redraw_on_allocate);
612 void gtk_widget_set_parent (GtkWidget *widget,
614 GtkWidget * gtk_widget_get_parent (GtkWidget *widget);
616 void gtk_widget_set_parent_window (GtkWidget *widget,
617 GdkWindow *parent_window);
618 GdkWindow * gtk_widget_get_parent_window (GtkWidget *widget);
620 void gtk_widget_set_child_visible (GtkWidget *widget,
621 gboolean is_visible);
622 gboolean gtk_widget_get_child_visible (GtkWidget *widget);
624 void gtk_widget_set_window (GtkWidget *widget,
626 GdkWindow * gtk_widget_get_window (GtkWidget *widget);
628 int gtk_widget_get_allocated_width (GtkWidget *widget);
629 int gtk_widget_get_allocated_height (GtkWidget *widget);
631 void gtk_widget_get_allocation (GtkWidget *widget,
632 GtkAllocation *allocation);
633 void gtk_widget_set_allocation (GtkWidget *widget,
634 const GtkAllocation *allocation);
636 void gtk_widget_get_requisition (GtkWidget *widget,
637 GtkRequisition *requisition);
639 gboolean gtk_widget_child_focus (GtkWidget *widget,
640 GtkDirectionType direction);
641 gboolean gtk_widget_keynav_failed (GtkWidget *widget,
642 GtkDirectionType direction);
643 void gtk_widget_error_bell (GtkWidget *widget);
645 void gtk_widget_set_size_request (GtkWidget *widget,
648 void gtk_widget_get_size_request (GtkWidget *widget,
651 void gtk_widget_set_events (GtkWidget *widget,
653 void gtk_widget_add_events (GtkWidget *widget,
655 void gtk_widget_set_device_events (GtkWidget *widget,
657 GdkEventMask events);
658 void gtk_widget_add_device_events (GtkWidget *widget,
660 GdkEventMask events);
661 void gtk_widget_set_extension_events (GtkWidget *widget,
662 GdkExtensionMode mode);
664 GdkExtensionMode gtk_widget_get_extension_events (GtkWidget *widget);
665 GtkWidget* gtk_widget_get_toplevel (GtkWidget *widget);
666 GtkWidget* gtk_widget_get_ancestor (GtkWidget *widget,
668 GdkVisual* gtk_widget_get_visual (GtkWidget *widget);
669 void gtk_widget_set_visual (GtkWidget *widget,
672 GdkScreen * gtk_widget_get_screen (GtkWidget *widget);
673 gboolean gtk_widget_has_screen (GtkWidget *widget);
674 GdkDisplay * gtk_widget_get_display (GtkWidget *widget);
675 GdkWindow * gtk_widget_get_root_window (GtkWidget *widget);
676 GtkSettings* gtk_widget_get_settings (GtkWidget *widget);
677 GtkClipboard *gtk_widget_get_clipboard (GtkWidget *widget,
681 /* Expand flags and related support */
682 gboolean gtk_widget_get_hexpand (GtkWidget *widget);
683 void gtk_widget_set_hexpand (GtkWidget *widget,
685 gboolean gtk_widget_get_hexpand_set (GtkWidget *widget);
686 void gtk_widget_set_hexpand_set (GtkWidget *widget,
688 gboolean gtk_widget_get_vexpand (GtkWidget *widget);
689 void gtk_widget_set_vexpand (GtkWidget *widget,
691 gboolean gtk_widget_get_vexpand_set (GtkWidget *widget);
692 void gtk_widget_set_vexpand_set (GtkWidget *widget,
694 void gtk_widget_queue_compute_expand (GtkWidget *widget);
695 gboolean gtk_widget_compute_expand (GtkWidget *widget,
696 GtkOrientation orientation);
699 /* Multidevice support */
700 gboolean gtk_widget_get_support_multidevice (GtkWidget *widget);
701 void gtk_widget_set_support_multidevice (GtkWidget *widget,
702 gboolean support_multidevice);
704 /* Accessibility support */
705 AtkObject* gtk_widget_get_accessible (GtkWidget *widget);
708 /* Margin and alignment */
709 GtkAlign gtk_widget_get_halign (GtkWidget *widget);
710 void gtk_widget_set_halign (GtkWidget *widget,
712 GtkAlign gtk_widget_get_valign (GtkWidget *widget);
713 void gtk_widget_set_valign (GtkWidget *widget,
715 gint gtk_widget_get_margin_left (GtkWidget *widget);
716 void gtk_widget_set_margin_left (GtkWidget *widget,
718 gint gtk_widget_get_margin_right (GtkWidget *widget);
719 void gtk_widget_set_margin_right (GtkWidget *widget,
721 gint gtk_widget_get_margin_top (GtkWidget *widget);
722 void gtk_widget_set_margin_top (GtkWidget *widget,
724 gint gtk_widget_get_margin_bottom (GtkWidget *widget);
725 void gtk_widget_set_margin_bottom (GtkWidget *widget,
729 gint gtk_widget_get_events (GtkWidget *widget);
730 GdkEventMask gtk_widget_get_device_events (GtkWidget *widget,
732 void gtk_widget_get_pointer (GtkWidget *widget,
736 gboolean gtk_widget_is_ancestor (GtkWidget *widget,
737 GtkWidget *ancestor);
739 gboolean gtk_widget_translate_coordinates (GtkWidget *src_widget,
740 GtkWidget *dest_widget,
746 /* Hide widget and return TRUE.
748 gboolean gtk_widget_hide_on_delete (GtkWidget *widget);
752 void gtk_widget_style_attach (GtkWidget *widget);
754 gboolean gtk_widget_has_rc_style (GtkWidget *widget);
755 void gtk_widget_set_style (GtkWidget *widget,
757 void gtk_widget_ensure_style (GtkWidget *widget);
758 GtkStyle * gtk_widget_get_style (GtkWidget *widget);
760 void gtk_widget_modify_style (GtkWidget *widget,
762 GtkRcStyle *gtk_widget_get_modifier_style (GtkWidget *widget);
763 void gtk_widget_modify_fg (GtkWidget *widget,
765 const GdkColor *color);
766 void gtk_widget_modify_bg (GtkWidget *widget,
768 const GdkColor *color);
769 void gtk_widget_modify_text (GtkWidget *widget,
771 const GdkColor *color);
772 void gtk_widget_modify_base (GtkWidget *widget,
774 const GdkColor *color);
775 void gtk_widget_modify_cursor (GtkWidget *widget,
776 const GdkColor *primary,
777 const GdkColor *secondary);
778 void gtk_widget_modify_font (GtkWidget *widget,
779 PangoFontDescription *font_desc);
780 void gtk_widget_modify_symbolic_color (GtkWidget *widget,
782 const GdkColor *color);
784 PangoContext *gtk_widget_create_pango_context (GtkWidget *widget);
785 PangoContext *gtk_widget_get_pango_context (GtkWidget *widget);
786 PangoLayout *gtk_widget_create_pango_layout (GtkWidget *widget,
789 GdkPixbuf *gtk_widget_render_icon (GtkWidget *widget,
790 const gchar *stock_id,
792 const gchar *detail);
794 /* handle composite names for GTK_COMPOSITE_CHILD widgets,
795 * the returned name is newly allocated.
797 void gtk_widget_set_composite_name (GtkWidget *widget,
799 gchar* gtk_widget_get_composite_name (GtkWidget *widget);
801 /* Descend recursively and set rc-style on all widgets without user styles */
802 void gtk_widget_reset_rc_styles (GtkWidget *widget);
804 /* Push/pop pairs, to change default values upon a widget's creation.
805 * This will override the values that got set by the
806 * gtk_widget_set_default_* () functions.
808 void gtk_widget_push_composite_child (void);
809 void gtk_widget_pop_composite_child (void);
811 /* widget style properties
813 void gtk_widget_class_install_style_property (GtkWidgetClass *klass,
815 void gtk_widget_class_install_style_property_parser (GtkWidgetClass *klass,
817 GtkRcPropertyParser parser);
818 GParamSpec* gtk_widget_class_find_style_property (GtkWidgetClass *klass,
819 const gchar *property_name);
820 GParamSpec** gtk_widget_class_list_style_properties (GtkWidgetClass *klass,
821 guint *n_properties);
822 void gtk_widget_style_get_property (GtkWidget *widget,
823 const gchar *property_name,
825 void gtk_widget_style_get_valist (GtkWidget *widget,
826 const gchar *first_property_name,
828 void gtk_widget_style_get (GtkWidget *widget,
829 const gchar *first_property_name,
830 ...) G_GNUC_NULL_TERMINATED;
833 /* Set certain default values to be used at widget creation time.
835 GtkStyle* gtk_widget_get_default_style (void);
837 /* Functions for setting directionality for widgets
840 void gtk_widget_set_direction (GtkWidget *widget,
841 GtkTextDirection dir);
842 GtkTextDirection gtk_widget_get_direction (GtkWidget *widget);
844 void gtk_widget_set_default_direction (GtkTextDirection dir);
845 GtkTextDirection gtk_widget_get_default_direction (void);
847 /* Compositing manager functionality */
848 gboolean gtk_widget_is_composited (GtkWidget *widget);
850 /* Counterpart to gdk_window_shape_combine_region.
852 void gtk_widget_shape_combine_region (GtkWidget *widget,
853 cairo_region_t *region);
854 void gtk_widget_input_shape_combine_region (GtkWidget *widget,
855 cairo_region_t *region);
857 /* internal function */
858 void gtk_widget_reset_shapes (GtkWidget *widget);
860 /* Compute a widget's path in the form "GtkWindow.MyLabel", and
861 * return newly alocated strings.
863 void gtk_widget_path (GtkWidget *widget,
866 gchar **path_reversed);
867 void gtk_widget_class_path (GtkWidget *widget,
870 gchar **path_reversed);
872 GList* gtk_widget_list_mnemonic_labels (GtkWidget *widget);
873 void gtk_widget_add_mnemonic_label (GtkWidget *widget,
875 void gtk_widget_remove_mnemonic_label (GtkWidget *widget,
878 void gtk_widget_set_tooltip_window (GtkWidget *widget,
879 GtkWindow *custom_window);
880 GtkWindow *gtk_widget_get_tooltip_window (GtkWidget *widget);
881 void gtk_widget_trigger_tooltip_query (GtkWidget *widget);
882 void gtk_widget_set_tooltip_text (GtkWidget *widget,
884 gchar * gtk_widget_get_tooltip_text (GtkWidget *widget);
885 void gtk_widget_set_tooltip_markup (GtkWidget *widget,
886 const gchar *markup);
887 gchar * gtk_widget_get_tooltip_markup (GtkWidget *widget);
888 void gtk_widget_set_has_tooltip (GtkWidget *widget,
889 gboolean has_tooltip);
890 gboolean gtk_widget_get_has_tooltip (GtkWidget *widget);
892 gboolean gtk_cairo_should_draw_window (cairo_t *cr,
894 void gtk_cairo_transform_to_window (cairo_t *cr,
898 GType gtk_requisition_get_type (void) G_GNUC_CONST;
899 GtkRequisition *gtk_requisition_new (void) G_GNUC_MALLOC;
900 GtkRequisition *gtk_requisition_copy (const GtkRequisition *requisition);
901 void gtk_requisition_free (GtkRequisition *requisition);
903 GdkEventExpose * _gtk_cairo_get_event (cairo_t *cr);
905 void _gtk_widget_draw_internal (GtkWidget *widget,
907 gboolean clip_to_size);
908 void _gtk_widget_set_has_default (GtkWidget *widget,
909 gboolean has_default);
910 void _gtk_widget_set_has_grab (GtkWidget *widget,
912 void _gtk_widget_set_is_toplevel (GtkWidget *widget,
913 gboolean is_toplevel);
915 void _gtk_widget_grab_notify (GtkWidget *widget,
916 gboolean was_grabbed);
918 GtkWidgetAuxInfo *_gtk_widget_get_aux_info (GtkWidget *widget,
920 void _gtk_widget_propagate_hierarchy_changed (GtkWidget *widget,
921 GtkWidget *previous_toplevel);
922 void _gtk_widget_propagate_screen_changed (GtkWidget *widget,
923 GdkScreen *previous_screen);
924 void _gtk_widget_propagate_composited_changed (GtkWidget *widget);
926 void _gtk_widget_set_device_window (GtkWidget *widget,
928 GdkWindow *pointer_window);
929 GdkWindow *_gtk_widget_get_device_window (GtkWidget *widget,
931 GList * _gtk_widget_list_devices (GtkWidget *widget);
933 void _gtk_widget_synthesize_crossing (GtkWidget *from,
936 GdkCrossingMode mode);
938 gpointer _gtk_widget_peek_request_cache (GtkWidget *widget);
940 void _gtk_widget_buildable_finish_accelerator (GtkWidget *widget,
944 gboolean gtk_widget_in_destruction (GtkWidget *widget);
948 #endif /* __GTK_WIDGET_H__ */