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 _GtkWidgetAuxInfo GtkWidgetAuxInfo;
72 typedef struct _GtkClipboard GtkClipboard;
73 typedef struct _GtkTooltip GtkTooltip;
74 typedef struct _GtkWindow GtkWindow;
79 * @x: the X position of the widget's area relative to its parents allocation.
80 * @y: the Y position of the widget's area relative to its parents allocation.
81 * @width: the width of the widget's allocated area.
82 * @height: the height of the widget's allocated area.
84 * A <structname>GtkAllocation</structname> of a widget represents region
85 * which has been allocated to the widget by its parent. It is a subregion
86 * of its parents allocation. See <xref linkend="geometry-management"/> for
89 typedef GdkRectangle GtkAllocation;
93 * @widget: the widget to operate on
94 * @data: user-supplied data
96 * The type of the callback functions used for e.g. iterating over
97 * the children of a container, see gtk_container_foreach().
99 typedef void (*GtkCallback) (GtkWidget *widget,
104 * @width: the widget's desired width
105 * @height: the widget's desired height
107 * A <structname>GtkRequisition</structname> represents the desired size of a widget. See
108 * <xref linkend="geometry-management"/> for more information.
110 struct _GtkRequisition
116 /* The widget is the base of the tree for displayable objects.
117 * (A displayable object is one which takes up some amount
118 * of screen real estate). It provides a common base and interface
119 * which actual widgets must adhere to.
123 GInitiallyUnowned parent_instance;
125 GtkWidgetPrivate *priv;
130 * @parent_class: The object class structure needs to be the first
131 * element in the widget class structure in order for the class mechanism
132 * to work correctly. This allows a GtkWidgetClass pointer to be cast to
133 * a GObjectClass pointer.
134 * @activate_signal: The signal to emit when a widget of this class is
135 * activated, gtk_widget_activate() handles the emission.
136 * Implementation of this signal is optional.
137 * @get_request_mode: This allows a widget to tell its parent container whether
138 * it prefers to be allocated in %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH or
139 * %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT mode.
140 * %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH means the widget prefers to have
141 * #GtkWidgetClass.get_preferred_width() called and then
142 * #GtkWidgetClass.get_preferred_height_for_width() and is the default
143 * return for unimplemented cases.
144 * However it's important to note (as described below) that any widget
145 * which trades height-for-width must respond properly to both
146 * #GtkSizeRequestModes since it might be queried in either orientation
147 * by its parent container.
148 * @get_preferred_height: This is called by containers to obtain the minimum
149 * and natural height of a widget. A widget that does not actually trade
150 * any height for width or width for height only has to implement these
151 * two virtual methods (#GtkWidgetClass.get_preferred_width() and
152 * #GtkWidgetClass.get_preferred_height()).
153 * @get_preferred_width_for_height: This is analogous to
154 * #GtkWidgetClass.get_preferred_height_for_width() except that it
155 * operates in the oposite orientation. It's rare that a widget actually
156 * does %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT requests but this can happen
157 * when, for example, a widget or container gets additional columns to
158 * compensate for a smaller allocated height.
159 * @get_preferred_width: This is called by containers to obtain the minimum
160 * and natural width of a widget. A widget will never be allocated a width
161 * less than its minimum and will only ever be allocated a width greater
162 * than the natural width once all of the said widget's siblings have
163 * received their natural widths.
164 * Furthermore, a widget will only ever be allocated a width greater than
165 * its natural width if it was configured to receive extra expand space
166 * from its parent container.
167 * @get_preferred_height_for_width: This is similar to
168 * #GtkWidgetClass.get_preferred_height() except that it is passed a
169 * contextual width to request height for. By implementing this virtual
170 * method it is possible for a #GtkLabel to tell its parent how much height
171 * would be required if the label were to be allocated a said width.
172 * @adjust_size_request: Convert an initial size request from a widget's
173 * #GtkSizeRequest virtual method implementations into a size request to
174 * be used by parent containers in laying out the widget.
175 * adjust_size_request adjusts <emphasis>from</emphasis> a child widget's
176 * original request <emphasis>to</emphasis> what a parent container should
177 * use for layout. The @for_size argument will be -1 if the request should
178 * not be for a particular size in the opposing orientation, i.e. if the
179 * request is not height-for-width or width-for-height. If @for_size is
180 * greater than -1, it is the proposed allocation in the opposing
181 * orientation that we need the request for. Implementations of
182 * adjust_size_request should chain up to the default implementation,
183 * which applies #GtkWidget's margin properties and imposes any values
184 * from gtk_widget_set_size_request(). Chaining up should be last,
185 * <emphasis>after</emphasis> your subclass adjusts the request, so
186 * #GtkWidget can apply constraints and add the margin properly.
187 * @adjust_size_allocation: Convert an initial size allocation assigned
188 * by a #GtkContainer using gtk_widget_size_allocate(), into an actual
189 * size allocation to be used by the widget. adjust_size_allocation
190 * adjusts <emphasis>to</emphasis> a child widget's actual allocation
191 * <emphasis>from</emphasis> what a parent container computed for the
192 * child. The adjusted allocation must be entirely within the original
193 * allocation. In any custom implementation, chain up to the default
194 * #GtkWidget implementation of this method, which applies the margin
195 * and alignment properties of #GtkWidget. Chain up
196 * <emphasis>before</emphasis> performing your own adjustments so your
197 * own adjustments remove more allocation after the #GtkWidget base
198 * class has already removed margin and alignment. The natural size
199 * passed in should be adjusted in the same way as the allocated size,
200 * which allows adjustments to perform alignments or other changes
201 * based on natural size.
203 struct _GtkWidgetClass
205 GInitiallyUnownedClass parent_class;
209 guint activate_signal;
211 /* seldomly overidden */
212 void (*dispatch_child_properties_changed) (GtkWidget *widget,
214 GParamSpec **pspecs);
217 void (* destroy) (GtkWidget *widget);
218 void (* show) (GtkWidget *widget);
219 void (* show_all) (GtkWidget *widget);
220 void (* hide) (GtkWidget *widget);
221 void (* map) (GtkWidget *widget);
222 void (* unmap) (GtkWidget *widget);
223 void (* realize) (GtkWidget *widget);
224 void (* unrealize) (GtkWidget *widget);
225 void (* size_allocate) (GtkWidget *widget,
226 GtkAllocation *allocation);
227 void (* state_changed) (GtkWidget *widget,
228 GtkStateType previous_state);
229 void (* state_flags_changed) (GtkWidget *widget,
230 GtkStateFlags previous_state_flags);
231 void (* parent_set) (GtkWidget *widget,
232 GtkWidget *previous_parent);
233 void (* hierarchy_changed) (GtkWidget *widget,
234 GtkWidget *previous_toplevel);
235 void (* style_set) (GtkWidget *widget,
236 GtkStyle *previous_style);
237 void (* direction_changed) (GtkWidget *widget,
238 GtkTextDirection previous_direction);
239 void (* grab_notify) (GtkWidget *widget,
240 gboolean was_grabbed);
241 void (* child_notify) (GtkWidget *widget,
243 gboolean (* draw) (GtkWidget *widget,
247 GtkSizeRequestMode (* get_request_mode) (GtkWidget *widget);
249 void (* get_preferred_height) (GtkWidget *widget,
250 gint *minimum_height,
251 gint *natural_height);
252 void (* get_preferred_width_for_height) (GtkWidget *widget,
255 gint *natural_width);
256 void (* get_preferred_width) (GtkWidget *widget,
258 gint *natural_width);
259 void (* get_preferred_height_for_width) (GtkWidget *widget,
261 gint *minimum_height,
262 gint *natural_height);
265 gboolean (* mnemonic_activate) (GtkWidget *widget,
266 gboolean group_cycling);
269 void (* grab_focus) (GtkWidget *widget);
270 gboolean (* focus) (GtkWidget *widget,
271 GtkDirectionType direction);
273 /* keyboard navigation */
274 void (* move_focus) (GtkWidget *widget,
275 GtkDirectionType direction);
276 gboolean (* keynav_failed) (GtkWidget *widget,
277 GtkDirectionType direction);
280 gboolean (* event) (GtkWidget *widget,
282 gboolean (* button_press_event) (GtkWidget *widget,
283 GdkEventButton *event);
284 gboolean (* button_release_event) (GtkWidget *widget,
285 GdkEventButton *event);
286 gboolean (* scroll_event) (GtkWidget *widget,
287 GdkEventScroll *event);
288 gboolean (* motion_notify_event) (GtkWidget *widget,
289 GdkEventMotion *event);
290 gboolean (* delete_event) (GtkWidget *widget,
292 gboolean (* destroy_event) (GtkWidget *widget,
294 gboolean (* key_press_event) (GtkWidget *widget,
296 gboolean (* key_release_event) (GtkWidget *widget,
298 gboolean (* enter_notify_event) (GtkWidget *widget,
299 GdkEventCrossing *event);
300 gboolean (* leave_notify_event) (GtkWidget *widget,
301 GdkEventCrossing *event);
302 gboolean (* configure_event) (GtkWidget *widget,
303 GdkEventConfigure *event);
304 gboolean (* focus_in_event) (GtkWidget *widget,
305 GdkEventFocus *event);
306 gboolean (* focus_out_event) (GtkWidget *widget,
307 GdkEventFocus *event);
308 gboolean (* map_event) (GtkWidget *widget,
310 gboolean (* unmap_event) (GtkWidget *widget,
312 gboolean (* property_notify_event) (GtkWidget *widget,
313 GdkEventProperty *event);
314 gboolean (* selection_clear_event) (GtkWidget *widget,
315 GdkEventSelection *event);
316 gboolean (* selection_request_event) (GtkWidget *widget,
317 GdkEventSelection *event);
318 gboolean (* selection_notify_event) (GtkWidget *widget,
319 GdkEventSelection *event);
320 gboolean (* proximity_in_event) (GtkWidget *widget,
321 GdkEventProximity *event);
322 gboolean (* proximity_out_event) (GtkWidget *widget,
323 GdkEventProximity *event);
324 gboolean (* visibility_notify_event) (GtkWidget *widget,
325 GdkEventVisibility *event);
326 gboolean (* client_event) (GtkWidget *widget,
327 GdkEventClient *event);
328 gboolean (* window_state_event) (GtkWidget *widget,
329 GdkEventWindowState *event);
330 gboolean (* damage_event) (GtkWidget *widget,
331 GdkEventExpose *event);
332 gboolean (* grab_broken_event) (GtkWidget *widget,
333 GdkEventGrabBroken *event);
336 void (* selection_get) (GtkWidget *widget,
337 GtkSelectionData *selection_data,
340 void (* selection_received) (GtkWidget *widget,
341 GtkSelectionData *selection_data,
344 /* Source side drag signals */
345 void (* drag_begin) (GtkWidget *widget,
346 GdkDragContext *context);
347 void (* drag_end) (GtkWidget *widget,
348 GdkDragContext *context);
349 void (* drag_data_get) (GtkWidget *widget,
350 GdkDragContext *context,
351 GtkSelectionData *selection_data,
354 void (* drag_data_delete) (GtkWidget *widget,
355 GdkDragContext *context);
357 /* Target side drag signals */
358 void (* drag_leave) (GtkWidget *widget,
359 GdkDragContext *context,
361 gboolean (* drag_motion) (GtkWidget *widget,
362 GdkDragContext *context,
366 gboolean (* drag_drop) (GtkWidget *widget,
367 GdkDragContext *context,
371 void (* drag_data_received) (GtkWidget *widget,
372 GdkDragContext *context,
375 GtkSelectionData *selection_data,
379 /* Signals used only for keybindings */
380 gboolean (* popup_menu) (GtkWidget *widget);
382 /* If a widget has multiple tooltips/whatsthis, it should show the
383 * one for the current focus location, or if that doesn't make
384 * sense, should cycle through them showing each tip alongside
385 * whatever piece of the widget it applies to.
387 gboolean (* show_help) (GtkWidget *widget,
388 GtkWidgetHelpType help_type);
390 /* accessibility support
392 AtkObject * (* get_accessible) (GtkWidget *widget);
394 void (* screen_changed) (GtkWidget *widget,
395 GdkScreen *previous_screen);
396 gboolean (* can_activate_accel) (GtkWidget *widget,
400 void (* composited_changed) (GtkWidget *widget);
402 gboolean (* query_tooltip) (GtkWidget *widget,
405 gboolean keyboard_tooltip,
406 GtkTooltip *tooltip);
408 void (* compute_expand) (GtkWidget *widget,
410 gboolean *vexpand_p);
412 void (* adjust_size_request) (GtkWidget *widget,
413 GtkOrientation orientation,
416 void (* adjust_size_allocation) (GtkWidget *widget,
417 GtkOrientation orientation,
420 gint *allocated_size);
422 void (* style_updated) (GtkWidget *widget);
426 /* Padding for future expansion */
427 void (*_gtk_reserved1) (void);
428 void (*_gtk_reserved2) (void);
429 void (*_gtk_reserved3) (void);
430 void (*_gtk_reserved4) (void);
431 void (*_gtk_reserved5) (void);
432 void (*_gtk_reserved6) (void);
433 void (*_gtk_reserved7) (void);
434 void (*_gtk_reserved8) (void);
437 struct _GtkWidgetAuxInfo
448 GType gtk_widget_get_type (void) G_GNUC_CONST;
449 GtkWidget* gtk_widget_new (GType type,
450 const gchar *first_property_name,
452 void gtk_widget_destroy (GtkWidget *widget);
453 void gtk_widget_destroyed (GtkWidget *widget,
454 GtkWidget **widget_pointer);
455 void gtk_widget_unparent (GtkWidget *widget);
456 void gtk_widget_show (GtkWidget *widget);
457 void gtk_widget_hide (GtkWidget *widget);
458 void gtk_widget_show_now (GtkWidget *widget);
459 void gtk_widget_show_all (GtkWidget *widget);
460 void gtk_widget_set_no_show_all (GtkWidget *widget,
461 gboolean no_show_all);
462 gboolean gtk_widget_get_no_show_all (GtkWidget *widget);
463 void gtk_widget_map (GtkWidget *widget);
464 void gtk_widget_unmap (GtkWidget *widget);
465 void gtk_widget_realize (GtkWidget *widget);
466 void gtk_widget_unrealize (GtkWidget *widget);
468 void gtk_widget_draw (GtkWidget *widget,
471 void gtk_widget_queue_draw (GtkWidget *widget);
472 void gtk_widget_queue_draw_area (GtkWidget *widget,
477 void gtk_widget_queue_draw_region (GtkWidget *widget,
478 cairo_region_t *region);
479 void gtk_widget_queue_resize (GtkWidget *widget);
480 void gtk_widget_queue_resize_no_redraw (GtkWidget *widget);
481 #ifndef GTK_DISABLE_DEPRECATED
482 void gtk_widget_size_request (GtkWidget *widget,
483 GtkRequisition *requisition);
485 void gtk_widget_size_allocate (GtkWidget *widget,
486 GtkAllocation *allocation);
488 GtkSizeRequestMode gtk_widget_get_request_mode (GtkWidget *widget);
489 void gtk_widget_get_preferred_width (GtkWidget *widget,
491 gint *natural_width);
492 void gtk_widget_get_preferred_height_for_width (GtkWidget *widget,
494 gint *minimum_height,
495 gint *natural_height);
496 void gtk_widget_get_preferred_height (GtkWidget *widget,
497 gint *minimum_height,
498 gint *natural_height);
499 void gtk_widget_get_preferred_width_for_height (GtkWidget *widget,
502 gint *natural_width);
503 void gtk_widget_get_preferred_size (GtkWidget *widget,
504 GtkRequisition *minimum_size,
505 GtkRequisition *natural_size);
507 #ifndef GTK_DISABLE_DEPRECATED
508 void gtk_widget_get_child_requisition (GtkWidget *widget,
509 GtkRequisition *requisition);
511 void gtk_widget_add_accelerator (GtkWidget *widget,
512 const gchar *accel_signal,
513 GtkAccelGroup *accel_group,
515 GdkModifierType accel_mods,
516 GtkAccelFlags accel_flags);
517 gboolean gtk_widget_remove_accelerator (GtkWidget *widget,
518 GtkAccelGroup *accel_group,
520 GdkModifierType accel_mods);
521 void gtk_widget_set_accel_path (GtkWidget *widget,
522 const gchar *accel_path,
523 GtkAccelGroup *accel_group);
524 const gchar* _gtk_widget_get_accel_path (GtkWidget *widget,
526 GList* gtk_widget_list_accel_closures (GtkWidget *widget);
527 gboolean gtk_widget_can_activate_accel (GtkWidget *widget,
529 gboolean gtk_widget_mnemonic_activate (GtkWidget *widget,
530 gboolean group_cycling);
531 gboolean gtk_widget_event (GtkWidget *widget,
533 gint gtk_widget_send_expose (GtkWidget *widget,
535 gboolean gtk_widget_send_focus_change (GtkWidget *widget,
538 gboolean gtk_widget_activate (GtkWidget *widget);
540 void gtk_widget_reparent (GtkWidget *widget,
541 GtkWidget *new_parent);
542 gboolean gtk_widget_intersect (GtkWidget *widget,
543 const GdkRectangle *area,
544 GdkRectangle *intersection);
545 cairo_region_t *gtk_widget_region_intersect (GtkWidget *widget,
546 const cairo_region_t *region);
548 void gtk_widget_freeze_child_notify (GtkWidget *widget);
549 void gtk_widget_child_notify (GtkWidget *widget,
550 const gchar *child_property);
551 void gtk_widget_thaw_child_notify (GtkWidget *widget);
553 void gtk_widget_set_can_focus (GtkWidget *widget,
555 gboolean gtk_widget_get_can_focus (GtkWidget *widget);
556 gboolean gtk_widget_has_focus (GtkWidget *widget);
557 gboolean gtk_widget_is_focus (GtkWidget *widget);
558 void gtk_widget_grab_focus (GtkWidget *widget);
560 void gtk_widget_set_can_default (GtkWidget *widget,
561 gboolean can_default);
562 gboolean gtk_widget_get_can_default (GtkWidget *widget);
563 gboolean gtk_widget_has_default (GtkWidget *widget);
564 void gtk_widget_grab_default (GtkWidget *widget);
566 void gtk_widget_set_receives_default (GtkWidget *widget,
567 gboolean receives_default);
568 gboolean gtk_widget_get_receives_default (GtkWidget *widget);
570 gboolean gtk_widget_has_grab (GtkWidget *widget);
572 gboolean gtk_widget_device_is_shadowed (GtkWidget *widget,
576 void gtk_widget_set_name (GtkWidget *widget,
578 G_CONST_RETURN gchar* gtk_widget_get_name (GtkWidget *widget);
580 void gtk_widget_set_state (GtkWidget *widget,
582 GtkStateType gtk_widget_get_state (GtkWidget *widget);
584 void gtk_widget_set_state_flags (GtkWidget *widget,
587 void gtk_widget_unset_state_flags (GtkWidget *widget,
588 GtkStateFlags flags);
589 GtkStateFlags gtk_widget_get_state_flags (GtkWidget *widget);
591 void gtk_widget_set_sensitive (GtkWidget *widget,
593 gboolean gtk_widget_get_sensitive (GtkWidget *widget);
594 gboolean gtk_widget_is_sensitive (GtkWidget *widget);
596 void gtk_widget_set_visible (GtkWidget *widget,
598 gboolean gtk_widget_get_visible (GtkWidget *widget);
600 void gtk_widget_set_has_window (GtkWidget *widget,
601 gboolean has_window);
602 gboolean gtk_widget_get_has_window (GtkWidget *widget);
604 gboolean gtk_widget_is_toplevel (GtkWidget *widget);
605 gboolean gtk_widget_is_drawable (GtkWidget *widget);
606 void gtk_widget_set_realized (GtkWidget *widget,
608 gboolean gtk_widget_get_realized (GtkWidget *widget);
609 void gtk_widget_set_mapped (GtkWidget *widget,
611 gboolean gtk_widget_get_mapped (GtkWidget *widget);
613 void gtk_widget_set_app_paintable (GtkWidget *widget,
614 gboolean app_paintable);
615 gboolean gtk_widget_get_app_paintable (GtkWidget *widget);
617 void gtk_widget_set_double_buffered (GtkWidget *widget,
618 gboolean double_buffered);
619 gboolean gtk_widget_get_double_buffered (GtkWidget *widget);
621 void gtk_widget_set_redraw_on_allocate (GtkWidget *widget,
622 gboolean redraw_on_allocate);
624 void gtk_widget_set_parent (GtkWidget *widget,
626 GtkWidget * gtk_widget_get_parent (GtkWidget *widget);
628 void gtk_widget_set_parent_window (GtkWidget *widget,
629 GdkWindow *parent_window);
630 GdkWindow * gtk_widget_get_parent_window (GtkWidget *widget);
632 void gtk_widget_set_child_visible (GtkWidget *widget,
633 gboolean is_visible);
634 gboolean gtk_widget_get_child_visible (GtkWidget *widget);
636 void gtk_widget_set_window (GtkWidget *widget,
638 GdkWindow * gtk_widget_get_window (GtkWidget *widget);
640 int gtk_widget_get_allocated_width (GtkWidget *widget);
641 int gtk_widget_get_allocated_height (GtkWidget *widget);
643 void gtk_widget_get_allocation (GtkWidget *widget,
644 GtkAllocation *allocation);
645 void gtk_widget_set_allocation (GtkWidget *widget,
646 const GtkAllocation *allocation);
648 void gtk_widget_get_requisition (GtkWidget *widget,
649 GtkRequisition *requisition);
651 gboolean gtk_widget_child_focus (GtkWidget *widget,
652 GtkDirectionType direction);
653 gboolean gtk_widget_keynav_failed (GtkWidget *widget,
654 GtkDirectionType direction);
655 void gtk_widget_error_bell (GtkWidget *widget);
657 void gtk_widget_set_size_request (GtkWidget *widget,
660 void gtk_widget_get_size_request (GtkWidget *widget,
663 void gtk_widget_set_events (GtkWidget *widget,
665 void gtk_widget_add_events (GtkWidget *widget,
667 void gtk_widget_set_device_events (GtkWidget *widget,
669 GdkEventMask events);
670 void gtk_widget_add_device_events (GtkWidget *widget,
672 GdkEventMask events);
673 void gtk_widget_set_extension_events (GtkWidget *widget,
674 GdkExtensionMode mode);
676 GdkExtensionMode gtk_widget_get_extension_events (GtkWidget *widget);
677 GtkWidget* gtk_widget_get_toplevel (GtkWidget *widget);
678 GtkWidget* gtk_widget_get_ancestor (GtkWidget *widget,
680 GdkVisual* gtk_widget_get_visual (GtkWidget *widget);
681 void gtk_widget_set_visual (GtkWidget *widget,
684 GdkScreen * gtk_widget_get_screen (GtkWidget *widget);
685 gboolean gtk_widget_has_screen (GtkWidget *widget);
686 GdkDisplay * gtk_widget_get_display (GtkWidget *widget);
687 GdkWindow * gtk_widget_get_root_window (GtkWidget *widget);
688 GtkSettings* gtk_widget_get_settings (GtkWidget *widget);
689 GtkClipboard *gtk_widget_get_clipboard (GtkWidget *widget,
693 /* Expand flags and related support */
694 gboolean gtk_widget_get_hexpand (GtkWidget *widget);
695 void gtk_widget_set_hexpand (GtkWidget *widget,
697 gboolean gtk_widget_get_hexpand_set (GtkWidget *widget);
698 void gtk_widget_set_hexpand_set (GtkWidget *widget,
700 gboolean gtk_widget_get_vexpand (GtkWidget *widget);
701 void gtk_widget_set_vexpand (GtkWidget *widget,
703 gboolean gtk_widget_get_vexpand_set (GtkWidget *widget);
704 void gtk_widget_set_vexpand_set (GtkWidget *widget,
706 void gtk_widget_queue_compute_expand (GtkWidget *widget);
707 gboolean gtk_widget_compute_expand (GtkWidget *widget,
708 GtkOrientation orientation);
711 /* Multidevice support */
712 gboolean gtk_widget_get_support_multidevice (GtkWidget *widget);
713 void gtk_widget_set_support_multidevice (GtkWidget *widget,
714 gboolean support_multidevice);
716 /* Accessibility support */
717 AtkObject* gtk_widget_get_accessible (GtkWidget *widget);
720 /* Margin and alignment */
721 GtkAlign gtk_widget_get_halign (GtkWidget *widget);
722 void gtk_widget_set_halign (GtkWidget *widget,
724 GtkAlign gtk_widget_get_valign (GtkWidget *widget);
725 void gtk_widget_set_valign (GtkWidget *widget,
727 gint gtk_widget_get_margin_left (GtkWidget *widget);
728 void gtk_widget_set_margin_left (GtkWidget *widget,
730 gint gtk_widget_get_margin_right (GtkWidget *widget);
731 void gtk_widget_set_margin_right (GtkWidget *widget,
733 gint gtk_widget_get_margin_top (GtkWidget *widget);
734 void gtk_widget_set_margin_top (GtkWidget *widget,
736 gint gtk_widget_get_margin_bottom (GtkWidget *widget);
737 void gtk_widget_set_margin_bottom (GtkWidget *widget,
741 gint gtk_widget_get_events (GtkWidget *widget);
742 GdkEventMask gtk_widget_get_device_events (GtkWidget *widget,
744 void gtk_widget_get_pointer (GtkWidget *widget,
748 gboolean gtk_widget_is_ancestor (GtkWidget *widget,
749 GtkWidget *ancestor);
751 gboolean gtk_widget_translate_coordinates (GtkWidget *src_widget,
752 GtkWidget *dest_widget,
758 /* Hide widget and return TRUE.
760 gboolean gtk_widget_hide_on_delete (GtkWidget *widget);
762 /* Functions to override widget styling */
763 void gtk_widget_override_color (GtkWidget *widget,
765 const GdkRGBA *color);
766 void gtk_widget_override_background_color (GtkWidget *widget,
768 const GdkRGBA *color);
770 void gtk_widget_override_font (GtkWidget *widget,
771 const PangoFontDescription *font_desc);
773 void gtk_widget_override_symbolic_color (GtkWidget *widget,
775 const GdkRGBA *color);
776 void gtk_widget_override_cursor (GtkWidget *widget,
777 const GdkRGBA *cursor,
778 const GdkRGBA *secondary_cursor);
781 void gtk_widget_style_attach (GtkWidget *widget);
783 #if !defined(GTK_DISABLE_DEPRECATED) || defined(GTK_COMPILATION)
787 gboolean gtk_widget_has_rc_style (GtkWidget *widget);
788 void gtk_widget_set_style (GtkWidget *widget,
790 void gtk_widget_ensure_style (GtkWidget *widget);
791 GtkStyle * gtk_widget_get_style (GtkWidget *widget);
793 void gtk_widget_modify_style (GtkWidget *widget,
795 GtkRcStyle *gtk_widget_get_modifier_style (GtkWidget *widget);
796 void gtk_widget_modify_fg (GtkWidget *widget,
798 const GdkColor *color);
799 void gtk_widget_modify_bg (GtkWidget *widget,
801 const GdkColor *color);
802 void gtk_widget_modify_text (GtkWidget *widget,
804 const GdkColor *color);
805 void gtk_widget_modify_base (GtkWidget *widget,
807 const GdkColor *color);
808 void gtk_widget_modify_cursor (GtkWidget *widget,
809 const GdkColor *primary,
810 const GdkColor *secondary);
811 void gtk_widget_modify_font (GtkWidget *widget,
812 PangoFontDescription *font_desc);
814 /* Descend recursively and set rc-style on all widgets without user styles */
815 void gtk_widget_reset_rc_styles (GtkWidget *widget);
816 void gtk_widget_reset_style (GtkWidget *widget);
818 /* Set certain default values to be used at widget creation time */
819 GtkStyle* gtk_widget_get_default_style (void);
821 /* Compute a widget's path in the form "GtkWindow.MyLabel", and
822 * return newly alocated strings.
824 void gtk_widget_path (GtkWidget *widget,
827 gchar **path_reversed);
828 void gtk_widget_class_path (GtkWidget *widget,
831 gchar **path_reversed);
833 #endif /* GTK_DISABLE_DEPRECATED */
835 PangoContext *gtk_widget_create_pango_context (GtkWidget *widget);
836 PangoContext *gtk_widget_get_pango_context (GtkWidget *widget);
837 PangoLayout *gtk_widget_create_pango_layout (GtkWidget *widget,
840 GdkPixbuf *gtk_widget_render_icon (GtkWidget *widget,
841 const gchar *stock_id,
843 const gchar *detail);
845 /* handle composite names for GTK_COMPOSITE_CHILD widgets,
846 * the returned name is newly allocated.
848 void gtk_widget_set_composite_name (GtkWidget *widget,
850 gchar* gtk_widget_get_composite_name (GtkWidget *widget);
852 /* Push/pop pairs, to change default values upon a widget's creation.
853 * This will override the values that got set by the
854 * gtk_widget_set_default_* () functions.
856 void gtk_widget_push_composite_child (void);
857 void gtk_widget_pop_composite_child (void);
859 /* widget style properties
861 void gtk_widget_class_install_style_property (GtkWidgetClass *klass,
863 void gtk_widget_class_install_style_property_parser (GtkWidgetClass *klass,
865 GtkRcPropertyParser parser);
866 GParamSpec* gtk_widget_class_find_style_property (GtkWidgetClass *klass,
867 const gchar *property_name);
868 GParamSpec** gtk_widget_class_list_style_properties (GtkWidgetClass *klass,
869 guint *n_properties);
870 void gtk_widget_style_get_property (GtkWidget *widget,
871 const gchar *property_name,
873 void gtk_widget_style_get_valist (GtkWidget *widget,
874 const gchar *first_property_name,
876 void gtk_widget_style_get (GtkWidget *widget,
877 const gchar *first_property_name,
878 ...) G_GNUC_NULL_TERMINATED;
880 /* Functions for setting directionality for widgets */
882 void gtk_widget_set_direction (GtkWidget *widget,
883 GtkTextDirection dir);
884 GtkTextDirection gtk_widget_get_direction (GtkWidget *widget);
886 void gtk_widget_set_default_direction (GtkTextDirection dir);
887 GtkTextDirection gtk_widget_get_default_direction (void);
889 /* Compositing manager functionality */
890 gboolean gtk_widget_is_composited (GtkWidget *widget);
892 /* Counterpart to gdk_window_shape_combine_region.
894 void gtk_widget_shape_combine_region (GtkWidget *widget,
895 cairo_region_t *region);
896 void gtk_widget_input_shape_combine_region (GtkWidget *widget,
897 cairo_region_t *region);
899 /* internal function */
900 void gtk_widget_reset_shapes (GtkWidget *widget);
902 GList* gtk_widget_list_mnemonic_labels (GtkWidget *widget);
903 void gtk_widget_add_mnemonic_label (GtkWidget *widget,
905 void gtk_widget_remove_mnemonic_label (GtkWidget *widget,
908 void gtk_widget_set_tooltip_window (GtkWidget *widget,
909 GtkWindow *custom_window);
910 GtkWindow *gtk_widget_get_tooltip_window (GtkWidget *widget);
911 void gtk_widget_trigger_tooltip_query (GtkWidget *widget);
912 void gtk_widget_set_tooltip_text (GtkWidget *widget,
914 gchar * gtk_widget_get_tooltip_text (GtkWidget *widget);
915 void gtk_widget_set_tooltip_markup (GtkWidget *widget,
916 const gchar *markup);
917 gchar * gtk_widget_get_tooltip_markup (GtkWidget *widget);
918 void gtk_widget_set_has_tooltip (GtkWidget *widget,
919 gboolean has_tooltip);
920 gboolean gtk_widget_get_has_tooltip (GtkWidget *widget);
922 gboolean gtk_cairo_should_draw_window (cairo_t *cr,
924 void gtk_cairo_transform_to_window (cairo_t *cr,
928 GType gtk_requisition_get_type (void) G_GNUC_CONST;
929 GtkRequisition *gtk_requisition_new (void) G_GNUC_MALLOC;
930 GtkRequisition *gtk_requisition_copy (const GtkRequisition *requisition);
931 void gtk_requisition_free (GtkRequisition *requisition);
933 GdkEventExpose * _gtk_cairo_get_event (cairo_t *cr);
935 void _gtk_widget_draw_internal (GtkWidget *widget,
937 gboolean clip_to_size);
938 void _gtk_widget_set_has_default (GtkWidget *widget,
939 gboolean has_default);
940 void _gtk_widget_set_has_grab (GtkWidget *widget,
942 void _gtk_widget_set_is_toplevel (GtkWidget *widget,
943 gboolean is_toplevel);
945 void _gtk_widget_grab_notify (GtkWidget *widget,
946 gboolean was_grabbed);
948 GtkWidgetAuxInfo *_gtk_widget_get_aux_info (GtkWidget *widget,
950 void _gtk_widget_propagate_hierarchy_changed (GtkWidget *widget,
951 GtkWidget *previous_toplevel);
952 void _gtk_widget_propagate_screen_changed (GtkWidget *widget,
953 GdkScreen *previous_screen);
954 void _gtk_widget_propagate_composited_changed (GtkWidget *widget);
956 void _gtk_widget_set_device_window (GtkWidget *widget,
958 GdkWindow *pointer_window);
959 GdkWindow *_gtk_widget_get_device_window (GtkWidget *widget,
961 GList * _gtk_widget_list_devices (GtkWidget *widget);
963 void _gtk_widget_synthesize_crossing (GtkWidget *from,
966 GdkCrossingMode mode);
968 gpointer _gtk_widget_peek_request_cache (GtkWidget *widget);
970 void _gtk_widget_buildable_finish_accelerator (GtkWidget *widget,
974 gboolean gtk_widget_in_destruction (GtkWidget *widget);
976 GtkStyleContext * gtk_widget_get_style_context (GtkWidget *widget);
978 GtkWidgetPath * gtk_widget_get_path (GtkWidget *widget);
983 #endif /* __GTK_WIDGET_H__ */