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 <gsk/gsk.h> |
34 | #include <gtk/gtkaccelgroup.h> |
35 | #include <gtk/gtkborder.h> |
36 | #include <gtk/gtkshortcut.h> |
37 | #include <gtk/gtkshortcutaction.h> |
38 | #include <gtk/gtktypes.h> |
39 | |
40 | G_BEGIN_DECLS |
41 | |
42 | /* Macro for casting a pointer to a GtkWidget or GtkWidgetClass pointer. |
43 | * Macros for testing whether widget or klass are of type GTK_TYPE_WIDGET. |
44 | */ |
45 | #define GTK_TYPE_WIDGET (gtk_widget_get_type ()) |
46 | #define GTK_WIDGET(widget) (G_TYPE_CHECK_INSTANCE_CAST ((widget), GTK_TYPE_WIDGET, GtkWidget)) |
47 | #define GTK_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_WIDGET, GtkWidgetClass)) |
48 | #define GTK_IS_WIDGET(widget) (G_TYPE_CHECK_INSTANCE_TYPE ((widget), GTK_TYPE_WIDGET)) |
49 | #define GTK_IS_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_WIDGET)) |
50 | #define GTK_WIDGET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_WIDGET, GtkWidgetClass)) |
51 | |
52 | #define GTK_TYPE_REQUISITION (gtk_requisition_get_type ()) |
53 | |
54 | typedef struct _GtkWidgetPrivate GtkWidgetPrivate; |
55 | typedef struct _GtkWidgetClass GtkWidgetClass; |
56 | typedef struct _GtkWidgetClassPrivate GtkWidgetClassPrivate; |
57 | |
58 | /** |
59 | * GtkAllocation: |
60 | * @x: the X position of the widget’s area relative to its parents allocation. |
61 | * @y: the Y position of the widget’s area relative to its parents allocation. |
62 | * @width: the width of the widget’s allocated area. |
63 | * @height: the height of the widget’s allocated area. |
64 | * |
65 | * The rectangle representing the area allocated for a widget by its parent. |
66 | */ |
67 | typedef GdkRectangle GtkAllocation; |
68 | |
69 | /** |
70 | * GtkTickCallback: |
71 | * @widget: the widget |
72 | * @frame_clock: the frame clock for the widget (same as calling gtk_widget_get_frame_clock()) |
73 | * @user_data: user data passed to gtk_widget_add_tick_callback(). |
74 | * |
75 | * Callback type for adding a function to update animations. See gtk_widget_add_tick_callback(). |
76 | * |
77 | * Returns: %G_SOURCE_CONTINUE if the tick callback should continue to be called, |
78 | * %G_SOURCE_REMOVE if the tick callback should be removed. |
79 | */ |
80 | typedef gboolean (*GtkTickCallback) (GtkWidget *widget, |
81 | GdkFrameClock *frame_clock, |
82 | gpointer user_data); |
83 | |
84 | /** |
85 | * GtkRequisition: |
86 | * @width: the widget’s desired width |
87 | * @height: the widget’s desired height |
88 | * |
89 | * A `GtkRequisition` represents the desired size of a widget. See |
90 | * [GtkWidget’s geometry management section](class.Widget.html#height-for-width-geometry-management) for |
91 | * more information. |
92 | */ |
93 | struct _GtkRequisition |
94 | { |
95 | int width; |
96 | int height; |
97 | }; |
98 | |
99 | /* The widget is the base of the tree for displayable objects. |
100 | * (A displayable object is one which takes up some amount |
101 | * of screen real estate). It provides a common base and interface |
102 | * which actual widgets must adhere to. |
103 | */ |
104 | struct _GtkWidget |
105 | { |
106 | GInitiallyUnowned parent_instance; |
107 | |
108 | /*< private >*/ |
109 | |
110 | GtkWidgetPrivate *priv; |
111 | }; |
112 | |
113 | /** |
114 | * GtkWidgetClass: |
115 | * @parent_class: The object class structure needs to be the first |
116 | * element in the widget class structure in order for the class mechanism |
117 | * to work correctly. This allows a GtkWidgetClass pointer to be cast to |
118 | * a GObjectClass pointer. |
119 | * @show: Signal emitted when widget is shown |
120 | * @hide: Signal emitted when widget is hidden. |
121 | * @map: Signal emitted when widget is going to be mapped, that is |
122 | * when the widget is visible (which is controlled with |
123 | * gtk_widget_set_visible()) and all its parents up to the toplevel |
124 | * widget are also visible. |
125 | * @unmap: Signal emitted when widget is going to be unmapped, which |
126 | * means that either it or any of its parents up to the toplevel |
127 | * widget have been set as hidden. |
128 | * @realize: Signal emitted when widget is associated with a |
129 | * `GdkSurface`, which means that gtk_widget_realize() has been called or |
130 | * the widget has been mapped (that is, it is going to be drawn). |
131 | * @unrealize: Signal emitted when the GdkSurface associated with |
132 | * widget is destroyed, which means that gtk_widget_unrealize() has |
133 | * been called or the widget has been unmapped (that is, it is going |
134 | * to be hidden). |
135 | * @root: Called when the widget gets added to a `GtkRoot` widget. Must |
136 | * chain up |
137 | * @unroot: Called when the widget is about to be removed from its |
138 | * `GtkRoot` widget. Must chain up |
139 | * @size_allocate: Called to set the allocation, if the widget does |
140 | * not have a layout manager. |
141 | * @state_flags_changed: Signal emitted when the widget state changes, |
142 | * see gtk_widget_get_state_flags(). |
143 | * @direction_changed: Signal emitted when the text direction of a |
144 | * widget changes. |
145 | * @get_request_mode: Called to get the request mode, if the widget |
146 | * does not have a layout manager. |
147 | * This allows a widget to tell its parent container whether |
148 | * it prefers to be allocated in %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH or |
149 | * %GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT mode. |
150 | * %GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH means the widget prefers to have |
151 | * `GtkWidgetClass.measure()` called first to get the default width (passing |
152 | * a for_size of -1), then again to get the height for said default width. |
153 | * %GTK_SIZE_REQUEST_CONSTANT_SIZE disables any height-for-width or |
154 | * width-for-height geometry management for said widget and is the |
155 | * default return. |
156 | * It’s important to note that any widget |
157 | * which trades height-for-width or width-for-height must respond properly |
158 | * to a for_size value >= -1 passed to `GtkWidgetClass.measure`, for both |
159 | * possible orientations. |
160 | * @measure: Called to obtain the minimum and natural size of the widget, |
161 | * if the widget does not have a layout manager. |
162 | * Depending on the orientation parameter, the passed for_size can be |
163 | * interpreted as width or height. A widget will never be allocated less |
164 | * than its minimum size. |
165 | * @mnemonic_activate: Activates the @widget if @group_cycling is |
166 | * %FALSE, and just grabs the focus if @group_cycling is %TRUE. |
167 | * @grab_focus: Causes @widget to have the keyboard focus for the |
168 | * `GtkWindow` it’s inside. |
169 | * @focus: Vfunc for gtk_widget_child_focus() |
170 | * @set_focus_child: Sets the focused child of a widget. Must chain up |
171 | * @move_focus: Signal emitted when a change of focus is requested |
172 | * @keynav_failed: Signal emitted if keyboard navigation fails. |
173 | * @query_tooltip: Signal emitted when “has-tooltip” is %TRUE and the |
174 | * hover timeout has expired with the cursor hovering “above” |
175 | * widget; or emitted when widget got focus in keyboard mode. |
176 | * @compute_expand: Computes whether a container should give this |
177 | * widget extra space when possible. |
178 | * @css_changed: Vfunc called when the CSS used by widget was changed. Widgets |
179 | * should then discard their caches that depend on CSS and queue resizes or |
180 | * redraws accordingly. The default implementation will take care of this for |
181 | * all the default CSS properties, so implementations must chain up. |
182 | * @system_setting_changed: Emitted when a system setting was changed. Must chain up. |
183 | * @snapshot: Vfunc called when a new snapshot of the widget has to be taken. |
184 | * @contains: Vfunc for gtk_widget_contains(). |
185 | */ |
186 | struct _GtkWidgetClass |
187 | { |
188 | GInitiallyUnownedClass parent_class; |
189 | |
190 | /*< public >*/ |
191 | |
192 | /* basics */ |
193 | void (* show) (GtkWidget *widget); |
194 | void (* hide) (GtkWidget *widget); |
195 | void (* map) (GtkWidget *widget); |
196 | void (* unmap) (GtkWidget *widget); |
197 | void (* realize) (GtkWidget *widget); |
198 | void (* unrealize) (GtkWidget *widget); |
199 | void (* root) (GtkWidget *widget); |
200 | void (* unroot) (GtkWidget *widget); |
201 | void (* size_allocate) (GtkWidget *widget, |
202 | int width, |
203 | int height, |
204 | int baseline); |
205 | void (* state_flags_changed) (GtkWidget *widget, |
206 | GtkStateFlags previous_state_flags); |
207 | void (* direction_changed) (GtkWidget *widget, |
208 | GtkTextDirection previous_direction); |
209 | |
210 | /* size requests */ |
211 | GtkSizeRequestMode (* get_request_mode) (GtkWidget *widget); |
212 | void (* measure) (GtkWidget *widget, |
213 | GtkOrientation orientation, |
214 | int for_size, |
215 | int *minimum, |
216 | int *natural, |
217 | int *minimum_baseline, |
218 | int *natural_baseline); |
219 | |
220 | /* Mnemonics */ |
221 | gboolean (* mnemonic_activate) (GtkWidget *widget, |
222 | gboolean group_cycling); |
223 | |
224 | /* explicit focus */ |
225 | gboolean (* grab_focus) (GtkWidget *widget); |
226 | gboolean (* focus) (GtkWidget *widget, |
227 | GtkDirectionType direction); |
228 | void (* set_focus_child) (GtkWidget *widget, |
229 | GtkWidget *child); |
230 | |
231 | /* keyboard navigation */ |
232 | void (* move_focus) (GtkWidget *widget, |
233 | GtkDirectionType direction); |
234 | gboolean (* keynav_failed) (GtkWidget *widget, |
235 | GtkDirectionType direction); |
236 | |
237 | gboolean (* query_tooltip) (GtkWidget *widget, |
238 | int x, |
239 | int y, |
240 | gboolean keyboard_tooltip, |
241 | GtkTooltip *tooltip); |
242 | |
243 | void (* compute_expand) (GtkWidget *widget, |
244 | gboolean *hexpand_p, |
245 | gboolean *vexpand_p); |
246 | |
247 | void (* css_changed) (GtkWidget *widget, |
248 | GtkCssStyleChange *change); |
249 | |
250 | void (* system_setting_changed) (GtkWidget *widget, |
251 | GtkSystemSetting settings); |
252 | |
253 | void (* snapshot) (GtkWidget *widget, |
254 | GtkSnapshot *snapshot); |
255 | |
256 | gboolean (* contains) (GtkWidget *widget, |
257 | double x, |
258 | double y); |
259 | |
260 | /*< private >*/ |
261 | |
262 | GtkWidgetClassPrivate *priv; |
263 | |
264 | gpointer padding[8]; |
265 | }; |
266 | |
267 | |
268 | GDK_AVAILABLE_IN_ALL |
269 | GType gtk_widget_get_type (void) G_GNUC_CONST; |
270 | GDK_AVAILABLE_IN_ALL |
271 | void gtk_widget_unparent (GtkWidget *widget); |
272 | GDK_AVAILABLE_IN_ALL |
273 | void gtk_widget_show (GtkWidget *widget); |
274 | GDK_AVAILABLE_IN_ALL |
275 | void gtk_widget_hide (GtkWidget *widget); |
276 | GDK_AVAILABLE_IN_ALL |
277 | void gtk_widget_map (GtkWidget *widget); |
278 | GDK_AVAILABLE_IN_ALL |
279 | void gtk_widget_unmap (GtkWidget *widget); |
280 | GDK_AVAILABLE_IN_ALL |
281 | void gtk_widget_realize (GtkWidget *widget); |
282 | GDK_AVAILABLE_IN_ALL |
283 | void gtk_widget_unrealize (GtkWidget *widget); |
284 | |
285 | /* Queuing draws */ |
286 | GDK_AVAILABLE_IN_ALL |
287 | void gtk_widget_queue_draw (GtkWidget *widget); |
288 | GDK_AVAILABLE_IN_ALL |
289 | void gtk_widget_queue_resize (GtkWidget *widget); |
290 | GDK_AVAILABLE_IN_ALL |
291 | void gtk_widget_queue_allocate (GtkWidget *widget); |
292 | GDK_AVAILABLE_IN_ALL |
293 | GdkFrameClock* gtk_widget_get_frame_clock (GtkWidget *widget); |
294 | |
295 | GDK_AVAILABLE_IN_ALL |
296 | void gtk_widget_size_allocate (GtkWidget *widget, |
297 | const GtkAllocation *allocation, |
298 | int baseline); |
299 | GDK_AVAILABLE_IN_ALL |
300 | void gtk_widget_allocate (GtkWidget *widget, |
301 | int width, |
302 | int height, |
303 | int baseline, |
304 | GskTransform *transform); |
305 | |
306 | GDK_AVAILABLE_IN_ALL |
307 | GtkSizeRequestMode gtk_widget_get_request_mode (GtkWidget *widget); |
308 | GDK_AVAILABLE_IN_ALL |
309 | void gtk_widget_measure (GtkWidget *widget, |
310 | GtkOrientation orientation, |
311 | int for_size, |
312 | int *minimum, |
313 | int *natural, |
314 | int *minimum_baseline, |
315 | int *natural_baseline); |
316 | GDK_AVAILABLE_IN_ALL |
317 | void gtk_widget_get_preferred_size (GtkWidget *widget, |
318 | GtkRequisition *minimum_size, |
319 | GtkRequisition *natural_size); |
320 | |
321 | GDK_AVAILABLE_IN_ALL |
322 | void gtk_widget_set_layout_manager (GtkWidget *widget, |
323 | GtkLayoutManager *layout_manager); |
324 | GDK_AVAILABLE_IN_ALL |
325 | GtkLayoutManager * gtk_widget_get_layout_manager (GtkWidget *widget); |
326 | |
327 | GDK_AVAILABLE_IN_ALL |
328 | void gtk_widget_class_set_layout_manager_type (GtkWidgetClass *widget_class, |
329 | GType type); |
330 | GDK_AVAILABLE_IN_ALL |
331 | GType gtk_widget_class_get_layout_manager_type (GtkWidgetClass *widget_class); |
332 | |
333 | GDK_AVAILABLE_IN_ALL |
334 | void gtk_widget_class_add_binding (GtkWidgetClass *widget_class, |
335 | guint keyval, |
336 | GdkModifierType mods, |
337 | GtkShortcutFunc callback, |
338 | const char *format_string, |
339 | ...); |
340 | GDK_AVAILABLE_IN_ALL |
341 | void gtk_widget_class_add_binding_signal |
342 | (GtkWidgetClass *widget_class, |
343 | guint keyval, |
344 | GdkModifierType mods, |
345 | const char *signal, |
346 | const char *format_string, |
347 | ...); |
348 | GDK_AVAILABLE_IN_ALL |
349 | void gtk_widget_class_add_binding_action |
350 | (GtkWidgetClass *widget_class, |
351 | guint keyval, |
352 | GdkModifierType mods, |
353 | const char *action_name, |
354 | const char *format_string, |
355 | ...); |
356 | GDK_AVAILABLE_IN_ALL |
357 | void gtk_widget_class_add_shortcut (GtkWidgetClass *widget_class, |
358 | GtkShortcut *shortcut); |
359 | |
360 | GDK_AVAILABLE_IN_ALL |
361 | void gtk_widget_class_set_activate_signal (GtkWidgetClass *widget_class, |
362 | guint signal_id); |
363 | GDK_AVAILABLE_IN_ALL |
364 | void gtk_widget_class_set_activate_signal_from_name (GtkWidgetClass *widget_class, |
365 | const char *signal_name); |
366 | GDK_AVAILABLE_IN_ALL |
367 | guint gtk_widget_class_get_activate_signal (GtkWidgetClass *widget_class); |
368 | |
369 | GDK_AVAILABLE_IN_ALL |
370 | gboolean gtk_widget_mnemonic_activate (GtkWidget *widget, |
371 | gboolean group_cycling); |
372 | GDK_AVAILABLE_IN_ALL |
373 | gboolean gtk_widget_activate (GtkWidget *widget); |
374 | |
375 | GDK_AVAILABLE_IN_ALL |
376 | void gtk_widget_set_can_focus (GtkWidget *widget, |
377 | gboolean can_focus); |
378 | GDK_AVAILABLE_IN_ALL |
379 | gboolean gtk_widget_get_can_focus (GtkWidget *widget); |
380 | GDK_AVAILABLE_IN_ALL |
381 | void gtk_widget_set_focusable (GtkWidget *widget, |
382 | gboolean focusable); |
383 | GDK_AVAILABLE_IN_ALL |
384 | gboolean gtk_widget_get_focusable (GtkWidget *widget); |
385 | GDK_AVAILABLE_IN_ALL |
386 | gboolean gtk_widget_has_focus (GtkWidget *widget); |
387 | GDK_AVAILABLE_IN_ALL |
388 | gboolean gtk_widget_is_focus (GtkWidget *widget); |
389 | GDK_AVAILABLE_IN_ALL |
390 | gboolean gtk_widget_has_visible_focus (GtkWidget *widget); |
391 | GDK_AVAILABLE_IN_ALL |
392 | gboolean gtk_widget_grab_focus (GtkWidget *widget); |
393 | GDK_AVAILABLE_IN_ALL |
394 | void gtk_widget_set_focus_on_click (GtkWidget *widget, |
395 | gboolean focus_on_click); |
396 | GDK_AVAILABLE_IN_ALL |
397 | gboolean gtk_widget_get_focus_on_click (GtkWidget *widget); |
398 | |
399 | GDK_AVAILABLE_IN_ALL |
400 | void gtk_widget_set_can_target (GtkWidget *widget, |
401 | gboolean can_target); |
402 | GDK_AVAILABLE_IN_ALL |
403 | gboolean gtk_widget_get_can_target (GtkWidget *widget); |
404 | |
405 | GDK_AVAILABLE_IN_ALL |
406 | gboolean gtk_widget_has_default (GtkWidget *widget); |
407 | |
408 | GDK_AVAILABLE_IN_ALL |
409 | void gtk_widget_set_receives_default (GtkWidget *widget, |
410 | gboolean receives_default); |
411 | GDK_AVAILABLE_IN_ALL |
412 | gboolean gtk_widget_get_receives_default (GtkWidget *widget); |
413 | |
414 | |
415 | GDK_AVAILABLE_IN_ALL |
416 | void gtk_widget_set_name (GtkWidget *widget, |
417 | const char *name); |
418 | GDK_AVAILABLE_IN_ALL |
419 | const char * gtk_widget_get_name (GtkWidget *widget); |
420 | |
421 | |
422 | GDK_AVAILABLE_IN_ALL |
423 | void gtk_widget_set_state_flags (GtkWidget *widget, |
424 | GtkStateFlags flags, |
425 | gboolean clear); |
426 | GDK_AVAILABLE_IN_ALL |
427 | void gtk_widget_unset_state_flags (GtkWidget *widget, |
428 | GtkStateFlags flags); |
429 | GDK_AVAILABLE_IN_ALL |
430 | GtkStateFlags gtk_widget_get_state_flags (GtkWidget *widget); |
431 | |
432 | GDK_AVAILABLE_IN_ALL |
433 | void gtk_widget_set_sensitive (GtkWidget *widget, |
434 | gboolean sensitive); |
435 | GDK_AVAILABLE_IN_ALL |
436 | gboolean gtk_widget_get_sensitive (GtkWidget *widget); |
437 | GDK_AVAILABLE_IN_ALL |
438 | gboolean gtk_widget_is_sensitive (GtkWidget *widget); |
439 | |
440 | GDK_AVAILABLE_IN_ALL |
441 | void gtk_widget_set_visible (GtkWidget *widget, |
442 | gboolean visible); |
443 | GDK_AVAILABLE_IN_ALL |
444 | gboolean gtk_widget_get_visible (GtkWidget *widget); |
445 | GDK_AVAILABLE_IN_ALL |
446 | gboolean gtk_widget_is_visible (GtkWidget *widget); |
447 | |
448 | GDK_AVAILABLE_IN_ALL |
449 | gboolean gtk_widget_is_drawable (GtkWidget *widget); |
450 | GDK_AVAILABLE_IN_ALL |
451 | gboolean gtk_widget_get_realized (GtkWidget *widget); |
452 | GDK_AVAILABLE_IN_ALL |
453 | gboolean gtk_widget_get_mapped (GtkWidget *widget); |
454 | |
455 | GDK_AVAILABLE_IN_ALL |
456 | void gtk_widget_set_parent (GtkWidget *widget, |
457 | GtkWidget *parent); |
458 | GDK_AVAILABLE_IN_ALL |
459 | GtkWidget * gtk_widget_get_parent (GtkWidget *widget); |
460 | |
461 | GDK_AVAILABLE_IN_ALL |
462 | GtkRoot * gtk_widget_get_root (GtkWidget *widget); |
463 | |
464 | GDK_AVAILABLE_IN_ALL |
465 | GtkNative * gtk_widget_get_native (GtkWidget *widget); |
466 | |
467 | GDK_AVAILABLE_IN_ALL |
468 | void gtk_widget_set_child_visible (GtkWidget *widget, |
469 | gboolean child_visible); |
470 | GDK_AVAILABLE_IN_ALL |
471 | gboolean gtk_widget_get_child_visible (GtkWidget *widget); |
472 | |
473 | GDK_AVAILABLE_IN_ALL |
474 | int gtk_widget_get_allocated_width (GtkWidget *widget); |
475 | GDK_AVAILABLE_IN_ALL |
476 | int gtk_widget_get_allocated_height (GtkWidget *widget); |
477 | GDK_AVAILABLE_IN_ALL |
478 | int gtk_widget_get_allocated_baseline (GtkWidget *widget); |
479 | |
480 | GDK_AVAILABLE_IN_ALL |
481 | void gtk_widget_get_allocation (GtkWidget *widget, |
482 | GtkAllocation *allocation); |
483 | GDK_AVAILABLE_IN_ALL |
484 | gboolean gtk_widget_compute_transform (GtkWidget *widget, |
485 | GtkWidget *target, |
486 | graphene_matrix_t *out_transform) G_GNUC_WARN_UNUSED_RESULT; |
487 | GDK_AVAILABLE_IN_ALL |
488 | gboolean gtk_widget_compute_bounds (GtkWidget *widget, |
489 | GtkWidget *target, |
490 | graphene_rect_t *out_bounds) G_GNUC_WARN_UNUSED_RESULT; |
491 | GDK_AVAILABLE_IN_ALL |
492 | gboolean gtk_widget_compute_point (GtkWidget *widget, |
493 | GtkWidget *target, |
494 | const graphene_point_t *point, |
495 | graphene_point_t *out_point) G_GNUC_WARN_UNUSED_RESULT; |
496 | |
497 | GDK_AVAILABLE_IN_ALL |
498 | int gtk_widget_get_width (GtkWidget *widget); |
499 | GDK_AVAILABLE_IN_ALL |
500 | int gtk_widget_get_height (GtkWidget *widget); |
501 | GDK_AVAILABLE_IN_ALL |
502 | int gtk_widget_get_size (GtkWidget *widget, |
503 | GtkOrientation orientation); |
504 | |
505 | GDK_AVAILABLE_IN_ALL |
506 | gboolean gtk_widget_child_focus (GtkWidget *widget, |
507 | GtkDirectionType direction); |
508 | GDK_AVAILABLE_IN_ALL |
509 | gboolean gtk_widget_keynav_failed (GtkWidget *widget, |
510 | GtkDirectionType direction); |
511 | GDK_AVAILABLE_IN_ALL |
512 | void gtk_widget_error_bell (GtkWidget *widget); |
513 | |
514 | GDK_AVAILABLE_IN_ALL |
515 | void gtk_widget_set_size_request (GtkWidget *widget, |
516 | int width, |
517 | int height); |
518 | GDK_AVAILABLE_IN_ALL |
519 | void gtk_widget_get_size_request (GtkWidget *widget, |
520 | int *width, |
521 | int *height); |
522 | GDK_AVAILABLE_IN_ALL |
523 | void gtk_widget_set_opacity (GtkWidget *widget, |
524 | double opacity); |
525 | GDK_AVAILABLE_IN_ALL |
526 | double gtk_widget_get_opacity (GtkWidget *widget); |
527 | GDK_AVAILABLE_IN_ALL |
528 | void gtk_widget_set_overflow (GtkWidget *widget, |
529 | GtkOverflow overflow); |
530 | GDK_AVAILABLE_IN_ALL |
531 | GtkOverflow gtk_widget_get_overflow (GtkWidget *widget); |
532 | |
533 | GDK_AVAILABLE_IN_ALL |
534 | GtkWidget* gtk_widget_get_ancestor (GtkWidget *widget, |
535 | GType widget_type); |
536 | |
537 | GDK_AVAILABLE_IN_ALL |
538 | int gtk_widget_get_scale_factor (GtkWidget *widget); |
539 | GDK_AVAILABLE_IN_ALL |
540 | GdkDisplay * gtk_widget_get_display (GtkWidget *widget); |
541 | GDK_AVAILABLE_IN_ALL |
542 | GtkSettings* gtk_widget_get_settings (GtkWidget *widget); |
543 | GDK_AVAILABLE_IN_ALL |
544 | GdkClipboard *gtk_widget_get_clipboard (GtkWidget *widget); |
545 | GDK_AVAILABLE_IN_ALL |
546 | GdkClipboard *gtk_widget_get_primary_clipboard (GtkWidget *widget); |
547 | |
548 | |
549 | /* Expand flags and related support */ |
550 | GDK_AVAILABLE_IN_ALL |
551 | gboolean gtk_widget_get_hexpand (GtkWidget *widget); |
552 | GDK_AVAILABLE_IN_ALL |
553 | void gtk_widget_set_hexpand (GtkWidget *widget, |
554 | gboolean expand); |
555 | GDK_AVAILABLE_IN_ALL |
556 | gboolean gtk_widget_get_hexpand_set (GtkWidget *widget); |
557 | GDK_AVAILABLE_IN_ALL |
558 | void gtk_widget_set_hexpand_set (GtkWidget *widget, |
559 | gboolean set); |
560 | GDK_AVAILABLE_IN_ALL |
561 | gboolean gtk_widget_get_vexpand (GtkWidget *widget); |
562 | GDK_AVAILABLE_IN_ALL |
563 | void gtk_widget_set_vexpand (GtkWidget *widget, |
564 | gboolean expand); |
565 | GDK_AVAILABLE_IN_ALL |
566 | gboolean gtk_widget_get_vexpand_set (GtkWidget *widget); |
567 | GDK_AVAILABLE_IN_ALL |
568 | void gtk_widget_set_vexpand_set (GtkWidget *widget, |
569 | gboolean set); |
570 | GDK_AVAILABLE_IN_ALL |
571 | gboolean gtk_widget_compute_expand (GtkWidget *widget, |
572 | GtkOrientation orientation); |
573 | |
574 | /* Margin and alignment */ |
575 | GDK_AVAILABLE_IN_ALL |
576 | GtkAlign gtk_widget_get_halign (GtkWidget *widget); |
577 | GDK_AVAILABLE_IN_ALL |
578 | void gtk_widget_set_halign (GtkWidget *widget, |
579 | GtkAlign align); |
580 | GDK_AVAILABLE_IN_ALL |
581 | GtkAlign gtk_widget_get_valign (GtkWidget *widget); |
582 | GDK_AVAILABLE_IN_ALL |
583 | void gtk_widget_set_valign (GtkWidget *widget, |
584 | GtkAlign align); |
585 | GDK_AVAILABLE_IN_ALL |
586 | int gtk_widget_get_margin_start (GtkWidget *widget); |
587 | GDK_AVAILABLE_IN_ALL |
588 | void gtk_widget_set_margin_start (GtkWidget *widget, |
589 | int margin); |
590 | GDK_AVAILABLE_IN_ALL |
591 | int gtk_widget_get_margin_end (GtkWidget *widget); |
592 | GDK_AVAILABLE_IN_ALL |
593 | void gtk_widget_set_margin_end (GtkWidget *widget, |
594 | int margin); |
595 | GDK_AVAILABLE_IN_ALL |
596 | int gtk_widget_get_margin_top (GtkWidget *widget); |
597 | GDK_AVAILABLE_IN_ALL |
598 | void gtk_widget_set_margin_top (GtkWidget *widget, |
599 | int margin); |
600 | GDK_AVAILABLE_IN_ALL |
601 | int gtk_widget_get_margin_bottom (GtkWidget *widget); |
602 | GDK_AVAILABLE_IN_ALL |
603 | void gtk_widget_set_margin_bottom (GtkWidget *widget, |
604 | int margin); |
605 | |
606 | GDK_AVAILABLE_IN_ALL |
607 | gboolean gtk_widget_is_ancestor (GtkWidget *widget, |
608 | GtkWidget *ancestor); |
609 | |
610 | GDK_AVAILABLE_IN_ALL |
611 | gboolean gtk_widget_translate_coordinates (GtkWidget *src_widget, |
612 | GtkWidget *dest_widget, |
613 | double src_x, |
614 | double src_y, |
615 | double *dest_x, |
616 | double *dest_y); |
617 | |
618 | GDK_AVAILABLE_IN_ALL |
619 | gboolean gtk_widget_contains (GtkWidget *widget, |
620 | double x, |
621 | double y); |
622 | GDK_AVAILABLE_IN_ALL |
623 | GtkWidget * gtk_widget_pick (GtkWidget *widget, |
624 | double x, |
625 | double y, |
626 | GtkPickFlags flags); |
627 | |
628 | GDK_AVAILABLE_IN_ALL |
629 | void gtk_widget_add_controller (GtkWidget *widget, |
630 | GtkEventController *controller); |
631 | GDK_AVAILABLE_IN_ALL |
632 | void gtk_widget_remove_controller (GtkWidget *widget, |
633 | GtkEventController *controller); |
634 | |
635 | GDK_AVAILABLE_IN_ALL |
636 | PangoContext *gtk_widget_create_pango_context (GtkWidget *widget); |
637 | GDK_AVAILABLE_IN_ALL |
638 | PangoContext *gtk_widget_get_pango_context (GtkWidget *widget); |
639 | GDK_AVAILABLE_IN_ALL |
640 | void gtk_widget_set_font_options (GtkWidget *widget, |
641 | const cairo_font_options_t *options); |
642 | GDK_AVAILABLE_IN_ALL |
643 | const cairo_font_options_t *gtk_widget_get_font_options (GtkWidget *widget); |
644 | GDK_AVAILABLE_IN_ALL |
645 | PangoLayout *gtk_widget_create_pango_layout (GtkWidget *widget, |
646 | const char *text); |
647 | |
648 | /* Functions for setting directionality for widgets */ |
649 | |
650 | GDK_AVAILABLE_IN_ALL |
651 | void gtk_widget_set_direction (GtkWidget *widget, |
652 | GtkTextDirection dir); |
653 | GDK_AVAILABLE_IN_ALL |
654 | GtkTextDirection gtk_widget_get_direction (GtkWidget *widget); |
655 | |
656 | GDK_AVAILABLE_IN_ALL |
657 | void gtk_widget_set_default_direction (GtkTextDirection dir); |
658 | GDK_AVAILABLE_IN_ALL |
659 | GtkTextDirection gtk_widget_get_default_direction (void); |
660 | |
661 | GDK_AVAILABLE_IN_ALL |
662 | void gtk_widget_set_cursor (GtkWidget *widget, |
663 | GdkCursor *cursor); |
664 | GDK_AVAILABLE_IN_ALL |
665 | void gtk_widget_set_cursor_from_name (GtkWidget *widget, |
666 | const char *name); |
667 | GDK_AVAILABLE_IN_ALL |
668 | GdkCursor * gtk_widget_get_cursor (GtkWidget *widget); |
669 | |
670 | GDK_AVAILABLE_IN_ALL |
671 | GList* gtk_widget_list_mnemonic_labels (GtkWidget *widget); |
672 | GDK_AVAILABLE_IN_ALL |
673 | void gtk_widget_add_mnemonic_label (GtkWidget *widget, |
674 | GtkWidget *label); |
675 | GDK_AVAILABLE_IN_ALL |
676 | void gtk_widget_remove_mnemonic_label (GtkWidget *widget, |
677 | GtkWidget *label); |
678 | |
679 | GDK_AVAILABLE_IN_ALL |
680 | void gtk_widget_trigger_tooltip_query (GtkWidget *widget); |
681 | GDK_AVAILABLE_IN_ALL |
682 | void gtk_widget_set_tooltip_text (GtkWidget *widget, |
683 | const char *text); |
684 | GDK_AVAILABLE_IN_ALL |
685 | const char * gtk_widget_get_tooltip_text (GtkWidget *widget); |
686 | GDK_AVAILABLE_IN_ALL |
687 | void gtk_widget_set_tooltip_markup (GtkWidget *widget, |
688 | const char *markup); |
689 | GDK_AVAILABLE_IN_ALL |
690 | const char * gtk_widget_get_tooltip_markup (GtkWidget *widget); |
691 | GDK_AVAILABLE_IN_ALL |
692 | void gtk_widget_set_has_tooltip (GtkWidget *widget, |
693 | gboolean has_tooltip); |
694 | GDK_AVAILABLE_IN_ALL |
695 | gboolean gtk_widget_get_has_tooltip (GtkWidget *widget); |
696 | |
697 | GDK_AVAILABLE_IN_ALL |
698 | GType gtk_requisition_get_type (void) G_GNUC_CONST; |
699 | GDK_AVAILABLE_IN_ALL |
700 | GtkRequisition *gtk_requisition_new (void) G_GNUC_MALLOC; |
701 | GDK_AVAILABLE_IN_ALL |
702 | GtkRequisition *gtk_requisition_copy (const GtkRequisition *requisition); |
703 | GDK_AVAILABLE_IN_ALL |
704 | void gtk_requisition_free (GtkRequisition *requisition); |
705 | |
706 | GDK_AVAILABLE_IN_ALL |
707 | gboolean gtk_widget_in_destruction (GtkWidget *widget); |
708 | |
709 | GDK_AVAILABLE_IN_ALL |
710 | GtkStyleContext * gtk_widget_get_style_context (GtkWidget *widget); |
711 | |
712 | GDK_AVAILABLE_IN_ALL |
713 | void gtk_widget_class_set_css_name (GtkWidgetClass *widget_class, |
714 | const char *name); |
715 | GDK_AVAILABLE_IN_ALL |
716 | const char * gtk_widget_class_get_css_name (GtkWidgetClass *widget_class); |
717 | |
718 | GDK_AVAILABLE_IN_ALL |
719 | guint gtk_widget_add_tick_callback (GtkWidget *widget, |
720 | GtkTickCallback callback, |
721 | gpointer user_data, |
722 | GDestroyNotify notify); |
723 | |
724 | GDK_AVAILABLE_IN_ALL |
725 | void gtk_widget_remove_tick_callback (GtkWidget *widget, |
726 | guint id); |
727 | |
728 | /** |
729 | * gtk_widget_class_bind_template_callback: |
730 | * @widget_class: a `GtkWidgetClass` |
731 | * @callback: the callback symbol |
732 | * |
733 | * Binds a callback function defined in a template to the @widget_class. |
734 | * |
735 | * This macro is a convenience wrapper around the |
736 | * gtk_widget_class_bind_template_callback_full() function. It is not |
737 | * supported after gtk_widget_class_set_template_scope() has been used |
738 | * on @widget_class. |
739 | */ |
740 | #define gtk_widget_class_bind_template_callback(widget_class, callback) \ |
741 | gtk_widget_class_bind_template_callback_full (GTK_WIDGET_CLASS (widget_class), \ |
742 | #callback, \ |
743 | G_CALLBACK (callback)) |
744 | |
745 | /** |
746 | * gtk_widget_class_bind_template_child: |
747 | * @widget_class: a `GtkWidgetClass` |
748 | * @TypeName: the type name of this widget |
749 | * @member_name: name of the instance member in the instance struct for @data_type |
750 | * |
751 | * Binds a child widget defined in a template to the @widget_class. |
752 | * |
753 | * This macro is a convenience wrapper around the |
754 | * gtk_widget_class_bind_template_child_full() function. |
755 | * |
756 | * This macro will use the offset of the @member_name inside the @TypeName |
757 | * instance structure. |
758 | */ |
759 | #define gtk_widget_class_bind_template_child(widget_class, TypeName, member_name) \ |
760 | gtk_widget_class_bind_template_child_full (widget_class, \ |
761 | #member_name, \ |
762 | FALSE, \ |
763 | G_STRUCT_OFFSET (TypeName, member_name)) |
764 | |
765 | /** |
766 | * gtk_widget_class_bind_template_child_internal: |
767 | * @widget_class: a `GtkWidgetClass` |
768 | * @TypeName: the type name, in CamelCase |
769 | * @member_name: name of the instance member in the instance struct for @data_type |
770 | * |
771 | * Binds a child widget defined in a template to the @widget_class, and |
772 | * also makes it available as an internal child in GtkBuilder, under the |
773 | * name @member_name. |
774 | * |
775 | * This macro is a convenience wrapper around the |
776 | * gtk_widget_class_bind_template_child_full() function. |
777 | * |
778 | * This macro will use the offset of the @member_name inside the @TypeName |
779 | * instance structure. |
780 | */ |
781 | #define gtk_widget_class_bind_template_child_internal(widget_class, TypeName, member_name) \ |
782 | gtk_widget_class_bind_template_child_full (widget_class, \ |
783 | #member_name, \ |
784 | TRUE, \ |
785 | G_STRUCT_OFFSET (TypeName, member_name)) |
786 | |
787 | /** |
788 | * gtk_widget_class_bind_template_child_private: |
789 | * @widget_class: a `GtkWidgetClass` |
790 | * @TypeName: the type name of this widget |
791 | * @member_name: name of the instance private member in the private struct for @data_type |
792 | * |
793 | * Binds a child widget defined in a template to the @widget_class. |
794 | * |
795 | * This macro is a convenience wrapper around the |
796 | * gtk_widget_class_bind_template_child_full() function. |
797 | * |
798 | * This macro will use the offset of the @member_name inside the @TypeName |
799 | * private data structure (it uses G_PRIVATE_OFFSET(), so the private struct |
800 | * must be added with G_ADD_PRIVATE()). |
801 | */ |
802 | #define gtk_widget_class_bind_template_child_private(widget_class, TypeName, member_name) \ |
803 | gtk_widget_class_bind_template_child_full (widget_class, \ |
804 | #member_name, \ |
805 | FALSE, \ |
806 | G_PRIVATE_OFFSET (TypeName, member_name)) |
807 | |
808 | /** |
809 | * gtk_widget_class_bind_template_child_internal_private: |
810 | * @widget_class: a `GtkWidgetClass` |
811 | * @TypeName: the type name, in CamelCase |
812 | * @member_name: name of the instance private member on the private struct for @data_type |
813 | * |
814 | * Binds a child widget defined in a template to the @widget_class, and |
815 | * also makes it available as an internal child in GtkBuilder, under the |
816 | * name @member_name. |
817 | * |
818 | * This macro is a convenience wrapper around the |
819 | * gtk_widget_class_bind_template_child_full() function. |
820 | * |
821 | * This macro will use the offset of the @member_name inside the @TypeName |
822 | * private data structure. |
823 | */ |
824 | #define gtk_widget_class_bind_template_child_internal_private(widget_class, TypeName, member_name) \ |
825 | gtk_widget_class_bind_template_child_full (widget_class, \ |
826 | #member_name, \ |
827 | TRUE, \ |
828 | G_PRIVATE_OFFSET (TypeName, member_name)) |
829 | |
830 | GDK_AVAILABLE_IN_ALL |
831 | void gtk_widget_init_template (GtkWidget *widget); |
832 | GDK_AVAILABLE_IN_ALL |
833 | GObject *gtk_widget_get_template_child (GtkWidget *widget, |
834 | GType widget_type, |
835 | const char *name); |
836 | GDK_AVAILABLE_IN_ALL |
837 | void gtk_widget_class_set_template (GtkWidgetClass *widget_class, |
838 | GBytes *template_bytes); |
839 | GDK_AVAILABLE_IN_ALL |
840 | void gtk_widget_class_set_template_from_resource (GtkWidgetClass *widget_class, |
841 | const char *resource_name); |
842 | GDK_AVAILABLE_IN_ALL |
843 | void gtk_widget_class_bind_template_callback_full (GtkWidgetClass *widget_class, |
844 | const char *callback_name, |
845 | GCallback callback_symbol); |
846 | GDK_AVAILABLE_IN_ALL |
847 | void gtk_widget_class_set_template_scope (GtkWidgetClass *widget_class, |
848 | GtkBuilderScope *scope); |
849 | GDK_AVAILABLE_IN_ALL |
850 | void gtk_widget_class_bind_template_child_full (GtkWidgetClass *widget_class, |
851 | const char *name, |
852 | gboolean internal_child, |
853 | gssize struct_offset); |
854 | |
855 | GDK_AVAILABLE_IN_ALL |
856 | void gtk_widget_insert_action_group (GtkWidget *widget, |
857 | const char *name, |
858 | GActionGroup *group); |
859 | |
860 | GDK_AVAILABLE_IN_ALL |
861 | gboolean gtk_widget_activate_action (GtkWidget *widget, |
862 | const char *name, |
863 | const char *format_string, |
864 | ...); |
865 | GDK_AVAILABLE_IN_ALL |
866 | gboolean gtk_widget_activate_action_variant (GtkWidget *widget, |
867 | const char *name, |
868 | GVariant *args); |
869 | |
870 | GDK_AVAILABLE_IN_ALL |
871 | void gtk_widget_activate_default (GtkWidget *widget); |
872 | |
873 | GDK_AVAILABLE_IN_ALL |
874 | void gtk_widget_set_font_map (GtkWidget *widget, |
875 | PangoFontMap *font_map); |
876 | GDK_AVAILABLE_IN_ALL |
877 | PangoFontMap * gtk_widget_get_font_map (GtkWidget *widget); |
878 | |
879 | GDK_AVAILABLE_IN_ALL |
880 | GtkWidget * gtk_widget_get_first_child (GtkWidget *widget); |
881 | GDK_AVAILABLE_IN_ALL |
882 | GtkWidget * gtk_widget_get_last_child (GtkWidget *widget); |
883 | GDK_AVAILABLE_IN_ALL |
884 | GtkWidget * gtk_widget_get_next_sibling (GtkWidget *widget); |
885 | GDK_AVAILABLE_IN_ALL |
886 | GtkWidget * gtk_widget_get_prev_sibling (GtkWidget *widget); |
887 | GDK_AVAILABLE_IN_ALL |
888 | GListModel * gtk_widget_observe_children (GtkWidget *widget); |
889 | GDK_AVAILABLE_IN_ALL |
890 | GListModel * gtk_widget_observe_controllers (GtkWidget *widget); |
891 | GDK_AVAILABLE_IN_ALL |
892 | void gtk_widget_insert_after (GtkWidget *widget, |
893 | GtkWidget *parent, |
894 | GtkWidget *previous_sibling); |
895 | GDK_AVAILABLE_IN_ALL |
896 | void gtk_widget_insert_before (GtkWidget *widget, |
897 | GtkWidget *parent, |
898 | GtkWidget *next_sibling); |
899 | GDK_AVAILABLE_IN_ALL |
900 | void gtk_widget_set_focus_child (GtkWidget *widget, |
901 | GtkWidget *child); |
902 | GDK_AVAILABLE_IN_ALL |
903 | GtkWidget * gtk_widget_get_focus_child (GtkWidget *widget); |
904 | |
905 | GDK_AVAILABLE_IN_ALL |
906 | void gtk_widget_snapshot_child (GtkWidget *widget, |
907 | GtkWidget *child, |
908 | GtkSnapshot *snapshot); |
909 | GDK_AVAILABLE_IN_ALL |
910 | gboolean gtk_widget_should_layout (GtkWidget *widget); |
911 | GDK_AVAILABLE_IN_ALL |
912 | const char * gtk_widget_get_css_name (GtkWidget *self) G_GNUC_PURE; |
913 | GDK_AVAILABLE_IN_ALL |
914 | void gtk_widget_add_css_class (GtkWidget *widget, |
915 | const char *css_class); |
916 | GDK_AVAILABLE_IN_ALL |
917 | void gtk_widget_remove_css_class (GtkWidget *widget, |
918 | const char *css_class); |
919 | GDK_AVAILABLE_IN_ALL |
920 | gboolean gtk_widget_has_css_class (GtkWidget *widget, |
921 | const char *css_class); |
922 | GDK_AVAILABLE_IN_ALL |
923 | char ** gtk_widget_get_css_classes (GtkWidget *widget); |
924 | GDK_AVAILABLE_IN_ALL |
925 | void gtk_widget_set_css_classes (GtkWidget *widget, |
926 | const char **classes); |
927 | |
928 | |
929 | |
930 | |
931 | /** |
932 | * GtkWidgetActionActivateFunc: |
933 | * @widget: the widget to which the action belongs |
934 | * @action_name: the action name |
935 | * @parameter: parameter for activation |
936 | * |
937 | * The type of the callback functions used for activating |
938 | * actions installed with gtk_widget_class_install_action(). |
939 | * |
940 | * The @parameter must match the @parameter_type of the action. |
941 | */ |
942 | typedef void (* GtkWidgetActionActivateFunc) (GtkWidget *widget, |
943 | const char *action_name, |
944 | GVariant *parameter); |
945 | |
946 | GDK_AVAILABLE_IN_ALL |
947 | void gtk_widget_class_install_action (GtkWidgetClass *widget_class, |
948 | const char *action_name, |
949 | const char *parameter_type, |
950 | GtkWidgetActionActivateFunc activate); |
951 | |
952 | GDK_AVAILABLE_IN_ALL |
953 | void gtk_widget_class_install_property_action (GtkWidgetClass *widget_class, |
954 | const char *action_name, |
955 | const char *property_name); |
956 | |
957 | GDK_AVAILABLE_IN_ALL |
958 | gboolean gtk_widget_class_query_action (GtkWidgetClass *widget_class, |
959 | guint index_, |
960 | GType *owner, |
961 | const char **action_name, |
962 | const GVariantType **parameter_type, |
963 | const char **property_name); |
964 | |
965 | GDK_AVAILABLE_IN_ALL |
966 | void gtk_widget_action_set_enabled (GtkWidget *widget, |
967 | const char *action_name, |
968 | gboolean enabled); |
969 | |
970 | |
971 | GDK_AVAILABLE_IN_ALL |
972 | void gtk_widget_class_set_accessible_role (GtkWidgetClass *widget_class, |
973 | GtkAccessibleRole accessible_role); |
974 | GDK_AVAILABLE_IN_ALL |
975 | GtkAccessibleRole gtk_widget_class_get_accessible_role (GtkWidgetClass *widget_class); |
976 | |
977 | G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkWidget, g_object_unref) |
978 | G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkRequisition, gtk_requisition_free) |
979 | |
980 | G_END_DECLS |
981 | |
982 | #endif /* __GTK_WIDGET_H__ */ |
983 | |