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/gtkborder.h>
39 #include <gtk/gtksettings.h>
40 #include <gtk/gtkstylecontext.h>
41 #include <gtk/gtkwidgetpath.h>
46 /* Kinds of widget-specific help */
49 GTK_WIDGET_HELP_TOOLTIP,
50 GTK_WIDGET_HELP_WHATS_THIS
53 /* Macro for casting a pointer to a GtkWidget or GtkWidgetClass pointer.
54 * Macros for testing whether `widget' or `klass' are of type GTK_TYPE_WIDGET.
56 #define GTK_TYPE_WIDGET (gtk_widget_get_type ())
57 #define GTK_WIDGET(widget) (G_TYPE_CHECK_INSTANCE_CAST ((widget), GTK_TYPE_WIDGET, GtkWidget))
58 #define GTK_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_WIDGET, GtkWidgetClass))
59 #define GTK_IS_WIDGET(widget) (G_TYPE_CHECK_INSTANCE_TYPE ((widget), GTK_TYPE_WIDGET))
60 #define GTK_IS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WIDGET))
61 #define GTK_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_WIDGET, GtkWidgetClass))
63 #define GTK_TYPE_REQUISITION (gtk_requisition_get_type ())
65 /* forward declaration to avoid excessive includes (and concurrent includes)
67 typedef struct _GtkRequisition GtkRequisition;
68 typedef struct _GtkSelectionData GtkSelectionData;
69 typedef struct _GtkWidgetPrivate GtkWidgetPrivate;
70 typedef struct _GtkWidgetClass GtkWidgetClass;
71 typedef struct _GtkWidgetClassPrivate GtkWidgetClassPrivate;
72 typedef struct _GtkWidgetAuxInfo GtkWidgetAuxInfo;
73 typedef struct _GtkClipboard GtkClipboard;
74 typedef struct _GtkTooltip GtkTooltip;
75 typedef struct _GtkWindow GtkWindow;
80 * @x: the X position of the widget's area relative to its parents allocation.
81 * @y: the Y position of the widget's area relative to its parents allocation.
82 * @width: the width of the widget's allocated area.
83 * @height: the height of the widget's allocated area.
85 * A <structname>GtkAllocation</structname> of a widget represents region
86 * which has been allocated to the widget by its parent. It is a subregion
87 * of its parents allocation. See <xref linkend="geometry-management"/> for
90 typedef GdkRectangle GtkAllocation;
94 * @widget: the widget to operate on
95 * @data: user-supplied data
97 * The type of the callback functions used for e.g. iterating over
98 * the children of a container, see gtk_container_foreach().
100 typedef void (*GtkCallback) (GtkWidget *widget,
105 * @width: the widget's desired width
106 * @height: the widget's desired height
108 * A <structname>GtkRequisition</structname> represents the desired size of a widget. See
109 * <xref linkend="geometry-management"/> for more information.
111 struct _GtkRequisition
117 /* The widget is the base of the tree for displayable objects.
118 * (A displayable object is one which takes up some amount
119 * of screen real estate). It provides a common base and interface
120 * which actual widgets must adhere to.
124 GInitiallyUnowned parent_instance;
126 GtkWidgetPrivate *priv;
131 * @parent_class: The object class structure needs to be the first
132 * element in the widget class structure in order for the class mechanism
133 * to work correctly. This allows a GtkWidgetClass pointer to be cast to
134 * a GObjectClass pointer.
135 * @activate_signal: The signal to emit when a widget of this class is
136 * activated, gtk_widget_activate() handles the emission.
137 * Implementation of this signal is optional.
138 * @get_request_mode: This allows a widget to tell its parent container whether
139 * it prefers to be allocated in %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH or
140 * %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT mode.
141 * %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH means the widget prefers to have
142 * #GtkWidgetClass.get_preferred_width() called and then
143 * #GtkWidgetClass.get_preferred_height_for_width().
144 * %GTK_SIZE_REQUEST_CONSTANT_SIZE disables any height-for-width or
145 * width-for-height geometry management for a said widget and is the
147 * It's important to note (as described below) that any widget
148 * which trades height-for-width or width-for-height must respond properly
149 * to both of the virtual methods #GtkWidgetClass.get_preferred_height_for_width()
150 * and #GtkWidgetClass.get_preferred_width_for_height() since it might be
151 * queried in either #GtkSizeRequestMode by its parent container.
152 * @get_preferred_height: This is called by containers to obtain the minimum
153 * and natural height of a widget. A widget that does not actually trade
154 * any height for width or width for height only has to implement these
155 * two virtual methods (#GtkWidgetClass.get_preferred_width() and
156 * #GtkWidgetClass.get_preferred_height()).
157 * @get_preferred_width_for_height: This is analogous to
158 * #GtkWidgetClass.get_preferred_height_for_width() except that it
159 * operates in the oposite orientation. It's rare that a widget actually
160 * does %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT requests but this can happen
161 * when, for example, a widget or container gets additional columns to
162 * compensate for a smaller allocated height.
163 * @get_preferred_width: This is called by containers to obtain the minimum
164 * and natural width of a widget. A widget will never be allocated a width
165 * less than its minimum and will only ever be allocated a width greater
166 * than the natural width once all of the said widget's siblings have
167 * received their natural widths.
168 * Furthermore, a widget will only ever be allocated a width greater than
169 * its natural width if it was configured to receive extra expand space
170 * from its parent container.
171 * @get_preferred_height_for_width: This is similar to
172 * #GtkWidgetClass.get_preferred_height() except that it is passed a
173 * contextual width to request height for. By implementing this virtual
174 * method it is possible for a #GtkLabel to tell its parent how much height
175 * would be required if the label were to be allocated a said width.
176 * @adjust_size_request: Convert an initial size request from a widget's
177 * #GtkSizeRequest virtual method implementations into a size request to
178 * be used by parent containers in laying out the widget.
179 * adjust_size_request adjusts <emphasis>from</emphasis> a child widget's
180 * original request <emphasis>to</emphasis> what a parent container should
181 * use for layout. The @for_size argument will be -1 if the request should
182 * not be for a particular size in the opposing orientation, i.e. if the
183 * request is not height-for-width or width-for-height. If @for_size is
184 * greater than -1, it is the proposed allocation in the opposing
185 * orientation that we need the request for. Implementations of
186 * adjust_size_request should chain up to the default implementation,
187 * which applies #GtkWidget's margin properties and imposes any values
188 * from gtk_widget_set_size_request(). Chaining up should be last,
189 * <emphasis>after</emphasis> your subclass adjusts the request, so
190 * #GtkWidget can apply constraints and add the margin properly.
191 * @adjust_size_allocation: Convert an initial size allocation assigned
192 * by a #GtkContainer using gtk_widget_size_allocate(), into an actual
193 * size allocation to be used by the widget. adjust_size_allocation
194 * adjusts <emphasis>to</emphasis> a child widget's actual allocation
195 * <emphasis>from</emphasis> what a parent container computed for the
196 * child. The adjusted allocation must be entirely within the original
197 * allocation. In any custom implementation, chain up to the default
198 * #GtkWidget implementation of this method, which applies the margin
199 * and alignment properties of #GtkWidget. Chain up
200 * <emphasis>before</emphasis> performing your own adjustments so your
201 * own adjustments remove more allocation after the #GtkWidget base
202 * class has already removed margin and alignment. The natural size
203 * passed in should be adjusted in the same way as the allocated size,
204 * which allows adjustments to perform alignments or other changes
205 * based on natural size.
207 struct _GtkWidgetClass
209 GInitiallyUnownedClass parent_class;
213 guint activate_signal;
215 /* seldomly overidden */
216 void (*dispatch_child_properties_changed) (GtkWidget *widget,
218 GParamSpec **pspecs);
221 void (* destroy) (GtkWidget *widget);
222 void (* show) (GtkWidget *widget);
223 void (* show_all) (GtkWidget *widget);
224 void (* hide) (GtkWidget *widget);
225 void (* map) (GtkWidget *widget);
226 void (* unmap) (GtkWidget *widget);
227 void (* realize) (GtkWidget *widget);
228 void (* unrealize) (GtkWidget *widget);
229 void (* size_allocate) (GtkWidget *widget,
230 GtkAllocation *allocation);
231 void (* state_changed) (GtkWidget *widget,
232 GtkStateType previous_state);
233 void (* state_flags_changed) (GtkWidget *widget,
234 GtkStateFlags previous_state_flags);
235 void (* parent_set) (GtkWidget *widget,
236 GtkWidget *previous_parent);
237 void (* hierarchy_changed) (GtkWidget *widget,
238 GtkWidget *previous_toplevel);
239 void (* style_set) (GtkWidget *widget,
240 GtkStyle *previous_style);
241 void (* direction_changed) (GtkWidget *widget,
242 GtkTextDirection previous_direction);
243 void (* grab_notify) (GtkWidget *widget,
244 gboolean was_grabbed);
245 void (* child_notify) (GtkWidget *widget,
247 gboolean (* draw) (GtkWidget *widget,
251 GtkSizeRequestMode (* get_request_mode) (GtkWidget *widget);
253 void (* get_preferred_height) (GtkWidget *widget,
254 gint *minimum_height,
255 gint *natural_height);
256 void (* get_preferred_width_for_height) (GtkWidget *widget,
259 gint *natural_width);
260 void (* get_preferred_width) (GtkWidget *widget,
262 gint *natural_width);
263 void (* get_preferred_height_for_width) (GtkWidget *widget,
265 gint *minimum_height,
266 gint *natural_height);
269 gboolean (* mnemonic_activate) (GtkWidget *widget,
270 gboolean group_cycling);
273 void (* grab_focus) (GtkWidget *widget);
274 gboolean (* focus) (GtkWidget *widget,
275 GtkDirectionType direction);
277 /* keyboard navigation */
278 void (* move_focus) (GtkWidget *widget,
279 GtkDirectionType direction);
280 gboolean (* keynav_failed) (GtkWidget *widget,
281 GtkDirectionType direction);
284 gboolean (* event) (GtkWidget *widget,
286 gboolean (* button_press_event) (GtkWidget *widget,
287 GdkEventButton *event);
288 gboolean (* button_release_event) (GtkWidget *widget,
289 GdkEventButton *event);
290 gboolean (* scroll_event) (GtkWidget *widget,
291 GdkEventScroll *event);
292 gboolean (* motion_notify_event) (GtkWidget *widget,
293 GdkEventMotion *event);
294 gboolean (* delete_event) (GtkWidget *widget,
296 gboolean (* destroy_event) (GtkWidget *widget,
298 gboolean (* key_press_event) (GtkWidget *widget,
300 gboolean (* key_release_event) (GtkWidget *widget,
302 gboolean (* enter_notify_event) (GtkWidget *widget,
303 GdkEventCrossing *event);
304 gboolean (* leave_notify_event) (GtkWidget *widget,
305 GdkEventCrossing *event);
306 gboolean (* configure_event) (GtkWidget *widget,
307 GdkEventConfigure *event);
308 gboolean (* focus_in_event) (GtkWidget *widget,
309 GdkEventFocus *event);
310 gboolean (* focus_out_event) (GtkWidget *widget,
311 GdkEventFocus *event);
312 gboolean (* map_event) (GtkWidget *widget,
314 gboolean (* unmap_event) (GtkWidget *widget,
316 gboolean (* property_notify_event) (GtkWidget *widget,
317 GdkEventProperty *event);
318 gboolean (* selection_clear_event) (GtkWidget *widget,
319 GdkEventSelection *event);
320 gboolean (* selection_request_event) (GtkWidget *widget,
321 GdkEventSelection *event);
322 gboolean (* selection_notify_event) (GtkWidget *widget,
323 GdkEventSelection *event);
324 gboolean (* proximity_in_event) (GtkWidget *widget,
325 GdkEventProximity *event);
326 gboolean (* proximity_out_event) (GtkWidget *widget,
327 GdkEventProximity *event);
328 gboolean (* visibility_notify_event) (GtkWidget *widget,
329 GdkEventVisibility *event);
330 gboolean (* window_state_event) (GtkWidget *widget,
331 GdkEventWindowState *event);
332 gboolean (* damage_event) (GtkWidget *widget,
333 GdkEventExpose *event);
334 gboolean (* grab_broken_event) (GtkWidget *widget,
335 GdkEventGrabBroken *event);
338 void (* selection_get) (GtkWidget *widget,
339 GtkSelectionData *selection_data,
342 void (* selection_received) (GtkWidget *widget,
343 GtkSelectionData *selection_data,
346 /* Source side drag signals */
347 void (* drag_begin) (GtkWidget *widget,
348 GdkDragContext *context);
349 void (* drag_end) (GtkWidget *widget,
350 GdkDragContext *context);
351 void (* drag_data_get) (GtkWidget *widget,
352 GdkDragContext *context,
353 GtkSelectionData *selection_data,
356 void (* drag_data_delete) (GtkWidget *widget,
357 GdkDragContext *context);
359 /* Target side drag signals */
360 void (* drag_leave) (GtkWidget *widget,
361 GdkDragContext *context,
363 gboolean (* drag_motion) (GtkWidget *widget,
364 GdkDragContext *context,
368 gboolean (* drag_drop) (GtkWidget *widget,
369 GdkDragContext *context,
373 void (* drag_data_received) (GtkWidget *widget,
374 GdkDragContext *context,
377 GtkSelectionData *selection_data,
380 gboolean (* drag_failed) (GtkWidget *widget,
381 GdkDragContext *context,
382 GtkDragResult result);
384 /* Signals used only for keybindings */
385 gboolean (* popup_menu) (GtkWidget *widget);
387 /* If a widget has multiple tooltips/whatsthis, it should show the
388 * one for the current focus location, or if that doesn't make
389 * sense, should cycle through them showing each tip alongside
390 * whatever piece of the widget it applies to.
392 gboolean (* show_help) (GtkWidget *widget,
393 GtkWidgetHelpType help_type);
395 /* accessibility support
397 AtkObject * (* get_accessible) (GtkWidget *widget);
399 void (* screen_changed) (GtkWidget *widget,
400 GdkScreen *previous_screen);
401 gboolean (* can_activate_accel) (GtkWidget *widget,
405 void (* composited_changed) (GtkWidget *widget);
407 gboolean (* query_tooltip) (GtkWidget *widget,
410 gboolean keyboard_tooltip,
411 GtkTooltip *tooltip);
413 void (* compute_expand) (GtkWidget *widget,
415 gboolean *vexpand_p);
417 void (* adjust_size_request) (GtkWidget *widget,
418 GtkOrientation orientation,
421 void (* adjust_size_allocation) (GtkWidget *widget,
422 GtkOrientation orientation,
426 gint *allocated_size);
428 void (* style_updated) (GtkWidget *widget);
432 GtkWidgetClassPrivate *priv;
434 /* Padding for future expansion */
435 void (*_gtk_reserved2) (void);
436 void (*_gtk_reserved3) (void);
437 void (*_gtk_reserved4) (void);
438 void (*_gtk_reserved5) (void);
439 void (*_gtk_reserved6) (void);
440 void (*_gtk_reserved7) (void);
441 void (*_gtk_reserved8) (void);
444 struct _GtkWidgetAuxInfo
455 GType gtk_widget_get_type (void) G_GNUC_CONST;
456 GtkWidget* gtk_widget_new (GType type,
457 const gchar *first_property_name,
459 void gtk_widget_destroy (GtkWidget *widget);
460 void gtk_widget_destroyed (GtkWidget *widget,
461 GtkWidget **widget_pointer);
462 void gtk_widget_unparent (GtkWidget *widget);
463 void gtk_widget_show (GtkWidget *widget);
464 void gtk_widget_hide (GtkWidget *widget);
465 void gtk_widget_show_now (GtkWidget *widget);
466 void gtk_widget_show_all (GtkWidget *widget);
467 void gtk_widget_set_no_show_all (GtkWidget *widget,
468 gboolean no_show_all);
469 gboolean gtk_widget_get_no_show_all (GtkWidget *widget);
470 void gtk_widget_map (GtkWidget *widget);
471 void gtk_widget_unmap (GtkWidget *widget);
472 void gtk_widget_realize (GtkWidget *widget);
473 void gtk_widget_unrealize (GtkWidget *widget);
475 void gtk_widget_draw (GtkWidget *widget,
478 void gtk_widget_queue_draw (GtkWidget *widget);
479 void gtk_widget_queue_draw_area (GtkWidget *widget,
484 void gtk_widget_queue_draw_region (GtkWidget *widget,
485 const cairo_region_t*region);
486 void gtk_widget_queue_resize (GtkWidget *widget);
487 void gtk_widget_queue_resize_no_redraw (GtkWidget *widget);
488 #ifndef GTK_DISABLE_DEPRECATED
489 void gtk_widget_size_request (GtkWidget *widget,
490 GtkRequisition *requisition);
492 void gtk_widget_size_allocate (GtkWidget *widget,
493 GtkAllocation *allocation);
495 GtkSizeRequestMode gtk_widget_get_request_mode (GtkWidget *widget);
496 void gtk_widget_get_preferred_width (GtkWidget *widget,
498 gint *natural_width);
499 void gtk_widget_get_preferred_height_for_width (GtkWidget *widget,
501 gint *minimum_height,
502 gint *natural_height);
503 void gtk_widget_get_preferred_height (GtkWidget *widget,
504 gint *minimum_height,
505 gint *natural_height);
506 void gtk_widget_get_preferred_width_for_height (GtkWidget *widget,
509 gint *natural_width);
510 void gtk_widget_get_preferred_size (GtkWidget *widget,
511 GtkRequisition *minimum_size,
512 GtkRequisition *natural_size);
514 #ifndef GTK_DISABLE_DEPRECATED
515 void gtk_widget_get_child_requisition (GtkWidget *widget,
516 GtkRequisition *requisition);
518 void gtk_widget_add_accelerator (GtkWidget *widget,
519 const gchar *accel_signal,
520 GtkAccelGroup *accel_group,
522 GdkModifierType accel_mods,
523 GtkAccelFlags accel_flags);
524 gboolean gtk_widget_remove_accelerator (GtkWidget *widget,
525 GtkAccelGroup *accel_group,
527 GdkModifierType accel_mods);
528 void gtk_widget_set_accel_path (GtkWidget *widget,
529 const gchar *accel_path,
530 GtkAccelGroup *accel_group);
531 GList* gtk_widget_list_accel_closures (GtkWidget *widget);
532 gboolean gtk_widget_can_activate_accel (GtkWidget *widget,
534 gboolean gtk_widget_mnemonic_activate (GtkWidget *widget,
535 gboolean group_cycling);
536 gboolean gtk_widget_event (GtkWidget *widget,
538 gint gtk_widget_send_expose (GtkWidget *widget,
540 gboolean gtk_widget_send_focus_change (GtkWidget *widget,
543 gboolean gtk_widget_activate (GtkWidget *widget);
545 void gtk_widget_reparent (GtkWidget *widget,
546 GtkWidget *new_parent);
547 gboolean gtk_widget_intersect (GtkWidget *widget,
548 const GdkRectangle *area,
549 GdkRectangle *intersection);
550 cairo_region_t *gtk_widget_region_intersect (GtkWidget *widget,
551 const cairo_region_t *region);
553 void gtk_widget_freeze_child_notify (GtkWidget *widget);
554 void gtk_widget_child_notify (GtkWidget *widget,
555 const gchar *child_property);
556 void gtk_widget_thaw_child_notify (GtkWidget *widget);
558 void gtk_widget_set_can_focus (GtkWidget *widget,
560 gboolean gtk_widget_get_can_focus (GtkWidget *widget);
561 gboolean gtk_widget_has_focus (GtkWidget *widget);
562 gboolean gtk_widget_is_focus (GtkWidget *widget);
563 void gtk_widget_grab_focus (GtkWidget *widget);
565 void gtk_widget_set_can_default (GtkWidget *widget,
566 gboolean can_default);
567 gboolean gtk_widget_get_can_default (GtkWidget *widget);
568 gboolean gtk_widget_has_default (GtkWidget *widget);
569 void gtk_widget_grab_default (GtkWidget *widget);
571 void gtk_widget_set_receives_default (GtkWidget *widget,
572 gboolean receives_default);
573 gboolean gtk_widget_get_receives_default (GtkWidget *widget);
575 gboolean gtk_widget_has_grab (GtkWidget *widget);
577 gboolean gtk_widget_device_is_shadowed (GtkWidget *widget,
581 void gtk_widget_set_name (GtkWidget *widget,
583 const gchar * gtk_widget_get_name (GtkWidget *widget);
585 void gtk_widget_set_state (GtkWidget *widget,
587 GtkStateType gtk_widget_get_state (GtkWidget *widget);
589 void gtk_widget_set_state_flags (GtkWidget *widget,
592 void gtk_widget_unset_state_flags (GtkWidget *widget,
593 GtkStateFlags flags);
594 GtkStateFlags gtk_widget_get_state_flags (GtkWidget *widget);
596 void gtk_widget_set_sensitive (GtkWidget *widget,
598 gboolean gtk_widget_get_sensitive (GtkWidget *widget);
599 gboolean gtk_widget_is_sensitive (GtkWidget *widget);
601 void gtk_widget_set_visible (GtkWidget *widget,
603 gboolean gtk_widget_get_visible (GtkWidget *widget);
605 void gtk_widget_set_has_window (GtkWidget *widget,
606 gboolean has_window);
607 gboolean gtk_widget_get_has_window (GtkWidget *widget);
609 gboolean gtk_widget_is_toplevel (GtkWidget *widget);
610 gboolean gtk_widget_is_drawable (GtkWidget *widget);
611 void gtk_widget_set_realized (GtkWidget *widget,
613 gboolean gtk_widget_get_realized (GtkWidget *widget);
614 void gtk_widget_set_mapped (GtkWidget *widget,
616 gboolean gtk_widget_get_mapped (GtkWidget *widget);
618 void gtk_widget_set_app_paintable (GtkWidget *widget,
619 gboolean app_paintable);
620 gboolean gtk_widget_get_app_paintable (GtkWidget *widget);
622 void gtk_widget_set_double_buffered (GtkWidget *widget,
623 gboolean double_buffered);
624 gboolean gtk_widget_get_double_buffered (GtkWidget *widget);
626 void gtk_widget_set_redraw_on_allocate (GtkWidget *widget,
627 gboolean redraw_on_allocate);
629 void gtk_widget_set_parent (GtkWidget *widget,
631 GtkWidget * gtk_widget_get_parent (GtkWidget *widget);
633 void gtk_widget_set_parent_window (GtkWidget *widget,
634 GdkWindow *parent_window);
635 GdkWindow * gtk_widget_get_parent_window (GtkWidget *widget);
637 void gtk_widget_set_child_visible (GtkWidget *widget,
638 gboolean is_visible);
639 gboolean gtk_widget_get_child_visible (GtkWidget *widget);
641 void gtk_widget_set_window (GtkWidget *widget,
643 GdkWindow * gtk_widget_get_window (GtkWidget *widget);
645 int gtk_widget_get_allocated_width (GtkWidget *widget);
646 int gtk_widget_get_allocated_height (GtkWidget *widget);
648 void gtk_widget_get_allocation (GtkWidget *widget,
649 GtkAllocation *allocation);
650 void gtk_widget_set_allocation (GtkWidget *widget,
651 const GtkAllocation *allocation);
653 void gtk_widget_get_requisition (GtkWidget *widget,
654 GtkRequisition *requisition);
656 gboolean gtk_widget_child_focus (GtkWidget *widget,
657 GtkDirectionType direction);
658 gboolean gtk_widget_keynav_failed (GtkWidget *widget,
659 GtkDirectionType direction);
660 void gtk_widget_error_bell (GtkWidget *widget);
662 void gtk_widget_set_size_request (GtkWidget *widget,
665 void gtk_widget_get_size_request (GtkWidget *widget,
668 void gtk_widget_set_events (GtkWidget *widget,
670 void gtk_widget_add_events (GtkWidget *widget,
672 void gtk_widget_set_device_events (GtkWidget *widget,
674 GdkEventMask events);
675 void gtk_widget_add_device_events (GtkWidget *widget,
677 GdkEventMask events);
679 void gtk_widget_set_device_enabled (GtkWidget *widget,
682 gboolean gtk_widget_get_device_enabled (GtkWidget *widget,
685 GtkWidget* gtk_widget_get_toplevel (GtkWidget *widget);
686 GtkWidget* gtk_widget_get_ancestor (GtkWidget *widget,
688 GdkVisual* gtk_widget_get_visual (GtkWidget *widget);
689 void gtk_widget_set_visual (GtkWidget *widget,
692 GdkScreen * gtk_widget_get_screen (GtkWidget *widget);
693 gboolean gtk_widget_has_screen (GtkWidget *widget);
694 GdkDisplay * gtk_widget_get_display (GtkWidget *widget);
695 GdkWindow * gtk_widget_get_root_window (GtkWidget *widget);
696 GtkSettings* gtk_widget_get_settings (GtkWidget *widget);
697 GtkClipboard *gtk_widget_get_clipboard (GtkWidget *widget,
701 /* Expand flags and related support */
702 gboolean gtk_widget_get_hexpand (GtkWidget *widget);
703 void gtk_widget_set_hexpand (GtkWidget *widget,
705 gboolean gtk_widget_get_hexpand_set (GtkWidget *widget);
706 void gtk_widget_set_hexpand_set (GtkWidget *widget,
708 gboolean gtk_widget_get_vexpand (GtkWidget *widget);
709 void gtk_widget_set_vexpand (GtkWidget *widget,
711 gboolean gtk_widget_get_vexpand_set (GtkWidget *widget);
712 void gtk_widget_set_vexpand_set (GtkWidget *widget,
714 void gtk_widget_queue_compute_expand (GtkWidget *widget);
715 gboolean gtk_widget_compute_expand (GtkWidget *widget,
716 GtkOrientation orientation);
719 /* Multidevice support */
720 gboolean gtk_widget_get_support_multidevice (GtkWidget *widget);
721 void gtk_widget_set_support_multidevice (GtkWidget *widget,
722 gboolean support_multidevice);
724 /* Accessibility support */
725 void gtk_widget_class_set_accessible_type (GtkWidgetClass *widget_class,
727 void gtk_widget_class_set_accessible_role (GtkWidgetClass *widget_class,
729 AtkObject* gtk_widget_get_accessible (GtkWidget *widget);
732 /* Margin and alignment */
733 GtkAlign gtk_widget_get_halign (GtkWidget *widget);
734 void gtk_widget_set_halign (GtkWidget *widget,
736 GtkAlign gtk_widget_get_valign (GtkWidget *widget);
737 void gtk_widget_set_valign (GtkWidget *widget,
739 gint gtk_widget_get_margin_left (GtkWidget *widget);
740 void gtk_widget_set_margin_left (GtkWidget *widget,
742 gint gtk_widget_get_margin_right (GtkWidget *widget);
743 void gtk_widget_set_margin_right (GtkWidget *widget,
745 gint gtk_widget_get_margin_top (GtkWidget *widget);
746 void gtk_widget_set_margin_top (GtkWidget *widget,
748 gint gtk_widget_get_margin_bottom (GtkWidget *widget);
749 void gtk_widget_set_margin_bottom (GtkWidget *widget,
753 gint gtk_widget_get_events (GtkWidget *widget);
754 GdkEventMask gtk_widget_get_device_events (GtkWidget *widget,
756 void gtk_widget_get_pointer (GtkWidget *widget,
760 gboolean gtk_widget_is_ancestor (GtkWidget *widget,
761 GtkWidget *ancestor);
763 gboolean gtk_widget_translate_coordinates (GtkWidget *src_widget,
764 GtkWidget *dest_widget,
770 /* Hide widget and return TRUE.
772 gboolean gtk_widget_hide_on_delete (GtkWidget *widget);
774 /* Functions to override widget styling */
775 void gtk_widget_override_color (GtkWidget *widget,
777 const GdkRGBA *color);
778 void gtk_widget_override_background_color (GtkWidget *widget,
780 const GdkRGBA *color);
782 void gtk_widget_override_font (GtkWidget *widget,
783 const PangoFontDescription *font_desc);
785 void gtk_widget_override_symbolic_color (GtkWidget *widget,
787 const GdkRGBA *color);
788 void gtk_widget_override_cursor (GtkWidget *widget,
789 const GdkRGBA *cursor,
790 const GdkRGBA *secondary_cursor);
792 void gtk_widget_reset_style (GtkWidget *widget);
794 #if !defined(GTK_DISABLE_DEPRECATED) || defined(GTK_COMPILATION)
796 void gtk_widget_style_attach (GtkWidget *widget);
800 gboolean gtk_widget_has_rc_style (GtkWidget *widget);
801 void gtk_widget_set_style (GtkWidget *widget,
803 void gtk_widget_ensure_style (GtkWidget *widget);
804 GtkStyle * gtk_widget_get_style (GtkWidget *widget);
806 void gtk_widget_modify_style (GtkWidget *widget,
808 GtkRcStyle *gtk_widget_get_modifier_style (GtkWidget *widget);
809 void gtk_widget_modify_fg (GtkWidget *widget,
811 const GdkColor *color);
812 void gtk_widget_modify_bg (GtkWidget *widget,
814 const GdkColor *color);
815 void gtk_widget_modify_text (GtkWidget *widget,
817 const GdkColor *color);
818 void gtk_widget_modify_base (GtkWidget *widget,
820 const GdkColor *color);
821 void gtk_widget_modify_cursor (GtkWidget *widget,
822 const GdkColor *primary,
823 const GdkColor *secondary);
824 void gtk_widget_modify_font (GtkWidget *widget,
825 PangoFontDescription *font_desc);
827 /* Descend recursively and set rc-style on all widgets without user styles */
828 void gtk_widget_reset_rc_styles (GtkWidget *widget);
830 /* Set certain default values to be used at widget creation time */
831 GtkStyle* gtk_widget_get_default_style (void);
833 /* Compute a widget's path in the form "GtkWindow.MyLabel", and
834 * return newly alocated strings.
836 void gtk_widget_path (GtkWidget *widget,
839 gchar **path_reversed);
840 void gtk_widget_class_path (GtkWidget *widget,
843 gchar **path_reversed);
845 GdkPixbuf *gtk_widget_render_icon (GtkWidget *widget,
846 const gchar *stock_id,
848 const gchar *detail);
849 #endif /* GTK_DISABLE_DEPRECATED */
851 PangoContext *gtk_widget_create_pango_context (GtkWidget *widget);
852 PangoContext *gtk_widget_get_pango_context (GtkWidget *widget);
853 PangoLayout *gtk_widget_create_pango_layout (GtkWidget *widget,
856 GdkPixbuf *gtk_widget_render_icon_pixbuf (GtkWidget *widget,
857 const gchar *stock_id,
860 /* handle composite names for GTK_COMPOSITE_CHILD widgets,
861 * the returned name is newly allocated.
863 void gtk_widget_set_composite_name (GtkWidget *widget,
865 gchar* gtk_widget_get_composite_name (GtkWidget *widget);
867 /* Push/pop pairs, to change default values upon a widget's creation.
868 * This will override the values that got set by the
869 * gtk_widget_set_default_* () functions.
871 void gtk_widget_push_composite_child (void);
872 void gtk_widget_pop_composite_child (void);
874 /* widget style properties
876 void gtk_widget_class_install_style_property (GtkWidgetClass *klass,
878 void gtk_widget_class_install_style_property_parser (GtkWidgetClass *klass,
880 GtkRcPropertyParser parser);
881 GParamSpec* gtk_widget_class_find_style_property (GtkWidgetClass *klass,
882 const gchar *property_name);
883 GParamSpec** gtk_widget_class_list_style_properties (GtkWidgetClass *klass,
884 guint *n_properties);
885 void gtk_widget_style_get_property (GtkWidget *widget,
886 const gchar *property_name,
888 void gtk_widget_style_get_valist (GtkWidget *widget,
889 const gchar *first_property_name,
891 void gtk_widget_style_get (GtkWidget *widget,
892 const gchar *first_property_name,
893 ...) G_GNUC_NULL_TERMINATED;
895 /* Functions for setting directionality for widgets */
897 void gtk_widget_set_direction (GtkWidget *widget,
898 GtkTextDirection dir);
899 GtkTextDirection gtk_widget_get_direction (GtkWidget *widget);
901 void gtk_widget_set_default_direction (GtkTextDirection dir);
902 GtkTextDirection gtk_widget_get_default_direction (void);
904 /* Compositing manager functionality */
905 gboolean gtk_widget_is_composited (GtkWidget *widget);
907 /* Counterpart to gdk_window_shape_combine_region.
909 void gtk_widget_shape_combine_region (GtkWidget *widget,
910 cairo_region_t *region);
911 void gtk_widget_input_shape_combine_region (GtkWidget *widget,
912 cairo_region_t *region);
914 GList* gtk_widget_list_mnemonic_labels (GtkWidget *widget);
915 void gtk_widget_add_mnemonic_label (GtkWidget *widget,
917 void gtk_widget_remove_mnemonic_label (GtkWidget *widget,
920 void gtk_widget_set_tooltip_window (GtkWidget *widget,
921 GtkWindow *custom_window);
922 GtkWindow *gtk_widget_get_tooltip_window (GtkWidget *widget);
923 void gtk_widget_trigger_tooltip_query (GtkWidget *widget);
924 void gtk_widget_set_tooltip_text (GtkWidget *widget,
926 gchar * gtk_widget_get_tooltip_text (GtkWidget *widget);
927 void gtk_widget_set_tooltip_markup (GtkWidget *widget,
928 const gchar *markup);
929 gchar * gtk_widget_get_tooltip_markup (GtkWidget *widget);
930 void gtk_widget_set_has_tooltip (GtkWidget *widget,
931 gboolean has_tooltip);
932 gboolean gtk_widget_get_has_tooltip (GtkWidget *widget);
934 gboolean gtk_cairo_should_draw_window (cairo_t *cr,
936 void gtk_cairo_transform_to_window (cairo_t *cr,
940 GType gtk_requisition_get_type (void) G_GNUC_CONST;
941 GtkRequisition *gtk_requisition_new (void) G_GNUC_MALLOC;
942 GtkRequisition *gtk_requisition_copy (const GtkRequisition *requisition);
943 void gtk_requisition_free (GtkRequisition *requisition);
945 gboolean gtk_widget_in_destruction (GtkWidget *widget);
947 GtkStyleContext * gtk_widget_get_style_context (GtkWidget *widget);
949 GtkWidgetPath * gtk_widget_get_path (GtkWidget *widget);
954 #endif /* __GTK_WIDGET_H__ */