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, see <http://www.gnu.org/licenses/>.
19 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
20 * file for a list of people on the GTK+ Team. See the ChangeLog
21 * files for a list of changes. These files are distributed with
22 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
25 #ifndef __GTK_WIDGET_H__
26 #define __GTK_WIDGET_H__
28 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
29 #error "Only <gtk/gtk.h> can be included directly."
33 #include <gtk/gtkaccelgroup.h>
34 #include <gtk/gtkborder.h>
35 #include <gtk/gtktypes.h>
40 /* Kinds of widget-specific help */
43 GTK_WIDGET_HELP_TOOLTIP,
44 GTK_WIDGET_HELP_WHATS_THIS
47 /* Macro for casting a pointer to a GtkWidget or GtkWidgetClass pointer.
48 * Macros for testing whether `widget' or `klass' are of type GTK_TYPE_WIDGET.
50 #define GTK_TYPE_WIDGET (gtk_widget_get_type ())
51 #define GTK_WIDGET(widget) (G_TYPE_CHECK_INSTANCE_CAST ((widget), GTK_TYPE_WIDGET, GtkWidget))
52 #define GTK_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_WIDGET, GtkWidgetClass))
53 #define GTK_IS_WIDGET(widget) (G_TYPE_CHECK_INSTANCE_TYPE ((widget), GTK_TYPE_WIDGET))
54 #define GTK_IS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WIDGET))
55 #define GTK_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_WIDGET, GtkWidgetClass))
57 #define GTK_TYPE_REQUISITION (gtk_requisition_get_type ())
59 typedef struct _GtkWidgetPrivate GtkWidgetPrivate;
60 typedef struct _GtkWidgetClass GtkWidgetClass;
61 typedef struct _GtkWidgetClassPrivate GtkWidgetClassPrivate;
62 typedef struct _GtkWidgetAuxInfo GtkWidgetAuxInfo;
66 * @x: the X position of the widget's area relative to its parents allocation.
67 * @y: the Y position of the widget's area relative to its parents allocation.
68 * @width: the width of the widget's allocated area.
69 * @height: the height of the widget's allocated area.
71 * A <structname>GtkAllocation</structname> of a widget represents region
72 * which has been allocated to the widget by its parent. It is a subregion
73 * of its parents allocation. See <xref linkend="geometry-management"/> for
76 typedef GdkRectangle GtkAllocation;
80 * @widget: the widget to operate on
81 * @data: (closure): user-supplied data
83 * The type of the callback functions used for e.g. iterating over
84 * the children of a container, see gtk_container_foreach().
86 typedef void (*GtkCallback) (GtkWidget *widget,
92 * @frame_clock: the frame clock for the widget (same as calling gtk_widget_get_frame_clock())
93 * @user_data: user data passed to gtk_widget_add_tick_callback().
95 * Callback type for adding a function to update animations. See gtk_widget_add_tick_callback().
97 * Returns: %G_SOURCE_CONTINUE if the tick callback should continue to be called,
98 * %G_SOURCE_REMOVE if the tick callback should be removed.
100 typedef gboolean (*GtkTickCallback) (GtkWidget *widget,
101 GdkFrameClock *frame_clock,
106 * @width: the widget's desired width
107 * @height: the widget's desired height
109 * A <structname>GtkRequisition</structname> represents the desired size of a widget. See
110 * <xref linkend="geometry-management"/> for more information.
112 struct _GtkRequisition
118 /* The widget is the base of the tree for displayable objects.
119 * (A displayable object is one which takes up some amount
120 * of screen real estate). It provides a common base and interface
121 * which actual widgets must adhere to.
125 GInitiallyUnowned parent_instance;
127 GtkWidgetPrivate *priv;
132 * @parent_class: The object class structure needs to be the first
133 * element in the widget class structure in order for the class mechanism
134 * to work correctly. This allows a GtkWidgetClass pointer to be cast to
135 * a GObjectClass pointer.
136 * @activate_signal: The signal to emit when a widget of this class is
137 * activated, gtk_widget_activate() handles the emission.
138 * Implementation of this signal is optional.
139 * @get_request_mode: This allows a widget to tell its parent container whether
140 * it prefers to be allocated in %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH or
141 * %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT mode.
142 * %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH means the widget prefers to have
143 * #GtkWidgetClass.get_preferred_width() called and then
144 * #GtkWidgetClass.get_preferred_height_for_width().
145 * %GTK_SIZE_REQUEST_CONSTANT_SIZE disables any height-for-width or
146 * width-for-height geometry management for a said widget and is the
148 * It's important to note (as described below) that any widget
149 * which trades height-for-width or width-for-height must respond properly
150 * to both of the virtual methods #GtkWidgetClass.get_preferred_height_for_width()
151 * and #GtkWidgetClass.get_preferred_width_for_height() since it might be
152 * queried in either #GtkSizeRequestMode by its parent container.
153 * @get_preferred_height: This is called by containers to obtain the minimum
154 * and natural height of a widget. A widget that does not actually trade
155 * any height for width or width for height only has to implement these
156 * two virtual methods (#GtkWidgetClass.get_preferred_width() and
157 * #GtkWidgetClass.get_preferred_height()).
158 * @get_preferred_width_for_height: This is analogous to
159 * #GtkWidgetClass.get_preferred_height_for_width() except that it
160 * operates in the oposite orientation. It's rare that a widget actually
161 * does %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT requests but this can happen
162 * when, for example, a widget or container gets additional columns to
163 * compensate for a smaller allocated height.
164 * @get_preferred_width: This is called by containers to obtain the minimum
165 * and natural width of a widget. A widget will never be allocated a width
166 * less than its minimum and will only ever be allocated a width greater
167 * than the natural width once all of the said widget's siblings have
168 * received their natural widths.
169 * Furthermore, a widget will only ever be allocated a width greater than
170 * its natural width if it was configured to receive extra expand space
171 * from its parent container.
172 * @get_preferred_height_for_width: This is similar to
173 * #GtkWidgetClass.get_preferred_height() except that it is passed a
174 * contextual width to request height for. By implementing this virtual
175 * method it is possible for a #GtkLabel to tell its parent how much height
176 * would be required if the label were to be allocated a said width.
177 * @adjust_size_request: Convert an initial size request from a widget's
178 * #GtkSizeRequestMode virtual method implementations into a size request to
179 * be used by parent containers in laying out the widget.
180 * adjust_size_request adjusts <emphasis>from</emphasis> a child widget's
181 * original request <emphasis>to</emphasis> what a parent container should
182 * use for layout. The @for_size argument will be -1 if the request should
183 * not be for a particular size in the opposing orientation, i.e. if the
184 * request is not height-for-width or width-for-height. If @for_size is
185 * greater than -1, it is the proposed allocation in the opposing
186 * orientation that we need the request for. Implementations of
187 * adjust_size_request should chain up to the default implementation,
188 * which applies #GtkWidget's margin properties and imposes any values
189 * from gtk_widget_set_size_request(). Chaining up should be last,
190 * <emphasis>after</emphasis> your subclass adjusts the request, so
191 * #GtkWidget can apply constraints and add the margin properly.
192 * @adjust_size_allocation: Convert an initial size allocation assigned
193 * by a #GtkContainer using gtk_widget_size_allocate(), into an actual
194 * size allocation to be used by the widget. adjust_size_allocation
195 * adjusts <emphasis>to</emphasis> a child widget's actual allocation
196 * <emphasis>from</emphasis> what a parent container computed for the
197 * child. The adjusted allocation must be entirely within the original
198 * allocation. In any custom implementation, chain up to the default
199 * #GtkWidget implementation of this method, which applies the margin
200 * and alignment properties of #GtkWidget. Chain up
201 * <emphasis>before</emphasis> performing your own adjustments so your
202 * own adjustments remove more allocation after the #GtkWidget base
203 * class has already removed margin and alignment. The natural size
204 * passed in should be adjusted in the same way as the allocated size,
205 * which allows adjustments to perform alignments or other changes
206 * based on natural size.
208 struct _GtkWidgetClass
210 GInitiallyUnownedClass parent_class;
214 guint activate_signal;
216 /* seldomly overidden */
217 void (*dispatch_child_properties_changed) (GtkWidget *widget,
219 GParamSpec **pspecs);
222 void (* destroy) (GtkWidget *widget);
223 void (* show) (GtkWidget *widget);
224 void (* show_all) (GtkWidget *widget);
225 void (* hide) (GtkWidget *widget);
226 void (* map) (GtkWidget *widget);
227 void (* unmap) (GtkWidget *widget);
228 void (* realize) (GtkWidget *widget);
229 void (* unrealize) (GtkWidget *widget);
230 void (* size_allocate) (GtkWidget *widget,
231 GtkAllocation *allocation);
232 void (* state_changed) (GtkWidget *widget,
233 GtkStateType previous_state);
234 void (* state_flags_changed) (GtkWidget *widget,
235 GtkStateFlags previous_state_flags);
236 void (* parent_set) (GtkWidget *widget,
237 GtkWidget *previous_parent);
238 void (* hierarchy_changed) (GtkWidget *widget,
239 GtkWidget *previous_toplevel);
240 void (* style_set) (GtkWidget *widget,
241 GtkStyle *previous_style);
242 void (* direction_changed) (GtkWidget *widget,
243 GtkTextDirection previous_direction);
244 void (* grab_notify) (GtkWidget *widget,
245 gboolean was_grabbed);
246 void (* child_notify) (GtkWidget *widget,
247 GParamSpec *child_property);
248 gboolean (* draw) (GtkWidget *widget,
252 GtkSizeRequestMode (* get_request_mode) (GtkWidget *widget);
254 void (* get_preferred_height) (GtkWidget *widget,
255 gint *minimum_height,
256 gint *natural_height);
257 void (* get_preferred_width_for_height) (GtkWidget *widget,
260 gint *natural_width);
261 void (* get_preferred_width) (GtkWidget *widget,
263 gint *natural_width);
264 void (* get_preferred_height_for_width) (GtkWidget *widget,
266 gint *minimum_height,
267 gint *natural_height);
270 gboolean (* mnemonic_activate) (GtkWidget *widget,
271 gboolean group_cycling);
274 void (* grab_focus) (GtkWidget *widget);
275 gboolean (* focus) (GtkWidget *widget,
276 GtkDirectionType direction);
278 /* keyboard navigation */
279 void (* move_focus) (GtkWidget *widget,
280 GtkDirectionType direction);
281 gboolean (* keynav_failed) (GtkWidget *widget,
282 GtkDirectionType direction);
285 gboolean (* event) (GtkWidget *widget,
287 gboolean (* button_press_event) (GtkWidget *widget,
288 GdkEventButton *event);
289 gboolean (* button_release_event) (GtkWidget *widget,
290 GdkEventButton *event);
291 gboolean (* scroll_event) (GtkWidget *widget,
292 GdkEventScroll *event);
293 gboolean (* motion_notify_event) (GtkWidget *widget,
294 GdkEventMotion *event);
295 gboolean (* delete_event) (GtkWidget *widget,
297 gboolean (* destroy_event) (GtkWidget *widget,
299 gboolean (* key_press_event) (GtkWidget *widget,
301 gboolean (* key_release_event) (GtkWidget *widget,
303 gboolean (* enter_notify_event) (GtkWidget *widget,
304 GdkEventCrossing *event);
305 gboolean (* leave_notify_event) (GtkWidget *widget,
306 GdkEventCrossing *event);
307 gboolean (* configure_event) (GtkWidget *widget,
308 GdkEventConfigure *event);
309 gboolean (* focus_in_event) (GtkWidget *widget,
310 GdkEventFocus *event);
311 gboolean (* focus_out_event) (GtkWidget *widget,
312 GdkEventFocus *event);
313 gboolean (* map_event) (GtkWidget *widget,
315 gboolean (* unmap_event) (GtkWidget *widget,
317 gboolean (* property_notify_event) (GtkWidget *widget,
318 GdkEventProperty *event);
319 gboolean (* selection_clear_event) (GtkWidget *widget,
320 GdkEventSelection *event);
321 gboolean (* selection_request_event) (GtkWidget *widget,
322 GdkEventSelection *event);
323 gboolean (* selection_notify_event) (GtkWidget *widget,
324 GdkEventSelection *event);
325 gboolean (* proximity_in_event) (GtkWidget *widget,
326 GdkEventProximity *event);
327 gboolean (* proximity_out_event) (GtkWidget *widget,
328 GdkEventProximity *event);
329 gboolean (* visibility_notify_event) (GtkWidget *widget,
330 GdkEventVisibility *event);
331 gboolean (* window_state_event) (GtkWidget *widget,
332 GdkEventWindowState *event);
333 gboolean (* damage_event) (GtkWidget *widget,
334 GdkEventExpose *event);
335 gboolean (* grab_broken_event) (GtkWidget *widget,
336 GdkEventGrabBroken *event);
339 void (* selection_get) (GtkWidget *widget,
340 GtkSelectionData *selection_data,
343 void (* selection_received) (GtkWidget *widget,
344 GtkSelectionData *selection_data,
347 /* Source side drag signals */
348 void (* drag_begin) (GtkWidget *widget,
349 GdkDragContext *context);
350 void (* drag_end) (GtkWidget *widget,
351 GdkDragContext *context);
352 void (* drag_data_get) (GtkWidget *widget,
353 GdkDragContext *context,
354 GtkSelectionData *selection_data,
357 void (* drag_data_delete) (GtkWidget *widget,
358 GdkDragContext *context);
360 /* Target side drag signals */
361 void (* drag_leave) (GtkWidget *widget,
362 GdkDragContext *context,
364 gboolean (* drag_motion) (GtkWidget *widget,
365 GdkDragContext *context,
369 gboolean (* drag_drop) (GtkWidget *widget,
370 GdkDragContext *context,
374 void (* drag_data_received) (GtkWidget *widget,
375 GdkDragContext *context,
378 GtkSelectionData *selection_data,
381 gboolean (* drag_failed) (GtkWidget *widget,
382 GdkDragContext *context,
383 GtkDragResult result);
385 /* Signals used only for keybindings */
386 gboolean (* popup_menu) (GtkWidget *widget);
388 /* If a widget has multiple tooltips/whatsthis, it should show the
389 * one for the current focus location, or if that doesn't make
390 * sense, should cycle through them showing each tip alongside
391 * whatever piece of the widget it applies to.
393 gboolean (* show_help) (GtkWidget *widget,
394 GtkWidgetHelpType help_type);
396 /* accessibility support
398 AtkObject * (* get_accessible) (GtkWidget *widget);
400 void (* screen_changed) (GtkWidget *widget,
401 GdkScreen *previous_screen);
402 gboolean (* can_activate_accel) (GtkWidget *widget,
406 void (* composited_changed) (GtkWidget *widget);
408 gboolean (* query_tooltip) (GtkWidget *widget,
411 gboolean keyboard_tooltip,
412 GtkTooltip *tooltip);
414 void (* compute_expand) (GtkWidget *widget,
416 gboolean *vexpand_p);
418 void (* adjust_size_request) (GtkWidget *widget,
419 GtkOrientation orientation,
422 void (* adjust_size_allocation) (GtkWidget *widget,
423 GtkOrientation orientation,
427 gint *allocated_size);
429 void (* style_updated) (GtkWidget *widget);
431 gboolean (* touch_event) (GtkWidget *widget,
432 GdkEventTouch *event);
436 GtkWidgetClassPrivate *priv;
438 /* Padding for future expansion */
439 void (*_gtk_reserved2) (void);
440 void (*_gtk_reserved3) (void);
441 void (*_gtk_reserved4) (void);
442 void (*_gtk_reserved5) (void);
443 void (*_gtk_reserved6) (void);
444 void (*_gtk_reserved7) (void);
447 struct _GtkWidgetAuxInfo
458 GType gtk_widget_get_type (void) G_GNUC_CONST;
459 GtkWidget* gtk_widget_new (GType type,
460 const gchar *first_property_name,
462 void gtk_widget_destroy (GtkWidget *widget);
463 void gtk_widget_destroyed (GtkWidget *widget,
464 GtkWidget **widget_pointer);
465 void gtk_widget_unparent (GtkWidget *widget);
466 void gtk_widget_show (GtkWidget *widget);
467 void gtk_widget_hide (GtkWidget *widget);
468 void gtk_widget_show_now (GtkWidget *widget);
469 void gtk_widget_show_all (GtkWidget *widget);
470 void gtk_widget_set_no_show_all (GtkWidget *widget,
471 gboolean no_show_all);
472 gboolean gtk_widget_get_no_show_all (GtkWidget *widget);
473 void gtk_widget_map (GtkWidget *widget);
474 void gtk_widget_unmap (GtkWidget *widget);
475 void gtk_widget_realize (GtkWidget *widget);
476 void gtk_widget_unrealize (GtkWidget *widget);
478 void gtk_widget_draw (GtkWidget *widget,
481 void gtk_widget_queue_draw (GtkWidget *widget);
482 void gtk_widget_queue_draw_area (GtkWidget *widget,
487 void gtk_widget_queue_draw_region (GtkWidget *widget,
488 const cairo_region_t*region);
489 void gtk_widget_queue_resize (GtkWidget *widget);
490 void gtk_widget_queue_resize_no_redraw (GtkWidget *widget);
491 GdkFrameClock* gtk_widget_get_frame_clock (GtkWidget *widget);
493 GDK_DEPRECATED_IN_3_0_FOR(gtk_widget_get_preferred_size)
494 void gtk_widget_size_request (GtkWidget *widget,
495 GtkRequisition *requisition);
496 void gtk_widget_size_allocate (GtkWidget *widget,
497 GtkAllocation *allocation);
499 GtkSizeRequestMode gtk_widget_get_request_mode (GtkWidget *widget);
500 void gtk_widget_get_preferred_width (GtkWidget *widget,
502 gint *natural_width);
503 void gtk_widget_get_preferred_height_for_width (GtkWidget *widget,
505 gint *minimum_height,
506 gint *natural_height);
507 void gtk_widget_get_preferred_height (GtkWidget *widget,
508 gint *minimum_height,
509 gint *natural_height);
510 void gtk_widget_get_preferred_width_for_height (GtkWidget *widget,
513 gint *natural_width);
514 void gtk_widget_get_preferred_size (GtkWidget *widget,
515 GtkRequisition *minimum_size,
516 GtkRequisition *natural_size);
518 GDK_DEPRECATED_IN_3_0_FOR(gtk_widget_get_preferred_size)
519 void gtk_widget_get_child_requisition (GtkWidget *widget,
520 GtkRequisition *requisition);
521 void gtk_widget_add_accelerator (GtkWidget *widget,
522 const gchar *accel_signal,
523 GtkAccelGroup *accel_group,
525 GdkModifierType accel_mods,
526 GtkAccelFlags accel_flags);
527 gboolean gtk_widget_remove_accelerator (GtkWidget *widget,
528 GtkAccelGroup *accel_group,
530 GdkModifierType accel_mods);
531 void gtk_widget_set_accel_path (GtkWidget *widget,
532 const gchar *accel_path,
533 GtkAccelGroup *accel_group);
534 GList* gtk_widget_list_accel_closures (GtkWidget *widget);
535 gboolean gtk_widget_can_activate_accel (GtkWidget *widget,
537 gboolean gtk_widget_mnemonic_activate (GtkWidget *widget,
538 gboolean group_cycling);
539 gboolean gtk_widget_event (GtkWidget *widget,
541 gint gtk_widget_send_expose (GtkWidget *widget,
543 gboolean gtk_widget_send_focus_change (GtkWidget *widget,
546 gboolean gtk_widget_activate (GtkWidget *widget);
548 void gtk_widget_reparent (GtkWidget *widget,
549 GtkWidget *new_parent);
550 gboolean gtk_widget_intersect (GtkWidget *widget,
551 const GdkRectangle *area,
552 GdkRectangle *intersection);
553 cairo_region_t *gtk_widget_region_intersect (GtkWidget *widget,
554 const cairo_region_t *region);
556 void gtk_widget_freeze_child_notify (GtkWidget *widget);
557 void gtk_widget_child_notify (GtkWidget *widget,
558 const gchar *child_property);
559 void gtk_widget_thaw_child_notify (GtkWidget *widget);
561 void gtk_widget_set_can_focus (GtkWidget *widget,
563 gboolean gtk_widget_get_can_focus (GtkWidget *widget);
564 gboolean gtk_widget_has_focus (GtkWidget *widget);
565 gboolean gtk_widget_is_focus (GtkWidget *widget);
567 gboolean gtk_widget_has_visible_focus (GtkWidget *widget);
568 void gtk_widget_grab_focus (GtkWidget *widget);
570 void gtk_widget_set_can_default (GtkWidget *widget,
571 gboolean can_default);
572 gboolean gtk_widget_get_can_default (GtkWidget *widget);
573 gboolean gtk_widget_has_default (GtkWidget *widget);
574 void gtk_widget_grab_default (GtkWidget *widget);
576 void gtk_widget_set_receives_default (GtkWidget *widget,
577 gboolean receives_default);
578 gboolean gtk_widget_get_receives_default (GtkWidget *widget);
580 gboolean gtk_widget_has_grab (GtkWidget *widget);
582 gboolean gtk_widget_device_is_shadowed (GtkWidget *widget,
586 void gtk_widget_set_name (GtkWidget *widget,
588 const gchar * gtk_widget_get_name (GtkWidget *widget);
590 void gtk_widget_set_state (GtkWidget *widget,
592 GtkStateType gtk_widget_get_state (GtkWidget *widget);
594 void gtk_widget_set_state_flags (GtkWidget *widget,
597 void gtk_widget_unset_state_flags (GtkWidget *widget,
598 GtkStateFlags flags);
599 GtkStateFlags gtk_widget_get_state_flags (GtkWidget *widget);
601 void gtk_widget_set_sensitive (GtkWidget *widget,
603 gboolean gtk_widget_get_sensitive (GtkWidget *widget);
604 gboolean gtk_widget_is_sensitive (GtkWidget *widget);
606 void gtk_widget_set_visible (GtkWidget *widget,
608 gboolean gtk_widget_get_visible (GtkWidget *widget);
609 gboolean gtk_widget_is_visible (GtkWidget *widget);
611 void gtk_widget_set_has_window (GtkWidget *widget,
612 gboolean has_window);
613 gboolean gtk_widget_get_has_window (GtkWidget *widget);
615 gboolean gtk_widget_is_toplevel (GtkWidget *widget);
616 gboolean gtk_widget_is_drawable (GtkWidget *widget);
617 void gtk_widget_set_realized (GtkWidget *widget,
619 gboolean gtk_widget_get_realized (GtkWidget *widget);
620 void gtk_widget_set_mapped (GtkWidget *widget,
622 gboolean gtk_widget_get_mapped (GtkWidget *widget);
624 void gtk_widget_set_app_paintable (GtkWidget *widget,
625 gboolean app_paintable);
626 gboolean gtk_widget_get_app_paintable (GtkWidget *widget);
628 void gtk_widget_set_double_buffered (GtkWidget *widget,
629 gboolean double_buffered);
630 gboolean gtk_widget_get_double_buffered (GtkWidget *widget);
632 void gtk_widget_set_redraw_on_allocate (GtkWidget *widget,
633 gboolean redraw_on_allocate);
635 void gtk_widget_set_parent (GtkWidget *widget,
637 GtkWidget * gtk_widget_get_parent (GtkWidget *widget);
639 void gtk_widget_set_parent_window (GtkWidget *widget,
640 GdkWindow *parent_window);
641 GdkWindow * gtk_widget_get_parent_window (GtkWidget *widget);
643 void gtk_widget_set_child_visible (GtkWidget *widget,
644 gboolean is_visible);
645 gboolean gtk_widget_get_child_visible (GtkWidget *widget);
647 void gtk_widget_set_window (GtkWidget *widget,
649 GdkWindow * gtk_widget_get_window (GtkWidget *widget);
651 void gtk_widget_register_window (GtkWidget *widget,
654 void gtk_widget_unregister_window (GtkWidget *widget,
657 int gtk_widget_get_allocated_width (GtkWidget *widget);
658 int gtk_widget_get_allocated_height (GtkWidget *widget);
660 void gtk_widget_get_allocation (GtkWidget *widget,
661 GtkAllocation *allocation);
662 void gtk_widget_set_allocation (GtkWidget *widget,
663 const GtkAllocation *allocation);
665 void gtk_widget_get_requisition (GtkWidget *widget,
666 GtkRequisition *requisition);
668 gboolean gtk_widget_child_focus (GtkWidget *widget,
669 GtkDirectionType direction);
670 gboolean gtk_widget_keynav_failed (GtkWidget *widget,
671 GtkDirectionType direction);
672 void gtk_widget_error_bell (GtkWidget *widget);
674 void gtk_widget_set_size_request (GtkWidget *widget,
677 void gtk_widget_get_size_request (GtkWidget *widget,
680 void gtk_widget_set_events (GtkWidget *widget,
682 void gtk_widget_add_events (GtkWidget *widget,
684 void gtk_widget_set_device_events (GtkWidget *widget,
686 GdkEventMask events);
687 void gtk_widget_add_device_events (GtkWidget *widget,
689 GdkEventMask events);
691 void gtk_widget_set_opacity (GtkWidget *widget,
694 double gtk_widget_get_opacity (GtkWidget *widget);
696 void gtk_widget_set_device_enabled (GtkWidget *widget,
699 gboolean gtk_widget_get_device_enabled (GtkWidget *widget,
702 GtkWidget* gtk_widget_get_toplevel (GtkWidget *widget);
703 GtkWidget* gtk_widget_get_ancestor (GtkWidget *widget,
705 GdkVisual* gtk_widget_get_visual (GtkWidget *widget);
706 void gtk_widget_set_visual (GtkWidget *widget,
709 GdkScreen * gtk_widget_get_screen (GtkWidget *widget);
710 gboolean gtk_widget_has_screen (GtkWidget *widget);
711 GdkDisplay * gtk_widget_get_display (GtkWidget *widget);
712 GdkWindow * gtk_widget_get_root_window (GtkWidget *widget);
713 GtkSettings* gtk_widget_get_settings (GtkWidget *widget);
714 GtkClipboard *gtk_widget_get_clipboard (GtkWidget *widget,
718 /* Expand flags and related support */
719 gboolean gtk_widget_get_hexpand (GtkWidget *widget);
720 void gtk_widget_set_hexpand (GtkWidget *widget,
722 gboolean gtk_widget_get_hexpand_set (GtkWidget *widget);
723 void gtk_widget_set_hexpand_set (GtkWidget *widget,
725 gboolean gtk_widget_get_vexpand (GtkWidget *widget);
726 void gtk_widget_set_vexpand (GtkWidget *widget,
728 gboolean gtk_widget_get_vexpand_set (GtkWidget *widget);
729 void gtk_widget_set_vexpand_set (GtkWidget *widget,
731 void gtk_widget_queue_compute_expand (GtkWidget *widget);
732 gboolean gtk_widget_compute_expand (GtkWidget *widget,
733 GtkOrientation orientation);
736 /* Multidevice support */
737 gboolean gtk_widget_get_support_multidevice (GtkWidget *widget);
738 void gtk_widget_set_support_multidevice (GtkWidget *widget,
739 gboolean support_multidevice);
741 /* Accessibility support */
743 void gtk_widget_class_set_accessible_type (GtkWidgetClass *widget_class,
746 void gtk_widget_class_set_accessible_role (GtkWidgetClass *widget_class,
748 AtkObject* gtk_widget_get_accessible (GtkWidget *widget);
751 /* Margin and alignment */
752 GtkAlign gtk_widget_get_halign (GtkWidget *widget);
753 void gtk_widget_set_halign (GtkWidget *widget,
755 GtkAlign gtk_widget_get_valign (GtkWidget *widget);
756 void gtk_widget_set_valign (GtkWidget *widget,
758 gint gtk_widget_get_margin_left (GtkWidget *widget);
759 void gtk_widget_set_margin_left (GtkWidget *widget,
761 gint gtk_widget_get_margin_right (GtkWidget *widget);
762 void gtk_widget_set_margin_right (GtkWidget *widget,
764 gint gtk_widget_get_margin_top (GtkWidget *widget);
765 void gtk_widget_set_margin_top (GtkWidget *widget,
767 gint gtk_widget_get_margin_bottom (GtkWidget *widget);
768 void gtk_widget_set_margin_bottom (GtkWidget *widget,
772 gint gtk_widget_get_events (GtkWidget *widget);
773 GdkEventMask gtk_widget_get_device_events (GtkWidget *widget,
775 GDK_DEPRECATED_IN_3_4_FOR(gdk_window_get_device_position)
776 void gtk_widget_get_pointer (GtkWidget *widget,
780 gboolean gtk_widget_is_ancestor (GtkWidget *widget,
781 GtkWidget *ancestor);
783 gboolean gtk_widget_translate_coordinates (GtkWidget *src_widget,
784 GtkWidget *dest_widget,
790 /* Hide widget and return TRUE.
792 gboolean gtk_widget_hide_on_delete (GtkWidget *widget);
794 /* Functions to override widget styling */
795 void gtk_widget_override_color (GtkWidget *widget,
797 const GdkRGBA *color);
798 void gtk_widget_override_background_color (GtkWidget *widget,
800 const GdkRGBA *color);
802 void gtk_widget_override_font (GtkWidget *widget,
803 const PangoFontDescription *font_desc);
805 void gtk_widget_override_symbolic_color (GtkWidget *widget,
807 const GdkRGBA *color);
808 void gtk_widget_override_cursor (GtkWidget *widget,
809 const GdkRGBA *cursor,
810 const GdkRGBA *secondary_cursor);
812 void gtk_widget_reset_style (GtkWidget *widget);
814 PangoContext *gtk_widget_create_pango_context (GtkWidget *widget);
815 PangoContext *gtk_widget_get_pango_context (GtkWidget *widget);
816 PangoLayout *gtk_widget_create_pango_layout (GtkWidget *widget,
819 GdkPixbuf *gtk_widget_render_icon_pixbuf (GtkWidget *widget,
820 const gchar *stock_id,
823 /* handle composite names for GTK_COMPOSITE_CHILD widgets,
824 * the returned name is newly allocated.
826 void gtk_widget_set_composite_name (GtkWidget *widget,
828 gchar* gtk_widget_get_composite_name (GtkWidget *widget);
830 /* Push/pop pairs, to change default values upon a widget's creation.
831 * This will override the values that got set by the
832 * gtk_widget_set_default_* () functions.
834 void gtk_widget_push_composite_child (void);
835 void gtk_widget_pop_composite_child (void);
837 /* widget style properties
839 void gtk_widget_class_install_style_property (GtkWidgetClass *klass,
841 void gtk_widget_class_install_style_property_parser (GtkWidgetClass *klass,
843 GtkRcPropertyParser parser);
844 GParamSpec* gtk_widget_class_find_style_property (GtkWidgetClass *klass,
845 const gchar *property_name);
846 GParamSpec** gtk_widget_class_list_style_properties (GtkWidgetClass *klass,
847 guint *n_properties);
848 void gtk_widget_style_get_property (GtkWidget *widget,
849 const gchar *property_name,
851 void gtk_widget_style_get_valist (GtkWidget *widget,
852 const gchar *first_property_name,
854 void gtk_widget_style_get (GtkWidget *widget,
855 const gchar *first_property_name,
856 ...) G_GNUC_NULL_TERMINATED;
858 /* Functions for setting directionality for widgets */
860 void gtk_widget_set_direction (GtkWidget *widget,
861 GtkTextDirection dir);
862 GtkTextDirection gtk_widget_get_direction (GtkWidget *widget);
864 void gtk_widget_set_default_direction (GtkTextDirection dir);
865 GtkTextDirection gtk_widget_get_default_direction (void);
867 /* Compositing manager functionality */
868 gboolean gtk_widget_is_composited (GtkWidget *widget);
870 /* Counterpart to gdk_window_shape_combine_region.
872 void gtk_widget_shape_combine_region (GtkWidget *widget,
873 cairo_region_t *region);
874 void gtk_widget_input_shape_combine_region (GtkWidget *widget,
875 cairo_region_t *region);
877 GList* gtk_widget_list_mnemonic_labels (GtkWidget *widget);
878 void gtk_widget_add_mnemonic_label (GtkWidget *widget,
880 void gtk_widget_remove_mnemonic_label (GtkWidget *widget,
883 void gtk_widget_set_tooltip_window (GtkWidget *widget,
884 GtkWindow *custom_window);
885 GtkWindow *gtk_widget_get_tooltip_window (GtkWidget *widget);
886 void gtk_widget_trigger_tooltip_query (GtkWidget *widget);
887 void gtk_widget_set_tooltip_text (GtkWidget *widget,
889 gchar * gtk_widget_get_tooltip_text (GtkWidget *widget);
890 void gtk_widget_set_tooltip_markup (GtkWidget *widget,
891 const gchar *markup);
892 gchar * gtk_widget_get_tooltip_markup (GtkWidget *widget);
893 void gtk_widget_set_has_tooltip (GtkWidget *widget,
894 gboolean has_tooltip);
895 gboolean gtk_widget_get_has_tooltip (GtkWidget *widget);
897 gboolean gtk_cairo_should_draw_window (cairo_t *cr,
899 void gtk_cairo_transform_to_window (cairo_t *cr,
903 GType gtk_requisition_get_type (void) G_GNUC_CONST;
904 GtkRequisition *gtk_requisition_new (void) G_GNUC_MALLOC;
905 GtkRequisition *gtk_requisition_copy (const GtkRequisition *requisition);
906 void gtk_requisition_free (GtkRequisition *requisition);
908 gboolean gtk_widget_in_destruction (GtkWidget *widget);
910 GtkStyleContext * gtk_widget_get_style_context (GtkWidget *widget);
912 GtkWidgetPath * gtk_widget_get_path (GtkWidget *widget);
915 GdkModifierType gtk_widget_get_modifier_mask (GtkWidget *widget,
916 GdkModifierIntent intent);
919 void gtk_widget_insert_action_group (GtkWidget *widget,
921 GActionGroup *group);
926 guint gtk_widget_add_tick_callback (GtkWidget *widget,
927 GtkTickCallback callback,
929 GDestroyNotify notify);
932 void gtk_widget_remove_tick_callback (GtkWidget *widget,
937 #endif /* __GTK_WIDGET_H__ */