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, see <http://www.gnu.org/licenses/>.
16 */
17
18/*
19 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
20 * file for a list of people on the GTK+ Team. See the ChangeLog
21 * files for a list of changes. These files are distributed with
22 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
23 */
24
25#ifndef __GTK_WIDGET_H__
26#define __GTK_WIDGET_H__
27
28#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
29#error "Only <gtk/gtk.h> can be included directly."
30#endif
31
32#include <gdk/gdk.h>
33#include <gtk/gtkaccelgroup.h>
34#include <gtk/gtkborder.h>
35#include <gtk/gtktypes.h>
36#include <atk/atk.h>
37
38G_BEGIN_DECLS
39
40/* Kinds of widget-specific help */
41/**
42 * GtkWidgetHelpType:
43 * @GTK_WIDGET_HELP_TOOLTIP: Tooltip.
44 * @GTK_WIDGET_HELP_WHATS_THIS: What’s this.
45 *
46 * Kinds of widget-specific help. Used by the ::show-help signal.
47 */
48typedef enum
49{
50 GTK_WIDGET_HELP_TOOLTIP,
51 GTK_WIDGET_HELP_WHATS_THIS
52} GtkWidgetHelpType;
53
54/* Macro for casting a pointer to a GtkWidget or GtkWidgetClass pointer.
55 * Macros for testing whether widget or klass are of type GTK_TYPE_WIDGET.
56 */
57#define GTK_TYPE_WIDGET (gtk_widget_get_type ())
58#define GTK_WIDGET(widget) (G_TYPE_CHECK_INSTANCE_CAST ((widget), GTK_TYPE_WIDGET, GtkWidget))
59#define GTK_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_WIDGET, GtkWidgetClass))
60#define GTK_IS_WIDGET(widget) (G_TYPE_CHECK_INSTANCE_TYPE ((widget), GTK_TYPE_WIDGET))
61#define GTK_IS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WIDGET))
62#define GTK_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_WIDGET, GtkWidgetClass))
63
64#define GTK_TYPE_REQUISITION (gtk_requisition_get_type ())
65
66typedef struct _GtkWidgetPrivate GtkWidgetPrivate;
67typedef struct _GtkWidgetClass GtkWidgetClass;
68typedef struct _GtkWidgetClassPrivate GtkWidgetClassPrivate;
69
70/**
71 * GtkAllocation:
72 * @x: the X position of the widget’s area relative to its parents allocation.
73 * @y: the Y position of the widget’s area relative to its parents allocation.
74 * @width: the width of the widget’s allocated area.
75 * @height: the height of the widget’s allocated area.
76 *
77 * A #GtkAllocation-struct of a widget represents region
78 * which has been allocated to the widget by its parent. It is a subregion
79 * of its parents allocation. See
80 * [GtkWidget’s geometry management section][geometry-management] for
81 * more information.
82 */
83typedef GdkRectangle GtkAllocation;
84
85/**
86 * GtkCallback:
87 * @widget: the widget to operate on
88 * @data: (closure): user-supplied data
89 *
90 * The type of the callback functions used for e.g. iterating over
91 * the children of a container, see gtk_container_foreach().
92 */
93typedef void (*GtkCallback) (GtkWidget *widget,
94 gpointer data);
95
96/**
97 * GtkTickCallback:
98 * @widget: the widget
99 * @frame_clock: the frame clock for the widget (same as calling gtk_widget_get_frame_clock())
100 * @user_data: user data passed to gtk_widget_add_tick_callback().
101 *
102 * Callback type for adding a function to update animations. See gtk_widget_add_tick_callback().
103 *
104 * Returns: %G_SOURCE_CONTINUE if the tick callback should continue to be called,
105 * %G_SOURCE_REMOVE if the tick callback should be removed.
106 *
107 * Since: 3.8
108 */
109typedef gboolean (*GtkTickCallback) (GtkWidget *widget,
110 GdkFrameClock *frame_clock,
111 gpointer user_data);
112
113/**
114 * GtkRequisition:
115 * @width: the widget’s desired width
116 * @height: the widget’s desired height
117 *
118 * A #GtkRequisition-struct represents the desired size of a widget. See
119 * [GtkWidget’s geometry management section][geometry-management] for
120 * more information.
121 */
122struct _GtkRequisition
123{
124 gint width;
125 gint height;
126};
127
128/* The widget is the base of the tree for displayable objects.
129 * (A displayable object is one which takes up some amount
130 * of screen real estate). It provides a common base and interface
131 * which actual widgets must adhere to.
132 */
133struct _GtkWidget
134{
135 GInitiallyUnowned parent_instance;
136
137 /*< private >*/
138
139 GtkWidgetPrivate *priv;
140};
141
142/**
143 * GtkWidgetClass:
144 * @parent_class: The object class structure needs to be the first
145 * element in the widget class structure in order for the class mechanism
146 * to work correctly. This allows a GtkWidgetClass pointer to be cast to
147 * a GObjectClass pointer.
148 * @activate_signal: The signal to emit when a widget of this class is
149 * activated, gtk_widget_activate() handles the emission.
150 * Implementation of this signal is optional.
151 * @dispatch_child_properties_changed: Seldomly overidden.
152 * @destroy: Signals that all holders of a reference to the widget
153 * should release the reference that they hold.
154 * @show: Signal emitted when widget is shown
155 * @show_all: Recursively shows a widget, and any child widgets (if the widget is
156 * a container).
157 * @hide: Signal emitted when widget is hidden.
158 * @map: Signal emitted when widget is going to be mapped, that is
159 * when the widget is visible (which is controlled with
160 * gtk_widget_set_visible()) and all its parents up to the toplevel
161 * widget are also visible.
162 * @unmap: Signal emitted when widget is going to be unmapped, which
163 * means that either it or any of its parents up to the toplevel
164 * widget have been set as hidden.
165 * @realize: Signal emitted when widget is associated with a
166 * #GdkWindow, which means that gtk_widget_realize() has been called or
167 * the widget has been mapped (that is, it is going to be drawn).
168 * @unrealize: Signal emitted when the GdkWindow associated with
169 * widget is destroyed, which means that gtk_widget_unrealize() has
170 * been called or the widget has been unmapped (that is, it is going
171 * to be hidden).
172 * @size_allocate: Signal emitted to get the widget allocation.
173 * @state_changed: Signal emitted when the widget state
174 * changes. Deprecated: 3.0
175 * @state_flags_changed: Signal emitted when the widget state changes,
176 * see gtk_widget_get_state_flags().
177 * @parent_set: Signal emitted when a new parent has been set on a
178 * widget.
179 * @hierarchy_changed: Signal emitted when the anchored state of a
180 * widget changes.
181 * @style_set: Signal emitted when a new style has been set on a
182 * widget. Deprecated: 3.0
183 * @direction_changed: Signal emitted when the text direction of a
184 * widget changes.
185 * @grab_notify: Signal emitted when a widget becomes shadowed by a
186 * GTK+ grab (not a pointer or keyboard grab) on another widget, or
187 * when it becomes unshadowed due to a grab being removed.
188 * @child_notify: Signal emitted for each child property that has
189 * changed on an object.
190 * @draw: Signal emitted when a widget is supposed to render itself.
191 * @get_request_mode: This allows a widget to tell its parent container whether
192 * it prefers to be allocated in %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH or
193 * %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT mode.
194 * %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH means the widget prefers to have
195 * #GtkWidgetClass.get_preferred_width() called and then
196 * #GtkWidgetClass.get_preferred_height_for_width().
197 * %GTK_SIZE_REQUEST_CONSTANT_SIZE disables any height-for-width or
198 * width-for-height geometry management for a said widget and is the
199 * default return.
200 * It’s important to note (as described below) that any widget
201 * which trades height-for-width or width-for-height must respond properly
202 * to both of the virtual methods #GtkWidgetClass.get_preferred_height_for_width()
203 * and #GtkWidgetClass.get_preferred_width_for_height() since it might be
204 * queried in either #GtkSizeRequestMode by its parent container.
205 * @get_preferred_height: This is called by containers to obtain the minimum
206 * and natural height of a widget. A widget that does not actually trade
207 * any height for width or width for height only has to implement these
208 * two virtual methods (#GtkWidgetClass.get_preferred_width() and
209 * #GtkWidgetClass.get_preferred_height()).
210 * @get_preferred_width_for_height: This is analogous to
211 * #GtkWidgetClass.get_preferred_height_for_width() except that it
212 * operates in the oposite orientation. It’s rare that a widget actually
213 * does %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT requests but this can happen
214 * when, for example, a widget or container gets additional columns to
215 * compensate for a smaller allocated height.
216 * @get_preferred_width: This is called by containers to obtain the minimum
217 * and natural width of a widget. A widget will never be allocated a width
218 * less than its minimum and will only ever be allocated a width greater
219 * than the natural width once all of the said widget’s siblings have
220 * received their natural widths.
221 * Furthermore, a widget will only ever be allocated a width greater than
222 * its natural width if it was configured to receive extra expand space
223 * from its parent container.
224 * @get_preferred_height_for_width: This is similar to
225 * #GtkWidgetClass.get_preferred_height() except that it is passed a
226 * contextual width to request height for. By implementing this virtual
227 * method it is possible for a #GtkLabel to tell its parent how much height
228 * would be required if the label were to be allocated a said width.
229 * @mnemonic_activate: Activates the @widget if @group_cycling is
230 * %FALSE, and just grabs the focus if @group_cycling is %TRUE.
231 * @grab_focus: Causes @widget to have the keyboard focus for the
232 * #GtkWindow it’s inside.
233 * @focus:
234 * @move_focus: Signal emitted when a change of focus is requested
235 * @keynav_failed: Signal emitted if keyboard navigation fails.
236 * @event: The GTK+ main loop will emit three signals for each GDK
237 * event delivered to a widget: one generic ::event signal, another,
238 * more specific, signal that matches the type of event delivered
239 * (e.g. "key-press-event") and finally a generic "event-after"
240 * signal.
241 * @button_press_event: Signal will be emitted when a button
242 * (typically from a mouse) is pressed.
243 * @button_release_event: Signal will be emitted when a button
244 * (typically from a mouse) is released.
245 * @scroll_event: Signal emitted when a button in the 4 to 7 range is
246 * pressed.
247 * @motion_notify_event: Signal emitted when the pointer moves over
248 * the widget’s #GdkWindow.
249 * @delete_event: Signal emitted if a user requests that a toplevel
250 * window is closed.
251 * @destroy_event: Signal is emitted when a #GdkWindow is destroyed.
252 * @key_press_event: Signal emitted when a key is pressed.
253 * @key_release_event: Signal is emitted when a key is released.
254 * @enter_notify_event: Signal event will be emitted when the pointer
255 * enters the widget’s window.
256 * @leave_notify_event: Will be emitted when the pointer leaves the
257 * widget’s window.
258 * @configure_event: Signal will be emitted when the size, position or
259 * stacking of the widget’s window has changed.
260 * @focus_in_event: Signal emitted when the keyboard focus enters the
261 * widget’s window.
262 * @focus_out_event: Signal emitted when the keyboard focus leaves the
263 * widget’s window.
264 * @map_event: Signal emitted when the widget’s window is mapped.
265 * @unmap_event: Signal will be emitted when the widget’s window is
266 * unmapped.
267 * @property_notify_event: Signal will be emitted when a property on
268 * the widget’s window has been changed or deleted.
269 * @selection_clear_event: Signal will be emitted when the the
270 * widget’s window has lost ownership of a selection.
271 * @selection_request_event: Signal will be emitted when another
272 * client requests ownership of the selection owned by the widget's
273 * window.
274 * @selection_notify_event:
275 * @proximity_in_event:
276 * @proximity_out_event:
277 * @visibility_notify_event: Signal emitted when the widget’s window is
278 * obscured or unobscured.
279 * @window_state_event: Signal emitted when the state of the toplevel
280 * window associated to the widget changes.
281 * @damage_event: Signal emitted when a redirected window belonging to
282 * widget gets drawn into.
283 * @grab_broken_event: Signal emitted when a pointer or keyboard grab
284 * on a window belonging to widget gets broken.
285 * @selection_get:
286 * @selection_received:
287 * @drag_begin: Signal emitted on the drag source when a drag is
288 * started.
289 * @drag_end: Signal emitted on the drag source when a drag is
290 * finished.
291 * @drag_data_get: Signal emitted on the drag source when the drop
292 * site requests the data which is dragged.
293 * @drag_data_delete: Signal emitted on the drag source when a drag
294 * with the action %GDK_ACTION_MOVE is successfully completed.
295 * @drag_leave: Signal emitted on the drop site when the cursor leaves
296 * the widget.
297 * @drag_motion: signal emitted on the drop site when the user moves
298 * the cursor over the widget during a drag.
299 * @drag_drop: Signal emitted on the drop site when the user drops the
300 * data onto the widget.
301 * @drag_data_received: Signal emitted on the drop site when the
302 * dragged data has been received.
303 * @drag_failed: Signal emitted on the drag source when a drag has
304 * failed.
305 * @popup_menu: Signal emitted whenever a widget should pop up a
306 * context menu.
307 * @show_help:
308 * @get_accessible: Returns the accessible object that describes the
309 * widget to an assistive technology.
310 * @screen_changed: Signal emitted when the screen of a widget has
311 * changed.
312 * @can_activate_accel: Signal allows applications and derived widgets
313 * to override the default GtkWidget handling for determining whether
314 * an accelerator can be activated.
315 * @composited_changed: Signal emitted when the composited status of
316 * widgets screen changes. See gdk_screen_is_composited().
317 * @query_tooltip: Signal emitted when “has-tooltip” is %TRUE and the
318 * hover timeout has expired with the cursor hovering “above”
319 * widget; or emitted when widget got focus in keyboard mode.
320 * @compute_expand: Computes whether a container should give this
321 * widget extra space when possible.
322 * @adjust_size_request: Convert an initial size request from a widget's
323 * #GtkSizeRequestMode virtual method implementations into a size request to
324 * be used by parent containers in laying out the widget.
325 * adjust_size_request adjusts from a child widget's
326 * original request to what a parent container should
327 * use for layout. The @for_size argument will be -1 if the request should
328 * not be for a particular size in the opposing orientation, i.e. if the
329 * request is not height-for-width or width-for-height. If @for_size is
330 * greater than -1, it is the proposed allocation in the opposing
331 * orientation that we need the request for. Implementations of
332 * adjust_size_request should chain up to the default implementation,
333 * which applies #GtkWidget’s margin properties and imposes any values
334 * from gtk_widget_set_size_request(). Chaining up should be last,
335 * after your subclass adjusts the request, so
336 * #GtkWidget can apply constraints and add the margin properly.
337 * @adjust_size_allocation: Convert an initial size allocation assigned
338 * by a #GtkContainer using gtk_widget_size_allocate(), into an actual
339 * size allocation to be used by the widget. adjust_size_allocation
340 * adjusts to a child widget’s actual allocation
341 * from what a parent container computed for the
342 * child. The adjusted allocation must be entirely within the original
343 * allocation. In any custom implementation, chain up to the default
344 * #GtkWidget implementation of this method, which applies the margin
345 * and alignment properties of #GtkWidget. Chain up
346 * before performing your own adjustments so your
347 * own adjustments remove more allocation after the #GtkWidget base
348 * class has already removed margin and alignment. The natural size
349 * passed in should be adjusted in the same way as the allocated size,
350 * which allows adjustments to perform alignments or other changes
351 * based on natural size.
352 * @style_updated: Signal emitted when the GtkStyleContext of a widget
353 * is changed.
354 * @touch_event:
355 * @get_preferred_height_and_baseline_for_width:
356 * @adjust_baseline_request:
357 * @adjust_baseline_allocation:
358 * @queue_draw_region: Invalidates the area of widget defined by
359 * region by calling gdk_window_invalidate_region() on the widget's
360 * window and all its child windows.
361 */
362struct _GtkWidgetClass
363{
364 GInitiallyUnownedClass parent_class;
365
366 /*< public >*/
367
368 guint activate_signal;
369
370 /* seldomly overidden */
371 void (*dispatch_child_properties_changed) (GtkWidget *widget,
372 guint n_pspecs,
373 GParamSpec **pspecs);
374
375 /* basics */
376 void (* destroy) (GtkWidget *widget);
377 void (* show) (GtkWidget *widget);
378 void (* show_all) (GtkWidget *widget);
379 void (* hide) (GtkWidget *widget);
380 void (* map) (GtkWidget *widget);
381 void (* unmap) (GtkWidget *widget);
382 void (* realize) (GtkWidget *widget);
383 void (* unrealize) (GtkWidget *widget);
384 void (* size_allocate) (GtkWidget *widget,
385 GtkAllocation *allocation);
386 void (* state_changed) (GtkWidget *widget,
387 GtkStateType previous_state);
388 void (* state_flags_changed) (GtkWidget *widget,
389 GtkStateFlags previous_state_flags);
390 void (* parent_set) (GtkWidget *widget,
391 GtkWidget *previous_parent);
392 void (* hierarchy_changed) (GtkWidget *widget,
393 GtkWidget *previous_toplevel);
394 void (* style_set) (GtkWidget *widget,
395 GtkStyle *previous_style);
396 void (* direction_changed) (GtkWidget *widget,
397 GtkTextDirection previous_direction);
398 void (* grab_notify) (GtkWidget *widget,
399 gboolean was_grabbed);
400 void (* child_notify) (GtkWidget *widget,
401 GParamSpec *child_property);
402 gboolean (* draw) (GtkWidget *widget,
403 cairo_t *cr);
404
405 /* size requests */
406 GtkSizeRequestMode (* get_request_mode) (GtkWidget *widget);
407
408 void (* get_preferred_height) (GtkWidget *widget,
409 gint *minimum_height,
410 gint *natural_height);
411 void (* get_preferred_width_for_height) (GtkWidget *widget,
412 gint height,
413 gint *minimum_width,
414 gint *natural_width);
415 void (* get_preferred_width) (GtkWidget *widget,
416 gint *minimum_width,
417 gint *natural_width);
418 void (* get_preferred_height_for_width) (GtkWidget *widget,
419 gint width,
420 gint *minimum_height,
421 gint *natural_height);
422
423 /* Mnemonics */
424 gboolean (* mnemonic_activate) (GtkWidget *widget,
425 gboolean group_cycling);
426
427 /* explicit focus */
428 void (* grab_focus) (GtkWidget *widget);
429 gboolean (* focus) (GtkWidget *widget,
430 GtkDirectionType direction);
431
432 /* keyboard navigation */
433 void (* move_focus) (GtkWidget *widget,
434 GtkDirectionType direction);
435 gboolean (* keynav_failed) (GtkWidget *widget,
436 GtkDirectionType direction);
437
438 /* events */
439 gboolean (* event) (GtkWidget *widget,
440 GdkEvent *event);
441 gboolean (* button_press_event) (GtkWidget *widget,
442 GdkEventButton *event);
443 gboolean (* button_release_event) (GtkWidget *widget,
444 GdkEventButton *event);
445 gboolean (* scroll_event) (GtkWidget *widget,
446 GdkEventScroll *event);
447 gboolean (* motion_notify_event) (GtkWidget *widget,
448 GdkEventMotion *event);
449 gboolean (* delete_event) (GtkWidget *widget,
450 GdkEventAny *event);
451 gboolean (* destroy_event) (GtkWidget *widget,
452 GdkEventAny *event);
453 gboolean (* key_press_event) (GtkWidget *widget,
454 GdkEventKey *event);
455 gboolean (* key_release_event) (GtkWidget *widget,
456 GdkEventKey *event);
457 gboolean (* enter_notify_event) (GtkWidget *widget,
458 GdkEventCrossing *event);
459 gboolean (* leave_notify_event) (GtkWidget *widget,
460 GdkEventCrossing *event);
461 gboolean (* configure_event) (GtkWidget *widget,
462 GdkEventConfigure *event);
463 gboolean (* focus_in_event) (GtkWidget *widget,
464 GdkEventFocus *event);
465 gboolean (* focus_out_event) (GtkWidget *widget,
466 GdkEventFocus *event);
467 gboolean (* map_event) (GtkWidget *widget,
468 GdkEventAny *event);
469 gboolean (* unmap_event) (GtkWidget *widget,
470 GdkEventAny *event);
471 gboolean (* property_notify_event) (GtkWidget *widget,
472 GdkEventProperty *event);
473 gboolean (* selection_clear_event) (GtkWidget *widget,
474 GdkEventSelection *event);
475 gboolean (* selection_request_event) (GtkWidget *widget,
476 GdkEventSelection *event);
477 gboolean (* selection_notify_event) (GtkWidget *widget,
478 GdkEventSelection *event);
479 gboolean (* proximity_in_event) (GtkWidget *widget,
480 GdkEventProximity *event);
481 gboolean (* proximity_out_event) (GtkWidget *widget,
482 GdkEventProximity *event);
483 gboolean (* visibility_notify_event) (GtkWidget *widget,
484 GdkEventVisibility *event);
485 gboolean (* window_state_event) (GtkWidget *widget,
486 GdkEventWindowState *event);
487 gboolean (* damage_event) (GtkWidget *widget,
488 GdkEventExpose *event);
489 gboolean (* grab_broken_event) (GtkWidget *widget,
490 GdkEventGrabBroken *event);
491
492 /* selection */
493 void (* selection_get) (GtkWidget *widget,
494 GtkSelectionData *selection_data,
495 guint info,
496 guint time_);
497 void (* selection_received) (GtkWidget *widget,
498 GtkSelectionData *selection_data,
499 guint time_);
500
501 /* Source side drag signals */
502 void (* drag_begin) (GtkWidget *widget,
503 GdkDragContext *context);
504 void (* drag_end) (GtkWidget *widget,
505 GdkDragContext *context);
506 void (* drag_data_get) (GtkWidget *widget,
507 GdkDragContext *context,
508 GtkSelectionData *selection_data,
509 guint info,
510 guint time_);
511 void (* drag_data_delete) (GtkWidget *widget,
512 GdkDragContext *context);
513
514 /* Target side drag signals */
515 void (* drag_leave) (GtkWidget *widget,
516 GdkDragContext *context,
517 guint time_);
518 gboolean (* drag_motion) (GtkWidget *widget,
519 GdkDragContext *context,
520 gint x,
521 gint y,
522 guint time_);
523 gboolean (* drag_drop) (GtkWidget *widget,
524 GdkDragContext *context,
525 gint x,
526 gint y,
527 guint time_);
528 void (* drag_data_received) (GtkWidget *widget,
529 GdkDragContext *context,
530 gint x,
531 gint y,
532 GtkSelectionData *selection_data,
533 guint info,
534 guint time_);
535 gboolean (* drag_failed) (GtkWidget *widget,
536 GdkDragContext *context,
537 GtkDragResult result);
538
539 /* Signals used only for keybindings */
540 gboolean (* popup_menu) (GtkWidget *widget);
541
542 /* If a widget has multiple tooltips/whatsthis, it should show the
543 * one for the current focus location, or if that doesn't make
544 * sense, should cycle through them showing each tip alongside
545 * whatever piece of the widget it applies to.
546 */
547 gboolean (* show_help) (GtkWidget *widget,
548 GtkWidgetHelpType help_type);
549
550 /* accessibility support
551 */
552 AtkObject * (* get_accessible) (GtkWidget *widget);
553
554 void (* screen_changed) (GtkWidget *widget,
555 GdkScreen *previous_screen);
556 gboolean (* can_activate_accel) (GtkWidget *widget,
557 guint signal_id);
558
559
560 void (* composited_changed) (GtkWidget *widget);
561
562 gboolean (* query_tooltip) (GtkWidget *widget,
563 gint x,
564 gint y,
565 gboolean keyboard_tooltip,
566 GtkTooltip *tooltip);
567
568 void (* compute_expand) (GtkWidget *widget,
569 gboolean *hexpand_p,
570 gboolean *vexpand_p);
571
572 void (* adjust_size_request) (GtkWidget *widget,
573 GtkOrientation orientation,
574 gint *minimum_size,
575 gint *natural_size);
576 void (* adjust_size_allocation) (GtkWidget *widget,
577 GtkOrientation orientation,
578 gint *minimum_size,
579 gint *natural_size,
580 gint *allocated_pos,
581 gint *allocated_size);
582
583 void (* style_updated) (GtkWidget *widget);
584
585 gboolean (* touch_event) (GtkWidget *widget,
586 GdkEventTouch *event);
587
588 void (* get_preferred_height_and_baseline_for_width) (GtkWidget *widget,
589 gint width,
590 gint *minimum_height,
591 gint *natural_height,
592 gint *minimum_baseline,
593 gint *natural_baseline);
594 void (* adjust_baseline_request)(GtkWidget *widget,
595 gint *minimum_baseline,
596 gint *natural_baseline);
597 void (* adjust_baseline_allocation) (GtkWidget *widget,
598 gint *baseline);
599 void (*queue_draw_region) (GtkWidget *widget,
600 const cairo_region_t *region);
601
602 /*< private >*/
603
604 GtkWidgetClassPrivate *priv;
605
606 /* Padding for future expansion */
607 void (*_gtk_reserved6) (void);
608 void (*_gtk_reserved7) (void);
609};
610
611
612GDK_AVAILABLE_IN_ALL
613GType gtk_widget_get_type (void) G_GNUC_CONST;
614GDK_AVAILABLE_IN_ALL
615GtkWidget* gtk_widget_new (GType type,
616 const gchar *first_property_name,
617 ...);
618GDK_AVAILABLE_IN_ALL
619void gtk_widget_destroy (GtkWidget *widget);
620GDK_AVAILABLE_IN_ALL
621void gtk_widget_destroyed (GtkWidget *widget,
622 GtkWidget **widget_pointer);
623GDK_AVAILABLE_IN_ALL
624void gtk_widget_unparent (GtkWidget *widget);
625GDK_AVAILABLE_IN_ALL
626void gtk_widget_show (GtkWidget *widget);
627GDK_AVAILABLE_IN_ALL
628void gtk_widget_hide (GtkWidget *widget);
629GDK_AVAILABLE_IN_ALL
630void gtk_widget_show_now (GtkWidget *widget);
631GDK_AVAILABLE_IN_ALL
632void gtk_widget_show_all (GtkWidget *widget);
633GDK_AVAILABLE_IN_ALL
634void gtk_widget_set_no_show_all (GtkWidget *widget,
635 gboolean no_show_all);
636GDK_AVAILABLE_IN_ALL
637gboolean gtk_widget_get_no_show_all (GtkWidget *widget);
638GDK_AVAILABLE_IN_ALL
639void gtk_widget_map (GtkWidget *widget);
640GDK_AVAILABLE_IN_ALL
641void gtk_widget_unmap (GtkWidget *widget);
642GDK_AVAILABLE_IN_ALL
643void gtk_widget_realize (GtkWidget *widget);
644GDK_AVAILABLE_IN_ALL
645void gtk_widget_unrealize (GtkWidget *widget);
646
647GDK_AVAILABLE_IN_ALL
648void gtk_widget_draw (GtkWidget *widget,
649 cairo_t *cr);
650/* Queuing draws */
651GDK_AVAILABLE_IN_ALL
652void gtk_widget_queue_draw (GtkWidget *widget);
653GDK_AVAILABLE_IN_ALL
654void gtk_widget_queue_draw_area (GtkWidget *widget,
655 gint x,
656 gint y,
657 gint width,
658 gint height);
659GDK_AVAILABLE_IN_ALL
660void gtk_widget_queue_draw_region (GtkWidget *widget,
661 const cairo_region_t*region);
662GDK_AVAILABLE_IN_ALL
663void gtk_widget_queue_resize (GtkWidget *widget);
664GDK_AVAILABLE_IN_ALL
665void gtk_widget_queue_resize_no_redraw (GtkWidget *widget);
666GDK_AVAILABLE_IN_3_20
667void gtk_widget_queue_allocate (GtkWidget *widget);
668GDK_AVAILABLE_IN_3_8
669GdkFrameClock* gtk_widget_get_frame_clock (GtkWidget *widget);
670
671GDK_DEPRECATED_IN_3_0_FOR(gtk_widget_get_preferred_size)
672void gtk_widget_size_request (GtkWidget *widget,
673 GtkRequisition *requisition);
674GDK_AVAILABLE_IN_ALL
675void gtk_widget_size_allocate (GtkWidget *widget,
676 GtkAllocation *allocation);
677GDK_AVAILABLE_IN_3_10
678void gtk_widget_size_allocate_with_baseline (GtkWidget *widget,
679 GtkAllocation *allocation,
680 gint baseline);
681
682GDK_AVAILABLE_IN_ALL
683GtkSizeRequestMode gtk_widget_get_request_mode (GtkWidget *widget);
684GDK_AVAILABLE_IN_ALL
685void gtk_widget_get_preferred_width (GtkWidget *widget,
686 gint *minimum_width,
687 gint *natural_width);
688GDK_AVAILABLE_IN_ALL
689void gtk_widget_get_preferred_height_for_width (GtkWidget *widget,
690 gint width,
691 gint *minimum_height,
692 gint *natural_height);
693GDK_AVAILABLE_IN_ALL
694void gtk_widget_get_preferred_height (GtkWidget *widget,
695 gint *minimum_height,
696 gint *natural_height);
697GDK_AVAILABLE_IN_ALL
698void gtk_widget_get_preferred_width_for_height (GtkWidget *widget,
699 gint height,
700 gint *minimum_width,
701 gint *natural_width);
702GDK_AVAILABLE_IN_3_10
703void gtk_widget_get_preferred_height_and_baseline_for_width (GtkWidget *widget,
704 gint width,
705 gint *minimum_height,
706 gint *natural_height,
707 gint *minimum_baseline,
708 gint *natural_baseline);
709GDK_AVAILABLE_IN_ALL
710void gtk_widget_get_preferred_size (GtkWidget *widget,
711 GtkRequisition *minimum_size,
712 GtkRequisition *natural_size);
713
714GDK_DEPRECATED_IN_3_0_FOR(gtk_widget_get_preferred_size)
715void gtk_widget_get_child_requisition (GtkWidget *widget,
716 GtkRequisition *requisition);
717GDK_AVAILABLE_IN_ALL
718void gtk_widget_add_accelerator (GtkWidget *widget,
719 const gchar *accel_signal,
720 GtkAccelGroup *accel_group,
721 guint accel_key,
722 GdkModifierType accel_mods,
723 GtkAccelFlags accel_flags);
724GDK_AVAILABLE_IN_ALL
725gboolean gtk_widget_remove_accelerator (GtkWidget *widget,
726 GtkAccelGroup *accel_group,
727 guint accel_key,
728 GdkModifierType accel_mods);
729GDK_AVAILABLE_IN_ALL
730void gtk_widget_set_accel_path (GtkWidget *widget,
731 const gchar *accel_path,
732 GtkAccelGroup *accel_group);
733GDK_AVAILABLE_IN_ALL
734GList* gtk_widget_list_accel_closures (GtkWidget *widget);
735GDK_AVAILABLE_IN_ALL
736gboolean gtk_widget_can_activate_accel (GtkWidget *widget,
737 guint signal_id);
738GDK_AVAILABLE_IN_ALL
739gboolean gtk_widget_mnemonic_activate (GtkWidget *widget,
740 gboolean group_cycling);
741GDK_AVAILABLE_IN_ALL
742gboolean gtk_widget_event (GtkWidget *widget,
743 GdkEvent *event);
744GDK_DEPRECATED_IN_3_22
745gint gtk_widget_send_expose (GtkWidget *widget,
746 GdkEvent *event);
747GDK_AVAILABLE_IN_ALL
748gboolean gtk_widget_send_focus_change (GtkWidget *widget,
749 GdkEvent *event);
750
751GDK_AVAILABLE_IN_ALL
752gboolean gtk_widget_activate (GtkWidget *widget);
753
754GDK_DEPRECATED_IN_3_14
755void gtk_widget_reparent (GtkWidget *widget,
756 GtkWidget *new_parent);
757GDK_AVAILABLE_IN_ALL
758gboolean gtk_widget_intersect (GtkWidget *widget,
759 const GdkRectangle *area,
760 GdkRectangle *intersection);
761GDK_DEPRECATED_IN_3_14
762cairo_region_t *gtk_widget_region_intersect (GtkWidget *widget,
763 const cairo_region_t *region);
764
765GDK_AVAILABLE_IN_ALL
766void gtk_widget_freeze_child_notify (GtkWidget *widget);
767GDK_AVAILABLE_IN_ALL
768void gtk_widget_child_notify (GtkWidget *widget,
769 const gchar *child_property);
770GDK_AVAILABLE_IN_ALL
771void gtk_widget_thaw_child_notify (GtkWidget *widget);
772
773GDK_AVAILABLE_IN_ALL
774void gtk_widget_set_can_focus (GtkWidget *widget,
775 gboolean can_focus);
776GDK_AVAILABLE_IN_ALL
777gboolean gtk_widget_get_can_focus (GtkWidget *widget);
778GDK_AVAILABLE_IN_ALL
779gboolean gtk_widget_has_focus (GtkWidget *widget);
780GDK_AVAILABLE_IN_ALL
781gboolean gtk_widget_is_focus (GtkWidget *widget);
782GDK_AVAILABLE_IN_3_2
783gboolean gtk_widget_has_visible_focus (GtkWidget *widget);
784GDK_AVAILABLE_IN_ALL
785void gtk_widget_grab_focus (GtkWidget *widget);
786GDK_AVAILABLE_IN_3_20
787void gtk_widget_set_focus_on_click (GtkWidget *widget,
788 gboolean focus_on_click);
789GDK_AVAILABLE_IN_3_20
790gboolean gtk_widget_get_focus_on_click (GtkWidget *widget);
791
792GDK_AVAILABLE_IN_ALL
793void gtk_widget_set_can_default (GtkWidget *widget,
794 gboolean can_default);
795GDK_AVAILABLE_IN_ALL
796gboolean gtk_widget_get_can_default (GtkWidget *widget);
797GDK_AVAILABLE_IN_ALL
798gboolean gtk_widget_has_default (GtkWidget *widget);
799GDK_AVAILABLE_IN_ALL
800void gtk_widget_grab_default (GtkWidget *widget);
801
802GDK_AVAILABLE_IN_ALL
803void gtk_widget_set_receives_default (GtkWidget *widget,
804 gboolean receives_default);
805GDK_AVAILABLE_IN_ALL
806gboolean gtk_widget_get_receives_default (GtkWidget *widget);
807
808GDK_AVAILABLE_IN_ALL
809gboolean gtk_widget_has_grab (GtkWidget *widget);
810
811GDK_AVAILABLE_IN_ALL
812gboolean gtk_widget_device_is_shadowed (GtkWidget *widget,
813 GdkDevice *device);
814
815
816GDK_AVAILABLE_IN_ALL
817void gtk_widget_set_name (GtkWidget *widget,
818 const gchar *name);
819GDK_AVAILABLE_IN_ALL
820const gchar * gtk_widget_get_name (GtkWidget *widget);
821
822GDK_DEPRECATED_IN_3_0_FOR(gtk_widget_set_state_flags)
823void gtk_widget_set_state (GtkWidget *widget,
824 GtkStateType state);
825
826GDK_DEPRECATED_IN_3_0_FOR(gtk_widget_get_state_flags)
827GtkStateType gtk_widget_get_state (GtkWidget *widget);
828
829GDK_AVAILABLE_IN_ALL
830void gtk_widget_set_state_flags (GtkWidget *widget,
831 GtkStateFlags flags,
832 gboolean clear);
833GDK_AVAILABLE_IN_ALL
834void gtk_widget_unset_state_flags (GtkWidget *widget,
835 GtkStateFlags flags);
836GDK_AVAILABLE_IN_ALL
837GtkStateFlags gtk_widget_get_state_flags (GtkWidget *widget);
838
839GDK_AVAILABLE_IN_ALL
840void gtk_widget_set_sensitive (GtkWidget *widget,
841 gboolean sensitive);
842GDK_AVAILABLE_IN_ALL
843gboolean gtk_widget_get_sensitive (GtkWidget *widget);
844GDK_AVAILABLE_IN_ALL
845gboolean gtk_widget_is_sensitive (GtkWidget *widget);
846
847GDK_AVAILABLE_IN_ALL
848void gtk_widget_set_visible (GtkWidget *widget,
849 gboolean visible);
850GDK_AVAILABLE_IN_ALL
851gboolean gtk_widget_get_visible (GtkWidget *widget);
852GDK_AVAILABLE_IN_ALL
853gboolean gtk_widget_is_visible (GtkWidget *widget);
854
855GDK_AVAILABLE_IN_ALL
856void gtk_widget_set_has_window (GtkWidget *widget,
857 gboolean has_window);
858GDK_AVAILABLE_IN_ALL
859gboolean gtk_widget_get_has_window (GtkWidget *widget);
860
861GDK_AVAILABLE_IN_ALL
862gboolean gtk_widget_is_toplevel (GtkWidget *widget);
863GDK_AVAILABLE_IN_ALL
864gboolean gtk_widget_is_drawable (GtkWidget *widget);
865GDK_AVAILABLE_IN_ALL
866void gtk_widget_set_realized (GtkWidget *widget,
867 gboolean realized);
868GDK_AVAILABLE_IN_ALL
869gboolean gtk_widget_get_realized (GtkWidget *widget);
870GDK_AVAILABLE_IN_ALL
871void gtk_widget_set_mapped (GtkWidget *widget,
872 gboolean mapped);
873GDK_AVAILABLE_IN_ALL
874gboolean gtk_widget_get_mapped (GtkWidget *widget);
875
876GDK_AVAILABLE_IN_ALL
877void gtk_widget_set_app_paintable (GtkWidget *widget,
878 gboolean app_paintable);
879GDK_AVAILABLE_IN_ALL
880gboolean gtk_widget_get_app_paintable (GtkWidget *widget);
881
882GDK_DEPRECATED_IN_3_14
883void gtk_widget_set_double_buffered (GtkWidget *widget,
884 gboolean double_buffered);
885GDK_DEPRECATED_IN_3_14
886gboolean gtk_widget_get_double_buffered (GtkWidget *widget);
887
888GDK_AVAILABLE_IN_ALL
889void gtk_widget_set_redraw_on_allocate (GtkWidget *widget,
890 gboolean redraw_on_allocate);
891
892GDK_AVAILABLE_IN_ALL
893void gtk_widget_set_parent (GtkWidget *widget,
894 GtkWidget *parent);
895GDK_AVAILABLE_IN_ALL
896GtkWidget * gtk_widget_get_parent (GtkWidget *widget);
897
898GDK_AVAILABLE_IN_ALL
899void gtk_widget_set_parent_window (GtkWidget *widget,
900 GdkWindow *parent_window);
901GDK_AVAILABLE_IN_ALL
902GdkWindow * gtk_widget_get_parent_window (GtkWidget *widget);
903
904GDK_AVAILABLE_IN_ALL
905void gtk_widget_set_child_visible (GtkWidget *widget,
906 gboolean is_visible);
907GDK_AVAILABLE_IN_ALL
908gboolean gtk_widget_get_child_visible (GtkWidget *widget);
909
910GDK_AVAILABLE_IN_ALL
911void gtk_widget_set_window (GtkWidget *widget,
912 GdkWindow *window);
913GDK_AVAILABLE_IN_ALL
914GdkWindow * gtk_widget_get_window (GtkWidget *widget);
915GDK_AVAILABLE_IN_3_8
916void gtk_widget_register_window (GtkWidget *widget,
917 GdkWindow *window);
918GDK_AVAILABLE_IN_3_8
919void gtk_widget_unregister_window (GtkWidget *widget,
920 GdkWindow *window);
921
922GDK_AVAILABLE_IN_ALL
923int gtk_widget_get_allocated_width (GtkWidget *widget);
924GDK_AVAILABLE_IN_ALL
925int gtk_widget_get_allocated_height (GtkWidget *widget);
926GDK_AVAILABLE_IN_3_10
927int gtk_widget_get_allocated_baseline (GtkWidget *widget);
928GDK_AVAILABLE_IN_3_20
929void gtk_widget_get_allocated_size (GtkWidget *widget,
930 GtkAllocation *allocation,
931 int *baseline);
932
933GDK_AVAILABLE_IN_ALL
934void gtk_widget_get_allocation (GtkWidget *widget,
935 GtkAllocation *allocation);
936GDK_AVAILABLE_IN_ALL
937void gtk_widget_set_allocation (GtkWidget *widget,
938 const GtkAllocation *allocation);
939GDK_AVAILABLE_IN_3_14
940void gtk_widget_set_clip (GtkWidget *widget,
941 const GtkAllocation *clip);
942GDK_AVAILABLE_IN_3_14
943void gtk_widget_get_clip (GtkWidget *widget,
944 GtkAllocation *clip);
945
946GDK_DEPRECATED_IN_3_0_FOR(gtk_widget_get_preferred_width & gtk_widget_get_preferred_height)
947
948void gtk_widget_get_requisition (GtkWidget *widget,
949 GtkRequisition *requisition);
950
951GDK_AVAILABLE_IN_ALL
952gboolean gtk_widget_child_focus (GtkWidget *widget,
953 GtkDirectionType direction);
954GDK_AVAILABLE_IN_ALL
955gboolean gtk_widget_keynav_failed (GtkWidget *widget,
956 GtkDirectionType direction);
957GDK_AVAILABLE_IN_ALL
958void gtk_widget_error_bell (GtkWidget *widget);
959
960GDK_AVAILABLE_IN_ALL
961void gtk_widget_set_size_request (GtkWidget *widget,
962 gint width,
963 gint height);
964GDK_AVAILABLE_IN_ALL
965void gtk_widget_get_size_request (GtkWidget *widget,
966 gint *width,
967 gint *height);
968GDK_AVAILABLE_IN_ALL
969void gtk_widget_set_events (GtkWidget *widget,
970 gint events);
971GDK_AVAILABLE_IN_ALL
972void gtk_widget_add_events (GtkWidget *widget,
973 gint events);
974GDK_AVAILABLE_IN_ALL
975void gtk_widget_set_device_events (GtkWidget *widget,
976 GdkDevice *device,
977 GdkEventMask events);
978GDK_AVAILABLE_IN_ALL
979void gtk_widget_add_device_events (GtkWidget *widget,
980 GdkDevice *device,
981 GdkEventMask events);
982GDK_AVAILABLE_IN_3_8
983void gtk_widget_set_opacity (GtkWidget *widget,
984 double opacity);
985GDK_AVAILABLE_IN_3_8
986double gtk_widget_get_opacity (GtkWidget *widget);
987
988GDK_AVAILABLE_IN_ALL
989void gtk_widget_set_device_enabled (GtkWidget *widget,
990 GdkDevice *device,
991 gboolean enabled);
992GDK_AVAILABLE_IN_ALL
993gboolean gtk_widget_get_device_enabled (GtkWidget *widget,
994 GdkDevice *device);
995
996GDK_AVAILABLE_IN_ALL
997GtkWidget* gtk_widget_get_toplevel (GtkWidget *widget);
998GDK_AVAILABLE_IN_ALL
999GtkWidget* gtk_widget_get_ancestor (GtkWidget *widget,
1000 GType widget_type);
1001GDK_AVAILABLE_IN_ALL
1002GdkVisual* gtk_widget_get_visual (GtkWidget *widget);
1003GDK_AVAILABLE_IN_ALL
1004void gtk_widget_set_visual (GtkWidget *widget,
1005 GdkVisual *visual);
1006
1007GDK_AVAILABLE_IN_ALL
1008GdkScreen * gtk_widget_get_screen (GtkWidget *widget);
1009GDK_AVAILABLE_IN_ALL
1010gboolean gtk_widget_has_screen (GtkWidget *widget);
1011GDK_AVAILABLE_IN_3_10
1012gint gtk_widget_get_scale_factor (GtkWidget *widget);
1013GDK_AVAILABLE_IN_ALL
1014GdkDisplay * gtk_widget_get_display (GtkWidget *widget);
1015GDK_DEPRECATED_IN_3_12
1016GdkWindow * gtk_widget_get_root_window (GtkWidget *widget);
1017GDK_AVAILABLE_IN_ALL
1018GtkSettings* gtk_widget_get_settings (GtkWidget *widget);
1019GDK_AVAILABLE_IN_ALL
1020GtkClipboard *gtk_widget_get_clipboard (GtkWidget *widget,
1021 GdkAtom selection);
1022
1023
1024/* Expand flags and related support */
1025GDK_AVAILABLE_IN_ALL
1026gboolean gtk_widget_get_hexpand (GtkWidget *widget);
1027GDK_AVAILABLE_IN_ALL
1028void gtk_widget_set_hexpand (GtkWidget *widget,
1029 gboolean expand);
1030GDK_AVAILABLE_IN_ALL
1031gboolean gtk_widget_get_hexpand_set (GtkWidget *widget);
1032GDK_AVAILABLE_IN_ALL
1033void gtk_widget_set_hexpand_set (GtkWidget *widget,
1034 gboolean set);
1035GDK_AVAILABLE_IN_ALL
1036gboolean gtk_widget_get_vexpand (GtkWidget *widget);
1037GDK_AVAILABLE_IN_ALL
1038void gtk_widget_set_vexpand (GtkWidget *widget,
1039 gboolean expand);
1040GDK_AVAILABLE_IN_ALL
1041gboolean gtk_widget_get_vexpand_set (GtkWidget *widget);
1042GDK_AVAILABLE_IN_ALL
1043void gtk_widget_set_vexpand_set (GtkWidget *widget,
1044 gboolean set);
1045GDK_AVAILABLE_IN_ALL
1046void gtk_widget_queue_compute_expand (GtkWidget *widget);
1047GDK_AVAILABLE_IN_ALL
1048gboolean gtk_widget_compute_expand (GtkWidget *widget,
1049 GtkOrientation orientation);
1050
1051
1052/* Multidevice support */
1053GDK_AVAILABLE_IN_ALL
1054gboolean gtk_widget_get_support_multidevice (GtkWidget *widget);
1055GDK_AVAILABLE_IN_ALL
1056void gtk_widget_set_support_multidevice (GtkWidget *widget,
1057 gboolean support_multidevice);
1058
1059/* Accessibility support */
1060GDK_AVAILABLE_IN_3_2
1061void gtk_widget_class_set_accessible_type (GtkWidgetClass *widget_class,
1062 GType type);
1063GDK_AVAILABLE_IN_3_2
1064void gtk_widget_class_set_accessible_role (GtkWidgetClass *widget_class,
1065 AtkRole role);
1066GDK_AVAILABLE_IN_ALL
1067AtkObject* gtk_widget_get_accessible (GtkWidget *widget);
1068
1069
1070/* Margin and alignment */
1071GDK_AVAILABLE_IN_ALL
1072GtkAlign gtk_widget_get_halign (GtkWidget *widget);
1073GDK_AVAILABLE_IN_ALL
1074void gtk_widget_set_halign (GtkWidget *widget,
1075 GtkAlign align);
1076GDK_AVAILABLE_IN_ALL
1077GtkAlign gtk_widget_get_valign (GtkWidget *widget);
1078GDK_AVAILABLE_IN_3_10
1079GtkAlign gtk_widget_get_valign_with_baseline (GtkWidget *widget);
1080GDK_AVAILABLE_IN_ALL
1081void gtk_widget_set_valign (GtkWidget *widget,
1082 GtkAlign align);
1083GDK_DEPRECATED_IN_3_12_FOR(gtk_widget_get_margin_start)
1084gint gtk_widget_get_margin_left (GtkWidget *widget);
1085GDK_DEPRECATED_IN_3_12_FOR(gtk_widget_set_margin_start)
1086void gtk_widget_set_margin_left (GtkWidget *widget,
1087 gint margin);
1088GDK_DEPRECATED_IN_3_12_FOR(gtk_widget_get_margin_end)
1089gint gtk_widget_get_margin_right (GtkWidget *widget);
1090GDK_DEPRECATED_IN_3_12_FOR(gtk_widget_set_margin_end)
1091void gtk_widget_set_margin_right (GtkWidget *widget,
1092 gint margin);
1093GDK_AVAILABLE_IN_3_12
1094gint gtk_widget_get_margin_start (GtkWidget *widget);
1095GDK_AVAILABLE_IN_3_12
1096void gtk_widget_set_margin_start (GtkWidget *widget,
1097 gint margin);
1098GDK_AVAILABLE_IN_3_12
1099gint gtk_widget_get_margin_end (GtkWidget *widget);
1100GDK_AVAILABLE_IN_3_12
1101void gtk_widget_set_margin_end (GtkWidget *widget,
1102 gint margin);
1103GDK_AVAILABLE_IN_ALL
1104gint gtk_widget_get_margin_top (GtkWidget *widget);
1105GDK_AVAILABLE_IN_ALL
1106void gtk_widget_set_margin_top (GtkWidget *widget,
1107 gint margin);
1108GDK_AVAILABLE_IN_ALL
1109gint gtk_widget_get_margin_bottom (GtkWidget *widget);
1110GDK_AVAILABLE_IN_ALL
1111void gtk_widget_set_margin_bottom (GtkWidget *widget,
1112 gint margin);
1113
1114
1115GDK_AVAILABLE_IN_ALL
1116gint gtk_widget_get_events (GtkWidget *widget);
1117GDK_AVAILABLE_IN_ALL
1118GdkEventMask gtk_widget_get_device_events (GtkWidget *widget,
1119 GdkDevice *device);
1120GDK_DEPRECATED_IN_3_4_FOR(gdk_window_get_device_position)
1121void gtk_widget_get_pointer (GtkWidget *widget,
1122 gint *x,
1123 gint *y);
1124
1125GDK_AVAILABLE_IN_ALL
1126gboolean gtk_widget_is_ancestor (GtkWidget *widget,
1127 GtkWidget *ancestor);
1128
1129GDK_AVAILABLE_IN_ALL
1130gboolean gtk_widget_translate_coordinates (GtkWidget *src_widget,
1131 GtkWidget *dest_widget,
1132 gint src_x,
1133 gint src_y,
1134 gint *dest_x,
1135 gint *dest_y);
1136
1137/* Hide widget and return TRUE.
1138 */
1139GDK_AVAILABLE_IN_ALL
1140gboolean gtk_widget_hide_on_delete (GtkWidget *widget);
1141
1142/* Functions to override widget styling */
1143GDK_DEPRECATED_IN_3_16
1144void gtk_widget_override_color (GtkWidget *widget,
1145 GtkStateFlags state,
1146 const GdkRGBA *color);
1147GDK_DEPRECATED_IN_3_16
1148void gtk_widget_override_background_color (GtkWidget *widget,
1149 GtkStateFlags state,
1150 const GdkRGBA *color);
1151
1152GDK_DEPRECATED_IN_3_16
1153void gtk_widget_override_font (GtkWidget *widget,
1154 const PangoFontDescription *font_desc);
1155
1156GDK_DEPRECATED_IN_3_16
1157void gtk_widget_override_symbolic_color (GtkWidget *widget,
1158 const gchar *name,
1159 const GdkRGBA *color);
1160GDK_DEPRECATED_IN_3_16
1161void gtk_widget_override_cursor (GtkWidget *widget,
1162 const GdkRGBA *cursor,
1163 const GdkRGBA *secondary_cursor);
1164
1165GDK_AVAILABLE_IN_ALL
1166void gtk_widget_reset_style (GtkWidget *widget);
1167
1168GDK_AVAILABLE_IN_ALL
1169PangoContext *gtk_widget_create_pango_context (GtkWidget *widget);
1170GDK_AVAILABLE_IN_ALL
1171PangoContext *gtk_widget_get_pango_context (GtkWidget *widget);
1172GDK_AVAILABLE_IN_3_18
1173void gtk_widget_set_font_options (GtkWidget *widget,
1174 const cairo_font_options_t *options);
1175GDK_AVAILABLE_IN_3_18
1176const cairo_font_options_t *gtk_widget_get_font_options (GtkWidget *widget);
1177GDK_AVAILABLE_IN_ALL
1178PangoLayout *gtk_widget_create_pango_layout (GtkWidget *widget,
1179 const gchar *text);
1180
1181GDK_DEPRECATED_IN_3_10_FOR(gtk_icon_theme_load_icon)
1182GdkPixbuf *gtk_widget_render_icon_pixbuf (GtkWidget *widget,
1183 const gchar *stock_id,
1184 GtkIconSize size);
1185
1186/* handle composite names for GTK_COMPOSITE_CHILD widgets,
1187 * the returned name is newly allocated.
1188 */
1189GDK_DEPRECATED_IN_3_10_FOR(gtk_widget_class_set_template)
1190void gtk_widget_set_composite_name (GtkWidget *widget,
1191 const gchar *name);
1192GDK_DEPRECATED_IN_3_10_FOR(gtk_widget_class_set_template)
1193gchar* gtk_widget_get_composite_name (GtkWidget *widget);
1194
1195/* Push/pop pairs, to change default values upon a widget's creation.
1196 * This will override the values that got set by the
1197 * gtk_widget_set_default_* () functions.
1198 */
1199GDK_DEPRECATED_IN_3_10_FOR(gtk_widget_class_set_template)
1200void gtk_widget_push_composite_child (void);
1201GDK_DEPRECATED_IN_3_10_FOR(gtk_widget_class_set_template)
1202void gtk_widget_pop_composite_child (void);
1203
1204/* widget style properties
1205 */
1206GDK_AVAILABLE_IN_ALL
1207void gtk_widget_class_install_style_property (GtkWidgetClass *klass,
1208 GParamSpec *pspec);
1209GDK_AVAILABLE_IN_ALL
1210void gtk_widget_class_install_style_property_parser (GtkWidgetClass *klass,
1211 GParamSpec *pspec,
1212 GtkRcPropertyParser parser);
1213GDK_AVAILABLE_IN_ALL
1214GParamSpec* gtk_widget_class_find_style_property (GtkWidgetClass *klass,
1215 const gchar *property_name);
1216GDK_AVAILABLE_IN_ALL
1217GParamSpec** gtk_widget_class_list_style_properties (GtkWidgetClass *klass,
1218 guint *n_properties);
1219GDK_AVAILABLE_IN_ALL
1220void gtk_widget_style_get_property (GtkWidget *widget,
1221 const gchar *property_name,
1222 GValue *value);
1223GDK_AVAILABLE_IN_ALL
1224void gtk_widget_style_get_valist (GtkWidget *widget,
1225 const gchar *first_property_name,
1226 va_list var_args);
1227GDK_AVAILABLE_IN_ALL
1228void gtk_widget_style_get (GtkWidget *widget,
1229 const gchar *first_property_name,
1230 ...) G_GNUC_NULL_TERMINATED;
1231
1232/* Functions for setting directionality for widgets */
1233
1234GDK_AVAILABLE_IN_ALL
1235void gtk_widget_set_direction (GtkWidget *widget,
1236 GtkTextDirection dir);
1237GDK_AVAILABLE_IN_ALL
1238GtkTextDirection gtk_widget_get_direction (GtkWidget *widget);
1239
1240GDK_AVAILABLE_IN_ALL
1241void gtk_widget_set_default_direction (GtkTextDirection dir);
1242GDK_AVAILABLE_IN_ALL
1243GtkTextDirection gtk_widget_get_default_direction (void);
1244
1245/* Compositing manager functionality */
1246GDK_AVAILABLE_IN_ALL
1247gboolean gtk_widget_is_composited (GtkWidget *widget);
1248
1249/* Counterpart to gdk_window_shape_combine_region.
1250 */
1251GDK_AVAILABLE_IN_ALL
1252void gtk_widget_shape_combine_region (GtkWidget *widget,
1253 cairo_region_t *region);
1254GDK_AVAILABLE_IN_ALL
1255void gtk_widget_input_shape_combine_region (GtkWidget *widget,
1256 cairo_region_t *region);
1257
1258GDK_AVAILABLE_IN_ALL
1259GList* gtk_widget_list_mnemonic_labels (GtkWidget *widget);
1260GDK_AVAILABLE_IN_ALL
1261void gtk_widget_add_mnemonic_label (GtkWidget *widget,
1262 GtkWidget *label);
1263GDK_AVAILABLE_IN_ALL
1264void gtk_widget_remove_mnemonic_label (GtkWidget *widget,
1265 GtkWidget *label);
1266
1267GDK_AVAILABLE_IN_ALL
1268void gtk_widget_set_tooltip_window (GtkWidget *widget,
1269 GtkWindow *custom_window);
1270GDK_AVAILABLE_IN_ALL
1271GtkWindow *gtk_widget_get_tooltip_window (GtkWidget *widget);
1272GDK_AVAILABLE_IN_ALL
1273void gtk_widget_trigger_tooltip_query (GtkWidget *widget);
1274GDK_AVAILABLE_IN_ALL
1275void gtk_widget_set_tooltip_text (GtkWidget *widget,
1276 const gchar *text);
1277GDK_AVAILABLE_IN_ALL
1278gchar * gtk_widget_get_tooltip_text (GtkWidget *widget);
1279GDK_AVAILABLE_IN_ALL
1280void gtk_widget_set_tooltip_markup (GtkWidget *widget,
1281 const gchar *markup);
1282GDK_AVAILABLE_IN_ALL
1283gchar * gtk_widget_get_tooltip_markup (GtkWidget *widget);
1284GDK_AVAILABLE_IN_ALL
1285void gtk_widget_set_has_tooltip (GtkWidget *widget,
1286 gboolean has_tooltip);
1287GDK_AVAILABLE_IN_ALL
1288gboolean gtk_widget_get_has_tooltip (GtkWidget *widget);
1289
1290GDK_AVAILABLE_IN_ALL
1291gboolean gtk_cairo_should_draw_window (cairo_t *cr,
1292 GdkWindow *window);
1293GDK_AVAILABLE_IN_ALL
1294void gtk_cairo_transform_to_window (cairo_t *cr,
1295 GtkWidget *widget,
1296 GdkWindow *window);
1297
1298GDK_AVAILABLE_IN_ALL
1299GType gtk_requisition_get_type (void) G_GNUC_CONST;
1300GDK_AVAILABLE_IN_ALL
1301GtkRequisition *gtk_requisition_new (void) G_GNUC_MALLOC;
1302GDK_AVAILABLE_IN_ALL
1303GtkRequisition *gtk_requisition_copy (const GtkRequisition *requisition);
1304GDK_AVAILABLE_IN_ALL
1305void gtk_requisition_free (GtkRequisition *requisition);
1306
1307GDK_AVAILABLE_IN_ALL
1308gboolean gtk_widget_in_destruction (GtkWidget *widget);
1309
1310GDK_AVAILABLE_IN_ALL
1311GtkStyleContext * gtk_widget_get_style_context (GtkWidget *widget);
1312
1313GDK_AVAILABLE_IN_ALL
1314GtkWidgetPath * gtk_widget_get_path (GtkWidget *widget);
1315
1316GDK_AVAILABLE_IN_3_20
1317void gtk_widget_class_set_css_name (GtkWidgetClass *widget_class,
1318 const char *name);
1319GDK_AVAILABLE_IN_3_20
1320const char * gtk_widget_class_get_css_name (GtkWidgetClass *widget_class);
1321
1322GDK_AVAILABLE_IN_3_4
1323GdkModifierType gtk_widget_get_modifier_mask (GtkWidget *widget,
1324 GdkModifierIntent intent);
1325
1326GDK_AVAILABLE_IN_3_6
1327void gtk_widget_insert_action_group (GtkWidget *widget,
1328 const gchar *name,
1329 GActionGroup *group);
1330
1331
1332
1333GDK_AVAILABLE_IN_3_8
1334guint gtk_widget_add_tick_callback (GtkWidget *widget,
1335 GtkTickCallback callback,
1336 gpointer user_data,
1337 GDestroyNotify notify);
1338
1339GDK_AVAILABLE_IN_3_8
1340void gtk_widget_remove_tick_callback (GtkWidget *widget,
1341 guint id);
1342
1343/**
1344 * gtk_widget_class_bind_template_callback:
1345 * @widget_class: a #GtkWidgetClass
1346 * @callback: the callback symbol
1347 *
1348 * Binds a callback function defined in a template to the @widget_class.
1349 *
1350 * This macro is a convenience wrapper around the
1351 * gtk_widget_class_bind_template_callback_full() function.
1352 *
1353 * Since: 3.10
1354 */
1355#define gtk_widget_class_bind_template_callback(widget_class, callback) \
1356 gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (widget_class), \
1357 #callback, \
1358 G_CALLBACK (callback))
1359
1360/**
1361 * gtk_widget_class_bind_template_child:
1362 * @widget_class: a #GtkWidgetClass
1363 * @TypeName: the type name of this widget
1364 * @member_name: name of the instance member in the instance struct for @data_type
1365 *
1366 * Binds a child widget defined in a template to the @widget_class.
1367 *
1368 * This macro is a convenience wrapper around the
1369 * gtk_widget_class_bind_template_child_full() function.
1370 *
1371 * This macro will use the offset of the @member_name inside the @TypeName
1372 * instance structure.
1373 *
1374 * Since: 3.10
1375 */
1376#define gtk_widget_class_bind_template_child(widget_class, TypeName, member_name) \
1377 gtk_widget_class_bind_template_child_full (widget_class, \
1378 #member_name, \
1379 FALSE, \
1380 G_STRUCT_OFFSET (TypeName, member_name))
1381
1382/**
1383 * gtk_widget_class_bind_template_child_internal:
1384 * @widget_class: a #GtkWidgetClass
1385 * @TypeName: the type name, in CamelCase
1386 * @member_name: name of the instance member in the instance struct for @data_type
1387 *
1388 * Binds a child widget defined in a template to the @widget_class, and
1389 * also makes it available as an internal child in GtkBuilder, under the
1390 * name @member_name.
1391 *
1392 * This macro is a convenience wrapper around the
1393 * gtk_widget_class_bind_template_child_full() function.
1394 *
1395 * This macro will use the offset of the @member_name inside the @TypeName
1396 * instance structure.
1397 *
1398 * Since: 3.10
1399 */
1400#define gtk_widget_class_bind_template_child_internal(widget_class, TypeName, member_name) \
1401 gtk_widget_class_bind_template_child_full (widget_class, \
1402 #member_name, \
1403 TRUE, \
1404 G_STRUCT_OFFSET (TypeName, member_name))
1405
1406/**
1407 * gtk_widget_class_bind_template_child_private:
1408 * @widget_class: a #GtkWidgetClass
1409 * @TypeName: the type name of this widget
1410 * @member_name: name of the instance private member in the private struct for @data_type
1411 *
1412 * Binds a child widget defined in a template to the @widget_class.
1413 *
1414 * This macro is a convenience wrapper around the
1415 * gtk_widget_class_bind_template_child_full() function.
1416 *
1417 * This macro will use the offset of the @member_name inside the @TypeName
1418 * private data structure (it uses G_PRIVATE_OFFSET(), so the private struct
1419 * must be added with G_ADD_PRIVATE()).
1420 *
1421 * Since: 3.10
1422 */
1423#define gtk_widget_class_bind_template_child_private(widget_class, TypeName, member_name) \
1424 gtk_widget_class_bind_template_child_full (widget_class, \
1425 #member_name, \
1426 FALSE, \
1427 G_PRIVATE_OFFSET (TypeName, member_name))
1428
1429/**
1430 * gtk_widget_class_bind_template_child_internal_private:
1431 * @widget_class: a #GtkWidgetClass
1432 * @TypeName: the type name, in CamelCase
1433 * @member_name: name of the instance private member on the private struct for @data_type
1434 *
1435 * Binds a child widget defined in a template to the @widget_class, and
1436 * also makes it available as an internal child in GtkBuilder, under the
1437 * name @member_name.
1438 *
1439 * This macro is a convenience wrapper around the
1440 * gtk_widget_class_bind_template_child_full() function.
1441 *
1442 * This macro will use the offset of the @member_name inside the @TypeName
1443 * private data structure.
1444 *
1445 * Since: 3.10
1446 */
1447#define gtk_widget_class_bind_template_child_internal_private(widget_class, TypeName, member_name) \
1448 gtk_widget_class_bind_template_child_full (widget_class, \
1449 #member_name, \
1450 TRUE, \
1451 G_PRIVATE_OFFSET (TypeName, member_name))
1452
1453GDK_AVAILABLE_IN_3_10
1454void gtk_widget_init_template (GtkWidget *widget);
1455GDK_AVAILABLE_IN_3_10
1456GObject *gtk_widget_get_template_child (GtkWidget *widget,
1457 GType widget_type,
1458 const gchar *name);
1459GDK_AVAILABLE_IN_3_10
1460void gtk_widget_class_set_template (GtkWidgetClass *widget_class,
1461 GBytes *template_bytes);
1462GDK_AVAILABLE_IN_3_10
1463void gtk_widget_class_set_template_from_resource (GtkWidgetClass *widget_class,
1464 const gchar *resource_name);
1465GDK_AVAILABLE_IN_3_10
1466void gtk_widget_class_bind_template_callback_full (GtkWidgetClass *widget_class,
1467 const gchar *callback_name,
1468 GCallback callback_symbol);
1469GDK_AVAILABLE_IN_3_10
1470void gtk_widget_class_set_connect_func (GtkWidgetClass *widget_class,
1471 GtkBuilderConnectFunc connect_func,
1472 gpointer connect_data,
1473 GDestroyNotify connect_data_destroy);
1474GDK_AVAILABLE_IN_3_10
1475void gtk_widget_class_bind_template_child_full (GtkWidgetClass *widget_class,
1476 const gchar *name,
1477 gboolean internal_child,
1478 gssize struct_offset);
1479
1480GDK_AVAILABLE_IN_3_16
1481GActionGroup *gtk_widget_get_action_group (GtkWidget *widget,
1482 const gchar *prefix);
1483
1484GDK_AVAILABLE_IN_3_16
1485const gchar ** gtk_widget_list_action_prefixes (GtkWidget *widget);
1486
1487GDK_AVAILABLE_IN_3_18
1488void gtk_widget_set_font_map (GtkWidget *widget,
1489 PangoFontMap *font_map);
1490GDK_AVAILABLE_IN_3_18
1491PangoFontMap * gtk_widget_get_font_map (GtkWidget *widget);
1492
1493G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkWidget, g_object_unref)
1494G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRequisition, gtk_requisition_free)
1495
1496G_END_DECLS
1497
1498#endif /* __GTK_WIDGET_H__ */
1499