1/* GTK - The GIMP Toolkit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3 *
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.
8 *
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.
13 *
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.
18 */
19
20/*
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/.
25 */
26
27#ifndef __GTK_WIDGET_H__
28#define __GTK_WIDGET_H__
29
30#if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
31#error "Only <gtk/gtk.h> can be included directly."
32#endif
33
34#include <gdk/gdk.h>
35#include <gtk/gtkaccelgroup.h>
36#include <gtk/gtkobject.h>
37#include <gtk/gtkadjustment.h>
38#include <gtk/gtkstyle.h>
39#include <gtk/gtksettings.h>
40#include <atk/atk.h>
41
42G_BEGIN_DECLS
43
44/**
45 * GtkWidgetFlags:
46 * @GTK_TOPLEVEL: widgets without a real parent, as there are #GtkWindow<!-- -->s and
47 * #GtkMenu<!-- -->s have this flag set throughout their lifetime.
48 * Toplevel widgets always contain their own #GdkWindow.
49 * @GTK_NO_WINDOW: Indicative for a widget that does not provide its own #GdkWindow.
50 * Visible action (e.g. drawing) is performed on the parent's #GdkWindow.
51 * @GTK_REALIZED: Set by gtk_widget_realize(), unset by gtk_widget_unrealize().
52 * A realized widget has an associated #GdkWindow.
53 * @GTK_MAPPED: Set by gtk_widget_map(), unset by gtk_widget_unmap().
54 * Only realized widgets can be mapped. It means that gdk_window_show()
55 * has been called on the widgets window(s).
56 * @GTK_VISIBLE: Set by gtk_widget_show(), unset by gtk_widget_hide(). Implies that a
57 * widget will be mapped as soon as its parent is mapped.
58 * @GTK_SENSITIVE: Set and unset by gtk_widget_set_sensitive().
59 * The sensitivity of a widget determines whether it will receive
60 * certain events (e.g. button or key presses). One premise for
61 * the widget's sensitivity is to have this flag set.
62 * @GTK_PARENT_SENSITIVE: Set and unset by gtk_widget_set_sensitive() operations on the
63 * parents of the widget.
64 * This is the second premise for the widget's sensitivity. Once
65 * it has %GTK_SENSITIVE and %GTK_PARENT_SENSITIVE set, its state is
66 * effectively sensitive. This is expressed (and can be examined) by
67 * the #GTK_WIDGET_IS_SENSITIVE macro.
68 * @GTK_CAN_FOCUS: Determines whether a widget is able to handle focus grabs.
69 * @GTK_HAS_FOCUS: Set by gtk_widget_grab_focus() for widgets that also
70 * have %GTK_CAN_FOCUS set. The flag will be unset once another widget
71 * grabs the focus.
72 * @GTK_CAN_DEFAULT: The widget is allowed to receive the default action via
73 * gtk_widget_grab_default() and will reserve space to draw the default if possible
74 * @GTK_HAS_DEFAULT: The widget currently is receiving the default action and
75 * should be drawn appropriately if possible
76 * @GTK_HAS_GRAB: Set by gtk_grab_add(), unset by gtk_grab_remove(). It means that the
77 * widget is in the grab_widgets stack, and will be the preferred one for
78 * receiving events other than ones of cosmetic value.
79 * @GTK_RC_STYLE: Indicates that the widget's style has been looked up through the rc
80 * mechanism. It does not imply that the widget actually had a style
81 * defined through the rc mechanism.
82 * @GTK_COMPOSITE_CHILD: Indicates that the widget is a composite child of its parent; see
83 * gtk_widget_push_composite_child(), gtk_widget_pop_composite_child().
84 * @GTK_NO_REPARENT: Unused since before GTK+ 1.2, will be removed in a future version.
85 * @GTK_APP_PAINTABLE: Set and unset by gtk_widget_set_app_paintable().
86 * Must be set on widgets whose window the application directly draws on,
87 * in order to keep GTK+ from overwriting the drawn stuff. See
88 * <xref linkend="app-paintable-widgets"/> for a detailed
89 * description of this flag.
90 * @GTK_RECEIVES_DEFAULT: The widget when focused will receive the default action and have
91 * %GTK_HAS_DEFAULT set even if there is a different widget set as default.
92 * @GTK_DOUBLE_BUFFERED: Set and unset by gtk_widget_set_double_buffered().
93 * Indicates that exposes done on the widget should be
94 * double-buffered. See <xref linkend="double-buffering"/> for a
95 * detailed discussion of how double-buffering works in GTK+ and
96 * why you may want to disable it for special cases.
97 * @GTK_NO_SHOW_ALL:
98 *
99 * Tells about certain properties of the widget.
100 */
101typedef enum
102{
103 GTK_TOPLEVEL = 1 << 4,
104 GTK_NO_WINDOW = 1 << 5,
105 GTK_REALIZED = 1 << 6,
106 GTK_MAPPED = 1 << 7,
107 GTK_VISIBLE = 1 << 8,
108 GTK_SENSITIVE = 1 << 9,
109 GTK_PARENT_SENSITIVE = 1 << 10,
110 GTK_CAN_FOCUS = 1 << 11,
111 GTK_HAS_FOCUS = 1 << 12,
112 GTK_CAN_DEFAULT = 1 << 13,
113 GTK_HAS_DEFAULT = 1 << 14,
114 GTK_HAS_GRAB = 1 << 15,
115 GTK_RC_STYLE = 1 << 16,
116 GTK_COMPOSITE_CHILD = 1 << 17,
117#ifndef GTK_DISABLE_DEPRECATED
118 GTK_NO_REPARENT = 1 << 18,
119#endif
120 GTK_APP_PAINTABLE = 1 << 19,
121 GTK_RECEIVES_DEFAULT = 1 << 20,
122 GTK_DOUBLE_BUFFERED = 1 << 21,
123 GTK_NO_SHOW_ALL = 1 << 22
124} GtkWidgetFlags;
125
126/* Kinds of widget-specific help */
127typedef enum
128{
129 GTK_WIDGET_HELP_TOOLTIP,
130 GTK_WIDGET_HELP_WHATS_THIS
131} GtkWidgetHelpType;
132
133/* Macro for casting a pointer to a GtkWidget or GtkWidgetClass pointer.
134 * Macros for testing whether `widget' or `klass' are of type GTK_TYPE_WIDGET.
135 */
136#define GTK_TYPE_WIDGET (gtk_widget_get_type ())
137#define GTK_WIDGET(widget) (G_TYPE_CHECK_INSTANCE_CAST ((widget), GTK_TYPE_WIDGET, GtkWidget))
138#define GTK_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_WIDGET, GtkWidgetClass))
139#define GTK_IS_WIDGET(widget) (G_TYPE_CHECK_INSTANCE_TYPE ((widget), GTK_TYPE_WIDGET))
140#define GTK_IS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WIDGET))
141#define GTK_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_WIDGET, GtkWidgetClass))
142
143/* Macros for extracting various fields from GtkWidget and GtkWidgetClass.
144 */
145#ifndef GTK_DISABLE_DEPRECATED
146/**
147 * GTK_WIDGET_TYPE:
148 * @wid: a #GtkWidget.
149 *
150 * Gets the type of a widget.
151 *
152 * Deprecated: 2.20: Use G_OBJECT_TYPE() instead.
153 */
154#define GTK_WIDGET_TYPE(wid) (GTK_OBJECT_TYPE (wid))
155#endif
156
157#ifndef GTK_DISABLE_DEPRECATED
158/**
159 * GTK_WIDGET_STATE:
160 * @wid: a #GtkWidget.
161 *
162 * Returns the current state of the widget, as a #GtkStateType.
163 *
164 * Deprecated: 2.20: Use gtk_widget_get_state() instead.
165 */
166#define GTK_WIDGET_STATE(wid) (GTK_WIDGET (wid)->state)
167#endif
168
169#ifndef GTK_DISABLE_DEPRECATED
170/**
171 * GTK_WIDGET_SAVED_STATE:
172 * @wid: a #GtkWidget.
173 *
174 * Returns the saved state of the widget, as a #GtkStateType.
175 *
176 * The saved state will be restored when a widget gets sensitive
177 * again, after it has been made insensitive with gtk_widget_set_state()
178 * or gtk_widget_set_sensitive().
179 *
180 * Deprecated: 2.20: Do not used it.
181 */
182#define GTK_WIDGET_SAVED_STATE(wid) (GTK_WIDGET (wid)->saved_state)
183#endif
184
185
186/* Macros for extracting the widget flags from GtkWidget.
187 */
188/**
189 * GTK_WIDGET_FLAGS:
190 * @wid: a #GtkWidget.
191 *
192 * Returns the widget flags from @wid.
193 *
194 * Deprecated: 2.20: Use the proper function to test individual states:
195 * gtk_widget_get_app_paintable(), gtk_widget_get_can_default(),
196 * gtk_widget_get_can_focus(), gtk_widget_get_double_buffered(),
197 * gtk_widget_has_default(), gtk_widget_is_drawable(),
198 * gtk_widget_has_focus(), gtk_widget_has_grab(), gtk_widget_get_mapped(),
199 * gtk_widget_get_has_window(), gtk_widget_has_rc_style(),
200 * gtk_widget_get_realized(), gtk_widget_get_receives_default(),
201 * gtk_widget_get_sensitive(), gtk_widget_is_sensitive(),
202 * gtk_widget_is_toplevel() or gtk_widget_get_visible().
203 */
204#define GTK_WIDGET_FLAGS(wid) (GTK_OBJECT_FLAGS (wid))
205/* FIXME: Deprecating GTK_WIDGET_FLAGS requires fixing GTK internals. */
206
207#ifndef GTK_DISABLE_DEPRECATED
208/**
209 * GTK_WIDGET_TOPLEVEL:
210 * @wid: a #GtkWidget.
211 *
212 * Evaluates to %TRUE if the widget is a toplevel widget.
213 *
214 * Deprecated: 2.20: Use gtk_widget_is_toplevel() instead.
215 */
216#define GTK_WIDGET_TOPLEVEL(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_TOPLEVEL) != 0)
217#endif
218
219#ifndef GTK_DISABLE_DEPRECATED
220/**
221 * GTK_WIDGET_NO_WINDOW:
222 * @wid: a #GtkWidget.
223 *
224 * Evaluates to %TRUE if the widget doesn't have an own #GdkWindow.
225 *
226 * Deprecated: 2.20: Use gtk_widget_get_has_window() instead.
227 */
228#define GTK_WIDGET_NO_WINDOW(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_NO_WINDOW) != 0)
229#endif
230
231#ifndef GTK_DISABLE_DEPRECATED
232/**
233 * GTK_WIDGET_REALIZED:
234 * @wid: a #GtkWidget.
235 *
236 * Evaluates to %TRUE if the widget is realized.
237 *
238 * Deprecated: 2.20: Use gtk_widget_get_realized() instead.
239 */
240#define GTK_WIDGET_REALIZED(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_REALIZED) != 0)
241#endif
242
243#ifndef GTK_DISABLE_DEPRECATED
244/**
245 * GTK_WIDGET_MAPPED:
246 * @wid: a #GtkWidget.
247 *
248 * Evaluates to %TRUE if the widget is mapped.
249 *
250 * Deprecated: 2.20: Use gtk_widget_get_mapped() instead.
251 */
252#define GTK_WIDGET_MAPPED(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_MAPPED) != 0)
253#endif
254
255#ifndef GTK_DISABLE_DEPRECATED
256/**
257 * GTK_WIDGET_VISIBLE:
258 * @wid: a #GtkWidget.
259 *
260 * Evaluates to %TRUE if the widget is visible.
261 *
262 * Deprecated: 2.20: Use gtk_widget_get_visible() instead.
263 */
264#define GTK_WIDGET_VISIBLE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_VISIBLE) != 0)
265#endif
266
267#ifndef GTK_DISABLE_DEPRECATED
268/**
269 * GTK_WIDGET_DRAWABLE:
270 * @wid: a #GtkWidget.
271 *
272 * Evaluates to %TRUE if the widget is mapped and visible.
273 *
274 * Deprecated: 2.20: Use gtk_widget_is_drawable() instead.
275 */
276#define GTK_WIDGET_DRAWABLE(wid) (GTK_WIDGET_VISIBLE (wid) && GTK_WIDGET_MAPPED (wid))
277#endif
278
279#ifndef GTK_DISABLE_DEPRECATED
280/**
281 * GTK_WIDGET_SENSITIVE:
282 * @wid: a #GtkWidget.
283 *
284 * Evaluates to %TRUE if the #GTK_SENSITIVE flag has be set on the widget.
285 *
286 * Deprecated: 2.20: Use gtk_widget_get_sensitive() instead.
287 */
288#define GTK_WIDGET_SENSITIVE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_SENSITIVE) != 0)
289#endif
290
291#ifndef GTK_DISABLE_DEPRECATED
292/**
293 * GTK_WIDGET_PARENT_SENSITIVE:
294 * @wid: a #GtkWidget.
295 *
296 * Evaluates to %TRUE if the #GTK_PARENT_SENSITIVE flag has be set on the widget.
297 *
298 * Deprecated: 2.20: Use gtk_widget_get_sensitive() on the parent widget instead.
299 */
300#define GTK_WIDGET_PARENT_SENSITIVE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_PARENT_SENSITIVE) != 0)
301#endif
302
303#ifndef GTK_DISABLE_DEPRECATED
304/**
305 * GTK_WIDGET_IS_SENSITIVE:
306 * @wid: a #GtkWidget.
307 *
308 * Evaluates to %TRUE if the widget is effectively sensitive.
309 *
310 * Deprecated: 2.20: Use gtk_widget_is_sensitive() instead.
311 */
312#define GTK_WIDGET_IS_SENSITIVE(wid) (GTK_WIDGET_SENSITIVE (wid) && \
313 GTK_WIDGET_PARENT_SENSITIVE (wid))
314#endif
315
316#ifndef GTK_DISABLE_DEPRECATED
317/**
318 * GTK_WIDGET_CAN_FOCUS:
319 * @wid: a #GtkWidget.
320 *
321 * Evaluates to %TRUE if the widget is able to handle focus grabs.
322 *
323 * Deprecated: 2.20: Use gtk_widget_get_can_focus() instead.
324 */
325#define GTK_WIDGET_CAN_FOCUS(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_CAN_FOCUS) != 0)
326#endif
327
328#ifndef GTK_DISABLE_DEPRECATED
329/**
330 * GTK_WIDGET_HAS_FOCUS:
331 * @wid: a #GtkWidget.
332 *
333 * Evaluates to %TRUE if the widget has grabbed the focus and no other
334 * widget has done so more recently.
335 *
336 * Deprecated: 2.20: Use gtk_widget_has_focus() instead.
337 */
338#define GTK_WIDGET_HAS_FOCUS(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_FOCUS) != 0)
339#endif
340
341#ifndef GTK_DISABLE_DEPRECATED
342/**
343 * GTK_WIDGET_CAN_DEFAULT:
344 * @wid: a #GtkWidget.
345 *
346 * Evaluates to %TRUE if the widget is allowed to receive the default action
347 * via gtk_widget_grab_default().
348 *
349 * Deprecated: 2.20: Use gtk_widget_get_can_default() instead.
350 */
351#define GTK_WIDGET_CAN_DEFAULT(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_CAN_DEFAULT) != 0)
352#endif
353
354#ifndef GTK_DISABLE_DEPRECATED
355/**
356 * GTK_WIDGET_HAS_DEFAULT:
357 * @wid: a #GtkWidget.
358 *
359 * Evaluates to %TRUE if the widget currently is receiving the default action.
360 *
361 * Deprecated: 2.20: Use gtk_widget_has_default() instead.
362 */
363#define GTK_WIDGET_HAS_DEFAULT(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_DEFAULT) != 0)
364#endif
365
366#ifndef GTK_DISABLE_DEPRECATED
367/**
368 * GTK_WIDGET_HAS_GRAB:
369 * @wid: a #GtkWidget.
370 *
371 * Evaluates to %TRUE if the widget is in the grab_widgets stack, and will be
372 * the preferred one for receiving events other than ones of cosmetic value.
373 *
374 * Deprecated: 2.20: Use gtk_widget_has_grab() instead.
375 */
376#define GTK_WIDGET_HAS_GRAB(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_GRAB) != 0)
377#endif
378
379#ifndef GTK_DISABLE_DEPRECATED
380/**
381 * GTK_WIDGET_RC_STYLE:
382 * @wid: a #GtkWidget.
383 *
384 * Evaluates to %TRUE if the widget's style has been looked up through the rc
385 * mechanism.
386 *
387 * Deprecated: 2.20: Use gtk_widget_has_rc_style() instead.
388 */
389#define GTK_WIDGET_RC_STYLE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_RC_STYLE) != 0)
390#endif
391
392#ifndef GTK_DISABLE_DEPRECATED
393/**
394 * GTK_WIDGET_COMPOSITE_CHILD:
395 * @wid: a #GtkWidget.
396 *
397 * Evaluates to %TRUE if the widget is a composite child of its parent.
398 *
399 * Deprecated: 2.20: Use the #GtkWidget:composite-child property instead.
400 */
401#define GTK_WIDGET_COMPOSITE_CHILD(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_COMPOSITE_CHILD) != 0)
402#endif
403
404#ifndef GTK_DISABLE_DEPRECATED
405/**
406 * GTK_WIDGET_APP_PAINTABLE:
407 * @wid: a #GtkWidget.
408 *
409 * Evaluates to %TRUE if the #GTK_APP_PAINTABLE flag has been set on the widget.
410 *
411 * Deprecated: 2.20: Use gtk_widget_get_app_paintable() instead.
412 */
413#define GTK_WIDGET_APP_PAINTABLE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_APP_PAINTABLE) != 0)
414#endif
415
416#ifndef GTK_DISABLE_DEPRECATED
417/**
418 * GTK_WIDGET_RECEIVES_DEFAULT:
419 * @wid: a #GtkWidget.
420 *
421 * Evaluates to %TRUE if the widget when focused will receive the default action
422 * even if there is a different widget set as default.
423 *
424 * Deprecated: 2.20: Use gtk_widget_get_receives_default() instead.
425 */
426#define GTK_WIDGET_RECEIVES_DEFAULT(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_RECEIVES_DEFAULT) != 0)
427#endif
428
429#ifndef GTK_DISABLE_DEPRECATED
430/**
431 * GTK_WIDGET_DOUBLE_BUFFERED:
432 * @wid: a #GtkWidget.
433 *
434 * Evaluates to %TRUE if the #GTK_DOUBLE_BUFFERED flag has been set on the widget.
435 *
436 * Deprecated: 2.20: Use gtk_widget_get_double_buffered() instead.
437 */
438#define GTK_WIDGET_DOUBLE_BUFFERED(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_DOUBLE_BUFFERED) != 0)
439#endif
440
441
442/* Macros for setting and clearing widget flags.
443 */
444/**
445 * GTK_WIDGET_SET_FLAGS:
446 * @wid: a #GtkWidget.
447 * @flag: the flags to set.
448 *
449 * Turns on certain widget flags.
450 *
451 * Deprecated: 2.22: Use the proper function instead: gtk_widget_set_app_paintable(),
452 * gtk_widget_set_can_default(), gtk_widget_set_can_focus(),
453 * gtk_widget_set_double_buffered(), gtk_widget_set_has_window(),
454 * gtk_widget_set_mapped(), gtk_widget_set_no_show_all(),
455 * gtk_widget_set_realized(), gtk_widget_set_receives_default(),
456 * gtk_widget_set_sensitive() or gtk_widget_set_visible().
457 *
458 */
459#define GTK_WIDGET_SET_FLAGS(wid,flag) G_STMT_START{ (GTK_WIDGET_FLAGS (wid) |= (flag)); }G_STMT_END
460/* FIXME: Deprecating GTK_WIDGET_SET_FLAGS requires fixing GTK internals. */
461
462/**
463 * GTK_WIDGET_UNSET_FLAGS:
464 * @wid: a #GtkWidget.
465 * @flag: the flags to unset.
466 *
467 * Turns off certain widget flags.
468 *
469 * Deprecated: 2.22: Use the proper function instead. See GTK_WIDGET_SET_FLAGS().
470 */
471#define GTK_WIDGET_UNSET_FLAGS(wid,flag) G_STMT_START{ (GTK_WIDGET_FLAGS (wid) &= ~(flag)); }G_STMT_END
472/* FIXME: Deprecating GTK_WIDGET_UNSET_FLAGS requires fixing GTK internals. */
473
474#define GTK_TYPE_REQUISITION (gtk_requisition_get_type ())
475
476/* forward declaration to avoid excessive includes (and concurrent includes)
477 */
478typedef struct _GtkRequisition GtkRequisition;
479typedef struct _GtkSelectionData GtkSelectionData;
480typedef struct _GtkWidgetClass GtkWidgetClass;
481typedef struct _GtkWidgetAuxInfo GtkWidgetAuxInfo;
482typedef struct _GtkWidgetShapeInfo GtkWidgetShapeInfo;
483typedef struct _GtkClipboard GtkClipboard;
484typedef struct _GtkTooltip GtkTooltip;
485typedef struct _GtkWindow GtkWindow;
486
487/**
488 * GtkAllocation:
489 * @x: the X position of the widget's area relative to its parents allocation.
490 * @y: the Y position of the widget's area relative to its parents allocation.
491 * @width: the width of the widget's allocated area.
492 * @height: the height of the widget's allocated area.
493 *
494 * A <structname>GtkAllocation</structname> of a widget represents region which has been allocated to the
495 * widget by its parent. It is a subregion of its parents allocation. See
496 * <xref linkend="size-allocation"/> for more information.
497 */
498typedef GdkRectangle GtkAllocation;
499
500/**
501 * GtkCallback:
502 * @widget: the widget to operate on
503 * @data: user-supplied data
504 *
505 * The type of the callback functions used for e.g. iterating over
506 * the children of a container, see gtk_container_foreach().
507 */
508typedef void (*GtkCallback) (GtkWidget *widget,
509 gpointer data);
510
511/**
512 * GtkRequisition:
513 * @width: the widget's desired width
514 * @height: the widget's desired height
515 *
516 * A <structname>GtkRequisition</structname> represents the desired size of a widget. See
517 * <xref linkend="size-requisition"/> for more information.
518 */
519struct _GtkRequisition
520{
521 gint width;
522 gint height;
523};
524
525/* The widget is the base of the tree for displayable objects.
526 * (A displayable object is one which takes up some amount
527 * of screen real estate). It provides a common base and interface
528 * which actual widgets must adhere to.
529 */
530struct _GtkWidget
531{
532 /* The object structure needs to be the first
533 * element in the widget structure in order for
534 * the object mechanism to work correctly. This
535 * allows a GtkWidget pointer to be cast to a
536 * GtkObject pointer.
537 */
538 GtkObject object;
539
540 /* 16 bits of internally used private flags.
541 * this will be packed into the same 4 byte alignment frame that
542 * state and saved_state go. we therefore don't waste any new
543 * space on this.
544 */
545 guint16 GSEAL (private_flags);
546
547 /* The state of the widget. There are actually only
548 * 5 widget states (defined in "gtkenums.h").
549 */
550 guint8 GSEAL (state);
551
552 /* The saved state of the widget. When a widget's state
553 * is changed to GTK_STATE_INSENSITIVE via
554 * "gtk_widget_set_state" or "gtk_widget_set_sensitive"
555 * the old state is kept around in this field. The state
556 * will be restored once the widget gets sensitive again.
557 */
558 guint8 GSEAL (saved_state);
559
560 /* The widget's name. If the widget does not have a name
561 * (the name is NULL), then its name (as returned by
562 * "gtk_widget_get_name") is its class's name.
563 * Among other things, the widget name is used to determine
564 * the style to use for a widget.
565 */
566 gchar *GSEAL (name);
567
568 /*< public >*/
569
570 /* The style for the widget. The style contains the
571 * colors the widget should be drawn in for each state
572 * along with graphics contexts used to draw with and
573 * the font to use for text.
574 */
575 GtkStyle *GSEAL (style);
576
577 /* The widget's desired size.
578 */
579 GtkRequisition GSEAL (requisition);
580
581 /* The widget's allocated size.
582 */
583 GtkAllocation GSEAL (allocation);
584
585 /* The widget's window or its parent window if it does
586 * not have a window. (Which will be indicated by the
587 * GTK_NO_WINDOW flag being set).
588 */
589 GdkWindow *GSEAL (window);
590
591 /* The widget's parent.
592 */
593 GtkWidget *GSEAL (parent);
594};
595
596/**
597 * GtkWidgetClass:
598 * @parent_class:
599 * @activate_signal:
600 * @set_scroll_adjustments_signal:
601 *
602 * <structfield>activate_signal</structfield>
603 * The signal to emit when a widget of this class is activated,
604 * gtk_widget_activate() handles the emission. Implementation of this
605 * signal is optional.
606 *
607 *
608 * <structfield>set_scroll_adjustment_signal</structfield>
609 * This signal is emitted when a widget of this class is added
610 * to a scrolling aware parent, gtk_widget_set_scroll_adjustments()
611 * handles the emission.
612 * Implementation of this signal is optional.
613 */
614struct _GtkWidgetClass
615{
616 /* The object class structure needs to be the first
617 * element in the widget class structure in order for
618 * the class mechanism to work correctly. This allows a
619 * GtkWidgetClass pointer to be cast to a GtkObjectClass
620 * pointer.
621 */
622 GtkObjectClass parent_class;
623
624 /*< public >*/
625
626 guint activate_signal;
627
628 guint set_scroll_adjustments_signal;
629
630 /*< private >*/
631
632 /* seldomly overidden */
633 void (*dispatch_child_properties_changed) (GtkWidget *widget,
634 guint n_pspecs,
635 GParamSpec **pspecs);
636
637 /* basics */
638 void (* show) (GtkWidget *widget);
639 void (* show_all) (GtkWidget *widget);
640 void (* hide) (GtkWidget *widget);
641 void (* hide_all) (GtkWidget *widget);
642 void (* map) (GtkWidget *widget);
643 void (* unmap) (GtkWidget *widget);
644 void (* realize) (GtkWidget *widget);
645 void (* unrealize) (GtkWidget *widget);
646 void (* size_request) (GtkWidget *widget,
647 GtkRequisition *requisition);
648 void (* size_allocate) (GtkWidget *widget,
649 GtkAllocation *allocation);
650 void (* state_changed) (GtkWidget *widget,
651 GtkStateType previous_state);
652 void (* parent_set) (GtkWidget *widget,
653 GtkWidget *previous_parent);
654 void (* hierarchy_changed) (GtkWidget *widget,
655 GtkWidget *previous_toplevel);
656 void (* style_set) (GtkWidget *widget,
657 GtkStyle *previous_style);
658 void (* direction_changed) (GtkWidget *widget,
659 GtkTextDirection previous_direction);
660 void (* grab_notify) (GtkWidget *widget,
661 gboolean was_grabbed);
662 void (* child_notify) (GtkWidget *widget,
663 GParamSpec *pspec);
664
665 /* Mnemonics */
666 gboolean (* mnemonic_activate) (GtkWidget *widget,
667 gboolean group_cycling);
668
669 /* explicit focus */
670 void (* grab_focus) (GtkWidget *widget);
671 gboolean (* focus) (GtkWidget *widget,
672 GtkDirectionType direction);
673
674 /* events */
675 gboolean (* event) (GtkWidget *widget,
676 GdkEvent *event);
677 gboolean (* button_press_event) (GtkWidget *widget,
678 GdkEventButton *event);
679 gboolean (* button_release_event) (GtkWidget *widget,
680 GdkEventButton *event);
681 gboolean (* scroll_event) (GtkWidget *widget,
682 GdkEventScroll *event);
683 gboolean (* motion_notify_event) (GtkWidget *widget,
684 GdkEventMotion *event);
685 gboolean (* delete_event) (GtkWidget *widget,
686 GdkEventAny *event);
687 gboolean (* destroy_event) (GtkWidget *widget,
688 GdkEventAny *event);
689 gboolean (* expose_event) (GtkWidget *widget,
690 GdkEventExpose *event);
691 gboolean (* key_press_event) (GtkWidget *widget,
692 GdkEventKey *event);
693 gboolean (* key_release_event) (GtkWidget *widget,
694 GdkEventKey *event);
695 gboolean (* enter_notify_event) (GtkWidget *widget,
696 GdkEventCrossing *event);
697 gboolean (* leave_notify_event) (GtkWidget *widget,
698 GdkEventCrossing *event);
699 gboolean (* configure_event) (GtkWidget *widget,
700 GdkEventConfigure *event);
701 gboolean (* focus_in_event) (GtkWidget *widget,
702 GdkEventFocus *event);
703 gboolean (* focus_out_event) (GtkWidget *widget,
704 GdkEventFocus *event);
705 gboolean (* map_event) (GtkWidget *widget,
706 GdkEventAny *event);
707 gboolean (* unmap_event) (GtkWidget *widget,
708 GdkEventAny *event);
709 gboolean (* property_notify_event) (GtkWidget *widget,
710 GdkEventProperty *event);
711 gboolean (* selection_clear_event) (GtkWidget *widget,
712 GdkEventSelection *event);
713 gboolean (* selection_request_event) (GtkWidget *widget,
714 GdkEventSelection *event);
715 gboolean (* selection_notify_event) (GtkWidget *widget,
716 GdkEventSelection *event);
717 gboolean (* proximity_in_event) (GtkWidget *widget,
718 GdkEventProximity *event);
719 gboolean (* proximity_out_event) (GtkWidget *widget,
720 GdkEventProximity *event);
721 gboolean (* visibility_notify_event) (GtkWidget *widget,
722 GdkEventVisibility *event);
723 gboolean (* client_event) (GtkWidget *widget,
724 GdkEventClient *event);
725 gboolean (* no_expose_event) (GtkWidget *widget,
726 GdkEventAny *event);
727 gboolean (* window_state_event) (GtkWidget *widget,
728 GdkEventWindowState *event);
729
730 /* selection */
731 void (* selection_get) (GtkWidget *widget,
732 GtkSelectionData *selection_data,
733 guint info,
734 guint time_);
735 void (* selection_received) (GtkWidget *widget,
736 GtkSelectionData *selection_data,
737 guint time_);
738
739 /* Source side drag signals */
740 void (* drag_begin) (GtkWidget *widget,
741 GdkDragContext *context);
742 void (* drag_end) (GtkWidget *widget,
743 GdkDragContext *context);
744 void (* drag_data_get) (GtkWidget *widget,
745 GdkDragContext *context,
746 GtkSelectionData *selection_data,
747 guint info,
748 guint time_);
749 void (* drag_data_delete) (GtkWidget *widget,
750 GdkDragContext *context);
751
752 /* Target side drag signals */
753 void (* drag_leave) (GtkWidget *widget,
754 GdkDragContext *context,
755 guint time_);
756 gboolean (* drag_motion) (GtkWidget *widget,
757 GdkDragContext *context,
758 gint x,
759 gint y,
760 guint time_);
761 gboolean (* drag_drop) (GtkWidget *widget,
762 GdkDragContext *context,
763 gint x,
764 gint y,
765 guint time_);
766 void (* drag_data_received) (GtkWidget *widget,
767 GdkDragContext *context,
768 gint x,
769 gint y,
770 GtkSelectionData *selection_data,
771 guint info,
772 guint time_);
773
774 /* Signals used only for keybindings */
775 gboolean (* popup_menu) (GtkWidget *widget);
776
777 /* If a widget has multiple tooltips/whatsthis, it should show the
778 * one for the current focus location, or if that doesn't make
779 * sense, should cycle through them showing each tip alongside
780 * whatever piece of the widget it applies to.
781 */
782 gboolean (* show_help) (GtkWidget *widget,
783 GtkWidgetHelpType help_type);
784
785 /* accessibility support
786 */
787 AtkObject* (*get_accessible) (GtkWidget *widget);
788
789 void (*screen_changed) (GtkWidget *widget,
790 GdkScreen *previous_screen);
791 gboolean (*can_activate_accel) (GtkWidget *widget,
792 guint signal_id);
793
794 /* Sent when a grab is broken. */
795 gboolean (*grab_broken_event) (GtkWidget *widget,
796 GdkEventGrabBroken *event);
797
798 void (* composited_changed) (GtkWidget *widget);
799
800 gboolean (* query_tooltip) (GtkWidget *widget,
801 gint x,
802 gint y,
803 gboolean keyboard_tooltip,
804 GtkTooltip *tooltip);
805 /* Signals without a C default handler class slot:
806 * gboolean (*damage_event) (GtkWidget *widget,
807 * GdkEventExpose *event);
808 */
809
810 /* Padding for future expansion */
811 void (*_gtk_reserved5) (void);
812 void (*_gtk_reserved6) (void);
813 void (*_gtk_reserved7) (void);
814};
815
816struct _GtkWidgetAuxInfo
817{
818 gint x;
819 gint y;
820 gint width;
821 gint height;
822 guint x_set : 1;
823 guint y_set : 1;
824};
825
826struct _GtkWidgetShapeInfo
827{
828 gint16 offset_x;
829 gint16 offset_y;
830 GdkBitmap *shape_mask;
831};
832
833GType gtk_widget_get_type (void) G_GNUC_CONST;
834GtkWidget* gtk_widget_new (GType type,
835 const gchar *first_property_name,
836 ...);
837void gtk_widget_destroy (GtkWidget *widget);
838void gtk_widget_destroyed (GtkWidget *widget,
839 GtkWidget **widget_pointer);
840#ifndef GTK_DISABLE_DEPRECATED
841GtkWidget* gtk_widget_ref (GtkWidget *widget);
842void gtk_widget_unref (GtkWidget *widget);
843void gtk_widget_set (GtkWidget *widget,
844 const gchar *first_property_name,
845 ...) G_GNUC_NULL_TERMINATED;
846#endif /* GTK_DISABLE_DEPRECATED */
847#if !defined(GTK_DISABLE_DEPRECATED) || defined (GTK_COMPILATION)
848void gtk_widget_hide_all (GtkWidget *widget);
849#endif
850void gtk_widget_unparent (GtkWidget *widget);
851void gtk_widget_show (GtkWidget *widget);
852void gtk_widget_show_now (GtkWidget *widget);
853void gtk_widget_hide (GtkWidget *widget);
854void gtk_widget_show_all (GtkWidget *widget);
855void gtk_widget_set_no_show_all (GtkWidget *widget,
856 gboolean no_show_all);
857gboolean gtk_widget_get_no_show_all (GtkWidget *widget);
858void gtk_widget_map (GtkWidget *widget);
859void gtk_widget_unmap (GtkWidget *widget);
860void gtk_widget_realize (GtkWidget *widget);
861void gtk_widget_unrealize (GtkWidget *widget);
862
863/* Queuing draws */
864void gtk_widget_queue_draw (GtkWidget *widget);
865void gtk_widget_queue_draw_area (GtkWidget *widget,
866 gint x,
867 gint y,
868 gint width,
869 gint height);
870#ifndef GTK_DISABLE_DEPRECATED
871void gtk_widget_queue_clear (GtkWidget *widget);
872void gtk_widget_queue_clear_area (GtkWidget *widget,
873 gint x,
874 gint y,
875 gint width,
876 gint height);
877#endif /* GTK_DISABLE_DEPRECATED */
878
879
880void gtk_widget_queue_resize (GtkWidget *widget);
881void gtk_widget_queue_resize_no_redraw (GtkWidget *widget);
882#ifndef GTK_DISABLE_DEPRECATED
883void gtk_widget_draw (GtkWidget *widget,
884 const GdkRectangle *area);
885#endif /* GTK_DISABLE_DEPRECATED */
886void gtk_widget_size_request (GtkWidget *widget,
887 GtkRequisition *requisition);
888void gtk_widget_size_allocate (GtkWidget *widget,
889 GtkAllocation *allocation);
890void gtk_widget_get_child_requisition (GtkWidget *widget,
891 GtkRequisition *requisition);
892void gtk_widget_add_accelerator (GtkWidget *widget,
893 const gchar *accel_signal,
894 GtkAccelGroup *accel_group,
895 guint accel_key,
896 GdkModifierType accel_mods,
897 GtkAccelFlags accel_flags);
898gboolean gtk_widget_remove_accelerator (GtkWidget *widget,
899 GtkAccelGroup *accel_group,
900 guint accel_key,
901 GdkModifierType accel_mods);
902void gtk_widget_set_accel_path (GtkWidget *widget,
903 const gchar *accel_path,
904 GtkAccelGroup *accel_group);
905const gchar* _gtk_widget_get_accel_path (GtkWidget *widget,
906 gboolean *locked);
907GList* gtk_widget_list_accel_closures (GtkWidget *widget);
908gboolean gtk_widget_can_activate_accel (GtkWidget *widget,
909 guint signal_id);
910gboolean gtk_widget_mnemonic_activate (GtkWidget *widget,
911 gboolean group_cycling);
912gboolean gtk_widget_event (GtkWidget *widget,
913 GdkEvent *event);
914gint gtk_widget_send_expose (GtkWidget *widget,
915 GdkEvent *event);
916gboolean gtk_widget_send_focus_change (GtkWidget *widget,
917 GdkEvent *event);
918
919gboolean gtk_widget_activate (GtkWidget *widget);
920gboolean gtk_widget_set_scroll_adjustments (GtkWidget *widget,
921 GtkAdjustment *hadjustment,
922 GtkAdjustment *vadjustment);
923
924void gtk_widget_reparent (GtkWidget *widget,
925 GtkWidget *new_parent);
926gboolean gtk_widget_intersect (GtkWidget *widget,
927 const GdkRectangle *area,
928 GdkRectangle *intersection);
929GdkRegion *gtk_widget_region_intersect (GtkWidget *widget,
930 const GdkRegion *region);
931
932void gtk_widget_freeze_child_notify (GtkWidget *widget);
933void gtk_widget_child_notify (GtkWidget *widget,
934 const gchar *child_property);
935void gtk_widget_thaw_child_notify (GtkWidget *widget);
936
937void gtk_widget_set_can_focus (GtkWidget *widget,
938 gboolean can_focus);
939gboolean gtk_widget_get_can_focus (GtkWidget *widget);
940gboolean gtk_widget_has_focus (GtkWidget *widget);
941gboolean gtk_widget_is_focus (GtkWidget *widget);
942void gtk_widget_grab_focus (GtkWidget *widget);
943
944void gtk_widget_set_can_default (GtkWidget *widget,
945 gboolean can_default);
946gboolean gtk_widget_get_can_default (GtkWidget *widget);
947gboolean gtk_widget_has_default (GtkWidget *widget);
948void gtk_widget_grab_default (GtkWidget *widget);
949
950void gtk_widget_set_receives_default (GtkWidget *widget,
951 gboolean receives_default);
952gboolean gtk_widget_get_receives_default (GtkWidget *widget);
953
954gboolean gtk_widget_has_grab (GtkWidget *widget);
955
956void gtk_widget_set_name (GtkWidget *widget,
957 const gchar *name);
958const gchar* gtk_widget_get_name (GtkWidget *widget);
959
960void gtk_widget_set_state (GtkWidget *widget,
961 GtkStateType state);
962GtkStateType gtk_widget_get_state (GtkWidget *widget);
963
964void gtk_widget_set_sensitive (GtkWidget *widget,
965 gboolean sensitive);
966gboolean gtk_widget_get_sensitive (GtkWidget *widget);
967gboolean gtk_widget_is_sensitive (GtkWidget *widget);
968
969void gtk_widget_set_visible (GtkWidget *widget,
970 gboolean visible);
971gboolean gtk_widget_get_visible (GtkWidget *widget);
972
973void gtk_widget_set_has_window (GtkWidget *widget,
974 gboolean has_window);
975gboolean gtk_widget_get_has_window (GtkWidget *widget);
976
977gboolean gtk_widget_is_toplevel (GtkWidget *widget);
978gboolean gtk_widget_is_drawable (GtkWidget *widget);
979void gtk_widget_set_realized (GtkWidget *widget,
980 gboolean realized);
981gboolean gtk_widget_get_realized (GtkWidget *widget);
982void gtk_widget_set_mapped (GtkWidget *widget,
983 gboolean mapped);
984gboolean gtk_widget_get_mapped (GtkWidget *widget);
985
986void gtk_widget_set_app_paintable (GtkWidget *widget,
987 gboolean app_paintable);
988gboolean gtk_widget_get_app_paintable (GtkWidget *widget);
989
990void gtk_widget_set_double_buffered (GtkWidget *widget,
991 gboolean double_buffered);
992gboolean gtk_widget_get_double_buffered (GtkWidget *widget);
993
994void gtk_widget_set_redraw_on_allocate (GtkWidget *widget,
995 gboolean redraw_on_allocate);
996
997void gtk_widget_set_parent (GtkWidget *widget,
998 GtkWidget *parent);
999GtkWidget * gtk_widget_get_parent (GtkWidget *widget);
1000
1001void gtk_widget_set_parent_window (GtkWidget *widget,
1002 GdkWindow *parent_window);
1003GdkWindow * gtk_widget_get_parent_window (GtkWidget *widget);
1004
1005void gtk_widget_set_child_visible (GtkWidget *widget,
1006 gboolean is_visible);
1007gboolean gtk_widget_get_child_visible (GtkWidget *widget);
1008
1009void gtk_widget_set_window (GtkWidget *widget,
1010 GdkWindow *window);
1011GdkWindow * gtk_widget_get_window (GtkWidget *widget);
1012
1013void gtk_widget_get_allocation (GtkWidget *widget,
1014 GtkAllocation *allocation);
1015void gtk_widget_set_allocation (GtkWidget *widget,
1016 const GtkAllocation *allocation);
1017
1018void gtk_widget_get_requisition (GtkWidget *widget,
1019 GtkRequisition *requisition);
1020
1021gboolean gtk_widget_child_focus (GtkWidget *widget,
1022 GtkDirectionType direction);
1023gboolean gtk_widget_keynav_failed (GtkWidget *widget,
1024 GtkDirectionType direction);
1025void gtk_widget_error_bell (GtkWidget *widget);
1026
1027void gtk_widget_set_size_request (GtkWidget *widget,
1028 gint width,
1029 gint height);
1030void gtk_widget_get_size_request (GtkWidget *widget,
1031 gint *width,
1032 gint *height);
1033#ifndef GTK_DISABLE_DEPRECATED
1034void gtk_widget_set_uposition (GtkWidget *widget,
1035 gint x,
1036 gint y);
1037void gtk_widget_set_usize (GtkWidget *widget,
1038 gint width,
1039 gint height);
1040#endif
1041
1042void gtk_widget_set_events (GtkWidget *widget,
1043 gint events);
1044void gtk_widget_add_events (GtkWidget *widget,
1045 gint events);
1046void gtk_widget_set_extension_events (GtkWidget *widget,
1047 GdkExtensionMode mode);
1048
1049GdkExtensionMode gtk_widget_get_extension_events (GtkWidget *widget);
1050GtkWidget* gtk_widget_get_toplevel (GtkWidget *widget);
1051GtkWidget* gtk_widget_get_ancestor (GtkWidget *widget,
1052 GType widget_type);
1053GdkColormap* gtk_widget_get_colormap (GtkWidget *widget);
1054GdkVisual* gtk_widget_get_visual (GtkWidget *widget);
1055
1056GdkScreen * gtk_widget_get_screen (GtkWidget *widget);
1057gboolean gtk_widget_has_screen (GtkWidget *widget);
1058GdkDisplay * gtk_widget_get_display (GtkWidget *widget);
1059GdkWindow * gtk_widget_get_root_window (GtkWidget *widget);
1060GtkSettings* gtk_widget_get_settings (GtkWidget *widget);
1061GtkClipboard *gtk_widget_get_clipboard (GtkWidget *widget,
1062 GdkAtom selection);
1063GdkPixmap * gtk_widget_get_snapshot (GtkWidget *widget,
1064 GdkRectangle *clip_rect);
1065
1066#ifndef GTK_DISABLE_DEPRECATED
1067
1068/**
1069 * gtk_widget_set_visual:
1070 * @widget: a #GtkWidget
1071 * @visual: a visual
1072 *
1073 * This function is deprecated; it does nothing.
1074 */
1075#define gtk_widget_set_visual(widget,visual) ((void) 0)
1076
1077/**
1078 * gtk_widget_push_visual:
1079 * @visual: a visual
1080 *
1081 * This function is deprecated; it does nothing.
1082 */
1083#define gtk_widget_push_visual(visual) ((void) 0)
1084
1085/**
1086 * gtk_widget_pop_visual:
1087 *
1088 * This function is deprecated; it does nothing.
1089 */
1090#define gtk_widget_pop_visual() ((void) 0)
1091
1092/**
1093 * gtk_widget_set_default_visual:
1094 * @visual: a visual
1095 *
1096 * This function is deprecated; it does nothing.
1097 */
1098#define gtk_widget_set_default_visual(visual) ((void) 0)
1099
1100#endif /* GTK_DISABLE_DEPRECATED */
1101
1102/* Accessibility support */
1103AtkObject* gtk_widget_get_accessible (GtkWidget *widget);
1104
1105/* The following functions must not be called on an already
1106 * realized widget. Because it is possible that somebody
1107 * can call get_colormap() or get_visual() and save the
1108 * result, these functions are probably only safe to
1109 * call in a widget's init() function.
1110 */
1111void gtk_widget_set_colormap (GtkWidget *widget,
1112 GdkColormap *colormap);
1113
1114gint gtk_widget_get_events (GtkWidget *widget);
1115void gtk_widget_get_pointer (GtkWidget *widget,
1116 gint *x,
1117 gint *y);
1118
1119gboolean gtk_widget_is_ancestor (GtkWidget *widget,
1120 GtkWidget *ancestor);
1121
1122gboolean gtk_widget_translate_coordinates (GtkWidget *src_widget,
1123 GtkWidget *dest_widget,
1124 gint src_x,
1125 gint src_y,
1126 gint *dest_x,
1127 gint *dest_y);
1128
1129/* Hide widget and return TRUE.
1130 */
1131gboolean gtk_widget_hide_on_delete (GtkWidget *widget);
1132
1133/* Widget styles.
1134 */
1135void gtk_widget_style_attach (GtkWidget *style);
1136
1137gboolean gtk_widget_has_rc_style (GtkWidget *widget);
1138void gtk_widget_set_style (GtkWidget *widget,
1139 GtkStyle *style);
1140void gtk_widget_ensure_style (GtkWidget *widget);
1141GtkStyle * gtk_widget_get_style (GtkWidget *widget);
1142
1143void gtk_widget_modify_style (GtkWidget *widget,
1144 GtkRcStyle *style);
1145GtkRcStyle *gtk_widget_get_modifier_style (GtkWidget *widget);
1146void gtk_widget_modify_fg (GtkWidget *widget,
1147 GtkStateType state,
1148 const GdkColor *color);
1149void gtk_widget_modify_bg (GtkWidget *widget,
1150 GtkStateType state,
1151 const GdkColor *color);
1152void gtk_widget_modify_text (GtkWidget *widget,
1153 GtkStateType state,
1154 const GdkColor *color);
1155void gtk_widget_modify_base (GtkWidget *widget,
1156 GtkStateType state,
1157 const GdkColor *color);
1158void gtk_widget_modify_cursor (GtkWidget *widget,
1159 const GdkColor *primary,
1160 const GdkColor *secondary);
1161void gtk_widget_modify_font (GtkWidget *widget,
1162 PangoFontDescription *font_desc);
1163
1164#ifndef GTK_DISABLE_DEPRECATED
1165
1166/**
1167 * gtk_widget_set_rc_style:
1168 * @widget: a #GtkWidget.
1169 *
1170 * Equivalent to <literal>gtk_widget_set_style (widget, NULL)</literal>.
1171 *
1172 * Deprecated: 2.0: Use gtk_widget_set_style() with a %NULL @style argument instead.
1173 */
1174#define gtk_widget_set_rc_style(widget) (gtk_widget_set_style (widget, NULL))
1175
1176/**
1177 * gtk_widget_restore_default_style:
1178 * @widget: a #GtkWidget.
1179 *
1180 * Equivalent to <literal>gtk_widget_set_style (widget, NULL)</literal>.
1181 *
1182 * Deprecated: 2.0: Use gtk_widget_set_style() with a %NULL @style argument instead.
1183 */
1184#define gtk_widget_restore_default_style(widget) (gtk_widget_set_style (widget, NULL))
1185#endif
1186
1187PangoContext *gtk_widget_create_pango_context (GtkWidget *widget);
1188PangoContext *gtk_widget_get_pango_context (GtkWidget *widget);
1189PangoLayout *gtk_widget_create_pango_layout (GtkWidget *widget,
1190 const gchar *text);
1191
1192GdkPixbuf *gtk_widget_render_icon (GtkWidget *widget,
1193 const gchar *stock_id,
1194 GtkIconSize size,
1195 const gchar *detail);
1196
1197/* handle composite names for GTK_COMPOSITE_CHILD widgets,
1198 * the returned name is newly allocated.
1199 */
1200void gtk_widget_set_composite_name (GtkWidget *widget,
1201 const gchar *name);
1202gchar* gtk_widget_get_composite_name (GtkWidget *widget);
1203
1204/* Descend recursively and set rc-style on all widgets without user styles */
1205void gtk_widget_reset_rc_styles (GtkWidget *widget);
1206
1207/* Push/pop pairs, to change default values upon a widget's creation.
1208 * This will override the values that got set by the
1209 * gtk_widget_set_default_* () functions.
1210 */
1211void gtk_widget_push_colormap (GdkColormap *cmap);
1212void gtk_widget_push_composite_child (void);
1213void gtk_widget_pop_composite_child (void);
1214void gtk_widget_pop_colormap (void);
1215
1216/* widget style properties
1217 */
1218void gtk_widget_class_install_style_property (GtkWidgetClass *klass,
1219 GParamSpec *pspec);
1220void gtk_widget_class_install_style_property_parser (GtkWidgetClass *klass,
1221 GParamSpec *pspec,
1222 GtkRcPropertyParser parser);
1223GParamSpec* gtk_widget_class_find_style_property (GtkWidgetClass *klass,
1224 const gchar *property_name);
1225GParamSpec** gtk_widget_class_list_style_properties (GtkWidgetClass *klass,
1226 guint *n_properties);
1227void gtk_widget_style_get_property (GtkWidget *widget,
1228 const gchar *property_name,
1229 GValue *value);
1230void gtk_widget_style_get_valist (GtkWidget *widget,
1231 const gchar *first_property_name,
1232 va_list var_args);
1233void gtk_widget_style_get (GtkWidget *widget,
1234 const gchar *first_property_name,
1235 ...) G_GNUC_NULL_TERMINATED;
1236
1237
1238/* Set certain default values to be used at widget creation time.
1239 */
1240void gtk_widget_set_default_colormap (GdkColormap *colormap);
1241GtkStyle* gtk_widget_get_default_style (void);
1242#ifndef GDK_MULTIHEAD_SAFE
1243GdkColormap* gtk_widget_get_default_colormap (void);
1244GdkVisual* gtk_widget_get_default_visual (void);
1245#endif
1246
1247/* Functions for setting directionality for widgets
1248 */
1249
1250void gtk_widget_set_direction (GtkWidget *widget,
1251 GtkTextDirection dir);
1252GtkTextDirection gtk_widget_get_direction (GtkWidget *widget);
1253
1254void gtk_widget_set_default_direction (GtkTextDirection dir);
1255GtkTextDirection gtk_widget_get_default_direction (void);
1256
1257/* Compositing manager functionality */
1258gboolean gtk_widget_is_composited (GtkWidget *widget);
1259
1260/* Counterpart to gdk_window_shape_combine_mask.
1261 */
1262void gtk_widget_shape_combine_mask (GtkWidget *widget,
1263 GdkBitmap *shape_mask,
1264 gint offset_x,
1265 gint offset_y);
1266void gtk_widget_input_shape_combine_mask (GtkWidget *widget,
1267 GdkBitmap *shape_mask,
1268 gint offset_x,
1269 gint offset_y);
1270
1271#if !defined(GTK_DISABLE_DEPRECATED) || defined (GTK_COMPILATION)
1272/* internal function */
1273void gtk_widget_reset_shapes (GtkWidget *widget);
1274#endif
1275
1276/* Compute a widget's path in the form "GtkWindow.MyLabel", and
1277 * return newly alocated strings.
1278 */
1279void gtk_widget_path (GtkWidget *widget,
1280 guint *path_length,
1281 gchar **path,
1282 gchar **path_reversed);
1283void gtk_widget_class_path (GtkWidget *widget,
1284 guint *path_length,
1285 gchar **path,
1286 gchar **path_reversed);
1287
1288GList* gtk_widget_list_mnemonic_labels (GtkWidget *widget);
1289void gtk_widget_add_mnemonic_label (GtkWidget *widget,
1290 GtkWidget *label);
1291void gtk_widget_remove_mnemonic_label (GtkWidget *widget,
1292 GtkWidget *label);
1293
1294void gtk_widget_set_tooltip_window (GtkWidget *widget,
1295 GtkWindow *custom_window);
1296GtkWindow *gtk_widget_get_tooltip_window (GtkWidget *widget);
1297void gtk_widget_trigger_tooltip_query (GtkWidget *widget);
1298void gtk_widget_set_tooltip_text (GtkWidget *widget,
1299 const gchar *text);
1300gchar * gtk_widget_get_tooltip_text (GtkWidget *widget);
1301void gtk_widget_set_tooltip_markup (GtkWidget *widget,
1302 const gchar *markup);
1303gchar * gtk_widget_get_tooltip_markup (GtkWidget *widget);
1304void gtk_widget_set_has_tooltip (GtkWidget *widget,
1305 gboolean has_tooltip);
1306gboolean gtk_widget_get_has_tooltip (GtkWidget *widget);
1307
1308GType gtk_requisition_get_type (void) G_GNUC_CONST;
1309GtkRequisition *gtk_requisition_copy (const GtkRequisition *requisition);
1310void gtk_requisition_free (GtkRequisition *requisition);
1311
1312#if defined (GTK_TRACE_OBJECTS) && defined (__GNUC__)
1313# define gtk_widget_ref g_object_ref
1314# define gtk_widget_unref g_object_unref
1315#endif /* GTK_TRACE_OBJECTS && __GNUC__ */
1316
1317void _gtk_widget_set_has_default (GtkWidget *widget,
1318 gboolean has_default);
1319void _gtk_widget_set_has_grab (GtkWidget *widget,
1320 gboolean has_grab);
1321void _gtk_widget_set_is_toplevel (GtkWidget *widget,
1322 gboolean is_toplevel);
1323
1324void _gtk_widget_grab_notify (GtkWidget *widget,
1325 gboolean was_grabbed);
1326
1327GtkWidgetAuxInfo *_gtk_widget_get_aux_info (GtkWidget *widget,
1328 gboolean create);
1329void _gtk_widget_propagate_hierarchy_changed (GtkWidget *widget,
1330 GtkWidget *previous_toplevel);
1331void _gtk_widget_propagate_screen_changed (GtkWidget *widget,
1332 GdkScreen *previous_screen);
1333void _gtk_widget_propagate_composited_changed (GtkWidget *widget);
1334
1335void _gtk_widget_set_pointer_window (GtkWidget *widget,
1336 GdkWindow *pointer_window);
1337GdkWindow *_gtk_widget_get_pointer_window (GtkWidget *widget);
1338gboolean _gtk_widget_is_pointer_widget (GtkWidget *widget);
1339void _gtk_widget_synthesize_crossing (GtkWidget *from,
1340 GtkWidget *to,
1341 GdkCrossingMode mode);
1342
1343GdkColormap* _gtk_widget_peek_colormap (void);
1344
1345void _gtk_widget_buildable_finish_accelerator (GtkWidget *widget,
1346 GtkWidget *toplevel,
1347 gpointer user_data);
1348
1349G_END_DECLS
1350
1351#endif /* __GTK_WIDGET_H__ */
1352