Skip to main content

gtk/auto/
widget.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{
6    AccelFlags, AccelGroup, Align, Allocation, Buildable, Clipboard, DirectionType, DragResult,
7    Orientation, Requisition, SelectionData, Settings, SizeRequestMode, StateFlags, StyleContext,
8    TargetList, TextDirection, Tooltip, WidgetHelpType, WidgetPath, Window, ffi,
9};
10use glib::{
11    object::ObjectType as _,
12    prelude::*,
13    signal::{SignalHandlerId, connect_raw},
14    translate::*,
15};
16use std::boxed::Box as Box_;
17
18glib::wrapper! {
19    ///
20    /// // the signal handler has the instance and user data swapped
21    /// // because of the swapped="yes" attribute in the template XML
22    /// static void
23    /// hello_button_clicked (FooWidget *self,
24    ///  GtkButton *button)
25    /// {
26    ///  g_print ("Hello, world!\n");
27    /// }
28    ///
29    /// static void
30    /// foo_widget_class_init (FooWidgetClass *klass)
31    /// {
32    ///  // ...
33    ///  gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass),
34    ///  "/com/example/ui/foowidget.ui");
35    ///  gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (klass), hello_button_clicked);
36    /// }
37    /// ]|
38    ///
39    /// This is an Abstract Base Class, you cannot instantiate it.
40    ///
41    /// ## Properties
42    ///
43    ///
44    /// #### `app-paintable`
45    ///  Readable | Writable
46    ///
47    ///
48    /// #### `can-default`
49    ///  Readable | Writable
50    ///
51    ///
52    /// #### `can-focus`
53    ///  Readable | Writable
54    ///
55    ///
56    /// #### `composite-child`
57    ///  Readable
58    ///
59    ///
60    /// #### `double-buffered`
61    ///  Whether the widget is double buffered.
62    ///
63    /// Readable | Writable
64    ///
65    ///
66    /// #### `events`
67    ///  Readable | Writable
68    ///
69    ///
70    /// #### `expand`
71    ///  Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
72    ///
73    /// Readable | Writable
74    ///
75    ///
76    /// #### `focus-on-click`
77    ///  Whether the widget should grab focus when it is clicked with the mouse.
78    ///
79    /// This property is only relevant for widgets that can take focus.
80    ///
81    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
82    /// GtkComboBox) implemented this property individually.
83    ///
84    /// Readable | Writable
85    ///
86    ///
87    /// #### `halign`
88    ///  How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
89    ///
90    /// Readable | Writable
91    ///
92    ///
93    /// #### `has-default`
94    ///  Readable | Writable
95    ///
96    ///
97    /// #### `has-focus`
98    ///  Readable | Writable
99    ///
100    ///
101    /// #### `has-tooltip`
102    ///  Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
103    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
104    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
105    /// whether it will provide a tooltip or not.
106    ///
107    /// Note that setting this property to [`true`] for the first time will change
108    /// the event masks of the GdkWindows of this widget to include leave-notify
109    /// and motion-notify events. This cannot and will not be undone when the
110    /// property is set to [`false`] again.
111    ///
112    /// Readable | Writable
113    ///
114    ///
115    /// #### `height-request`
116    ///  Readable | Writable
117    ///
118    ///
119    /// #### `hexpand`
120    ///  Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
121    ///
122    /// Readable | Writable
123    ///
124    ///
125    /// #### `hexpand-set`
126    ///  Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
127    ///
128    /// Readable | Writable
129    ///
130    ///
131    /// #### `is-focus`
132    ///  Readable | Writable
133    ///
134    ///
135    /// #### `margin`
136    ///  Sets all four sides' margin at once. If read, returns max
137    /// margin on any side.
138    ///
139    /// Readable | Writable
140    ///
141    ///
142    /// #### `margin-bottom`
143    ///  Margin on bottom side of widget.
144    ///
145    /// This property adds margin outside of the widget's normal size
146    /// request, the margin will be added in addition to the size from
147    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
148    ///
149    /// Readable | Writable
150    ///
151    ///
152    /// #### `margin-end`
153    ///  Margin on end of widget, horizontally. This property supports
154    /// left-to-right and right-to-left text directions.
155    ///
156    /// This property adds margin outside of the widget's normal size
157    /// request, the margin will be added in addition to the size from
158    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
159    ///
160    /// Readable | Writable
161    ///
162    ///
163    /// #### `margin-left`
164    ///  Margin on left side of widget.
165    ///
166    /// This property adds margin outside of the widget's normal size
167    /// request, the margin will be added in addition to the size from
168    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
169    ///
170    /// Readable | Writable
171    ///
172    ///
173    /// #### `margin-right`
174    ///  Margin on right side of widget.
175    ///
176    /// This property adds margin outside of the widget's normal size
177    /// request, the margin will be added in addition to the size from
178    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
179    ///
180    /// Readable | Writable
181    ///
182    ///
183    /// #### `margin-start`
184    ///  Margin on start of widget, horizontally. This property supports
185    /// left-to-right and right-to-left text directions.
186    ///
187    /// This property adds margin outside of the widget's normal size
188    /// request, the margin will be added in addition to the size from
189    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
190    ///
191    /// Readable | Writable
192    ///
193    ///
194    /// #### `margin-top`
195    ///  Margin on top side of widget.
196    ///
197    /// This property adds margin outside of the widget's normal size
198    /// request, the margin will be added in addition to the size from
199    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
200    ///
201    /// Readable | Writable
202    ///
203    ///
204    /// #### `name`
205    ///  Readable | Writable
206    ///
207    ///
208    /// #### `no-show-all`
209    ///  Readable | Writable
210    ///
211    ///
212    /// #### `opacity`
213    ///  The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
214    /// more details about window opacity.
215    ///
216    /// Before 3.8 this was only available in GtkWindow
217    ///
218    /// Readable | Writable
219    ///
220    ///
221    /// #### `parent`
222    ///  Readable | Writable
223    ///
224    ///
225    /// #### `receives-default`
226    ///  Readable | Writable
227    ///
228    ///
229    /// #### `scale-factor`
230    ///  The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
231    /// more details about widget scaling.
232    ///
233    /// Readable
234    ///
235    ///
236    /// #### `sensitive`
237    ///  Readable | Writable
238    ///
239    ///
240    /// #### `style`
241    ///  The style of the widget, which contains information about how it will look (colors, etc).
242    ///
243    /// Readable | Writable
244    ///
245    ///
246    /// #### `tooltip-markup`
247    ///  Sets the text of tooltip to be the given string, which is marked up
248    /// with the [Pango text markup language][PangoMarkupFormat].
249    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
250    ///
251    /// This is a convenience property which will take care of getting the
252    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
253    /// will automatically be set to [`true`] and there will be taken care of
254    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
255    ///
256    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
257    /// are set, the last one wins.
258    ///
259    /// Readable | Writable
260    ///
261    ///
262    /// #### `tooltip-text`
263    ///  Sets the text of tooltip to be the given string.
264    ///
265    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
266    ///
267    /// This is a convenience property which will take care of getting the
268    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
269    /// will automatically be set to [`true`] and there will be taken care of
270    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
271    ///
272    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
273    /// are set, the last one wins.
274    ///
275    /// Readable | Writable
276    ///
277    ///
278    /// #### `valign`
279    ///  How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
280    ///
281    /// Readable | Writable
282    ///
283    ///
284    /// #### `vexpand`
285    ///  Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
286    ///
287    /// Readable | Writable
288    ///
289    ///
290    /// #### `vexpand-set`
291    ///  Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
292    ///
293    /// Readable | Writable
294    ///
295    ///
296    /// #### `visible`
297    ///  Readable | Writable
298    ///
299    ///
300    /// #### `width-request`
301    ///  Readable | Writable
302    ///
303    ///
304    /// #### `window`
305    ///  The widget's window if it is realized, [`None`] otherwise.
306    ///
307    /// Readable
308    ///
309    /// ## Signals
310    ///
311    ///
312    /// #### `accel-closures-changed`
313    ///
314    ///
315    ///
316    /// #### `button-press-event`
317    ///  The ::button-press-event signal will be emitted when a button
318    /// (typically from a mouse) is pressed.
319    ///
320    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
321    /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
322    ///
323    /// This signal will be sent to the grab widget if there is one.
324    ///
325    ///
326    ///
327    ///
328    /// #### `button-release-event`
329    ///  The ::button-release-event signal will be emitted when a button
330    /// (typically from a mouse) is released.
331    ///
332    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
333    /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
334    ///
335    /// This signal will be sent to the grab widget if there is one.
336    ///
337    ///
338    ///
339    ///
340    /// #### `can-activate-accel`
341    ///  Determines whether an accelerator that activates the signal
342    /// identified by `signal_id` can currently be activated.
343    /// This signal is present to allow applications and derived
344    /// widgets to override the default [`Widget`][crate::Widget] handling
345    /// for determining whether an accelerator can be activated.
346    ///
347    ///
348    ///
349    ///
350    /// #### `child-notify`
351    ///  The ::child-notify signal is emitted for each
352    /// [child property][child-properties] that has
353    /// changed on an object. The signal's detail holds the property name.
354    ///
355    /// Detailed
356    ///
357    ///
358    /// #### `composited-changed`
359    ///  The ::composited-changed signal is emitted when the composited
360    /// status of `widgets` screen changes.
361    /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
362    ///
363    /// Action
364    ///
365    ///
366    /// #### `configure-event`
367    ///  The ::configure-event signal will be emitted when the size, position or
368    /// stacking of the `widget`'s window has changed.
369    ///
370    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
371    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
372    /// automatically for all new windows.
373    ///
374    ///
375    ///
376    ///
377    /// #### `damage-event`
378    ///  Emitted when a redirected window belonging to `widget` gets drawn into.
379    /// The region/area members of the event shows what area of the redirected
380    /// drawable was drawn into.
381    ///
382    ///
383    ///
384    ///
385    /// #### `delete-event`
386    ///  The ::delete-event signal is emitted if a user requests that
387    /// a toplevel window is closed. The default handler for this signal
388    /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
389    /// this signal will cause the window to be hidden instead, so that
390    /// it can later be shown again without reconstructing it.
391    ///
392    ///
393    ///
394    ///
395    /// #### `destroy`
396    ///  Signals that all holders of a reference to the widget should release
397    /// the reference that they hold. May result in finalization of the widget
398    /// if all references are released.
399    ///
400    /// This signal is not suitable for saving widget state.
401    ///
402    ///
403    ///
404    ///
405    /// #### `destroy-event`
406    ///  The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
407    /// You rarely get this signal, because most widgets disconnect themselves
408    /// from their window before they destroy it, so no widget owns the
409    /// window at destroy time.
410    ///
411    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
412    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
413    /// automatically for all new windows.
414    ///
415    ///
416    ///
417    ///
418    /// #### `direction-changed`
419    ///  The ::direction-changed signal is emitted when the text direction
420    /// of a widget changes.
421    ///
422    ///
423    ///
424    ///
425    /// #### `drag-begin`
426    ///  The ::drag-begin signal is emitted on the drag source when a drag is
427    /// started. A typical reason to connect to this signal is to set up a
428    /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
429    ///
430    /// Note that some widgets set up a drag icon in the default handler of
431    /// this signal, so you may have to use `g_signal_connect_after()` to
432    /// override what the default handler did.
433    ///
434    ///
435    ///
436    ///
437    /// #### `drag-data-delete`
438    ///  The ::drag-data-delete signal is emitted on the drag source when a drag
439    /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
440    /// handler is responsible for deleting the data that has been dropped. What
441    /// "delete" means depends on the context of the drag operation.
442    ///
443    ///
444    ///
445    ///
446    /// #### `drag-data-get`
447    ///  The ::drag-data-get signal is emitted on the drag source when the drop
448    /// site requests the data which is dragged. It is the responsibility of
449    /// the signal handler to fill `data` with the data in the format which
450    /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
451    /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
452    ///
453    ///
454    ///
455    ///
456    /// #### `drag-data-received`
457    ///  format == 8))
458    ///  {
459    ///  GdkDragAction action;
460    ///
461    ///  // handle data here
462    ///
463    ///  action = gdk_drag_context_get_selected_action (context);
464    ///  if (action == GDK_ACTION_ASK)
465    ///  {
466    ///  GtkWidget *dialog;
467    ///  gint response;
468    ///
469    ///  dialog = gtk_message_dialog_new (NULL,
470    ///  GTK_DIALOG_MODAL |
471    ///  GTK_DIALOG_DESTROY_WITH_PARENT,
472    ///  GTK_MESSAGE_INFO,
473    ///  GTK_BUTTONS_YES_NO,
474    ///  "Move the data ?\n");
475    ///  response = gtk_dialog_run (GTK_DIALOG (dialog));
476    ///  gtk_widget_destroy (dialog);
477    ///
478    ///  if (response == GTK_RESPONSE_YES)
479    ///  action = GDK_ACTION_MOVE;
480    ///  else
481    ///  action = GDK_ACTION_COPY;
482    ///  }
483    ///
484    ///  gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
485    ///  }
486    ///  else
487    ///  gtk_drag_finish (context, FALSE, FALSE, time);
488    ///  }
489    /// ]|
490    ///
491    ///
492    ///
493    ///
494    /// #### `drag-drop`
495    ///  The ::drag-drop signal is emitted on the drop site when the user drops
496    /// the data onto the widget. The signal handler must determine whether
497    /// the cursor position is in a drop zone or not. If it is not in a drop
498    /// zone, it returns [`false`] and no further processing is necessary.
499    /// Otherwise, the handler returns [`true`]. In this case, the handler must
500    /// ensure that `gtk_drag_finish()` is called to let the source know that
501    /// the drop is done. The call to `gtk_drag_finish()` can be done either
502    /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
503    /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
504    /// or more of the supported targets.
505    ///
506    ///
507    ///
508    ///
509    /// #### `drag-end`
510    ///  The ::drag-end signal is emitted on the drag source when a drag is
511    /// finished. A typical reason to connect to this signal is to undo
512    /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
513    ///
514    ///
515    ///
516    ///
517    /// #### `drag-failed`
518    ///  The ::drag-failed signal is emitted on the drag source when a drag has
519    /// failed. The signal handler may hook custom code to handle a failed DnD
520    /// operation based on the type of error, it returns [`true`] is the failure has
521    /// been already handled (not showing the default "drag operation failed"
522    /// animation), otherwise it returns [`false`].
523    ///
524    ///
525    ///
526    ///
527    /// #### `drag-leave`
528    ///  The ::drag-leave signal is emitted on the drop site when the cursor
529    /// leaves the widget. A typical reason to connect to this signal is to
530    /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
531    /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
532    ///
533    ///
534    /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
535    /// ::drag-drop signal, for instance to allow cleaning up of a preview item
536    /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
537    ///
538    ///
539    ///
540    ///
541    /// #### `drag-motion`
542    ///  suggested_action,
543    ///  time);
544    ///  }
545    ///  else
546    ///  {
547    ///  // accept the drop
548    ///  }
549    /// }
550    /// ]|
551    ///
552    ///
553    ///
554    ///
555    /// #### `draw`
556    ///  This signal is emitted when a widget is supposed to render itself.
557    /// The `widget`'s top left corner must be painted at the origin of
558    /// the passed in context and be sized to the values returned by
559    /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
560    /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
561    ///
562    /// Signal handlers connected to this signal can modify the cairo
563    /// context passed as `cr` in any way they like and don't need to
564    /// restore it. The signal emission takes care of calling `cairo_save()`
565    /// before and `cairo_restore()` after invoking the handler.
566    ///
567    /// The signal handler will get a `cr` with a clip region already set to the
568    /// widget's dirty region, i.e. to the area that needs repainting. Complicated
569    /// widgets that want to avoid redrawing themselves completely can get the full
570    /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
571    /// get a finer-grained representation of the dirty region with
572    /// `cairo_copy_clip_rectangle_list()`.
573    ///
574    ///
575    ///
576    ///
577    /// #### `enter-notify-event`
578    ///  The ::enter-notify-event will be emitted when the pointer enters
579    /// the `widget`'s window.
580    ///
581    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
582    /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
583    ///
584    /// This signal will be sent to the grab widget if there is one.
585    ///
586    ///
587    ///
588    ///
589    /// #### `event`
590    ///  The GTK+ main loop will emit three signals for each GDK event delivered
591    /// to a widget: one generic ::event signal, another, more specific,
592    /// signal that matches the type of event delivered (e.g.
593    /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
594    /// [`event-after`][struct@crate::Widget#event-after] signal.
595    ///
596    ///
597    ///
598    ///
599    /// #### `event-after`
600    ///  After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
601    /// the second more specific signal, ::event-after will be emitted
602    /// regardless of the previous two signals handlers return values.
603    ///
604    ///
605    ///
606    ///
607    /// #### `focus`
608    ///
609    ///
610    ///
611    /// #### `focus-in-event`
612    ///  The ::focus-in-event signal will be emitted when the keyboard focus
613    /// enters the `widget`'s window.
614    ///
615    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
616    /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
617    ///
618    ///
619    ///
620    ///
621    /// #### `focus-out-event`
622    ///  The ::focus-out-event signal will be emitted when the keyboard focus
623    /// leaves the `widget`'s window.
624    ///
625    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
626    /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
627    ///
628    ///
629    ///
630    ///
631    /// #### `grab-broken-event`
632    ///  Emitted when a pointer or keyboard grab on a window belonging
633    /// to `widget` gets broken.
634    ///
635    /// On X11, this happens when the grab window becomes unviewable
636    /// (i.e. it or one of its ancestors is unmapped), or if the same
637    /// application grabs the pointer or keyboard again.
638    ///
639    ///
640    ///
641    ///
642    /// #### `grab-focus`
643    ///  Action
644    ///
645    ///
646    /// #### `grab-notify`
647    ///  The ::grab-notify signal is emitted when a widget becomes
648    /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
649    /// another widget, or when it becomes unshadowed due to a grab
650    /// being removed.
651    ///
652    /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
653    /// grab widget in the grab stack of its window group is not
654    /// its ancestor.
655    ///
656    ///
657    ///
658    ///
659    /// #### `hide`
660    ///  The ::hide signal is emitted when `widget` is hidden, for example with
661    /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
662    ///
663    ///
664    ///
665    ///
666    /// #### `hierarchy-changed`
667    ///  The ::hierarchy-changed signal is emitted when the
668    /// anchored state of a widget changes. A widget is
669    /// “anchored” when its toplevel
670    /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
671    /// a widget changes from un-anchored to anchored or vice-versa.
672    ///
673    ///
674    ///
675    ///
676    /// #### `key-press-event`
677    ///  The ::key-press-event signal is emitted when a key is pressed. The signal
678    /// emission will reoccur at the key-repeat rate when the key is kept pressed.
679    ///
680    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
681    /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
682    ///
683    /// This signal will be sent to the grab widget if there is one.
684    ///
685    ///
686    ///
687    ///
688    /// #### `key-release-event`
689    ///  The ::key-release-event signal is emitted when a key is released.
690    ///
691    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
692    /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
693    ///
694    /// This signal will be sent to the grab widget if there is one.
695    ///
696    ///
697    ///
698    ///
699    /// #### `keynav-failed`
700    ///  Gets emitted if keyboard navigation fails.
701    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
702    ///
703    ///
704    ///
705    ///
706    /// #### `leave-notify-event`
707    ///  The ::leave-notify-event will be emitted when the pointer leaves
708    /// the `widget`'s window.
709    ///
710    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
711    /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
712    ///
713    /// This signal will be sent to the grab widget if there is one.
714    ///
715    ///
716    ///
717    ///
718    /// #### `map`
719    ///  The ::map signal is emitted when `widget` is going to be mapped, that is
720    /// when the widget is visible (which is controlled with
721    /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
722    /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
723    /// be emitted.
724    ///
725    /// The ::map signal can be used to determine whether a widget will be drawn,
726    /// for instance it can resume an animation that was stopped during the
727    /// emission of [`unmap`][struct@crate::Widget#unmap].
728    ///
729    ///
730    ///
731    ///
732    /// #### `map-event`
733    ///  The ::map-event signal will be emitted when the `widget`'s window is
734    /// mapped. A window is mapped when it becomes visible on the screen.
735    ///
736    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
737    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
738    /// automatically for all new windows.
739    ///
740    ///
741    ///
742    ///
743    /// #### `mnemonic-activate`
744    ///  The default handler for this signal activates `widget` if `group_cycling`
745    /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
746    ///
747    ///
748    ///
749    ///
750    /// #### `motion-notify-event`
751    ///  The ::motion-notify-event signal is emitted when the pointer moves
752    /// over the widget's [`gdk::Window`][crate::gdk::Window].
753    ///
754    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
755    /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
756    ///
757    /// This signal will be sent to the grab widget if there is one.
758    ///
759    ///
760    ///
761    ///
762    /// #### `move-focus`
763    ///  Action
764    ///
765    ///
766    /// #### `parent-set`
767    ///  The ::parent-set signal is emitted when a new parent
768    /// has been set on a widget.
769    ///
770    ///
771    ///
772    ///
773    /// #### `popup-menu`
774    ///  This signal gets emitted whenever a widget should pop up a context
775    /// menu. This usually happens through the standard key binding mechanism;
776    /// by pressing a certain key while a widget is focused, the user can cause
777    /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
778    /// a menu with clipboard commands. See the
779    /// [Popup Menu Migration Checklist][checklist-popup-menu]
780    /// for an example of how to use this signal.
781    ///
782    /// Action
783    ///
784    ///
785    /// #### `property-notify-event`
786    ///  The ::property-notify-event signal will be emitted when a property on
787    /// the `widget`'s window has been changed or deleted.
788    ///
789    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
790    /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
791    ///
792    ///
793    ///
794    ///
795    /// #### `proximity-in-event`
796    ///  To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
797    /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
798    ///
799    /// This signal will be sent to the grab widget if there is one.
800    ///
801    ///
802    ///
803    ///
804    /// #### `proximity-out-event`
805    ///  To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
806    /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
807    ///
808    /// This signal will be sent to the grab widget if there is one.
809    ///
810    ///
811    ///
812    ///
813    /// #### `query-tooltip`
814    ///  Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
815    /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
816    /// focus in keyboard mode.
817    ///
818    /// Using the given coordinates, the signal handler should determine
819    /// whether a tooltip should be shown for `widget`. If this is the case
820    /// [`true`] should be returned, [`false`] otherwise. Note that if
821    /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
822    /// should not be used.
823    ///
824    /// The signal handler is free to manipulate `tooltip` with the therefore
825    /// destined function calls.
826    ///
827    ///
828    ///
829    ///
830    /// #### `realize`
831    ///  The ::realize signal is emitted when `widget` is associated with a
832    /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
833    /// widget has been mapped (that is, it is going to be drawn).
834    ///
835    ///
836    ///
837    ///
838    /// #### `screen-changed`
839    ///  The ::screen-changed signal gets emitted when the
840    /// screen of a widget has changed.
841    ///
842    ///
843    ///
844    ///
845    /// #### `scroll-event`
846    ///  The ::scroll-event signal is emitted when a button in the 4 to 7
847    /// range is pressed. Wheel mice are usually configured to generate
848    /// button press events for buttons 4 and 5 when the wheel is turned.
849    ///
850    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
851    /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
852    ///
853    /// This signal will be sent to the grab widget if there is one.
854    ///
855    ///
856    ///
857    ///
858    /// #### `selection-clear-event`
859    ///  The ::selection-clear-event signal will be emitted when the
860    /// the `widget`'s window has lost ownership of a selection.
861    ///
862    ///
863    ///
864    ///
865    /// #### `selection-get`
866    ///
867    ///
868    ///
869    /// #### `selection-notify-event`
870    ///
871    ///
872    ///
873    /// #### `selection-received`
874    ///
875    ///
876    ///
877    /// #### `selection-request-event`
878    ///  The ::selection-request-event signal will be emitted when
879    /// another client requests ownership of the selection owned by
880    /// the `widget`'s window.
881    ///
882    ///
883    ///
884    ///
885    /// #### `show`
886    ///  The ::show signal is emitted when `widget` is shown, for example with
887    /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
888    ///
889    ///
890    ///
891    ///
892    /// #### `show-help`
893    ///  Action
894    ///
895    ///
896    /// #### `size-allocate`
897    ///
898    ///
899    ///
900    /// #### `state-changed`
901    ///  The ::state-changed signal is emitted when the widget state changes.
902    /// See `gtk_widget_get_state()`.
903    ///
904    ///
905    ///
906    ///
907    /// #### `state-flags-changed`
908    ///  The ::state-flags-changed signal is emitted when the widget state
909    /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
910    ///
911    ///
912    ///
913    ///
914    /// #### `style-set`
915    ///  The ::style-set signal is emitted when a new style has been set
916    /// on a widget. Note that style-modifying functions like
917    /// `gtk_widget_modify_base()` also cause this signal to be emitted.
918    ///
919    /// Note that this signal is emitted for changes to the deprecated
920    /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
921    /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
922    ///
923    ///
924    ///
925    ///
926    /// #### `style-updated`
927    ///  The ::style-updated signal is a convenience signal that is emitted when the
928    /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
929    /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
930    ///
931    /// Note that style-modifying functions like `gtk_widget_override_color()` also
932    /// cause this signal to be emitted.
933    ///
934    ///
935    ///
936    ///
937    /// #### `touch-event`
938    ///
939    ///
940    ///
941    /// #### `unmap`
942    ///  The ::unmap signal is emitted when `widget` is going to be unmapped, which
943    /// means that either it or any of its parents up to the toplevel widget have
944    /// been set as hidden.
945    ///
946    /// As ::unmap indicates that a widget will not be shown any longer, it can be
947    /// used to, for example, stop an animation on the widget.
948    ///
949    ///
950    ///
951    ///
952    /// #### `unmap-event`
953    ///  The ::unmap-event signal will be emitted when the `widget`'s window is
954    /// unmapped. A window is unmapped when it becomes invisible on the screen.
955    ///
956    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
957    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
958    /// automatically for all new windows.
959    ///
960    ///
961    ///
962    ///
963    /// #### `unrealize`
964    ///  The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
965    /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
966    /// called or the widget has been unmapped (that is, it is going to be
967    /// hidden).
968    ///
969    ///
970    ///
971    ///
972    /// #### `visibility-notify-event`
973    ///  The ::visibility-notify-event will be emitted when the `widget`'s
974    /// window is obscured or unobscured.
975    ///
976    /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
977    /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
978    ///
979    ///
980    ///
981    ///
982    /// #### `window-state-event`
983    ///  The ::window-state-event will be emitted when the state of the
984    /// toplevel window associated to the `widget` changes.
985    ///
986    /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
987    /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
988    /// this mask automatically for all new windows.
989    ///
990    ///
991    ///
992    /// # Implements
993    ///
994    /// [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
995    #[doc(alias = "GtkWidget")]
996    pub struct Widget(Object<ffi::GtkWidget, ffi::GtkWidgetClass>) @implements Buildable;
997
998    match fn {
999        type_ => || ffi::gtk_widget_get_type(),
1000    }
1001}
1002
1003impl Widget {
1004    pub const NONE: Option<&'static Widget> = None;
1005
1006    //#[doc(alias = "gtk_widget_new")]
1007    //pub fn new(type_: glib::types::Type, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) -> Widget {
1008    //    unsafe { TODO: call ffi:gtk_widget_new() }
1009    //}
1010
1011    /// Obtains the current default reading direction. See
1012    /// [`set_default_direction()`][Self::set_default_direction()].
1013    ///
1014    /// # Returns
1015    ///
1016    /// the current default direction.
1017    #[doc(alias = "gtk_widget_get_default_direction")]
1018    #[doc(alias = "get_default_direction")]
1019    pub fn default_direction() -> TextDirection {
1020        assert_initialized_main_thread!();
1021        unsafe { from_glib(ffi::gtk_widget_get_default_direction()) }
1022    }
1023
1024    /// Sets the default reading direction for widgets where the
1025    /// direction has not been explicitly set by [`WidgetExt::set_direction()`][crate::prelude::WidgetExt::set_direction()].
1026    /// ## `dir`
1027    /// the new default direction. This cannot be
1028    ///  [`TextDirection::None`][crate::TextDirection::None].
1029    #[doc(alias = "gtk_widget_set_default_direction")]
1030    pub fn set_default_direction(dir: TextDirection) {
1031        assert_initialized_main_thread!();
1032        unsafe {
1033            ffi::gtk_widget_set_default_direction(dir.into_glib());
1034        }
1035    }
1036}
1037
1038impl std::fmt::Display for Widget {
1039    #[inline]
1040    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
1041        f.write_str(&WidgetExt::widget_name(self))
1042    }
1043}
1044
1045/// Trait containing all [`struct@Widget`] methods.
1046///
1047/// # Implementors
1048///
1049/// [`Actionable`][struct@crate::Actionable], [`AppChooser`][struct@crate::AppChooser], [`Calendar`][struct@crate::Calendar], [`CellEditable`][struct@crate::CellEditable], [`CellView`][struct@crate::CellView], [`Container`][struct@crate::Container], [`DrawingArea`][struct@crate::DrawingArea], [`Entry`][struct@crate::Entry], [`GLArea`][struct@crate::GLArea], [`Invisible`][struct@crate::Invisible], [`LevelBar`][struct@crate::LevelBar], [`Misc`][struct@crate::Misc], [`ProgressBar`][struct@crate::ProgressBar], [`Range`][struct@crate::Range], [`Separator`][struct@crate::Separator], [`Spinner`][struct@crate::Spinner], [`Switch`][struct@crate::Switch], [`ToolShell`][struct@crate::ToolShell], [`Widget`][struct@crate::Widget]
1050pub trait WidgetExt: IsA<Widget> + 'static {
1051    /// For widgets that can be “activated” (buttons, menu items, etc.)
1052    /// this function activates them. Activation is what happens when you
1053    /// press Enter on a widget during key navigation. If `self` isn't
1054    /// activatable, the function returns [`false`].
1055    ///
1056    /// # Returns
1057    ///
1058    /// [`true`] if the widget was activatable
1059    #[doc(alias = "gtk_widget_activate")]
1060    fn activate(&self) -> bool {
1061        unsafe { from_glib(ffi::gtk_widget_activate(self.as_ref().to_glib_none().0)) }
1062    }
1063
1064    /// Installs an accelerator for this `self` in `accel_group` that causes
1065    /// `accel_signal` to be emitted if the accelerator is activated.
1066    /// The `accel_group` needs to be added to the widget’s toplevel via
1067    /// [`GtkWindowExt::add_accel_group()`][crate::prelude::GtkWindowExt::add_accel_group()], and the signal must be of type `G_SIGNAL_ACTION`.
1068    /// Accelerators added through this function are not user changeable during
1069    /// runtime. If you want to support accelerators that can be changed by the
1070    /// user, use `gtk_accel_map_add_entry()` and [`set_accel_path()`][Self::set_accel_path()] or
1071    /// [`GtkMenuItemExt::set_accel_path()`][crate::prelude::GtkMenuItemExt::set_accel_path()] instead.
1072    /// ## `accel_signal`
1073    /// widget signal to emit on accelerator activation
1074    /// ## `accel_group`
1075    /// accel group for this widget, added to its toplevel
1076    /// ## `accel_key`
1077    /// GDK keyval of the accelerator
1078    /// ## `accel_mods`
1079    /// modifier key combination of the accelerator
1080    /// ## `accel_flags`
1081    /// flag accelerators, e.g. [`AccelFlags::VISIBLE`][crate::AccelFlags::VISIBLE]
1082    #[doc(alias = "gtk_widget_add_accelerator")]
1083    fn add_accelerator(
1084        &self,
1085        accel_signal: &str,
1086        accel_group: &impl IsA<AccelGroup>,
1087        accel_key: u32,
1088        accel_mods: gdk::ModifierType,
1089        accel_flags: AccelFlags,
1090    ) {
1091        unsafe {
1092            ffi::gtk_widget_add_accelerator(
1093                self.as_ref().to_glib_none().0,
1094                accel_signal.to_glib_none().0,
1095                accel_group.as_ref().to_glib_none().0,
1096                accel_key,
1097                accel_mods.into_glib(),
1098                accel_flags.into_glib(),
1099            );
1100        }
1101    }
1102
1103    /// Adds the device events in the bitfield `events` to the event mask for
1104    /// `self`. See [`set_device_events()`][Self::set_device_events()] for details.
1105    /// ## `device`
1106    /// a [`gdk::Device`][crate::gdk::Device]
1107    /// ## `events`
1108    /// an event mask, see [`gdk::EventMask`][crate::gdk::EventMask]
1109    #[doc(alias = "gtk_widget_add_device_events")]
1110    fn add_device_events(&self, device: &gdk::Device, events: gdk::EventMask) {
1111        unsafe {
1112            ffi::gtk_widget_add_device_events(
1113                self.as_ref().to_glib_none().0,
1114                device.to_glib_none().0,
1115                events.into_glib(),
1116            );
1117        }
1118    }
1119
1120    /// Adds a widget to the list of mnemonic labels for
1121    /// this widget. (See [`list_mnemonic_labels()`][Self::list_mnemonic_labels()]). Note the
1122    /// list of mnemonic labels for the widget is cleared when the
1123    /// widget is destroyed, so the caller must make sure to update
1124    /// its internal state at this point as well, by using a connection
1125    /// to the [`destroy`][struct@crate::Widget#destroy] signal or a weak notifier.
1126    /// ## `label`
1127    /// a [`Widget`][crate::Widget] that acts as a mnemonic label for `self`
1128    #[doc(alias = "gtk_widget_add_mnemonic_label")]
1129    fn add_mnemonic_label(&self, label: &impl IsA<Widget>) {
1130        unsafe {
1131            ffi::gtk_widget_add_mnemonic_label(
1132                self.as_ref().to_glib_none().0,
1133                label.as_ref().to_glib_none().0,
1134            );
1135        }
1136    }
1137
1138    /// This function is used by custom widget implementations; if you're
1139    /// writing an app, you’d use [`grab_focus()`][Self::grab_focus()] to move the focus
1140    /// to a particular widget, and [`ContainerExt::set_focus_chain()`][crate::prelude::ContainerExt::set_focus_chain()] to
1141    /// change the focus tab order. So you may want to investigate those
1142    /// functions instead.
1143    ///
1144    /// [`child_focus()`][Self::child_focus()] is called by containers as the user moves
1145    /// around the window using keyboard shortcuts. `direction` indicates
1146    /// what kind of motion is taking place (up, down, left, right, tab
1147    /// forward, tab backward). [`child_focus()`][Self::child_focus()] emits the
1148    /// [`focus`][struct@crate::Widget#focus] signal; widgets override the default handler
1149    /// for this signal in order to implement appropriate focus behavior.
1150    ///
1151    /// The default ::focus handler for a widget should return [`true`] if
1152    /// moving in `direction` left the focus on a focusable location inside
1153    /// that widget, and [`false`] if moving in `direction` moved the focus
1154    /// outside the widget. If returning [`true`], widgets normally
1155    /// call [`grab_focus()`][Self::grab_focus()] to place the focus accordingly;
1156    /// if returning [`false`], they don’t modify the current focus location.
1157    /// ## `direction`
1158    /// direction of focus movement
1159    ///
1160    /// # Returns
1161    ///
1162    /// [`true`] if focus ended up inside `self`
1163    #[doc(alias = "gtk_widget_child_focus")]
1164    fn child_focus(&self, direction: DirectionType) -> bool {
1165        unsafe {
1166            from_glib(ffi::gtk_widget_child_focus(
1167                self.as_ref().to_glib_none().0,
1168                direction.into_glib(),
1169            ))
1170        }
1171    }
1172
1173    /// Emits a [`child-notify`][struct@crate::Widget#child-notify] signal for the
1174    /// [child property][child-properties] `child_property`
1175    /// on `self`.
1176    ///
1177    /// This is the analogue of [`ObjectExt::notify()`][crate::glib::prelude::ObjectExt::notify()] for child properties.
1178    ///
1179    /// Also see [`ContainerExt::child_notify()`][crate::prelude::ContainerExt::child_notify()].
1180    /// ## `child_property`
1181    /// the name of a child property installed on the
1182    ///  class of `self`’s parent
1183    #[doc(alias = "gtk_widget_child_notify")]
1184    fn child_notify(&self, child_property: &str) {
1185        unsafe {
1186            ffi::gtk_widget_child_notify(
1187                self.as_ref().to_glib_none().0,
1188                child_property.to_glib_none().0,
1189            );
1190        }
1191    }
1192
1193    /// Computes whether a container should give this widget extra space
1194    /// when possible. Containers should check this, rather than
1195    /// looking at [`hexpands()`][Self::hexpands()] or [`vexpands()`][Self::vexpands()].
1196    ///
1197    /// This function already checks whether the widget is visible, so
1198    /// visibility does not need to be checked separately. Non-visible
1199    /// widgets are not expanded.
1200    ///
1201    /// The computed expand value uses either the expand setting explicitly
1202    /// set on the widget itself, or, if none has been explicitly set,
1203    /// the widget may expand if some of its children do.
1204    /// ## `orientation`
1205    /// expand direction
1206    ///
1207    /// # Returns
1208    ///
1209    /// whether widget tree rooted here should be expanded
1210    #[doc(alias = "gtk_widget_compute_expand")]
1211    fn compute_expand(&self, orientation: Orientation) -> bool {
1212        unsafe {
1213            from_glib(ffi::gtk_widget_compute_expand(
1214                self.as_ref().to_glib_none().0,
1215                orientation.into_glib(),
1216            ))
1217        }
1218    }
1219
1220    /// Creates a new [`pango::Context`][crate::pango::Context] with the appropriate font map,
1221    /// font options, font description, and base direction for drawing
1222    /// text for this widget. See also [`pango_context()`][Self::pango_context()].
1223    ///
1224    /// # Returns
1225    ///
1226    /// the new [`pango::Context`][crate::pango::Context]
1227    #[doc(alias = "gtk_widget_create_pango_context")]
1228    fn create_pango_context(&self) -> pango::Context {
1229        unsafe {
1230            from_glib_full(ffi::gtk_widget_create_pango_context(
1231                self.as_ref().to_glib_none().0,
1232            ))
1233        }
1234    }
1235
1236    /// Creates a new [`pango::Layout`][crate::pango::Layout] with the appropriate font map,
1237    /// font description, and base direction for drawing text for
1238    /// this widget.
1239    ///
1240    /// If you keep a [`pango::Layout`][crate::pango::Layout] created in this way around, you need
1241    /// to re-create it when the widget [`pango::Context`][crate::pango::Context] is replaced.
1242    /// This can be tracked by using the [`screen-changed`][struct@crate::Widget#screen-changed] signal
1243    /// on the widget.
1244    /// ## `text`
1245    /// text to set on the layout (can be [`None`])
1246    ///
1247    /// # Returns
1248    ///
1249    /// the new [`pango::Layout`][crate::pango::Layout]
1250    #[doc(alias = "gtk_widget_create_pango_layout")]
1251    fn create_pango_layout(&self, text: Option<&str>) -> pango::Layout {
1252        unsafe {
1253            from_glib_full(ffi::gtk_widget_create_pango_layout(
1254                self.as_ref().to_glib_none().0,
1255                text.to_glib_none().0,
1256            ))
1257        }
1258    }
1259
1260    //#[doc(alias = "gtk_widget_destroyed")]
1261    //fn destroyed(&self, widget_pointer: /*Unimplemented*/Widget) {
1262    //    unsafe { TODO: call ffi:gtk_widget_destroyed() }
1263    //}
1264
1265    /// Returns [`true`] if `device` has been shadowed by a GTK+
1266    /// device grab on another widget, so it would stop sending
1267    /// events to `self`. This may be used in the
1268    /// [`grab-notify`][struct@crate::Widget#grab-notify] signal to check for specific
1269    /// devices. See [`device_grab_add()`][crate::device_grab_add()].
1270    /// ## `device`
1271    /// a [`gdk::Device`][crate::gdk::Device]
1272    ///
1273    /// # Returns
1274    ///
1275    /// [`true`] if there is an ongoing grab on `device`
1276    ///  by another [`Widget`][crate::Widget] than `self`.
1277    #[doc(alias = "gtk_widget_device_is_shadowed")]
1278    fn device_is_shadowed(&self, device: &gdk::Device) -> bool {
1279        unsafe {
1280            from_glib(ffi::gtk_widget_device_is_shadowed(
1281                self.as_ref().to_glib_none().0,
1282                device.to_glib_none().0,
1283            ))
1284        }
1285    }
1286
1287    /// Initiates a drag on the source side. The function only needs to be used
1288    /// when the application is starting drags itself, and is not needed when
1289    /// [`WidgetExtManual::drag_source_set()`][crate::prelude::WidgetExtManual::drag_source_set()] is used.
1290    ///
1291    /// The `event` is used to retrieve the timestamp that will be used internally to
1292    /// grab the pointer. If `event` is [`None`], then `GDK_CURRENT_TIME` will be used.
1293    /// However, you should try to pass a real event in all cases, since that can be
1294    /// used to get information about the drag.
1295    ///
1296    /// Generally there are three cases when you want to start a drag by hand by
1297    /// calling this function:
1298    ///
1299    /// 1. During a [`button-press-event`][struct@crate::Widget#button-press-event] handler, if you want to start a drag
1300    /// immediately when the user presses the mouse button. Pass the `event`
1301    /// that you have in your [`button-press-event`][struct@crate::Widget#button-press-event] handler.
1302    ///
1303    /// 2. During a [`motion-notify-event`][struct@crate::Widget#motion-notify-event] handler, if you want to start a drag
1304    /// when the mouse moves past a certain threshold distance after a button-press.
1305    /// Pass the `event` that you have in your [`motion-notify-event`][struct@crate::Widget#motion-notify-event] handler.
1306    ///
1307    /// 3. During a timeout handler, if you want to start a drag after the mouse
1308    /// button is held down for some time. Try to save the last event that you got
1309    /// from the mouse, using `gdk_event_copy()`, and pass it to this function
1310    /// (remember to free the event with `gdk_event_free()` when you are done).
1311    /// If you really cannot pass a real event, pass [`None`] instead.
1312    /// ## `targets`
1313    /// The targets (data formats) in which the
1314    ///  source can provide the data
1315    /// ## `actions`
1316    /// A bitmask of the allowed drag actions for this drag
1317    /// ## `button`
1318    /// The button the user clicked to start the drag
1319    /// ## `event`
1320    /// The event that triggered the start of the drag,
1321    ///  or [`None`] if none can be obtained.
1322    /// ## `x`
1323    /// The initial x coordinate to start dragging from, in the coordinate space
1324    ///  of `self`. If -1 is passed, the coordinates are retrieved from `event` or
1325    ///  the current pointer position
1326    /// ## `y`
1327    /// The initial y coordinate to start dragging from, in the coordinate space
1328    ///  of `self`. If -1 is passed, the coordinates are retrieved from `event` or
1329    ///  the current pointer position
1330    ///
1331    /// # Returns
1332    ///
1333    /// the context for this drag
1334    #[doc(alias = "gtk_drag_begin_with_coordinates")]
1335    fn drag_begin_with_coordinates(
1336        &self,
1337        targets: &TargetList,
1338        actions: gdk::DragAction,
1339        button: i32,
1340        event: Option<&gdk::Event>,
1341        x: i32,
1342        y: i32,
1343    ) -> Option<gdk::DragContext> {
1344        unsafe {
1345            from_glib_none(ffi::gtk_drag_begin_with_coordinates(
1346                self.as_ref().to_glib_none().0,
1347                targets.to_glib_none().0,
1348                actions.into_glib(),
1349                button,
1350                mut_override(event.to_glib_none().0),
1351                x,
1352                y,
1353            ))
1354        }
1355    }
1356
1357    /// Checks to see if a mouse drag starting at (`start_x`, `start_y`) and ending
1358    /// at (`current_x`, `current_y`) has passed the GTK+ drag threshold, and thus
1359    /// should trigger the beginning of a drag-and-drop operation.
1360    /// ## `start_x`
1361    /// X coordinate of start of drag
1362    /// ## `start_y`
1363    /// Y coordinate of start of drag
1364    /// ## `current_x`
1365    /// current X coordinate
1366    /// ## `current_y`
1367    /// current Y coordinate
1368    ///
1369    /// # Returns
1370    ///
1371    /// [`true`] if the drag threshold has been passed.
1372    #[doc(alias = "gtk_drag_check_threshold")]
1373    fn drag_check_threshold(
1374        &self,
1375        start_x: i32,
1376        start_y: i32,
1377        current_x: i32,
1378        current_y: i32,
1379    ) -> bool {
1380        unsafe {
1381            from_glib(ffi::gtk_drag_check_threshold(
1382                self.as_ref().to_glib_none().0,
1383                start_x,
1384                start_y,
1385                current_x,
1386                current_y,
1387            ))
1388        }
1389    }
1390
1391    /// Add the image targets supported by [`SelectionData`][crate::SelectionData] to
1392    /// the target list of the drag destination. The targets
1393    /// are added with `info` = 0. If you need another value,
1394    /// use [`TargetList::add_image_targets()`][crate::TargetList::add_image_targets()] and
1395    /// [`drag_dest_set_target_list()`][Self::drag_dest_set_target_list()].
1396    #[doc(alias = "gtk_drag_dest_add_image_targets")]
1397    fn drag_dest_add_image_targets(&self) {
1398        unsafe {
1399            ffi::gtk_drag_dest_add_image_targets(self.as_ref().to_glib_none().0);
1400        }
1401    }
1402
1403    /// Add the text targets supported by [`SelectionData`][crate::SelectionData] to
1404    /// the target list of the drag destination. The targets
1405    /// are added with `info` = 0. If you need another value,
1406    /// use [`TargetList::add_text_targets()`][crate::TargetList::add_text_targets()] and
1407    /// [`drag_dest_set_target_list()`][Self::drag_dest_set_target_list()].
1408    #[doc(alias = "gtk_drag_dest_add_text_targets")]
1409    fn drag_dest_add_text_targets(&self) {
1410        unsafe {
1411            ffi::gtk_drag_dest_add_text_targets(self.as_ref().to_glib_none().0);
1412        }
1413    }
1414
1415    /// Add the URI targets supported by [`SelectionData`][crate::SelectionData] to
1416    /// the target list of the drag destination. The targets
1417    /// are added with `info` = 0. If you need another value,
1418    /// use [`TargetList::add_uri_targets()`][crate::TargetList::add_uri_targets()] and
1419    /// [`drag_dest_set_target_list()`][Self::drag_dest_set_target_list()].
1420    #[doc(alias = "gtk_drag_dest_add_uri_targets")]
1421    fn drag_dest_add_uri_targets(&self) {
1422        unsafe {
1423            ffi::gtk_drag_dest_add_uri_targets(self.as_ref().to_glib_none().0);
1424        }
1425    }
1426
1427    /// Looks for a match between the supported targets of `context` and the
1428    /// `dest_target_list`, returning the first matching target, otherwise
1429    /// returning `GDK_NONE`. `dest_target_list` should usually be the return
1430    /// value from [`drag_dest_get_target_list()`][Self::drag_dest_get_target_list()], but some widgets may
1431    /// have different valid targets for different parts of the widget; in
1432    /// that case, they will have to implement a drag_motion handler that
1433    /// passes the correct target list to this function.
1434    /// ## `context`
1435    /// drag context
1436    /// ## `target_list`
1437    /// list of droppable targets, or [`None`] to use
1438    ///  gtk_drag_dest_get_target_list (`self`).
1439    ///
1440    /// # Returns
1441    ///
1442    /// first target that the source offers
1443    ///  and the dest can accept, or `GDK_NONE`
1444    #[doc(alias = "gtk_drag_dest_find_target")]
1445    fn drag_dest_find_target(
1446        &self,
1447        context: &gdk::DragContext,
1448        target_list: Option<&TargetList>,
1449    ) -> Option<gdk::Atom> {
1450        unsafe {
1451            from_glib_none(ffi::gtk_drag_dest_find_target(
1452                self.as_ref().to_glib_none().0,
1453                context.to_glib_none().0,
1454                target_list.to_glib_none().0,
1455            ))
1456        }
1457    }
1458
1459    /// Returns the list of targets this widget can accept from
1460    /// drag-and-drop.
1461    ///
1462    /// # Returns
1463    ///
1464    /// the [`TargetList`][crate::TargetList], or [`None`] if none
1465    #[doc(alias = "gtk_drag_dest_get_target_list")]
1466    fn drag_dest_get_target_list(&self) -> Option<TargetList> {
1467        unsafe {
1468            from_glib_none(ffi::gtk_drag_dest_get_target_list(
1469                self.as_ref().to_glib_none().0,
1470            ))
1471        }
1472    }
1473
1474    /// Returns whether the widget has been configured to always
1475    /// emit [`drag-motion`][struct@crate::Widget#drag-motion] signals.
1476    ///
1477    /// # Returns
1478    ///
1479    /// [`true`] if the widget always emits
1480    ///  [`drag-motion`][struct@crate::Widget#drag-motion] events
1481    #[doc(alias = "gtk_drag_dest_get_track_motion")]
1482    fn drag_dest_get_track_motion(&self) -> bool {
1483        unsafe {
1484            from_glib(ffi::gtk_drag_dest_get_track_motion(
1485                self.as_ref().to_glib_none().0,
1486            ))
1487        }
1488    }
1489
1490    /// Sets the target types that this widget can accept from drag-and-drop.
1491    /// The widget must first be made into a drag destination with
1492    /// [`WidgetExtManual::drag_dest_set()`][crate::prelude::WidgetExtManual::drag_dest_set()].
1493    /// ## `target_list`
1494    /// list of droppable targets, or [`None`] for none
1495    #[doc(alias = "gtk_drag_dest_set_target_list")]
1496    fn drag_dest_set_target_list(&self, target_list: Option<&TargetList>) {
1497        unsafe {
1498            ffi::gtk_drag_dest_set_target_list(
1499                self.as_ref().to_glib_none().0,
1500                target_list.to_glib_none().0,
1501            );
1502        }
1503    }
1504
1505    /// Tells the widget to emit [`drag-motion`][struct@crate::Widget#drag-motion] and
1506    /// [`drag-leave`][struct@crate::Widget#drag-leave] events regardless of the targets and the
1507    /// [`DestDefaults::MOTION`][crate::DestDefaults::MOTION] flag.
1508    ///
1509    /// This may be used when a widget wants to do generic
1510    /// actions regardless of the targets that the source offers.
1511    /// ## `track_motion`
1512    /// whether to accept all targets
1513    #[doc(alias = "gtk_drag_dest_set_track_motion")]
1514    fn drag_dest_set_track_motion(&self, track_motion: bool) {
1515        unsafe {
1516            ffi::gtk_drag_dest_set_track_motion(
1517                self.as_ref().to_glib_none().0,
1518                track_motion.into_glib(),
1519            );
1520        }
1521    }
1522
1523    /// Clears information about a drop destination set with
1524    /// [`WidgetExtManual::drag_dest_set()`][crate::prelude::WidgetExtManual::drag_dest_set()]. The widget will no longer receive
1525    /// notification of drags.
1526    #[doc(alias = "gtk_drag_dest_unset")]
1527    fn drag_dest_unset(&self) {
1528        unsafe {
1529            ffi::gtk_drag_dest_unset(self.as_ref().to_glib_none().0);
1530        }
1531    }
1532
1533    /// Gets the data associated with a drag. When the data
1534    /// is received or the retrieval fails, GTK+ will emit a
1535    /// [`drag-data-received`][struct@crate::Widget#drag-data-received] signal. Failure of the retrieval
1536    /// is indicated by the length field of the `selection_data`
1537    /// signal parameter being negative. However, when [`drag_get_data()`][Self::drag_get_data()]
1538    /// is called implicitely because the [`DestDefaults::DROP`][crate::DestDefaults::DROP] was set,
1539    /// then the widget will not receive notification of failed
1540    /// drops.
1541    /// ## `context`
1542    /// the drag context
1543    /// ## `target`
1544    /// the target (form of the data) to retrieve
1545    /// ## `time_`
1546    /// a timestamp for retrieving the data. This will
1547    ///  generally be the time received in a [`drag-motion`][struct@crate::Widget#drag-motion]
1548    ///  or [`drag-drop`][struct@crate::Widget#drag-drop] signal
1549    #[doc(alias = "gtk_drag_get_data")]
1550    fn drag_get_data(&self, context: &gdk::DragContext, target: &gdk::Atom, time_: u32) {
1551        unsafe {
1552            ffi::gtk_drag_get_data(
1553                self.as_ref().to_glib_none().0,
1554                context.to_glib_none().0,
1555                target.to_glib_none().0,
1556                time_,
1557            );
1558        }
1559    }
1560
1561    /// Highlights a widget as a currently hovered drop target.
1562    /// To end the highlight, call [`drag_unhighlight()`][Self::drag_unhighlight()].
1563    /// GTK+ calls this automatically if [`DestDefaults::HIGHLIGHT`][crate::DestDefaults::HIGHLIGHT] is set.
1564    #[doc(alias = "gtk_drag_highlight")]
1565    fn drag_highlight(&self) {
1566        unsafe {
1567            ffi::gtk_drag_highlight(self.as_ref().to_glib_none().0);
1568        }
1569    }
1570
1571    /// Add the writable image targets supported by [`SelectionData`][crate::SelectionData] to
1572    /// the target list of the drag source. The targets
1573    /// are added with `info` = 0. If you need another value,
1574    /// use [`TargetList::add_image_targets()`][crate::TargetList::add_image_targets()] and
1575    /// [`drag_source_set_target_list()`][Self::drag_source_set_target_list()].
1576    #[doc(alias = "gtk_drag_source_add_image_targets")]
1577    fn drag_source_add_image_targets(&self) {
1578        unsafe {
1579            ffi::gtk_drag_source_add_image_targets(self.as_ref().to_glib_none().0);
1580        }
1581    }
1582
1583    /// Add the text targets supported by [`SelectionData`][crate::SelectionData] to
1584    /// the target list of the drag source. The targets
1585    /// are added with `info` = 0. If you need another value,
1586    /// use [`TargetList::add_text_targets()`][crate::TargetList::add_text_targets()] and
1587    /// [`drag_source_set_target_list()`][Self::drag_source_set_target_list()].
1588    #[doc(alias = "gtk_drag_source_add_text_targets")]
1589    fn drag_source_add_text_targets(&self) {
1590        unsafe {
1591            ffi::gtk_drag_source_add_text_targets(self.as_ref().to_glib_none().0);
1592        }
1593    }
1594
1595    /// Add the URI targets supported by [`SelectionData`][crate::SelectionData] to
1596    /// the target list of the drag source. The targets
1597    /// are added with `info` = 0. If you need another value,
1598    /// use [`TargetList::add_uri_targets()`][crate::TargetList::add_uri_targets()] and
1599    /// [`drag_source_set_target_list()`][Self::drag_source_set_target_list()].
1600    #[doc(alias = "gtk_drag_source_add_uri_targets")]
1601    fn drag_source_add_uri_targets(&self) {
1602        unsafe {
1603            ffi::gtk_drag_source_add_uri_targets(self.as_ref().to_glib_none().0);
1604        }
1605    }
1606
1607    /// Gets the list of targets this widget can provide for
1608    /// drag-and-drop.
1609    ///
1610    /// # Returns
1611    ///
1612    /// the [`TargetList`][crate::TargetList], or [`None`] if none
1613    #[doc(alias = "gtk_drag_source_get_target_list")]
1614    fn drag_source_get_target_list(&self) -> Option<TargetList> {
1615        unsafe {
1616            from_glib_none(ffi::gtk_drag_source_get_target_list(
1617                self.as_ref().to_glib_none().0,
1618            ))
1619        }
1620    }
1621
1622    /// Sets the icon that will be used for drags from a particular source
1623    /// to `icon`. See the docs for [`IconTheme`][crate::IconTheme] for more details.
1624    /// ## `icon`
1625    /// A [`gio::Icon`][crate::gio::Icon]
1626    #[doc(alias = "gtk_drag_source_set_icon_gicon")]
1627    fn drag_source_set_icon_gicon(&self, icon: &impl IsA<gio::Icon>) {
1628        unsafe {
1629            ffi::gtk_drag_source_set_icon_gicon(
1630                self.as_ref().to_glib_none().0,
1631                icon.as_ref().to_glib_none().0,
1632            );
1633        }
1634    }
1635
1636    /// Sets the icon that will be used for drags from a particular source
1637    /// to a themed icon. See the docs for [`IconTheme`][crate::IconTheme] for more details.
1638    /// ## `icon_name`
1639    /// name of icon to use
1640    #[doc(alias = "gtk_drag_source_set_icon_name")]
1641    fn drag_source_set_icon_name(&self, icon_name: &str) {
1642        unsafe {
1643            ffi::gtk_drag_source_set_icon_name(
1644                self.as_ref().to_glib_none().0,
1645                icon_name.to_glib_none().0,
1646            );
1647        }
1648    }
1649
1650    /// Sets the icon that will be used for drags from a particular widget
1651    /// from a [`gdk_pixbuf::Pixbuf`][crate::gdk_pixbuf::Pixbuf]. GTK+ retains a reference for `pixbuf` and will
1652    /// release it when it is no longer needed.
1653    /// ## `pixbuf`
1654    /// the [`gdk_pixbuf::Pixbuf`][crate::gdk_pixbuf::Pixbuf] for the drag icon
1655    #[doc(alias = "gtk_drag_source_set_icon_pixbuf")]
1656    fn drag_source_set_icon_pixbuf(&self, pixbuf: &gdk_pixbuf::Pixbuf) {
1657        unsafe {
1658            ffi::gtk_drag_source_set_icon_pixbuf(
1659                self.as_ref().to_glib_none().0,
1660                pixbuf.to_glib_none().0,
1661            );
1662        }
1663    }
1664
1665    /// Changes the target types that this widget offers for drag-and-drop.
1666    /// The widget must first be made into a drag source with
1667    /// [`WidgetExtManual::drag_source_set()`][crate::prelude::WidgetExtManual::drag_source_set()].
1668    /// ## `target_list`
1669    /// list of draggable targets, or [`None`] for none
1670    #[doc(alias = "gtk_drag_source_set_target_list")]
1671    fn drag_source_set_target_list(&self, target_list: Option<&TargetList>) {
1672        unsafe {
1673            ffi::gtk_drag_source_set_target_list(
1674                self.as_ref().to_glib_none().0,
1675                target_list.to_glib_none().0,
1676            );
1677        }
1678    }
1679
1680    /// Undoes the effects of [`WidgetExtManual::drag_source_set()`][crate::prelude::WidgetExtManual::drag_source_set()].
1681    #[doc(alias = "gtk_drag_source_unset")]
1682    fn drag_source_unset(&self) {
1683        unsafe {
1684            ffi::gtk_drag_source_unset(self.as_ref().to_glib_none().0);
1685        }
1686    }
1687
1688    /// Removes a highlight set by [`drag_highlight()`][Self::drag_highlight()] from
1689    /// a widget.
1690    #[doc(alias = "gtk_drag_unhighlight")]
1691    fn drag_unhighlight(&self) {
1692        unsafe {
1693            ffi::gtk_drag_unhighlight(self.as_ref().to_glib_none().0);
1694        }
1695    }
1696
1697    /// Draws `self` to `cr`. The top left corner of the widget will be
1698    /// drawn to the currently set origin point of `cr`.
1699    ///
1700    /// You should pass a cairo context as `cr` argument that is in an
1701    /// original state. Otherwise the resulting drawing is undefined. For
1702    /// example changing the operator using `cairo_set_operator()` or the
1703    /// line width using `cairo_set_line_width()` might have unwanted side
1704    /// effects.
1705    /// You may however change the context’s transform matrix - like with
1706    /// `cairo_scale()`, `cairo_translate()` or `cairo_set_matrix()` and clip
1707    /// region with `cairo_clip()` prior to calling this function. Also, it
1708    /// is fine to modify the context with `cairo_save()` and
1709    /// `cairo_push_group()` prior to calling this function.
1710    ///
1711    /// Note that special-purpose widgets may contain special code for
1712    /// rendering to the screen and might appear differently on screen
1713    /// and when rendered using [`draw()`][Self::draw()].
1714    /// ## `cr`
1715    /// a cairo context to draw to
1716    #[doc(alias = "gtk_widget_draw")]
1717    fn draw(&self, cr: &cairo::Context) {
1718        unsafe {
1719            ffi::gtk_widget_draw(
1720                self.as_ref().to_glib_none().0,
1721                mut_override(cr.to_glib_none().0),
1722            );
1723        }
1724    }
1725
1726    /// Notifies the user about an input-related error on this widget.
1727    /// If the [`gtk-error-bell`][struct@crate::Settings#gtk-error-bell] setting is [`true`], it calls
1728    /// [`Window::beep()`][crate::gdk::Window::beep()], otherwise it does nothing.
1729    ///
1730    /// Note that the effect of [`Window::beep()`][crate::gdk::Window::beep()] can be configured in many
1731    /// ways, depending on the windowing backend and the desktop environment
1732    /// or window manager that is used.
1733    #[doc(alias = "gtk_widget_error_bell")]
1734    fn error_bell(&self) {
1735        unsafe {
1736            ffi::gtk_widget_error_bell(self.as_ref().to_glib_none().0);
1737        }
1738    }
1739
1740    /// Rarely-used function. This function is used to emit
1741    /// the event signals on a widget (those signals should never
1742    /// be emitted without using this function to do so).
1743    /// If you want to synthesize an event though, don’t use this function;
1744    /// instead, use [`main_do_event()`][crate::main_do_event()] so the event will behave as if
1745    /// it were in the event queue. Don’t synthesize expose events; instead,
1746    /// use [`Window::invalidate_rect()`][crate::gdk::Window::invalidate_rect()] to invalidate a region of the
1747    /// window.
1748    /// ## `event`
1749    /// a `GdkEvent`
1750    ///
1751    /// # Returns
1752    ///
1753    /// return from the event signal emission ([`true`] if
1754    ///  the event was handled)
1755    #[doc(alias = "gtk_widget_event")]
1756    fn event(&self, event: &gdk::Event) -> bool {
1757        unsafe {
1758            from_glib(ffi::gtk_widget_event(
1759                self.as_ref().to_glib_none().0,
1760                mut_override(event.to_glib_none().0),
1761            ))
1762        }
1763    }
1764
1765    /// Stops emission of [`child-notify`][struct@crate::Widget#child-notify] signals on `self`. The
1766    /// signals are queued until [`thaw_child_notify()`][Self::thaw_child_notify()] is called
1767    /// on `self`.
1768    ///
1769    /// This is the analogue of [`ObjectExt::freeze_notify()`][crate::glib::prelude::ObjectExt::freeze_notify()] for child properties.
1770    #[doc(alias = "gtk_widget_freeze_child_notify")]
1771    fn freeze_child_notify(&self) {
1772        unsafe {
1773            ffi::gtk_widget_freeze_child_notify(self.as_ref().to_glib_none().0);
1774        }
1775    }
1776
1777    /// Returns the accessible object that describes the widget to an
1778    /// assistive technology.
1779    ///
1780    /// If accessibility support is not available, this [`atk::Object`][crate::atk::Object]
1781    /// instance may be a no-op. Likewise, if no class-specific [`atk::Object`][crate::atk::Object]
1782    /// implementation is available for the widget instance in question,
1783    /// it will inherit an [`atk::Object`][crate::atk::Object] implementation from the first ancestor
1784    /// class for which such an implementation is defined.
1785    ///
1786    /// The documentation of the
1787    /// [ATK](http://developer.gnome.org/atk/stable/)
1788    /// library contains more information about accessible objects and their uses.
1789    ///
1790    /// # Returns
1791    ///
1792    /// the [`atk::Object`][crate::atk::Object] associated with `self`
1793    #[doc(alias = "gtk_widget_get_accessible")]
1794    #[doc(alias = "get_accessible")]
1795    fn accessible(&self) -> Option<atk::Object> {
1796        unsafe {
1797            from_glib_none(ffi::gtk_widget_get_accessible(
1798                self.as_ref().to_glib_none().0,
1799            ))
1800        }
1801    }
1802
1803    /// Retrieves the [`gio::ActionGroup`][crate::gio::ActionGroup] that was registered using `prefix`. The resulting
1804    /// [`gio::ActionGroup`][crate::gio::ActionGroup] may have been registered to `self` or any [`Widget`][crate::Widget] in its
1805    /// ancestry.
1806    ///
1807    /// If no action group was found matching `prefix`, then [`None`] is returned.
1808    /// ## `prefix`
1809    /// The “prefix” of the action group.
1810    ///
1811    /// # Returns
1812    ///
1813    /// A [`gio::ActionGroup`][crate::gio::ActionGroup] or [`None`].
1814    #[doc(alias = "gtk_widget_get_action_group")]
1815    #[doc(alias = "get_action_group")]
1816    fn action_group(&self, prefix: &str) -> Option<gio::ActionGroup> {
1817        unsafe {
1818            from_glib_none(ffi::gtk_widget_get_action_group(
1819                self.as_ref().to_glib_none().0,
1820                prefix.to_glib_none().0,
1821            ))
1822        }
1823    }
1824
1825    /// Returns the baseline that has currently been allocated to `self`.
1826    /// This function is intended to be used when implementing handlers
1827    /// for the [`draw`][struct@crate::Widget#draw] function, and when allocating child
1828    /// widgets in [`size_allocate`][struct@crate::Widget#size_allocate].
1829    ///
1830    /// # Returns
1831    ///
1832    /// the baseline of the `self`, or -1 if none
1833    #[doc(alias = "gtk_widget_get_allocated_baseline")]
1834    #[doc(alias = "get_allocated_baseline")]
1835    fn allocated_baseline(&self) -> i32 {
1836        unsafe { ffi::gtk_widget_get_allocated_baseline(self.as_ref().to_glib_none().0) }
1837    }
1838
1839    /// Returns the height that has currently been allocated to `self`.
1840    /// This function is intended to be used when implementing handlers
1841    /// for the [`draw`][struct@crate::Widget#draw] function.
1842    ///
1843    /// # Returns
1844    ///
1845    /// the height of the `self`
1846    #[doc(alias = "gtk_widget_get_allocated_height")]
1847    #[doc(alias = "get_allocated_height")]
1848    fn allocated_height(&self) -> i32 {
1849        unsafe { ffi::gtk_widget_get_allocated_height(self.as_ref().to_glib_none().0) }
1850    }
1851
1852    /// Retrieves the widget’s allocated size.
1853    ///
1854    /// This function returns the last values passed to
1855    /// [`size_allocate_with_baseline()`][Self::size_allocate_with_baseline()]. The value differs from
1856    /// the size returned in [`allocation()`][Self::allocation()] in that functions
1857    /// like [`set_halign()`][Self::set_halign()] can adjust the allocation, but not
1858    /// the value returned by this function.
1859    ///
1860    /// If a widget is not visible, its allocated size is 0.
1861    ///
1862    /// # Returns
1863    ///
1864    ///
1865    /// ## `allocation`
1866    /// a pointer to a `GtkAllocation` to copy to
1867    ///
1868    /// ## `baseline`
1869    /// a pointer to an integer to copy to
1870    #[doc(alias = "gtk_widget_get_allocated_size")]
1871    #[doc(alias = "get_allocated_size")]
1872    fn allocated_size(&self) -> (Allocation, i32) {
1873        unsafe {
1874            let mut allocation = Allocation::uninitialized();
1875            let mut baseline = std::mem::MaybeUninit::uninit();
1876            ffi::gtk_widget_get_allocated_size(
1877                self.as_ref().to_glib_none().0,
1878                allocation.to_glib_none_mut().0,
1879                baseline.as_mut_ptr(),
1880            );
1881            (allocation, baseline.assume_init())
1882        }
1883    }
1884
1885    /// Returns the width that has currently been allocated to `self`.
1886    /// This function is intended to be used when implementing handlers
1887    /// for the [`draw`][struct@crate::Widget#draw] function.
1888    ///
1889    /// # Returns
1890    ///
1891    /// the width of the `self`
1892    #[doc(alias = "gtk_widget_get_allocated_width")]
1893    #[doc(alias = "get_allocated_width")]
1894    fn allocated_width(&self) -> i32 {
1895        unsafe { ffi::gtk_widget_get_allocated_width(self.as_ref().to_glib_none().0) }
1896    }
1897
1898    /// Retrieves the widget’s allocation.
1899    ///
1900    /// Note, when implementing a [`Container`][crate::Container]: a widget’s allocation will
1901    /// be its “adjusted” allocation, that is, the widget’s parent
1902    /// container typically calls [`size_allocate()`][Self::size_allocate()] with an
1903    /// allocation, and that allocation is then adjusted (to handle margin
1904    /// and alignment for example) before assignment to the widget.
1905    /// [`allocation()`][Self::allocation()] returns the adjusted allocation that
1906    /// was actually assigned to the widget. The adjusted allocation is
1907    /// guaranteed to be completely contained within the
1908    /// [`size_allocate()`][Self::size_allocate()] allocation, however. So a [`Container`][crate::Container]
1909    /// is guaranteed that its children stay inside the assigned bounds,
1910    /// but not that they have exactly the bounds the container assigned.
1911    /// There is no way to get the original allocation assigned by
1912    /// [`size_allocate()`][Self::size_allocate()], since it isn’t stored; if a container
1913    /// implementation needs that information it will have to track it itself.
1914    ///
1915    /// # Returns
1916    ///
1917    ///
1918    /// ## `allocation`
1919    /// a pointer to a `GtkAllocation` to copy to
1920    #[doc(alias = "gtk_widget_get_allocation")]
1921    #[doc(alias = "get_allocation")]
1922    fn allocation(&self) -> Allocation {
1923        unsafe {
1924            let mut allocation = Allocation::uninitialized();
1925            ffi::gtk_widget_get_allocation(
1926                self.as_ref().to_glib_none().0,
1927                allocation.to_glib_none_mut().0,
1928            );
1929            allocation
1930        }
1931    }
1932
1933    /// Gets the first ancestor of `self` with type `widget_type`. For example,
1934    /// `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)` gets
1935    /// the first [`Box`][crate::Box] that’s an ancestor of `self`. No reference will be
1936    /// added to the returned widget; it should not be unreferenced. See note
1937    /// about checking for a toplevel [`Window`][crate::Window] in the docs for
1938    /// [`toplevel()`][Self::toplevel()].
1939    ///
1940    /// Note that unlike [`is_ancestor()`][Self::is_ancestor()], [`ancestor()`][Self::ancestor()]
1941    /// considers `self` to be an ancestor of itself.
1942    /// ## `widget_type`
1943    /// ancestor type
1944    ///
1945    /// # Returns
1946    ///
1947    /// the ancestor widget, or [`None`] if not found
1948    #[doc(alias = "gtk_widget_get_ancestor")]
1949    #[doc(alias = "get_ancestor")]
1950    #[must_use]
1951    fn ancestor(&self, widget_type: glib::types::Type) -> Option<Widget> {
1952        unsafe {
1953            from_glib_none(ffi::gtk_widget_get_ancestor(
1954                self.as_ref().to_glib_none().0,
1955                widget_type.into_glib(),
1956            ))
1957        }
1958    }
1959
1960    /// Determines whether the application intends to draw on the widget in
1961    /// an [`draw`][struct@crate::Widget#draw] handler.
1962    ///
1963    /// See [`set_app_paintable()`][Self::set_app_paintable()]
1964    ///
1965    /// # Returns
1966    ///
1967    /// [`true`] if the widget is app paintable
1968    #[doc(alias = "gtk_widget_get_app_paintable")]
1969    #[doc(alias = "get_app_paintable")]
1970    #[doc(alias = "app-paintable")]
1971    fn is_app_paintable(&self) -> bool {
1972        unsafe {
1973            from_glib(ffi::gtk_widget_get_app_paintable(
1974                self.as_ref().to_glib_none().0,
1975            ))
1976        }
1977    }
1978
1979    /// Determines whether `self` can be a default widget. See
1980    /// [`set_can_default()`][Self::set_can_default()].
1981    ///
1982    /// # Returns
1983    ///
1984    /// [`true`] if `self` can be a default widget, [`false`] otherwise
1985    #[doc(alias = "gtk_widget_get_can_default")]
1986    #[doc(alias = "get_can_default")]
1987    #[doc(alias = "can-default")]
1988    fn can_default(&self) -> bool {
1989        unsafe {
1990            from_glib(ffi::gtk_widget_get_can_default(
1991                self.as_ref().to_glib_none().0,
1992            ))
1993        }
1994    }
1995
1996    /// Determines whether `self` can own the input focus. See
1997    /// [`set_can_focus()`][Self::set_can_focus()].
1998    ///
1999    /// # Returns
2000    ///
2001    /// [`true`] if `self` can own the input focus, [`false`] otherwise
2002    #[doc(alias = "gtk_widget_get_can_focus")]
2003    #[doc(alias = "get_can_focus")]
2004    #[doc(alias = "can-focus")]
2005    fn can_focus(&self) -> bool {
2006        unsafe {
2007            from_glib(ffi::gtk_widget_get_can_focus(
2008                self.as_ref().to_glib_none().0,
2009            ))
2010        }
2011    }
2012
2013    /// Gets the value set with [`set_child_visible()`][Self::set_child_visible()].
2014    /// If you feel a need to use this function, your code probably
2015    /// needs reorganization.
2016    ///
2017    /// This function is only useful for container implementations and
2018    /// never should be called by an application.
2019    ///
2020    /// # Returns
2021    ///
2022    /// [`true`] if the widget is mapped with the parent.
2023    #[doc(alias = "gtk_widget_get_child_visible")]
2024    #[doc(alias = "get_child_visible")]
2025    fn is_child_visible(&self) -> bool {
2026        unsafe {
2027            from_glib(ffi::gtk_widget_get_child_visible(
2028                self.as_ref().to_glib_none().0,
2029            ))
2030        }
2031    }
2032
2033    /// Retrieves the widget’s clip area.
2034    ///
2035    /// The clip area is the area in which all of `self`'s drawing will
2036    /// happen. Other toolkits call it the bounding box.
2037    ///
2038    /// Historically, in GTK+ the clip area has been equal to the allocation
2039    /// retrieved via [`allocation()`][Self::allocation()].
2040    ///
2041    /// # Returns
2042    ///
2043    ///
2044    /// ## `clip`
2045    /// a pointer to a `GtkAllocation` to copy to
2046    #[doc(alias = "gtk_widget_get_clip")]
2047    #[doc(alias = "get_clip")]
2048    fn clip(&self) -> Allocation {
2049        unsafe {
2050            let mut clip = Allocation::uninitialized();
2051            ffi::gtk_widget_get_clip(self.as_ref().to_glib_none().0, clip.to_glib_none_mut().0);
2052            clip
2053        }
2054    }
2055
2056    /// Returns the clipboard object for the given selection to
2057    /// be used with `self`. `self` must have a [`gdk::Display`][crate::gdk::Display]
2058    /// associated with it, so must be attached to a toplevel
2059    /// window.
2060    /// ## `selection`
2061    /// a [`gdk::Atom`][crate::gdk::Atom] which identifies the clipboard
2062    ///  to use. `GDK_SELECTION_CLIPBOARD` gives the
2063    ///  default clipboard. Another common value
2064    ///  is `GDK_SELECTION_PRIMARY`, which gives
2065    ///  the primary X selection.
2066    ///
2067    /// # Returns
2068    ///
2069    /// the appropriate clipboard object. If no
2070    ///  clipboard already exists, a new one will
2071    ///  be created. Once a clipboard object has
2072    ///  been created, it is persistent for all time.
2073    #[doc(alias = "gtk_widget_get_clipboard")]
2074    #[doc(alias = "get_clipboard")]
2075    fn clipboard(&self, selection: &gdk::Atom) -> Clipboard {
2076        unsafe {
2077            from_glib_none(ffi::gtk_widget_get_clipboard(
2078                self.as_ref().to_glib_none().0,
2079                selection.to_glib_none().0,
2080            ))
2081        }
2082    }
2083
2084    /// Returns whether `device` can interact with `self` and its
2085    /// children. See [`set_device_enabled()`][Self::set_device_enabled()].
2086    /// ## `device`
2087    /// a [`gdk::Device`][crate::gdk::Device]
2088    ///
2089    /// # Returns
2090    ///
2091    /// [`true`] is `device` is enabled for `self`
2092    #[doc(alias = "gtk_widget_get_device_enabled")]
2093    #[doc(alias = "get_device_enabled")]
2094    fn device_is_enabled(&self, device: &gdk::Device) -> bool {
2095        unsafe {
2096            from_glib(ffi::gtk_widget_get_device_enabled(
2097                self.as_ref().to_glib_none().0,
2098                device.to_glib_none().0,
2099            ))
2100        }
2101    }
2102
2103    /// Returns the events mask for the widget corresponding to an specific device. These
2104    /// are the events that the widget will receive when `device` operates on it.
2105    /// ## `device`
2106    /// a [`gdk::Device`][crate::gdk::Device]
2107    ///
2108    /// # Returns
2109    ///
2110    /// device event mask for `self`
2111    #[doc(alias = "gtk_widget_get_device_events")]
2112    #[doc(alias = "get_device_events")]
2113    fn device_events(&self, device: &gdk::Device) -> gdk::EventMask {
2114        unsafe {
2115            from_glib(ffi::gtk_widget_get_device_events(
2116                self.as_ref().to_glib_none().0,
2117                device.to_glib_none().0,
2118            ))
2119        }
2120    }
2121
2122    /// Gets the reading direction for a particular widget. See
2123    /// [`set_direction()`][Self::set_direction()].
2124    ///
2125    /// # Returns
2126    ///
2127    /// the reading direction for the widget.
2128    #[doc(alias = "gtk_widget_get_direction")]
2129    #[doc(alias = "get_direction")]
2130    fn direction(&self) -> TextDirection {
2131        unsafe {
2132            from_glib(ffi::gtk_widget_get_direction(
2133                self.as_ref().to_glib_none().0,
2134            ))
2135        }
2136    }
2137
2138    /// Get the [`gdk::Display`][crate::gdk::Display] for the toplevel window associated with
2139    /// this widget. This function can only be called after the widget
2140    /// has been added to a widget hierarchy with a [`Window`][crate::Window] at the top.
2141    ///
2142    /// In general, you should only create display specific
2143    /// resources when a widget has been realized, and you should
2144    /// free those resources when the widget is unrealized.
2145    ///
2146    /// # Returns
2147    ///
2148    /// the [`gdk::Display`][crate::gdk::Display] for the toplevel for this widget.
2149    #[doc(alias = "gtk_widget_get_display")]
2150    #[doc(alias = "get_display")]
2151    fn display(&self) -> gdk::Display {
2152        unsafe { from_glib_none(ffi::gtk_widget_get_display(self.as_ref().to_glib_none().0)) }
2153    }
2154
2155    /// Determines whether the widget is double buffered.
2156    ///
2157    /// See `gtk_widget_set_double_buffered()`
2158    ///
2159    /// # Returns
2160    ///
2161    /// [`true`] if the widget is double buffered
2162    #[doc(alias = "gtk_widget_get_double_buffered")]
2163    #[doc(alias = "get_double_buffered")]
2164    #[doc(alias = "double-buffered")]
2165    fn is_double_buffered(&self) -> bool {
2166        unsafe {
2167            from_glib(ffi::gtk_widget_get_double_buffered(
2168                self.as_ref().to_glib_none().0,
2169            ))
2170        }
2171    }
2172
2173    /// Returns whether the widget should grab focus when it is clicked with the mouse.
2174    /// See [`set_focus_on_click()`][Self::set_focus_on_click()].
2175    ///
2176    /// # Returns
2177    ///
2178    /// [`true`] if the widget should grab focus when it is clicked with
2179    ///  the mouse.
2180    #[doc(alias = "gtk_widget_get_focus_on_click")]
2181    #[doc(alias = "get_focus_on_click")]
2182    #[doc(alias = "focus-on-click")]
2183    fn gets_focus_on_click(&self) -> bool {
2184        unsafe {
2185            from_glib(ffi::gtk_widget_get_focus_on_click(
2186                self.as_ref().to_glib_none().0,
2187            ))
2188        }
2189    }
2190
2191    /// Gets the font map that has been set with [`set_font_map()`][Self::set_font_map()].
2192    ///
2193    /// # Returns
2194    ///
2195    /// A [`pango::FontMap`][crate::pango::FontMap], or [`None`]
2196    #[doc(alias = "gtk_widget_get_font_map")]
2197    #[doc(alias = "get_font_map")]
2198    fn font_map(&self) -> Option<pango::FontMap> {
2199        unsafe { from_glib_none(ffi::gtk_widget_get_font_map(self.as_ref().to_glib_none().0)) }
2200    }
2201
2202    /// Returns the [`cairo::FontOptions`][crate::cairo::FontOptions] used for Pango rendering. When not set,
2203    /// the defaults font options for the [`gdk::Screen`][crate::gdk::Screen] will be used.
2204    ///
2205    /// # Returns
2206    ///
2207    /// the [`cairo::FontOptions`][crate::cairo::FontOptions] or [`None`] if not set
2208    #[doc(alias = "gtk_widget_get_font_options")]
2209    #[doc(alias = "get_font_options")]
2210    fn font_options(&self) -> Option<cairo::FontOptions> {
2211        unsafe {
2212            from_glib_none(ffi::gtk_widget_get_font_options(
2213                self.as_ref().to_glib_none().0,
2214            ))
2215        }
2216    }
2217
2218    /// Obtains the frame clock for a widget. The frame clock is a global
2219    /// “ticker” that can be used to drive animations and repaints. The
2220    /// most common reason to get the frame clock is to call
2221    /// [`FrameClock::frame_time()`][crate::gdk::FrameClock::frame_time()], in order to get a time to use for
2222    /// animating. For example you might record the start of the animation
2223    /// with an initial value from [`FrameClock::frame_time()`][crate::gdk::FrameClock::frame_time()], and
2224    /// then update the animation by calling
2225    /// [`FrameClock::frame_time()`][crate::gdk::FrameClock::frame_time()] again during each repaint.
2226    ///
2227    /// [`FrameClock::request_phase()`][crate::gdk::FrameClock::request_phase()] will result in a new frame on the
2228    /// clock, but won’t necessarily repaint any widgets. To repaint a
2229    /// widget, you have to use [`queue_draw()`][Self::queue_draw()] which invalidates
2230    /// the widget (thus scheduling it to receive a draw on the next
2231    /// frame). [`queue_draw()`][Self::queue_draw()] will also end up requesting a frame
2232    /// on the appropriate frame clock.
2233    ///
2234    /// A widget’s frame clock will not change while the widget is
2235    /// mapped. Reparenting a widget (which implies a temporary unmap) can
2236    /// change the widget’s frame clock.
2237    ///
2238    /// Unrealized widgets do not have a frame clock.
2239    ///
2240    /// # Returns
2241    ///
2242    /// a [`gdk::FrameClock`][crate::gdk::FrameClock],
2243    /// or [`None`] if widget is unrealized
2244    #[doc(alias = "gtk_widget_get_frame_clock")]
2245    #[doc(alias = "get_frame_clock")]
2246    fn frame_clock(&self) -> Option<gdk::FrameClock> {
2247        unsafe {
2248            from_glib_none(ffi::gtk_widget_get_frame_clock(
2249                self.as_ref().to_glib_none().0,
2250            ))
2251        }
2252    }
2253
2254    /// Gets the value of the [`halign`][struct@crate::Widget#halign] property.
2255    ///
2256    /// For backwards compatibility reasons this method will never return
2257    /// [`Align::Baseline`][crate::Align::Baseline], but instead it will convert it to
2258    /// [`Align::Fill`][crate::Align::Fill]. Baselines are not supported for horizontal
2259    /// alignment.
2260    ///
2261    /// # Returns
2262    ///
2263    /// the horizontal alignment of `self`
2264    #[doc(alias = "gtk_widget_get_halign")]
2265    #[doc(alias = "get_halign")]
2266    fn halign(&self) -> Align {
2267        unsafe { from_glib(ffi::gtk_widget_get_halign(self.as_ref().to_glib_none().0)) }
2268    }
2269
2270    /// Returns the current value of the has-tooltip property. See
2271    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] for more information.
2272    ///
2273    /// # Returns
2274    ///
2275    /// current value of has-tooltip on `self`.
2276    #[doc(alias = "gtk_widget_get_has_tooltip")]
2277    #[doc(alias = "get_has_tooltip")]
2278    #[doc(alias = "has-tooltip")]
2279    fn has_tooltip(&self) -> bool {
2280        unsafe {
2281            from_glib(ffi::gtk_widget_get_has_tooltip(
2282                self.as_ref().to_glib_none().0,
2283            ))
2284        }
2285    }
2286
2287    /// Determines whether `self` has a [`gdk::Window`][crate::gdk::Window] of its own. See
2288    /// [`set_has_window()`][Self::set_has_window()].
2289    ///
2290    /// # Returns
2291    ///
2292    /// [`true`] if `self` has a window, [`false`] otherwise
2293    #[doc(alias = "gtk_widget_get_has_window")]
2294    #[doc(alias = "get_has_window")]
2295    fn has_window(&self) -> bool {
2296        unsafe {
2297            from_glib(ffi::gtk_widget_get_has_window(
2298                self.as_ref().to_glib_none().0,
2299            ))
2300        }
2301    }
2302
2303    /// Gets whether the widget would like any available extra horizontal
2304    /// space. When a user resizes a [`Window`][crate::Window], widgets with expand=TRUE
2305    /// generally receive the extra space. For example, a list or
2306    /// scrollable area or document in your window would often be set to
2307    /// expand.
2308    ///
2309    /// Containers should use [`compute_expand()`][Self::compute_expand()] rather than
2310    /// this function, to see whether a widget, or any of its children,
2311    /// has the expand flag set. If any child of a widget wants to
2312    /// expand, the parent may ask to expand also.
2313    ///
2314    /// This function only looks at the widget’s own hexpand flag, rather
2315    /// than computing whether the entire widget tree rooted at this widget
2316    /// wants to expand.
2317    ///
2318    /// # Returns
2319    ///
2320    /// whether hexpand flag is set
2321    #[doc(alias = "gtk_widget_get_hexpand")]
2322    #[doc(alias = "get_hexpand")]
2323    #[doc(alias = "hexpand")]
2324    fn hexpands(&self) -> bool {
2325        unsafe { from_glib(ffi::gtk_widget_get_hexpand(self.as_ref().to_glib_none().0)) }
2326    }
2327
2328    /// Gets whether [`set_hexpand()`][Self::set_hexpand()] has been used to
2329    /// explicitly set the expand flag on this widget.
2330    ///
2331    /// If hexpand is set, then it overrides any computed
2332    /// expand value based on child widgets. If hexpand is not
2333    /// set, then the expand value depends on whether any
2334    /// children of the widget would like to expand.
2335    ///
2336    /// There are few reasons to use this function, but it’s here
2337    /// for completeness and consistency.
2338    ///
2339    /// # Returns
2340    ///
2341    /// whether hexpand has been explicitly set
2342    #[doc(alias = "gtk_widget_get_hexpand_set")]
2343    #[doc(alias = "get_hexpand_set")]
2344    #[doc(alias = "hexpand-set")]
2345    fn is_hexpand_set(&self) -> bool {
2346        unsafe {
2347            from_glib(ffi::gtk_widget_get_hexpand_set(
2348                self.as_ref().to_glib_none().0,
2349            ))
2350        }
2351    }
2352
2353    /// Whether the widget is mapped.
2354    ///
2355    /// # Returns
2356    ///
2357    /// [`true`] if the widget is mapped, [`false`] otherwise.
2358    #[doc(alias = "gtk_widget_get_mapped")]
2359    #[doc(alias = "get_mapped")]
2360    fn is_mapped(&self) -> bool {
2361        unsafe { from_glib(ffi::gtk_widget_get_mapped(self.as_ref().to_glib_none().0)) }
2362    }
2363
2364    /// Gets the value of the [`margin-bottom`][struct@crate::Widget#margin-bottom] property.
2365    ///
2366    /// # Returns
2367    ///
2368    /// The bottom margin of `self`
2369    #[doc(alias = "gtk_widget_get_margin_bottom")]
2370    #[doc(alias = "get_margin_bottom")]
2371    #[doc(alias = "margin-bottom")]
2372    fn margin_bottom(&self) -> i32 {
2373        unsafe { ffi::gtk_widget_get_margin_bottom(self.as_ref().to_glib_none().0) }
2374    }
2375
2376    /// Gets the value of the [`margin-end`][struct@crate::Widget#margin-end] property.
2377    ///
2378    /// # Returns
2379    ///
2380    /// The end margin of `self`
2381    #[doc(alias = "gtk_widget_get_margin_end")]
2382    #[doc(alias = "get_margin_end")]
2383    #[doc(alias = "margin-end")]
2384    fn margin_end(&self) -> i32 {
2385        unsafe { ffi::gtk_widget_get_margin_end(self.as_ref().to_glib_none().0) }
2386    }
2387
2388    /// Gets the value of the [`margin-start`][struct@crate::Widget#margin-start] property.
2389    ///
2390    /// # Returns
2391    ///
2392    /// The start margin of `self`
2393    #[doc(alias = "gtk_widget_get_margin_start")]
2394    #[doc(alias = "get_margin_start")]
2395    #[doc(alias = "margin-start")]
2396    fn margin_start(&self) -> i32 {
2397        unsafe { ffi::gtk_widget_get_margin_start(self.as_ref().to_glib_none().0) }
2398    }
2399
2400    /// Gets the value of the [`margin-top`][struct@crate::Widget#margin-top] property.
2401    ///
2402    /// # Returns
2403    ///
2404    /// The top margin of `self`
2405    #[doc(alias = "gtk_widget_get_margin_top")]
2406    #[doc(alias = "get_margin_top")]
2407    #[doc(alias = "margin-top")]
2408    fn margin_top(&self) -> i32 {
2409        unsafe { ffi::gtk_widget_get_margin_top(self.as_ref().to_glib_none().0) }
2410    }
2411
2412    /// Returns the modifier mask the `self`’s windowing system backend
2413    /// uses for a particular purpose.
2414    ///
2415    /// See `gdk_keymap_get_modifier_mask()`.
2416    /// ## `intent`
2417    /// the use case for the modifier mask
2418    ///
2419    /// # Returns
2420    ///
2421    /// the modifier mask used for `intent`.
2422    #[doc(alias = "gtk_widget_get_modifier_mask")]
2423    #[doc(alias = "get_modifier_mask")]
2424    fn modifier_mask(&self, intent: gdk::ModifierIntent) -> gdk::ModifierType {
2425        unsafe {
2426            from_glib(ffi::gtk_widget_get_modifier_mask(
2427                self.as_ref().to_glib_none().0,
2428                intent.into_glib(),
2429            ))
2430        }
2431    }
2432
2433    /// Retrieves the name of a widget. See [`set_widget_name()`][Self::set_widget_name()] for the
2434    /// significance of widget names.
2435    ///
2436    /// # Returns
2437    ///
2438    /// name of the widget. This string is owned by GTK+ and
2439    /// should not be modified or freed
2440    #[doc(alias = "gtk_widget_get_name")]
2441    #[doc(alias = "get_name")]
2442    #[doc(alias = "name")]
2443    fn widget_name(&self) -> glib::GString {
2444        unsafe { from_glib_none(ffi::gtk_widget_get_name(self.as_ref().to_glib_none().0)) }
2445    }
2446
2447    /// Returns the current value of the [`no-show-all`][struct@crate::Widget#no-show-all] property,
2448    /// which determines whether calls to [`show_all()`][Self::show_all()]
2449    /// will affect this widget.
2450    ///
2451    /// # Returns
2452    ///
2453    /// the current value of the “no-show-all” property.
2454    #[doc(alias = "gtk_widget_get_no_show_all")]
2455    #[doc(alias = "get_no_show_all")]
2456    #[doc(alias = "no-show-all")]
2457    fn is_no_show_all(&self) -> bool {
2458        unsafe {
2459            from_glib(ffi::gtk_widget_get_no_show_all(
2460                self.as_ref().to_glib_none().0,
2461            ))
2462        }
2463    }
2464
2465    /// Fetches the requested opacity for this widget.
2466    /// See [`set_opacity()`][Self::set_opacity()].
2467    ///
2468    /// # Returns
2469    ///
2470    /// the requested opacity for this widget.
2471    #[doc(alias = "gtk_widget_get_opacity")]
2472    #[doc(alias = "get_opacity")]
2473    fn opacity(&self) -> f64 {
2474        unsafe { ffi::gtk_widget_get_opacity(self.as_ref().to_glib_none().0) }
2475    }
2476
2477    /// Gets a [`pango::Context`][crate::pango::Context] with the appropriate font map, font description,
2478    /// and base direction for this widget. Unlike the context returned
2479    /// by [`create_pango_context()`][Self::create_pango_context()], this context is owned by
2480    /// the widget (it can be used until the screen for the widget changes
2481    /// or the widget is removed from its toplevel), and will be updated to
2482    /// match any changes to the widget’s attributes. This can be tracked
2483    /// by using the [`screen-changed`][struct@crate::Widget#screen-changed] signal on the widget.
2484    ///
2485    /// # Returns
2486    ///
2487    /// the [`pango::Context`][crate::pango::Context] for the widget.
2488    #[doc(alias = "gtk_widget_get_pango_context")]
2489    #[doc(alias = "get_pango_context")]
2490    fn pango_context(&self) -> pango::Context {
2491        unsafe {
2492            from_glib_none(ffi::gtk_widget_get_pango_context(
2493                self.as_ref().to_glib_none().0,
2494            ))
2495        }
2496    }
2497
2498    /// Returns the parent container of `self`.
2499    ///
2500    /// # Returns
2501    ///
2502    /// the parent container of `self`, or [`None`]
2503    #[doc(alias = "gtk_widget_get_parent")]
2504    #[doc(alias = "get_parent")]
2505    #[must_use]
2506    fn parent(&self) -> Option<Widget> {
2507        unsafe { from_glib_none(ffi::gtk_widget_get_parent(self.as_ref().to_glib_none().0)) }
2508    }
2509
2510    /// Gets `self`’s parent window, or [`None`] if it does not have one.
2511    ///
2512    /// # Returns
2513    ///
2514    /// the parent window of `self`, or [`None`]
2515    /// if it does not have a parent window.
2516    #[doc(alias = "gtk_widget_get_parent_window")]
2517    #[doc(alias = "get_parent_window")]
2518    fn parent_window(&self) -> Option<gdk::Window> {
2519        unsafe {
2520            from_glib_none(ffi::gtk_widget_get_parent_window(
2521                self.as_ref().to_glib_none().0,
2522            ))
2523        }
2524    }
2525
2526    /// Returns the [`WidgetPath`][crate::WidgetPath] representing `self`, if the widget
2527    /// is not connected to a toplevel widget, a partial path will be
2528    /// created.
2529    ///
2530    /// # Returns
2531    ///
2532    /// The [`WidgetPath`][crate::WidgetPath] representing `self`
2533    #[doc(alias = "gtk_widget_get_path")]
2534    #[doc(alias = "get_path")]
2535    fn path(&self) -> WidgetPath {
2536        unsafe { from_glib_none(ffi::gtk_widget_get_path(self.as_ref().to_glib_none().0)) }
2537    }
2538
2539    /// Retrieves a widget’s initial minimum and natural height.
2540    ///
2541    /// This call is specific to width-for-height requests.
2542    ///
2543    /// The returned request will be modified by the
2544    /// GtkWidgetClass::adjust_size_request virtual method and by any
2545    /// `GtkSizeGroups` that have been applied. That is, the returned request
2546    /// is the one that should be used for layout, not necessarily the one
2547    /// returned by the widget itself.
2548    ///
2549    /// # Returns
2550    ///
2551    ///
2552    /// ## `minimum_height`
2553    /// location to store the minimum height, or [`None`]
2554    ///
2555    /// ## `natural_height`
2556    /// location to store the natural height, or [`None`]
2557    #[doc(alias = "gtk_widget_get_preferred_height")]
2558    #[doc(alias = "get_preferred_height")]
2559    fn preferred_height(&self) -> (i32, i32) {
2560        unsafe {
2561            let mut minimum_height = std::mem::MaybeUninit::uninit();
2562            let mut natural_height = std::mem::MaybeUninit::uninit();
2563            ffi::gtk_widget_get_preferred_height(
2564                self.as_ref().to_glib_none().0,
2565                minimum_height.as_mut_ptr(),
2566                natural_height.as_mut_ptr(),
2567            );
2568            (minimum_height.assume_init(), natural_height.assume_init())
2569        }
2570    }
2571
2572    /// Retrieves a widget’s minimum and natural height and the corresponding baselines if it would be given
2573    /// the specified `width`, or the default height if `width` is -1. The baselines may be -1 which means
2574    /// that no baseline is requested for this widget.
2575    ///
2576    /// The returned request will be modified by the
2577    /// GtkWidgetClass::adjust_size_request and GtkWidgetClass::adjust_baseline_request virtual methods
2578    /// and by any `GtkSizeGroups` that have been applied. That is, the returned request
2579    /// is the one that should be used for layout, not necessarily the one
2580    /// returned by the widget itself.
2581    /// ## `width`
2582    /// the width which is available for allocation, or -1 if none
2583    ///
2584    /// # Returns
2585    ///
2586    ///
2587    /// ## `minimum_height`
2588    /// location for storing the minimum height, or [`None`]
2589    ///
2590    /// ## `natural_height`
2591    /// location for storing the natural height, or [`None`]
2592    ///
2593    /// ## `minimum_baseline`
2594    /// location for storing the baseline for the minimum height, or [`None`]
2595    ///
2596    /// ## `natural_baseline`
2597    /// location for storing the baseline for the natural height, or [`None`]
2598    #[doc(alias = "gtk_widget_get_preferred_height_and_baseline_for_width")]
2599    #[doc(alias = "get_preferred_height_and_baseline_for_width")]
2600    fn preferred_height_and_baseline_for_width(&self, width: i32) -> (i32, i32, i32, i32) {
2601        unsafe {
2602            let mut minimum_height = std::mem::MaybeUninit::uninit();
2603            let mut natural_height = std::mem::MaybeUninit::uninit();
2604            let mut minimum_baseline = std::mem::MaybeUninit::uninit();
2605            let mut natural_baseline = std::mem::MaybeUninit::uninit();
2606            ffi::gtk_widget_get_preferred_height_and_baseline_for_width(
2607                self.as_ref().to_glib_none().0,
2608                width,
2609                minimum_height.as_mut_ptr(),
2610                natural_height.as_mut_ptr(),
2611                minimum_baseline.as_mut_ptr(),
2612                natural_baseline.as_mut_ptr(),
2613            );
2614            (
2615                minimum_height.assume_init(),
2616                natural_height.assume_init(),
2617                minimum_baseline.assume_init(),
2618                natural_baseline.assume_init(),
2619            )
2620        }
2621    }
2622
2623    /// Retrieves a widget’s minimum and natural height if it would be given
2624    /// the specified `width`.
2625    ///
2626    /// The returned request will be modified by the
2627    /// GtkWidgetClass::adjust_size_request virtual method and by any
2628    /// `GtkSizeGroups` that have been applied. That is, the returned request
2629    /// is the one that should be used for layout, not necessarily the one
2630    /// returned by the widget itself.
2631    /// ## `width`
2632    /// the width which is available for allocation
2633    ///
2634    /// # Returns
2635    ///
2636    ///
2637    /// ## `minimum_height`
2638    /// location for storing the minimum height, or [`None`]
2639    ///
2640    /// ## `natural_height`
2641    /// location for storing the natural height, or [`None`]
2642    #[doc(alias = "gtk_widget_get_preferred_height_for_width")]
2643    #[doc(alias = "get_preferred_height_for_width")]
2644    fn preferred_height_for_width(&self, width: i32) -> (i32, i32) {
2645        unsafe {
2646            let mut minimum_height = std::mem::MaybeUninit::uninit();
2647            let mut natural_height = std::mem::MaybeUninit::uninit();
2648            ffi::gtk_widget_get_preferred_height_for_width(
2649                self.as_ref().to_glib_none().0,
2650                width,
2651                minimum_height.as_mut_ptr(),
2652                natural_height.as_mut_ptr(),
2653            );
2654            (minimum_height.assume_init(), natural_height.assume_init())
2655        }
2656    }
2657
2658    /// Retrieves the minimum and natural size of a widget, taking
2659    /// into account the widget’s preference for height-for-width management.
2660    ///
2661    /// This is used to retrieve a suitable size by container widgets which do
2662    /// not impose any restrictions on the child placement. It can be used
2663    /// to deduce toplevel window and menu sizes as well as child widgets in
2664    /// free-form containers such as GtkLayout.
2665    ///
2666    /// Handle with care. Note that the natural height of a height-for-width
2667    /// widget will generally be a smaller size than the minimum height, since the required
2668    /// height for the natural width is generally smaller than the required height for
2669    /// the minimum width.
2670    ///
2671    /// Use [`preferred_height_and_baseline_for_width()`][Self::preferred_height_and_baseline_for_width()] if you want to support
2672    /// baseline alignment.
2673    ///
2674    /// # Returns
2675    ///
2676    ///
2677    /// ## `minimum_size`
2678    /// location for storing the minimum size, or [`None`]
2679    ///
2680    /// ## `natural_size`
2681    /// location for storing the natural size, or [`None`]
2682    #[doc(alias = "gtk_widget_get_preferred_size")]
2683    #[doc(alias = "get_preferred_size")]
2684    fn preferred_size(&self) -> (Requisition, Requisition) {
2685        unsafe {
2686            let mut minimum_size = Requisition::uninitialized();
2687            let mut natural_size = Requisition::uninitialized();
2688            ffi::gtk_widget_get_preferred_size(
2689                self.as_ref().to_glib_none().0,
2690                minimum_size.to_glib_none_mut().0,
2691                natural_size.to_glib_none_mut().0,
2692            );
2693            (minimum_size, natural_size)
2694        }
2695    }
2696
2697    /// Retrieves a widget’s initial minimum and natural width.
2698    ///
2699    /// This call is specific to height-for-width requests.
2700    ///
2701    /// The returned request will be modified by the
2702    /// GtkWidgetClass::adjust_size_request virtual method and by any
2703    /// `GtkSizeGroups` that have been applied. That is, the returned request
2704    /// is the one that should be used for layout, not necessarily the one
2705    /// returned by the widget itself.
2706    ///
2707    /// # Returns
2708    ///
2709    ///
2710    /// ## `minimum_width`
2711    /// location to store the minimum width, or [`None`]
2712    ///
2713    /// ## `natural_width`
2714    /// location to store the natural width, or [`None`]
2715    #[doc(alias = "gtk_widget_get_preferred_width")]
2716    #[doc(alias = "get_preferred_width")]
2717    fn preferred_width(&self) -> (i32, i32) {
2718        unsafe {
2719            let mut minimum_width = std::mem::MaybeUninit::uninit();
2720            let mut natural_width = std::mem::MaybeUninit::uninit();
2721            ffi::gtk_widget_get_preferred_width(
2722                self.as_ref().to_glib_none().0,
2723                minimum_width.as_mut_ptr(),
2724                natural_width.as_mut_ptr(),
2725            );
2726            (minimum_width.assume_init(), natural_width.assume_init())
2727        }
2728    }
2729
2730    /// Retrieves a widget’s minimum and natural width if it would be given
2731    /// the specified `height`.
2732    ///
2733    /// The returned request will be modified by the
2734    /// GtkWidgetClass::adjust_size_request virtual method and by any
2735    /// `GtkSizeGroups` that have been applied. That is, the returned request
2736    /// is the one that should be used for layout, not necessarily the one
2737    /// returned by the widget itself.
2738    /// ## `height`
2739    /// the height which is available for allocation
2740    ///
2741    /// # Returns
2742    ///
2743    ///
2744    /// ## `minimum_width`
2745    /// location for storing the minimum width, or [`None`]
2746    ///
2747    /// ## `natural_width`
2748    /// location for storing the natural width, or [`None`]
2749    #[doc(alias = "gtk_widget_get_preferred_width_for_height")]
2750    #[doc(alias = "get_preferred_width_for_height")]
2751    fn preferred_width_for_height(&self, height: i32) -> (i32, i32) {
2752        unsafe {
2753            let mut minimum_width = std::mem::MaybeUninit::uninit();
2754            let mut natural_width = std::mem::MaybeUninit::uninit();
2755            ffi::gtk_widget_get_preferred_width_for_height(
2756                self.as_ref().to_glib_none().0,
2757                height,
2758                minimum_width.as_mut_ptr(),
2759                natural_width.as_mut_ptr(),
2760            );
2761            (minimum_width.assume_init(), natural_width.assume_init())
2762        }
2763    }
2764
2765    /// Determines whether `self` is realized.
2766    ///
2767    /// # Returns
2768    ///
2769    /// [`true`] if `self` is realized, [`false`] otherwise
2770    #[doc(alias = "gtk_widget_get_realized")]
2771    #[doc(alias = "get_realized")]
2772    fn is_realized(&self) -> bool {
2773        unsafe { from_glib(ffi::gtk_widget_get_realized(self.as_ref().to_glib_none().0)) }
2774    }
2775
2776    /// Determines whether `self` is always treated as the default widget
2777    /// within its toplevel when it has the focus, even if another widget
2778    /// is the default.
2779    ///
2780    /// See [`set_receives_default()`][Self::set_receives_default()].
2781    ///
2782    /// # Returns
2783    ///
2784    /// [`true`] if `self` acts as the default widget when focused,
2785    ///  [`false`] otherwise
2786    #[doc(alias = "gtk_widget_get_receives_default")]
2787    #[doc(alias = "get_receives_default")]
2788    #[doc(alias = "receives-default")]
2789    fn receives_default(&self) -> bool {
2790        unsafe {
2791            from_glib(ffi::gtk_widget_get_receives_default(
2792                self.as_ref().to_glib_none().0,
2793            ))
2794        }
2795    }
2796
2797    /// Gets whether the widget prefers a height-for-width layout
2798    /// or a width-for-height layout.
2799    ///
2800    /// [`Bin`][crate::Bin] widgets generally propagate the preference of
2801    /// their child, container widgets need to request something either in
2802    /// context of their children or in context of their allocation
2803    /// capabilities.
2804    ///
2805    /// # Returns
2806    ///
2807    /// The [`SizeRequestMode`][crate::SizeRequestMode] preferred by `self`.
2808    #[doc(alias = "gtk_widget_get_request_mode")]
2809    #[doc(alias = "get_request_mode")]
2810    fn request_mode(&self) -> SizeRequestMode {
2811        unsafe {
2812            from_glib(ffi::gtk_widget_get_request_mode(
2813                self.as_ref().to_glib_none().0,
2814            ))
2815        }
2816    }
2817
2818    /// Retrieves the internal scale factor that maps from window coordinates
2819    /// to the actual device pixels. On traditional systems this is 1, on
2820    /// high density outputs, it can be a higher value (typically 2).
2821    ///
2822    /// See [`Window::scale_factor()`][crate::gdk::Window::scale_factor()].
2823    ///
2824    /// # Returns
2825    ///
2826    /// the scale factor for `self`
2827    #[doc(alias = "gtk_widget_get_scale_factor")]
2828    #[doc(alias = "get_scale_factor")]
2829    #[doc(alias = "scale-factor")]
2830    fn scale_factor(&self) -> i32 {
2831        unsafe { ffi::gtk_widget_get_scale_factor(self.as_ref().to_glib_none().0) }
2832    }
2833
2834    /// Get the [`gdk::Screen`][crate::gdk::Screen] from the toplevel window associated with
2835    /// this widget. This function can only be called after the widget
2836    /// has been added to a widget hierarchy with a [`Window`][crate::Window]
2837    /// at the top.
2838    ///
2839    /// In general, you should only create screen specific
2840    /// resources when a widget has been realized, and you should
2841    /// free those resources when the widget is unrealized.
2842    ///
2843    /// # Returns
2844    ///
2845    /// the [`gdk::Screen`][crate::gdk::Screen] for the toplevel for this widget.
2846    #[doc(alias = "gtk_widget_get_screen")]
2847    #[doc(alias = "get_screen")]
2848    fn screen(&self) -> Option<gdk::Screen> {
2849        unsafe { from_glib_none(ffi::gtk_widget_get_screen(self.as_ref().to_glib_none().0)) }
2850    }
2851
2852    /// Returns the widget’s sensitivity (in the sense of returning
2853    /// the value that has been set using [`set_sensitive()`][Self::set_sensitive()]).
2854    ///
2855    /// The effective sensitivity of a widget is however determined by both its
2856    /// own and its parent widget’s sensitivity. See [`is_sensitive()`][Self::is_sensitive()].
2857    ///
2858    /// # Returns
2859    ///
2860    /// [`true`] if the widget is sensitive
2861    #[doc(alias = "gtk_widget_get_sensitive")]
2862    #[doc(alias = "sensitive")]
2863    fn get_sensitive(&self) -> bool {
2864        unsafe {
2865            from_glib(ffi::gtk_widget_get_sensitive(
2866                self.as_ref().to_glib_none().0,
2867            ))
2868        }
2869    }
2870
2871    /// Gets the settings object holding the settings used for this widget.
2872    ///
2873    /// Note that this function can only be called when the [`Widget`][crate::Widget]
2874    /// is attached to a toplevel, since the settings object is specific
2875    /// to a particular [`gdk::Screen`][crate::gdk::Screen].
2876    ///
2877    /// # Returns
2878    ///
2879    /// the relevant [`Settings`][crate::Settings] object
2880    #[doc(alias = "gtk_widget_get_settings")]
2881    #[doc(alias = "get_settings")]
2882    fn settings(&self) -> Option<Settings> {
2883        unsafe { from_glib_none(ffi::gtk_widget_get_settings(self.as_ref().to_glib_none().0)) }
2884    }
2885
2886    /// Gets the size request that was explicitly set for the widget using
2887    /// [`set_size_request()`][Self::set_size_request()]. A value of -1 stored in `width` or
2888    /// `height` indicates that that dimension has not been set explicitly
2889    /// and the natural requisition of the widget will be used instead. See
2890    /// [`set_size_request()`][Self::set_size_request()]. To get the size a widget will
2891    /// actually request, call [`preferred_size()`][Self::preferred_size()] instead of
2892    /// this function.
2893    ///
2894    /// # Returns
2895    ///
2896    ///
2897    /// ## `width`
2898    /// return location for width, or [`None`]
2899    ///
2900    /// ## `height`
2901    /// return location for height, or [`None`]
2902    #[doc(alias = "gtk_widget_get_size_request")]
2903    #[doc(alias = "get_size_request")]
2904    fn size_request(&self) -> (i32, i32) {
2905        unsafe {
2906            let mut width = std::mem::MaybeUninit::uninit();
2907            let mut height = std::mem::MaybeUninit::uninit();
2908            ffi::gtk_widget_get_size_request(
2909                self.as_ref().to_glib_none().0,
2910                width.as_mut_ptr(),
2911                height.as_mut_ptr(),
2912            );
2913            (width.assume_init(), height.assume_init())
2914        }
2915    }
2916
2917    /// Returns the widget state as a flag set. It is worth mentioning
2918    /// that the effective [`StateFlags::INSENSITIVE`][crate::StateFlags::INSENSITIVE] state will be
2919    /// returned, that is, also based on parent insensitivity, even if
2920    /// `self` itself is sensitive.
2921    ///
2922    /// Also note that if you are looking for a way to obtain the
2923    /// [`StateFlags`][crate::StateFlags] to pass to a [`StyleContext`][crate::StyleContext] method, you
2924    /// should look at [`StyleContextExt::state()`][crate::prelude::StyleContextExt::state()].
2925    ///
2926    /// # Returns
2927    ///
2928    /// The state flags for widget
2929    #[doc(alias = "gtk_widget_get_state_flags")]
2930    #[doc(alias = "get_state_flags")]
2931    fn state_flags(&self) -> StateFlags {
2932        unsafe {
2933            from_glib(ffi::gtk_widget_get_state_flags(
2934                self.as_ref().to_glib_none().0,
2935            ))
2936        }
2937    }
2938
2939    /// Returns the style context associated to `self`. The returned object is
2940    /// guaranteed to be the same for the lifetime of `self`.
2941    ///
2942    /// # Returns
2943    ///
2944    /// a [`StyleContext`][crate::StyleContext]. This memory is owned by `self` and
2945    ///  must not be freed.
2946    #[doc(alias = "gtk_widget_get_style_context")]
2947    #[doc(alias = "get_style_context")]
2948    fn style_context(&self) -> StyleContext {
2949        unsafe {
2950            from_glib_none(ffi::gtk_widget_get_style_context(
2951                self.as_ref().to_glib_none().0,
2952            ))
2953        }
2954    }
2955
2956    /// Returns [`true`] if `self` is multiple pointer aware. See
2957    /// [`set_support_multidevice()`][Self::set_support_multidevice()] for more information.
2958    ///
2959    /// # Returns
2960    ///
2961    /// [`true`] if `self` is multidevice aware.
2962    #[doc(alias = "gtk_widget_get_support_multidevice")]
2963    #[doc(alias = "get_support_multidevice")]
2964    fn supports_multidevice(&self) -> bool {
2965        unsafe {
2966            from_glib(ffi::gtk_widget_get_support_multidevice(
2967                self.as_ref().to_glib_none().0,
2968            ))
2969        }
2970    }
2971
2972    /// Fetch an object build from the template XML for `widget_type` in this `self` instance.
2973    ///
2974    /// This will only report children which were previously declared with
2975    /// `gtk_widget_class_bind_template_child_full()` or one of its
2976    /// variants.
2977    ///
2978    /// This function is only meant to be called for code which is private to the `widget_type` which
2979    /// declared the child and is meant for language bindings which cannot easily make use
2980    /// of the GObject structure offsets.
2981    /// ## `widget_type`
2982    /// The `GType` to get a template child for
2983    /// ## `name`
2984    /// The “id” of the child defined in the template XML
2985    ///
2986    /// # Returns
2987    ///
2988    /// The object built in the template XML with the id `name`
2989    #[doc(alias = "gtk_widget_get_template_child")]
2990    #[doc(alias = "get_template_child")]
2991    fn template_child(&self, widget_type: glib::types::Type, name: &str) -> Option<glib::Object> {
2992        unsafe {
2993            from_glib_none(ffi::gtk_widget_get_template_child(
2994                self.as_ref().to_glib_none().0,
2995                widget_type.into_glib(),
2996                name.to_glib_none().0,
2997            ))
2998        }
2999    }
3000
3001    /// Gets the contents of the tooltip for `self`.
3002    ///
3003    /// # Returns
3004    ///
3005    /// the tooltip text, or [`None`]. You should free the
3006    ///  returned string with `g_free()` when done.
3007    #[doc(alias = "gtk_widget_get_tooltip_markup")]
3008    #[doc(alias = "get_tooltip_markup")]
3009    #[doc(alias = "tooltip-markup")]
3010    fn tooltip_markup(&self) -> Option<glib::GString> {
3011        unsafe {
3012            from_glib_full(ffi::gtk_widget_get_tooltip_markup(
3013                self.as_ref().to_glib_none().0,
3014            ))
3015        }
3016    }
3017
3018    /// Gets the contents of the tooltip for `self`.
3019    ///
3020    /// # Returns
3021    ///
3022    /// the tooltip text, or [`None`]. You should free the
3023    ///  returned string with `g_free()` when done.
3024    #[doc(alias = "gtk_widget_get_tooltip_text")]
3025    #[doc(alias = "get_tooltip_text")]
3026    #[doc(alias = "tooltip-text")]
3027    fn tooltip_text(&self) -> Option<glib::GString> {
3028        unsafe {
3029            from_glib_full(ffi::gtk_widget_get_tooltip_text(
3030                self.as_ref().to_glib_none().0,
3031            ))
3032        }
3033    }
3034
3035    /// Returns the [`Window`][crate::Window] of the current tooltip. This can be the
3036    /// GtkWindow created by default, or the custom tooltip window set
3037    /// using [`set_tooltip_window()`][Self::set_tooltip_window()].
3038    ///
3039    /// # Returns
3040    ///
3041    /// The [`Window`][crate::Window] of the current tooltip.
3042    #[doc(alias = "gtk_widget_get_tooltip_window")]
3043    #[doc(alias = "get_tooltip_window")]
3044    fn tooltip_window(&self) -> Option<Window> {
3045        unsafe {
3046            from_glib_none(ffi::gtk_widget_get_tooltip_window(
3047                self.as_ref().to_glib_none().0,
3048            ))
3049        }
3050    }
3051
3052    ///
3053    /// static const char *
3054    /// get_widget_toplevel_title (GtkWidget *widget)
3055    /// {
3056    ///  GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
3057    ///  if (GTK_IS_WINDOW (toplevel))
3058    ///  {
3059    ///  return gtk_window_get_title (GTK_WINDOW (toplevel));
3060    ///  }
3061    ///
3062    ///  return NULL;
3063    /// }
3064    /// ]|
3065    ///
3066    /// # Returns
3067    ///
3068    /// the topmost ancestor of `self`, or `self` itself
3069    ///  if there’s no ancestor.
3070    #[doc(alias = "gtk_widget_get_toplevel")]
3071    #[doc(alias = "get_toplevel")]
3072    #[must_use]
3073    fn toplevel(&self) -> Option<Widget> {
3074        unsafe { from_glib_none(ffi::gtk_widget_get_toplevel(self.as_ref().to_glib_none().0)) }
3075    }
3076
3077    /// value, NULL)`, which will
3078    /// also report the true value.
3079    ///
3080    /// # Returns
3081    ///
3082    /// the vertical alignment of `self`, ignoring baseline alignment
3083    #[doc(alias = "gtk_widget_get_valign")]
3084    #[doc(alias = "get_valign")]
3085    fn valign(&self) -> Align {
3086        unsafe { from_glib(ffi::gtk_widget_get_valign(self.as_ref().to_glib_none().0)) }
3087    }
3088
3089    /// Gets the value of the [`valign`][struct@crate::Widget#valign] property, including
3090    /// [`Align::Baseline`][crate::Align::Baseline].
3091    ///
3092    /// # Returns
3093    ///
3094    /// the vertical alignment of `self`
3095    #[doc(alias = "gtk_widget_get_valign_with_baseline")]
3096    #[doc(alias = "get_valign_with_baseline")]
3097    fn valign_with_baseline(&self) -> Align {
3098        unsafe {
3099            from_glib(ffi::gtk_widget_get_valign_with_baseline(
3100                self.as_ref().to_glib_none().0,
3101            ))
3102        }
3103    }
3104
3105    /// Gets whether the widget would like any available extra vertical
3106    /// space.
3107    ///
3108    /// See [`hexpands()`][Self::hexpands()] for more detail.
3109    ///
3110    /// # Returns
3111    ///
3112    /// whether vexpand flag is set
3113    #[doc(alias = "gtk_widget_get_vexpand")]
3114    #[doc(alias = "get_vexpand")]
3115    #[doc(alias = "vexpand")]
3116    fn vexpands(&self) -> bool {
3117        unsafe { from_glib(ffi::gtk_widget_get_vexpand(self.as_ref().to_glib_none().0)) }
3118    }
3119
3120    /// Gets whether [`set_vexpand()`][Self::set_vexpand()] has been used to
3121    /// explicitly set the expand flag on this widget.
3122    ///
3123    /// See [`is_hexpand_set()`][Self::is_hexpand_set()] for more detail.
3124    ///
3125    /// # Returns
3126    ///
3127    /// whether vexpand has been explicitly set
3128    #[doc(alias = "gtk_widget_get_vexpand_set")]
3129    #[doc(alias = "get_vexpand_set")]
3130    #[doc(alias = "vexpand-set")]
3131    fn is_vexpand_set(&self) -> bool {
3132        unsafe {
3133            from_glib(ffi::gtk_widget_get_vexpand_set(
3134                self.as_ref().to_glib_none().0,
3135            ))
3136        }
3137    }
3138
3139    /// Determines whether the widget is visible. If you want to
3140    /// take into account whether the widget’s parent is also marked as
3141    /// visible, use [`is_visible()`][Self::is_visible()] instead.
3142    ///
3143    /// This function does not check if the widget is obscured in any way.
3144    ///
3145    /// See [`set_visible()`][Self::set_visible()].
3146    ///
3147    /// # Returns
3148    ///
3149    /// [`true`] if the widget is visible
3150    #[doc(alias = "gtk_widget_get_visible")]
3151    #[doc(alias = "visible")]
3152    fn get_visible(&self) -> bool {
3153        unsafe { from_glib(ffi::gtk_widget_get_visible(self.as_ref().to_glib_none().0)) }
3154    }
3155
3156    /// Gets the visual that will be used to render `self`.
3157    ///
3158    /// # Returns
3159    ///
3160    /// the visual for `self`
3161    #[doc(alias = "gtk_widget_get_visual")]
3162    #[doc(alias = "get_visual")]
3163    fn visual(&self) -> Option<gdk::Visual> {
3164        unsafe { from_glib_none(ffi::gtk_widget_get_visual(self.as_ref().to_glib_none().0)) }
3165    }
3166
3167    /// Returns the widget’s window if it is realized, [`None`] otherwise
3168    ///
3169    /// # Returns
3170    ///
3171    /// `self`’s window.
3172    #[doc(alias = "gtk_widget_get_window")]
3173    #[doc(alias = "get_window")]
3174    fn window(&self) -> Option<gdk::Window> {
3175        unsafe { from_glib_none(ffi::gtk_widget_get_window(self.as_ref().to_glib_none().0)) }
3176    }
3177
3178    /// Makes `self` the current grabbed widget.
3179    ///
3180    /// This means that interaction with other widgets in the same
3181    /// application is blocked and mouse as well as keyboard events
3182    /// are delivered to this widget.
3183    ///
3184    /// If `self` is not sensitive, it is not set as the current
3185    /// grabbed widget and this function does nothing.
3186    #[doc(alias = "gtk_grab_add")]
3187    fn grab_add(&self) {
3188        unsafe {
3189            ffi::gtk_grab_add(self.as_ref().to_glib_none().0);
3190        }
3191    }
3192
3193    /// Causes `self` to become the default widget. `self` must be able to be
3194    /// a default widget; typically you would ensure this yourself
3195    /// by calling [`set_can_default()`][Self::set_can_default()] with a [`true`] value.
3196    /// The default widget is activated when
3197    /// the user presses Enter in a window. Default widgets must be
3198    /// activatable, that is, [`activate()`][Self::activate()] should affect them. Note
3199    /// that [`Entry`][crate::Entry] widgets require the “activates-default” property
3200    /// set to [`true`] before they activate the default widget when Enter
3201    /// is pressed and the [`Entry`][crate::Entry] is focused.
3202    #[doc(alias = "gtk_widget_grab_default")]
3203    fn grab_default(&self) {
3204        unsafe {
3205            ffi::gtk_widget_grab_default(self.as_ref().to_glib_none().0);
3206        }
3207    }
3208
3209    /// Causes `self` to have the keyboard focus for the [`Window`][crate::Window] it's
3210    /// inside. `self` must be a focusable widget, such as a [`Entry`][crate::Entry];
3211    /// something like [`Frame`][crate::Frame] won’t work.
3212    ///
3213    /// More precisely, it must have the `GTK_CAN_FOCUS` flag set. Use
3214    /// [`set_can_focus()`][Self::set_can_focus()] to modify that flag.
3215    ///
3216    /// The widget also needs to be realized and mapped. This is indicated by the
3217    /// related signals. Grabbing the focus immediately after creating the widget
3218    /// will likely fail and cause critical warnings.
3219    #[doc(alias = "gtk_widget_grab_focus")]
3220    fn grab_focus(&self) {
3221        unsafe {
3222            ffi::gtk_widget_grab_focus(self.as_ref().to_glib_none().0);
3223        }
3224    }
3225
3226    /// Removes the grab from the given widget.
3227    ///
3228    /// You have to pair calls to [`grab_add()`][Self::grab_add()] and [`grab_remove()`][Self::grab_remove()].
3229    ///
3230    /// If `self` does not have the grab, this function does nothing.
3231    #[doc(alias = "gtk_grab_remove")]
3232    fn grab_remove(&self) {
3233        unsafe {
3234            ffi::gtk_grab_remove(self.as_ref().to_glib_none().0);
3235        }
3236    }
3237
3238    /// Determines whether `self` is the current default widget within its
3239    /// toplevel. See [`set_can_default()`][Self::set_can_default()].
3240    ///
3241    /// # Returns
3242    ///
3243    /// [`true`] if `self` is the current default widget within
3244    ///  its toplevel, [`false`] otherwise
3245    #[doc(alias = "gtk_widget_has_default")]
3246    fn has_default(&self) -> bool {
3247        unsafe { from_glib(ffi::gtk_widget_has_default(self.as_ref().to_glib_none().0)) }
3248    }
3249
3250    /// Determines if the widget has the global input focus. See
3251    /// [`is_focus()`][Self::is_focus()] for the difference between having the global
3252    /// input focus, and only having the focus within a toplevel.
3253    ///
3254    /// # Returns
3255    ///
3256    /// [`true`] if the widget has the global input focus.
3257    #[doc(alias = "gtk_widget_has_focus")]
3258    fn has_focus(&self) -> bool {
3259        unsafe { from_glib(ffi::gtk_widget_has_focus(self.as_ref().to_glib_none().0)) }
3260    }
3261
3262    /// Determines whether the widget is currently grabbing events, so it
3263    /// is the only widget receiving input events (keyboard and mouse).
3264    ///
3265    /// See also [`grab_add()`][Self::grab_add()].
3266    ///
3267    /// # Returns
3268    ///
3269    /// [`true`] if the widget is in the grab_widgets stack
3270    #[doc(alias = "gtk_widget_has_grab")]
3271    fn has_grab(&self) -> bool {
3272        unsafe { from_glib(ffi::gtk_widget_has_grab(self.as_ref().to_glib_none().0)) }
3273    }
3274
3275    /// Checks whether there is a [`gdk::Screen`][crate::gdk::Screen] is associated with
3276    /// this widget. All toplevel widgets have an associated
3277    /// screen, and all widgets added into a hierarchy with a toplevel
3278    /// window at the top.
3279    ///
3280    /// # Returns
3281    ///
3282    /// [`true`] if there is a [`gdk::Screen`][crate::gdk::Screen] associated
3283    ///  with the widget.
3284    #[doc(alias = "gtk_widget_has_screen")]
3285    fn has_screen(&self) -> bool {
3286        unsafe { from_glib(ffi::gtk_widget_has_screen(self.as_ref().to_glib_none().0)) }
3287    }
3288
3289    /// Determines if the widget should show a visible indication that
3290    /// it has the global input focus. This is a convenience function for
3291    /// use in ::draw handlers that takes into account whether focus
3292    /// indication should currently be shown in the toplevel window of
3293    /// `self`. See [`GtkWindowExt::gets_focus_visible()`][crate::prelude::GtkWindowExt::gets_focus_visible()] for more information
3294    /// about focus indication.
3295    ///
3296    /// To find out if the widget has the global input focus, use
3297    /// [`has_focus()`][Self::has_focus()].
3298    ///
3299    /// # Returns
3300    ///
3301    /// [`true`] if the widget should display a “focus rectangle”
3302    #[doc(alias = "gtk_widget_has_visible_focus")]
3303    fn has_visible_focus(&self) -> bool {
3304        unsafe {
3305            from_glib(ffi::gtk_widget_has_visible_focus(
3306                self.as_ref().to_glib_none().0,
3307            ))
3308        }
3309    }
3310
3311    /// Reverses the effects of [`show()`][Self::show()], causing the widget to be
3312    /// hidden (invisible to the user).
3313    #[doc(alias = "gtk_widget_hide")]
3314    fn hide(&self) {
3315        unsafe {
3316            ffi::gtk_widget_hide(self.as_ref().to_glib_none().0);
3317        }
3318    }
3319
3320    /// Returns whether the widget is currently being destroyed.
3321    /// This information can sometimes be used to avoid doing
3322    /// unnecessary work.
3323    ///
3324    /// # Returns
3325    ///
3326    /// [`true`] if `self` is being destroyed
3327    #[doc(alias = "gtk_widget_in_destruction")]
3328    fn in_destruction(&self) -> bool {
3329        unsafe {
3330            from_glib(ffi::gtk_widget_in_destruction(
3331                self.as_ref().to_glib_none().0,
3332            ))
3333        }
3334    }
3335
3336    /// Creates and initializes child widgets defined in templates. This
3337    /// function must be called in the instance initializer for any
3338    /// class which assigned itself a template using `gtk_widget_class_set_template()`
3339    ///
3340    /// It is important to call this function in the instance initializer
3341    /// of a [`Widget`][crate::Widget] subclass and not in `GObject.constructed()` or
3342    /// `GObject.constructor()` for two reasons.
3343    ///
3344    /// One reason is that generally derived widgets will assume that parent
3345    /// class composite widgets have been created in their instance
3346    /// initializers.
3347    ///
3348    /// Another reason is that when calling [`glib::Object::new()`][crate::glib::Object::new()] on a widget with
3349    /// composite templates, it’s important to build the composite widgets
3350    /// before the construct properties are set. Properties passed to [`glib::Object::new()`][crate::glib::Object::new()]
3351    /// should take precedence over properties set in the private template XML.
3352    #[doc(alias = "gtk_widget_init_template")]
3353    fn init_template(&self) {
3354        unsafe {
3355            ffi::gtk_widget_init_template(self.as_ref().to_glib_none().0);
3356        }
3357    }
3358
3359    /// Sets an input shape for this widget’s GDK window. This allows for
3360    /// windows which react to mouse click in a nonrectangular region, see
3361    /// [`Window::input_shape_combine_region()`][crate::gdk::Window::input_shape_combine_region()] for more information.
3362    /// ## `region`
3363    /// shape to be added, or [`None`] to remove an existing shape
3364    #[doc(alias = "gtk_widget_input_shape_combine_region")]
3365    fn input_shape_combine_region(&self, region: Option<&cairo::Region>) {
3366        unsafe {
3367            ffi::gtk_widget_input_shape_combine_region(
3368                self.as_ref().to_glib_none().0,
3369                mut_override(region.to_glib_none().0),
3370            );
3371        }
3372    }
3373
3374    /// Inserts `group` into `self`. Children of `self` that implement
3375    /// [`Actionable`][crate::Actionable] can then be associated with actions in `group` by
3376    /// setting their “action-name” to
3377    /// `prefix`.`action-name`.
3378    ///
3379    /// If `group` is [`None`], a previously inserted group for `name` is removed
3380    /// from `self`.
3381    /// ## `name`
3382    /// the prefix for actions in `group`
3383    /// ## `group`
3384    /// a [`gio::ActionGroup`][crate::gio::ActionGroup], or [`None`]
3385    #[doc(alias = "gtk_widget_insert_action_group")]
3386    fn insert_action_group(&self, name: &str, group: Option<&impl IsA<gio::ActionGroup>>) {
3387        unsafe {
3388            ffi::gtk_widget_insert_action_group(
3389                self.as_ref().to_glib_none().0,
3390                name.to_glib_none().0,
3391                group.map(|p| p.as_ref()).to_glib_none().0,
3392            );
3393        }
3394    }
3395
3396    /// Determines whether `self` is somewhere inside `ancestor`, possibly with
3397    /// intermediate containers.
3398    /// ## `ancestor`
3399    /// another [`Widget`][crate::Widget]
3400    ///
3401    /// # Returns
3402    ///
3403    /// [`true`] if `ancestor` contains `self` as a child,
3404    ///  grandchild, great grandchild, etc.
3405    #[doc(alias = "gtk_widget_is_ancestor")]
3406    fn is_ancestor(&self, ancestor: &impl IsA<Widget>) -> bool {
3407        unsafe {
3408            from_glib(ffi::gtk_widget_is_ancestor(
3409                self.as_ref().to_glib_none().0,
3410                ancestor.as_ref().to_glib_none().0,
3411            ))
3412        }
3413    }
3414
3415    /// Determines whether `self` can be drawn to. A widget can be drawn
3416    /// to if it is mapped and visible.
3417    ///
3418    /// # Returns
3419    ///
3420    /// [`true`] if `self` is drawable, [`false`] otherwise
3421    #[doc(alias = "gtk_widget_is_drawable")]
3422    fn is_drawable(&self) -> bool {
3423        unsafe { from_glib(ffi::gtk_widget_is_drawable(self.as_ref().to_glib_none().0)) }
3424    }
3425
3426    /// Determines if the widget is the focus widget within its
3427    /// toplevel. (This does not mean that the [`has-focus`][struct@crate::Widget#has-focus] property is
3428    /// necessarily set; [`has-focus`][struct@crate::Widget#has-focus] will only be set if the
3429    /// toplevel widget additionally has the global input focus.)
3430    ///
3431    /// # Returns
3432    ///
3433    /// [`true`] if the widget is the focus widget.
3434    #[doc(alias = "gtk_widget_is_focus")]
3435    fn is_focus(&self) -> bool {
3436        unsafe { from_glib(ffi::gtk_widget_is_focus(self.as_ref().to_glib_none().0)) }
3437    }
3438
3439    /// Returns the widget’s effective sensitivity, which means
3440    /// it is sensitive itself and also its parent widget is sensitive
3441    ///
3442    /// # Returns
3443    ///
3444    /// [`true`] if the widget is effectively sensitive
3445    #[doc(alias = "gtk_widget_is_sensitive")]
3446    fn is_sensitive(&self) -> bool {
3447        unsafe { from_glib(ffi::gtk_widget_is_sensitive(self.as_ref().to_glib_none().0)) }
3448    }
3449
3450    /// Determines whether `self` is a toplevel widget.
3451    ///
3452    /// Currently only [`Window`][crate::Window] and [`Invisible`][crate::Invisible] (and out-of-process
3453    /// `GtkPlugs`) are toplevel widgets. Toplevel widgets have no parent
3454    /// widget.
3455    ///
3456    /// # Returns
3457    ///
3458    /// [`true`] if `self` is a toplevel, [`false`] otherwise
3459    #[doc(alias = "gtk_widget_is_toplevel")]
3460    fn is_toplevel(&self) -> bool {
3461        unsafe { from_glib(ffi::gtk_widget_is_toplevel(self.as_ref().to_glib_none().0)) }
3462    }
3463
3464    /// Determines whether the widget and all its parents are marked as
3465    /// visible.
3466    ///
3467    /// This function does not check if the widget is obscured in any way.
3468    ///
3469    /// See also [`get_visible()`][Self::get_visible()] and [`set_visible()`][Self::set_visible()]
3470    ///
3471    /// # Returns
3472    ///
3473    /// [`true`] if the widget and all its parents are visible
3474    #[doc(alias = "gtk_widget_is_visible")]
3475    fn is_visible(&self) -> bool {
3476        unsafe { from_glib(ffi::gtk_widget_is_visible(self.as_ref().to_glib_none().0)) }
3477    }
3478
3479    /// This function should be called whenever keyboard navigation within
3480    /// a single widget hits a boundary. The function emits the
3481    /// [`keynav-failed`][struct@crate::Widget#keynav-failed] signal on the widget and its return
3482    /// value should be interpreted in a way similar to the return value of
3483    /// [`child_focus()`][Self::child_focus()]:
3484    ///
3485    /// When [`true`] is returned, stay in the widget, the failed keyboard
3486    /// navigation is OK and/or there is nowhere we can/should move the
3487    /// focus to.
3488    ///
3489    /// When [`false`] is returned, the caller should continue with keyboard
3490    /// navigation outside the widget, e.g. by calling
3491    /// [`child_focus()`][Self::child_focus()] on the widget’s toplevel.
3492    ///
3493    /// The default ::keynav-failed handler returns [`false`] for
3494    /// [`DirectionType::TabForward`][crate::DirectionType::TabForward] and [`DirectionType::TabBackward`][crate::DirectionType::TabBackward]. For the other
3495    /// values of [`DirectionType`][crate::DirectionType] it returns [`true`].
3496    ///
3497    /// Whenever the default handler returns [`true`], it also calls
3498    /// [`error_bell()`][Self::error_bell()] to notify the user of the failed keyboard
3499    /// navigation.
3500    ///
3501    /// A use case for providing an own implementation of ::keynav-failed
3502    /// (either by connecting to it or by overriding it) would be a row of
3503    /// [`Entry`][crate::Entry] widgets where the user should be able to navigate the
3504    /// entire row with the cursor keys, as e.g. known from user interfaces
3505    /// that require entering license keys.
3506    /// ## `direction`
3507    /// direction of focus movement
3508    ///
3509    /// # Returns
3510    ///
3511    /// [`true`] if stopping keyboard navigation is fine, [`false`]
3512    ///  if the emitting widget should try to handle the keyboard
3513    ///  navigation attempt in its parent container(s).
3514    #[doc(alias = "gtk_widget_keynav_failed")]
3515    fn keynav_failed(&self, direction: DirectionType) -> bool {
3516        unsafe {
3517            from_glib(ffi::gtk_widget_keynav_failed(
3518                self.as_ref().to_glib_none().0,
3519                direction.into_glib(),
3520            ))
3521        }
3522    }
3523
3524    /// Lists the closures used by `self` for accelerator group connections
3525    /// with [`AccelGroupExtManual::connect_accel_group_by_path()`][crate::prelude::AccelGroupExtManual::connect_accel_group_by_path()] or [`AccelGroupExtManual::connect_accel_group()`][crate::prelude::AccelGroupExtManual::connect_accel_group()].
3526    /// The closures can be used to monitor accelerator changes on `self`,
3527    /// by connecting to the [`AccelGroup`][crate::AccelGroup] signal of the
3528    /// [`AccelGroup`][crate::AccelGroup] of a closure which can be found out with
3529    /// [`AccelGroup::from_accel_closure()`][crate::AccelGroup::from_accel_closure()].
3530    ///
3531    /// # Returns
3532    ///
3533    ///
3534    ///  a newly allocated `GList` of closures
3535    #[doc(alias = "gtk_widget_list_accel_closures")]
3536    fn list_accel_closures(&self) -> Vec<glib::Closure> {
3537        unsafe {
3538            FromGlibPtrContainer::from_glib_container(ffi::gtk_widget_list_accel_closures(
3539                self.as_ref().to_glib_none().0,
3540            ))
3541        }
3542    }
3543
3544    /// Retrieves a [`None`]-terminated array of strings containing the prefixes of
3545    /// [`gio::ActionGroup`][crate::gio::ActionGroup]'s available to `self`.
3546    ///
3547    /// # Returns
3548    ///
3549    /// a [`None`]-terminated array of strings.
3550    #[doc(alias = "gtk_widget_list_action_prefixes")]
3551    fn list_action_prefixes(&self) -> Vec<glib::GString> {
3552        unsafe {
3553            FromGlibPtrContainer::from_glib_container(ffi::gtk_widget_list_action_prefixes(
3554                self.as_ref().to_glib_none().0,
3555            ))
3556        }
3557    }
3558
3559    /// Returns a newly allocated list of the widgets, normally labels, for
3560    /// which this widget is the target of a mnemonic (see for example,
3561    /// [`LabelExt::set_mnemonic_widget()`][crate::prelude::LabelExt::set_mnemonic_widget()]).
3562    ///
3563    /// The widgets in the list are not individually referenced. If you
3564    /// want to iterate through the list and perform actions involving
3565    /// callbacks that might destroy the widgets, you
3566    /// must call `g_list_foreach (result,
3567    /// (GFunc)g_object_ref, NULL)` first, and then unref all the
3568    /// widgets afterwards.
3569    ///
3570    /// # Returns
3571    ///
3572    /// the list of
3573    ///  mnemonic labels; free this list
3574    ///  with `g_list_free()` when you are done with it.
3575    #[doc(alias = "gtk_widget_list_mnemonic_labels")]
3576    fn list_mnemonic_labels(&self) -> Vec<Widget> {
3577        unsafe {
3578            FromGlibPtrContainer::from_glib_container(ffi::gtk_widget_list_mnemonic_labels(
3579                self.as_ref().to_glib_none().0,
3580            ))
3581        }
3582    }
3583
3584    /// This function is only for use in widget implementations. Causes
3585    /// a widget to be mapped if it isn’t already.
3586    #[doc(alias = "gtk_widget_map")]
3587    fn map(&self) {
3588        unsafe {
3589            ffi::gtk_widget_map(self.as_ref().to_glib_none().0);
3590        }
3591    }
3592
3593    /// Emits the [`mnemonic-activate`][struct@crate::Widget#mnemonic-activate] signal.
3594    /// ## `group_cycling`
3595    /// [`true`] if there are other widgets with the same mnemonic
3596    ///
3597    /// # Returns
3598    ///
3599    /// [`true`] if the signal has been handled
3600    #[doc(alias = "gtk_widget_mnemonic_activate")]
3601    fn mnemonic_activate(&self, group_cycling: bool) -> bool {
3602        unsafe {
3603            from_glib(ffi::gtk_widget_mnemonic_activate(
3604                self.as_ref().to_glib_none().0,
3605                group_cycling.into_glib(),
3606            ))
3607        }
3608    }
3609
3610    /// This function is only for use in widget implementations.
3611    ///
3612    /// Flags the widget for a rerun of the GtkWidgetClass::size_allocate
3613    /// function. Use this function instead of [`queue_resize()`][Self::queue_resize()]
3614    /// when the `self`'s size request didn't change but it wants to
3615    /// reposition its contents.
3616    ///
3617    /// An example user of this function is [`set_halign()`][Self::set_halign()].
3618    #[doc(alias = "gtk_widget_queue_allocate")]
3619    fn queue_allocate(&self) {
3620        unsafe {
3621            ffi::gtk_widget_queue_allocate(self.as_ref().to_glib_none().0);
3622        }
3623    }
3624
3625    /// Mark `self` as needing to recompute its expand flags. Call
3626    /// this function when setting legacy expand child properties
3627    /// on the child of a container.
3628    ///
3629    /// See [`compute_expand()`][Self::compute_expand()].
3630    #[doc(alias = "gtk_widget_queue_compute_expand")]
3631    fn queue_compute_expand(&self) {
3632        unsafe {
3633            ffi::gtk_widget_queue_compute_expand(self.as_ref().to_glib_none().0);
3634        }
3635    }
3636
3637    /// Equivalent to calling [`queue_draw_area()`][Self::queue_draw_area()] for the
3638    /// entire area of a widget.
3639    #[doc(alias = "gtk_widget_queue_draw")]
3640    fn queue_draw(&self) {
3641        unsafe {
3642            ffi::gtk_widget_queue_draw(self.as_ref().to_glib_none().0);
3643        }
3644    }
3645
3646    /// allocation.y otherwise.
3647    ///
3648    /// `width` or `height` may be 0, in this case this function does
3649    /// nothing. Negative values for `width` and `height` are not allowed.
3650    /// ## `x`
3651    /// x coordinate of upper-left corner of rectangle to redraw
3652    /// ## `y`
3653    /// y coordinate of upper-left corner of rectangle to redraw
3654    /// ## `width`
3655    /// width of region to draw
3656    /// ## `height`
3657    /// height of region to draw
3658    #[doc(alias = "gtk_widget_queue_draw_area")]
3659    fn queue_draw_area(&self, x: i32, y: i32, width: i32, height: i32) {
3660        unsafe {
3661            ffi::gtk_widget_queue_draw_area(self.as_ref().to_glib_none().0, x, y, width, height);
3662        }
3663    }
3664
3665    /// Invalidates the area of `self` defined by `region` by calling
3666    /// [`Window::invalidate_region()`][crate::gdk::Window::invalidate_region()] on the widget’s window and all its
3667    /// child windows. Once the main loop becomes idle (after the current
3668    /// batch of events has been processed, roughly), the window will
3669    /// receive expose events for the union of all regions that have been
3670    /// invalidated.
3671    ///
3672    /// Normally you would only use this function in widget
3673    /// implementations. You might also use it to schedule a redraw of a
3674    /// [`DrawingArea`][crate::DrawingArea] or some portion thereof.
3675    /// ## `region`
3676    /// region to draw
3677    #[doc(alias = "gtk_widget_queue_draw_region")]
3678    fn queue_draw_region(&self, region: &cairo::Region) {
3679        unsafe {
3680            ffi::gtk_widget_queue_draw_region(
3681                self.as_ref().to_glib_none().0,
3682                region.to_glib_none().0,
3683            );
3684        }
3685    }
3686
3687    /// This function is only for use in widget implementations.
3688    /// Flags a widget to have its size renegotiated; should
3689    /// be called when a widget for some reason has a new size request.
3690    /// For example, when you change the text in a [`Label`][crate::Label], [`Label`][crate::Label]
3691    /// queues a resize to ensure there’s enough space for the new text.
3692    ///
3693    /// Note that you cannot call [`queue_resize()`][Self::queue_resize()] on a widget
3694    /// from inside its implementation of the GtkWidgetClass::size_allocate
3695    /// virtual method. Calls to [`queue_resize()`][Self::queue_resize()] from inside
3696    /// GtkWidgetClass::size_allocate will be silently ignored.
3697    #[doc(alias = "gtk_widget_queue_resize")]
3698    fn queue_resize(&self) {
3699        unsafe {
3700            ffi::gtk_widget_queue_resize(self.as_ref().to_glib_none().0);
3701        }
3702    }
3703
3704    /// This function works like [`queue_resize()`][Self::queue_resize()],
3705    /// except that the widget is not invalidated.
3706    #[doc(alias = "gtk_widget_queue_resize_no_redraw")]
3707    fn queue_resize_no_redraw(&self) {
3708        unsafe {
3709            ffi::gtk_widget_queue_resize_no_redraw(self.as_ref().to_glib_none().0);
3710        }
3711    }
3712
3713    /// window will be created when a widget
3714    /// is realized. Normally realization happens implicitly; if you show
3715    /// a widget and all its parent containers, then the widget will be
3716    /// realized and mapped automatically.
3717    ///
3718    /// Realizing a widget requires all
3719    /// the widget’s parent widgets to be realized; calling
3720    /// [`realize()`][Self::realize()] realizes the widget’s parents in addition to
3721    /// `self` itself. If a widget is not yet inside a toplevel window
3722    /// when you realize it, bad things will happen.
3723    ///
3724    /// This function is primarily used in widget implementations, and
3725    /// isn’t very useful otherwise. Many times when you think you might
3726    /// need it, a better approach is to connect to a signal that will be
3727    /// called after the widget is realized automatically, such as
3728    /// [`draw`][struct@crate::Widget#draw]. Or simply g_signal_connect () to the
3729    /// [`realize`][struct@crate::Widget#realize] signal.
3730    #[doc(alias = "gtk_widget_realize")]
3731    fn realize(&self) {
3732        unsafe {
3733            ffi::gtk_widget_realize(self.as_ref().to_glib_none().0);
3734        }
3735    }
3736
3737    /// Registers a [`gdk::Window`][crate::gdk::Window] with the widget and sets it up so that
3738    /// the widget receives events for it. Call [`unregister_window()`][Self::unregister_window()]
3739    /// when destroying the window.
3740    ///
3741    /// Before 3.8 you needed to call [`Window::set_user_data()`][crate::gdk::Window::set_user_data()] directly to set
3742    /// this up. This is now deprecated and you should use [`register_window()`][Self::register_window()]
3743    /// instead. Old code will keep working as is, although some new features like
3744    /// transparency might not work perfectly.
3745    /// ## `window`
3746    /// a [`gdk::Window`][crate::gdk::Window]
3747    #[doc(alias = "gtk_widget_register_window")]
3748    fn register_window(&self, window: &gdk::Window) {
3749        unsafe {
3750            ffi::gtk_widget_register_window(
3751                self.as_ref().to_glib_none().0,
3752                window.to_glib_none().0,
3753            );
3754        }
3755    }
3756
3757    /// Removes an accelerator from `self`, previously installed with
3758    /// [`add_accelerator()`][Self::add_accelerator()].
3759    /// ## `accel_group`
3760    /// accel group for this widget
3761    /// ## `accel_key`
3762    /// GDK keyval of the accelerator
3763    /// ## `accel_mods`
3764    /// modifier key combination of the accelerator
3765    ///
3766    /// # Returns
3767    ///
3768    /// whether an accelerator was installed and could be removed
3769    #[doc(alias = "gtk_widget_remove_accelerator")]
3770    fn remove_accelerator(
3771        &self,
3772        accel_group: &impl IsA<AccelGroup>,
3773        accel_key: u32,
3774        accel_mods: gdk::ModifierType,
3775    ) -> bool {
3776        unsafe {
3777            from_glib(ffi::gtk_widget_remove_accelerator(
3778                self.as_ref().to_glib_none().0,
3779                accel_group.as_ref().to_glib_none().0,
3780                accel_key,
3781                accel_mods.into_glib(),
3782            ))
3783        }
3784    }
3785
3786    /// Removes a widget from the list of mnemonic labels for
3787    /// this widget. (See [`list_mnemonic_labels()`][Self::list_mnemonic_labels()]). The widget
3788    /// must have previously been added to the list with
3789    /// [`add_mnemonic_label()`][Self::add_mnemonic_label()].
3790    /// ## `label`
3791    /// a [`Widget`][crate::Widget] that was previously set as a mnemonic label for
3792    ///  `self` with [`add_mnemonic_label()`][Self::add_mnemonic_label()].
3793    #[doc(alias = "gtk_widget_remove_mnemonic_label")]
3794    fn remove_mnemonic_label(&self, label: &impl IsA<Widget>) {
3795        unsafe {
3796            ffi::gtk_widget_remove_mnemonic_label(
3797                self.as_ref().to_glib_none().0,
3798                label.as_ref().to_glib_none().0,
3799            );
3800        }
3801    }
3802
3803    /// Updates the style context of `self` and all descendants
3804    /// by updating its widget path. `GtkContainers` may want
3805    /// to use this on a child when reordering it in a way that a different
3806    /// style might apply to it. See also [`ContainerExt::path_for_child()`][crate::prelude::ContainerExt::path_for_child()].
3807    #[doc(alias = "gtk_widget_reset_style")]
3808    fn reset_style(&self) {
3809        unsafe {
3810            ffi::gtk_widget_reset_style(self.as_ref().to_glib_none().0);
3811        }
3812    }
3813
3814    /// focus_change.window);
3815    ///
3816    ///  gtk_widget_send_focus_change (widget, fevent);
3817    ///
3818    ///  gdk_event_free (event);
3819    /// ]|
3820    /// ## `event`
3821    /// a `GdkEvent` of type GDK_FOCUS_CHANGE
3822    ///
3823    /// # Returns
3824    ///
3825    /// the return value from the event signal emission: [`true`]
3826    ///  if the event was handled, and [`false`] otherwise
3827    #[doc(alias = "gtk_widget_send_focus_change")]
3828    fn send_focus_change(&self, event: &gdk::Event) -> bool {
3829        unsafe {
3830            from_glib(ffi::gtk_widget_send_focus_change(
3831                self.as_ref().to_glib_none().0,
3832                mut_override(event.to_glib_none().0),
3833            ))
3834        }
3835    }
3836
3837    /// Given an accelerator group, `accel_group`, and an accelerator path,
3838    /// `accel_path`, sets up an accelerator in `accel_group` so whenever the
3839    /// key binding that is defined for `accel_path` is pressed, `self`
3840    /// will be activated. This removes any accelerators (for any
3841    /// accelerator group) installed by previous calls to
3842    /// [`set_accel_path()`][Self::set_accel_path()]. Associating accelerators with
3843    /// paths allows them to be modified by the user and the modifications
3844    /// to be saved for future use. (See `gtk_accel_map_save()`.)
3845    ///
3846    /// This function is a low level function that would most likely
3847    /// be used by a menu creation system like `GtkUIManager`. If you
3848    /// use `GtkUIManager`, setting up accelerator paths will be done
3849    /// automatically.
3850    ///
3851    /// Even when you you aren’t using `GtkUIManager`, if you only want to
3852    /// set up accelerators on menu items [`GtkMenuItemExt::set_accel_path()`][crate::prelude::GtkMenuItemExt::set_accel_path()]
3853    /// provides a somewhat more convenient interface.
3854    ///
3855    /// Note that `accel_path` string will be stored in a `GQuark`. Therefore, if you
3856    /// pass a static string, you can save some memory by interning it first with
3857    /// `g_intern_static_string()`.
3858    /// ## `accel_path`
3859    /// path used to look up the accelerator
3860    /// ## `accel_group`
3861    /// a [`AccelGroup`][crate::AccelGroup].
3862    #[doc(alias = "gtk_widget_set_accel_path")]
3863    fn set_accel_path(&self, accel_path: Option<&str>, accel_group: Option<&impl IsA<AccelGroup>>) {
3864        unsafe {
3865            ffi::gtk_widget_set_accel_path(
3866                self.as_ref().to_glib_none().0,
3867                accel_path.to_glib_none().0,
3868                accel_group.map(|p| p.as_ref()).to_glib_none().0,
3869            );
3870        }
3871    }
3872
3873    /// Sets the widget’s allocation. This should not be used
3874    /// directly, but from within a widget’s size_allocate method.
3875    ///
3876    /// The allocation set should be the “adjusted” or actual
3877    /// allocation. If you’re implementing a [`Container`][crate::Container], you want to use
3878    /// [`size_allocate()`][Self::size_allocate()] instead of [`set_allocation()`][Self::set_allocation()].
3879    /// The GtkWidgetClass::adjust_size_allocation virtual method adjusts the
3880    /// allocation inside [`size_allocate()`][Self::size_allocate()] to create an adjusted
3881    /// allocation.
3882    /// ## `allocation`
3883    /// a pointer to a `GtkAllocation` to copy from
3884    #[doc(alias = "gtk_widget_set_allocation")]
3885    fn set_allocation(&self, allocation: &Allocation) {
3886        unsafe {
3887            ffi::gtk_widget_set_allocation(
3888                self.as_ref().to_glib_none().0,
3889                allocation.to_glib_none().0,
3890            );
3891        }
3892    }
3893
3894    /// Sets whether the application intends to draw on the widget in
3895    /// an [`draw`][struct@crate::Widget#draw] handler.
3896    ///
3897    /// This is a hint to the widget and does not affect the behavior of
3898    /// the GTK+ core; many widgets ignore this flag entirely. For widgets
3899    /// that do pay attention to the flag, such as [`EventBox`][crate::EventBox] and [`Window`][crate::Window],
3900    /// the effect is to suppress default themed drawing of the widget's
3901    /// background. (Children of the widget will still be drawn.) The application
3902    /// is then entirely responsible for drawing the widget background.
3903    ///
3904    /// Note that the background is still drawn when the widget is mapped.
3905    /// ## `app_paintable`
3906    /// [`true`] if the application will paint on the widget
3907    #[doc(alias = "gtk_widget_set_app_paintable")]
3908    #[doc(alias = "app-paintable")]
3909    fn set_app_paintable(&self, app_paintable: bool) {
3910        unsafe {
3911            ffi::gtk_widget_set_app_paintable(
3912                self.as_ref().to_glib_none().0,
3913                app_paintable.into_glib(),
3914            );
3915        }
3916    }
3917
3918    /// Specifies whether `self` can be a default widget. See
3919    /// [`grab_default()`][Self::grab_default()] for details about the meaning of
3920    /// “default”.
3921    /// ## `can_default`
3922    /// whether or not `self` can be a default widget.
3923    #[doc(alias = "gtk_widget_set_can_default")]
3924    #[doc(alias = "can-default")]
3925    fn set_can_default(&self, can_default: bool) {
3926        unsafe {
3927            ffi::gtk_widget_set_can_default(
3928                self.as_ref().to_glib_none().0,
3929                can_default.into_glib(),
3930            );
3931        }
3932    }
3933
3934    /// Specifies whether `self` can own the input focus. See
3935    /// [`grab_focus()`][Self::grab_focus()] for actually setting the input focus on a
3936    /// widget.
3937    /// ## `can_focus`
3938    /// whether or not `self` can own the input focus.
3939    #[doc(alias = "gtk_widget_set_can_focus")]
3940    #[doc(alias = "can-focus")]
3941    fn set_can_focus(&self, can_focus: bool) {
3942        unsafe {
3943            ffi::gtk_widget_set_can_focus(self.as_ref().to_glib_none().0, can_focus.into_glib());
3944        }
3945    }
3946
3947    /// Sets whether `self` should be mapped along with its when its parent
3948    /// is mapped and `self` has been shown with [`show()`][Self::show()].
3949    ///
3950    /// The child visibility can be set for widget before it is added to
3951    /// a container with [`set_parent()`][Self::set_parent()], to avoid mapping
3952    /// children unnecessary before immediately unmapping them. However
3953    /// it will be reset to its default state of [`true`] when the widget
3954    /// is removed from a container.
3955    ///
3956    /// Note that changing the child visibility of a widget does not
3957    /// queue a resize on the widget. Most of the time, the size of
3958    /// a widget is computed from all visible children, whether or
3959    /// not they are mapped. If this is not the case, the container
3960    /// can queue a resize itself.
3961    ///
3962    /// This function is only useful for container implementations and
3963    /// never should be called by an application.
3964    /// ## `is_visible`
3965    /// if [`true`], `self` should be mapped along with its parent.
3966    #[doc(alias = "gtk_widget_set_child_visible")]
3967    fn set_child_visible(&self, is_visible: bool) {
3968        unsafe {
3969            ffi::gtk_widget_set_child_visible(
3970                self.as_ref().to_glib_none().0,
3971                is_visible.into_glib(),
3972            );
3973        }
3974    }
3975
3976    /// Sets the widget’s clip. This must not be used directly,
3977    /// but from within a widget’s size_allocate method.
3978    /// It must be called after [`set_allocation()`][Self::set_allocation()] (or after chaining up
3979    /// to the parent class), because that function resets the clip.
3980    ///
3981    /// The clip set should be the area that `self` draws on. If `self` is a
3982    /// [`Container`][crate::Container], the area must contain all children's clips.
3983    ///
3984    /// If this function is not called by `self` during a ::size-allocate handler,
3985    /// the clip will be set to `self`'s allocation.
3986    /// ## `clip`
3987    /// a pointer to a `GtkAllocation` to copy from
3988    #[doc(alias = "gtk_widget_set_clip")]
3989    fn set_clip(&self, clip: &Allocation) {
3990        unsafe {
3991            ffi::gtk_widget_set_clip(self.as_ref().to_glib_none().0, clip.to_glib_none().0);
3992        }
3993    }
3994
3995    /// Enables or disables a [`gdk::Device`][crate::gdk::Device] to interact with `self`
3996    /// and all its children.
3997    ///
3998    /// It does so by descending through the [`gdk::Window`][crate::gdk::Window] hierarchy
3999    /// and enabling the same mask that is has for core events
4000    /// (i.e. the one that [`Window::events()`][crate::gdk::Window::events()] returns).
4001    /// ## `device`
4002    /// a [`gdk::Device`][crate::gdk::Device]
4003    /// ## `enabled`
4004    /// whether to enable the device
4005    #[doc(alias = "gtk_widget_set_device_enabled")]
4006    fn set_device_enabled(&self, device: &gdk::Device, enabled: bool) {
4007        unsafe {
4008            ffi::gtk_widget_set_device_enabled(
4009                self.as_ref().to_glib_none().0,
4010                device.to_glib_none().0,
4011                enabled.into_glib(),
4012            );
4013        }
4014    }
4015
4016    /// Sets the device event mask (see [`gdk::EventMask`][crate::gdk::EventMask]) for a widget. The event
4017    /// mask determines which events a widget will receive from `device`. Keep
4018    /// in mind that different widgets have different default event masks, and by
4019    /// changing the event mask you may disrupt a widget’s functionality,
4020    /// so be careful. This function must be called while a widget is
4021    /// unrealized. Consider [`add_device_events()`][Self::add_device_events()] for widgets that are
4022    /// already realized, or if you want to preserve the existing event
4023    /// mask. This function can’t be used with windowless widgets (which return
4024    /// [`false`] from [`has_window()`][Self::has_window()]);
4025    /// to get events on those widgets, place them inside a [`EventBox`][crate::EventBox]
4026    /// and receive events on the event box.
4027    /// ## `device`
4028    /// a [`gdk::Device`][crate::gdk::Device]
4029    /// ## `events`
4030    /// event mask
4031    #[doc(alias = "gtk_widget_set_device_events")]
4032    fn set_device_events(&self, device: &gdk::Device, events: gdk::EventMask) {
4033        unsafe {
4034            ffi::gtk_widget_set_device_events(
4035                self.as_ref().to_glib_none().0,
4036                device.to_glib_none().0,
4037                events.into_glib(),
4038            );
4039        }
4040    }
4041
4042    /// Sets the reading direction on a particular widget. This direction
4043    /// controls the primary direction for widgets containing text,
4044    /// and also the direction in which the children of a container are
4045    /// packed. The ability to set the direction is present in order
4046    /// so that correct localization into languages with right-to-left
4047    /// reading directions can be done. Generally, applications will
4048    /// let the default reading direction present, except for containers
4049    /// where the containers are arranged in an order that is explicitly
4050    /// visual rather than logical (such as buttons for text justification).
4051    ///
4052    /// If the direction is set to [`TextDirection::None`][crate::TextDirection::None], then the value
4053    /// set by [`Widget::set_default_direction()`][crate::Widget::set_default_direction()] will be used.
4054    /// ## `dir`
4055    /// the new direction
4056    #[doc(alias = "gtk_widget_set_direction")]
4057    fn set_direction(&self, dir: TextDirection) {
4058        unsafe {
4059            ffi::gtk_widget_set_direction(self.as_ref().to_glib_none().0, dir.into_glib());
4060        }
4061    }
4062
4063    /// Sets whether the widget should grab focus when it is clicked with the mouse.
4064    /// Making mouse clicks not grab focus is useful in places like toolbars where
4065    /// you don’t want the keyboard focus removed from the main area of the
4066    /// application.
4067    /// ## `focus_on_click`
4068    /// whether the widget should grab focus when clicked with the mouse
4069    #[doc(alias = "gtk_widget_set_focus_on_click")]
4070    #[doc(alias = "focus-on-click")]
4071    fn set_focus_on_click(&self, focus_on_click: bool) {
4072        unsafe {
4073            ffi::gtk_widget_set_focus_on_click(
4074                self.as_ref().to_glib_none().0,
4075                focus_on_click.into_glib(),
4076            );
4077        }
4078    }
4079
4080    /// Sets the font map to use for Pango rendering. When not set, the widget
4081    /// will inherit the font map from its parent.
4082    /// ## `font_map`
4083    /// a [`pango::FontMap`][crate::pango::FontMap], or [`None`] to unset any previously
4084    ///  set font map
4085    #[doc(alias = "gtk_widget_set_font_map")]
4086    fn set_font_map(&self, font_map: Option<&impl IsA<pango::FontMap>>) {
4087        unsafe {
4088            ffi::gtk_widget_set_font_map(
4089                self.as_ref().to_glib_none().0,
4090                font_map.map(|p| p.as_ref()).to_glib_none().0,
4091            );
4092        }
4093    }
4094
4095    /// Sets the [`cairo::FontOptions`][crate::cairo::FontOptions] used for Pango rendering in this widget.
4096    /// When not set, the default font options for the [`gdk::Screen`][crate::gdk::Screen] will be used.
4097    /// ## `options`
4098    /// a [`cairo::FontOptions`][crate::cairo::FontOptions], or [`None`] to unset any
4099    ///  previously set default font options.
4100    #[doc(alias = "gtk_widget_set_font_options")]
4101    fn set_font_options(&self, options: Option<&cairo::FontOptions>) {
4102        unsafe {
4103            ffi::gtk_widget_set_font_options(
4104                self.as_ref().to_glib_none().0,
4105                options.to_glib_none().0,
4106            );
4107        }
4108    }
4109
4110    /// Sets the horizontal alignment of `self`.
4111    /// See the [`halign`][struct@crate::Widget#halign] property.
4112    /// ## `align`
4113    /// the horizontal alignment
4114    #[doc(alias = "gtk_widget_set_halign")]
4115    #[doc(alias = "halign")]
4116    fn set_halign(&self, align: Align) {
4117        unsafe {
4118            ffi::gtk_widget_set_halign(self.as_ref().to_glib_none().0, align.into_glib());
4119        }
4120    }
4121
4122    /// Sets the has-tooltip property on `self` to `has_tooltip`. See
4123    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] for more information.
4124    /// ## `has_tooltip`
4125    /// whether or not `self` has a tooltip.
4126    #[doc(alias = "gtk_widget_set_has_tooltip")]
4127    #[doc(alias = "has-tooltip")]
4128    fn set_has_tooltip(&self, has_tooltip: bool) {
4129        unsafe {
4130            ffi::gtk_widget_set_has_tooltip(
4131                self.as_ref().to_glib_none().0,
4132                has_tooltip.into_glib(),
4133            );
4134        }
4135    }
4136
4137    /// Specifies whether `self` has a [`gdk::Window`][crate::gdk::Window] of its own. Note that
4138    /// all realized widgets have a non-[`None`] “window” pointer
4139    /// ([`window()`][Self::window()] never returns a [`None`] window when a widget
4140    /// is realized), but for many of them it’s actually the [`gdk::Window`][crate::gdk::Window] of
4141    /// one of its parent widgets. Widgets that do not create a `window` for
4142    /// themselves in [`realize`][struct@crate::Widget#realize] must announce this by
4143    /// calling this function with `has_window` = [`false`].
4144    ///
4145    /// This function should only be called by widget implementations,
4146    /// and they should call it in their `init()` function.
4147    /// ## `has_window`
4148    /// whether or not `self` has a window.
4149    #[doc(alias = "gtk_widget_set_has_window")]
4150    fn set_has_window(&self, has_window: bool) {
4151        unsafe {
4152            ffi::gtk_widget_set_has_window(self.as_ref().to_glib_none().0, has_window.into_glib());
4153        }
4154    }
4155
4156    /// Sets whether the widget would like any available extra horizontal
4157    /// space. When a user resizes a [`Window`][crate::Window], widgets with expand=TRUE
4158    /// generally receive the extra space. For example, a list or
4159    /// scrollable area or document in your window would often be set to
4160    /// expand.
4161    ///
4162    /// Call this function to set the expand flag if you would like your
4163    /// widget to become larger horizontally when the window has extra
4164    /// room.
4165    ///
4166    /// By default, widgets automatically expand if any of their children
4167    /// want to expand. (To see if a widget will automatically expand given
4168    /// its current children and state, call [`compute_expand()`][Self::compute_expand()]. A
4169    /// container can decide how the expandability of children affects the
4170    /// expansion of the container by overriding the compute_expand virtual
4171    /// method on [`Widget`][crate::Widget].).
4172    ///
4173    /// Setting hexpand explicitly with this function will override the
4174    /// automatic expand behavior.
4175    ///
4176    /// This function forces the widget to expand or not to expand,
4177    /// regardless of children. The override occurs because
4178    /// [`set_hexpand()`][Self::set_hexpand()] sets the hexpand-set property (see
4179    /// [`set_hexpand_set()`][Self::set_hexpand_set()]) which causes the widget’s hexpand
4180    /// value to be used, rather than looking at children and widget state.
4181    /// ## `expand`
4182    /// whether to expand
4183    #[doc(alias = "gtk_widget_set_hexpand")]
4184    #[doc(alias = "hexpand")]
4185    fn set_hexpand(&self, expand: bool) {
4186        unsafe {
4187            ffi::gtk_widget_set_hexpand(self.as_ref().to_glib_none().0, expand.into_glib());
4188        }
4189    }
4190
4191    /// Sets whether the hexpand flag (see [`hexpands()`][Self::hexpands()]) will
4192    /// be used.
4193    ///
4194    /// The hexpand-set property will be set automatically when you call
4195    /// [`set_hexpand()`][Self::set_hexpand()] to set hexpand, so the most likely
4196    /// reason to use this function would be to unset an explicit expand
4197    /// flag.
4198    ///
4199    /// If hexpand is set, then it overrides any computed
4200    /// expand value based on child widgets. If hexpand is not
4201    /// set, then the expand value depends on whether any
4202    /// children of the widget would like to expand.
4203    ///
4204    /// There are few reasons to use this function, but it’s here
4205    /// for completeness and consistency.
4206    /// ## `set`
4207    /// value for hexpand-set property
4208    #[doc(alias = "gtk_widget_set_hexpand_set")]
4209    #[doc(alias = "hexpand-set")]
4210    fn set_hexpand_set(&self, set: bool) {
4211        unsafe {
4212            ffi::gtk_widget_set_hexpand_set(self.as_ref().to_glib_none().0, set.into_glib());
4213        }
4214    }
4215
4216    /// Marks the widget as being mapped.
4217    ///
4218    /// This function should only ever be called in a derived widget's
4219    /// “map” or “unmap” implementation.
4220    /// ## `mapped`
4221    /// [`true`] to mark the widget as mapped
4222    #[doc(alias = "gtk_widget_set_mapped")]
4223    fn set_mapped(&self, mapped: bool) {
4224        unsafe {
4225            ffi::gtk_widget_set_mapped(self.as_ref().to_glib_none().0, mapped.into_glib());
4226        }
4227    }
4228
4229    /// Sets the bottom margin of `self`.
4230    /// See the [`margin-bottom`][struct@crate::Widget#margin-bottom] property.
4231    /// ## `margin`
4232    /// the bottom margin
4233    #[doc(alias = "gtk_widget_set_margin_bottom")]
4234    #[doc(alias = "margin-bottom")]
4235    fn set_margin_bottom(&self, margin: i32) {
4236        unsafe {
4237            ffi::gtk_widget_set_margin_bottom(self.as_ref().to_glib_none().0, margin);
4238        }
4239    }
4240
4241    /// Sets the end margin of `self`.
4242    /// See the [`margin-end`][struct@crate::Widget#margin-end] property.
4243    /// ## `margin`
4244    /// the end margin
4245    #[doc(alias = "gtk_widget_set_margin_end")]
4246    #[doc(alias = "margin-end")]
4247    fn set_margin_end(&self, margin: i32) {
4248        unsafe {
4249            ffi::gtk_widget_set_margin_end(self.as_ref().to_glib_none().0, margin);
4250        }
4251    }
4252
4253    /// Sets the start margin of `self`.
4254    /// See the [`margin-start`][struct@crate::Widget#margin-start] property.
4255    /// ## `margin`
4256    /// the start margin
4257    #[doc(alias = "gtk_widget_set_margin_start")]
4258    #[doc(alias = "margin-start")]
4259    fn set_margin_start(&self, margin: i32) {
4260        unsafe {
4261            ffi::gtk_widget_set_margin_start(self.as_ref().to_glib_none().0, margin);
4262        }
4263    }
4264
4265    /// Sets the top margin of `self`.
4266    /// See the [`margin-top`][struct@crate::Widget#margin-top] property.
4267    /// ## `margin`
4268    /// the top margin
4269    #[doc(alias = "gtk_widget_set_margin_top")]
4270    #[doc(alias = "margin-top")]
4271    fn set_margin_top(&self, margin: i32) {
4272        unsafe {
4273            ffi::gtk_widget_set_margin_top(self.as_ref().to_glib_none().0, margin);
4274        }
4275    }
4276
4277    /// , *...), so using
4278    /// these will make your widget impossible to match by name. Any combination
4279    /// of alphanumeric symbols, dashes and underscores will suffice.
4280    /// ## `name`
4281    /// name for the widget
4282    #[doc(alias = "gtk_widget_set_name")]
4283    #[doc(alias = "set_name")]
4284    #[doc(alias = "name")]
4285    fn set_widget_name(&self, name: &str) {
4286        unsafe {
4287            ffi::gtk_widget_set_name(self.as_ref().to_glib_none().0, name.to_glib_none().0);
4288        }
4289    }
4290
4291    /// Sets the [`no-show-all`][struct@crate::Widget#no-show-all] property, which determines whether
4292    /// calls to [`show_all()`][Self::show_all()] will affect this widget.
4293    ///
4294    /// This is mostly for use in constructing widget hierarchies with externally
4295    /// controlled visibility, see `GtkUIManager`.
4296    /// ## `no_show_all`
4297    /// the new value for the “no-show-all” property
4298    #[doc(alias = "gtk_widget_set_no_show_all")]
4299    #[doc(alias = "no-show-all")]
4300    fn set_no_show_all(&self, no_show_all: bool) {
4301        unsafe {
4302            ffi::gtk_widget_set_no_show_all(
4303                self.as_ref().to_glib_none().0,
4304                no_show_all.into_glib(),
4305            );
4306        }
4307    }
4308
4309    /// Request the `self` to be rendered partially transparent,
4310    /// with opacity 0 being fully transparent and 1 fully opaque. (Opacity values
4311    /// are clamped to the [0,1] range.).
4312    /// This works on both toplevel widget, and child widgets, although there
4313    /// are some limitations:
4314    ///
4315    /// For toplevel widgets this depends on the capabilities of the windowing
4316    /// system. On X11 this has any effect only on X screens with a compositing manager
4317    /// running. See `gtk_widget_is_composited()`. On Windows it should work
4318    /// always, although setting a window’s opacity after the window has been
4319    /// shown causes it to flicker once on Windows.
4320    ///
4321    /// For child widgets it doesn’t work if any affected widget has a native window, or
4322    /// disables double buffering.
4323    /// ## `opacity`
4324    /// desired opacity, between 0 and 1
4325    #[doc(alias = "gtk_widget_set_opacity")]
4326    #[doc(alias = "opacity")]
4327    fn set_opacity(&self, opacity: f64) {
4328        unsafe {
4329            ffi::gtk_widget_set_opacity(self.as_ref().to_glib_none().0, opacity);
4330        }
4331    }
4332
4333    /// This function is useful only when implementing subclasses of
4334    /// [`Container`][crate::Container].
4335    /// Sets the container as the parent of `self`, and takes care of
4336    /// some details such as updating the state and style of the child
4337    /// to reflect its new location. The opposite function is
4338    /// [`unparent()`][Self::unparent()].
4339    /// ## `parent`
4340    /// parent container
4341    #[doc(alias = "gtk_widget_set_parent")]
4342    #[doc(alias = "parent")]
4343    fn set_parent(&self, parent: &impl IsA<Widget>) {
4344        unsafe {
4345            ffi::gtk_widget_set_parent(
4346                self.as_ref().to_glib_none().0,
4347                parent.as_ref().to_glib_none().0,
4348            );
4349        }
4350    }
4351
4352    /// Sets a non default parent window for `self`.
4353    ///
4354    /// For [`Window`][crate::Window] classes, setting a `parent_window` effects whether
4355    /// the window is a toplevel window or can be embedded into other
4356    /// widgets.
4357    ///
4358    /// For [`Window`][crate::Window] classes, this needs to be called before the
4359    /// window is realized.
4360    /// ## `parent_window`
4361    /// the new parent window.
4362    #[doc(alias = "gtk_widget_set_parent_window")]
4363    fn set_parent_window(&self, parent_window: &gdk::Window) {
4364        unsafe {
4365            ffi::gtk_widget_set_parent_window(
4366                self.as_ref().to_glib_none().0,
4367                parent_window.to_glib_none().0,
4368            );
4369        }
4370    }
4371
4372    /// Marks the widget as being realized. This function must only be
4373    /// called after all `GdkWindows` for the `self` have been created
4374    /// and registered.
4375    ///
4376    /// This function should only ever be called in a derived widget's
4377    /// “realize” or “unrealize” implementation.
4378    /// ## `realized`
4379    /// [`true`] to mark the widget as realized
4380    #[doc(alias = "gtk_widget_set_realized")]
4381    fn set_realized(&self, realized: bool) {
4382        unsafe {
4383            ffi::gtk_widget_set_realized(self.as_ref().to_glib_none().0, realized.into_glib());
4384        }
4385    }
4386
4387    /// Specifies whether `self` will be treated as the default widget
4388    /// within its toplevel when it has the focus, even if another widget
4389    /// is the default.
4390    ///
4391    /// See [`grab_default()`][Self::grab_default()] for details about the meaning of
4392    /// “default”.
4393    /// ## `receives_default`
4394    /// whether or not `self` can be a default widget.
4395    #[doc(alias = "gtk_widget_set_receives_default")]
4396    #[doc(alias = "receives-default")]
4397    fn set_receives_default(&self, receives_default: bool) {
4398        unsafe {
4399            ffi::gtk_widget_set_receives_default(
4400                self.as_ref().to_glib_none().0,
4401                receives_default.into_glib(),
4402            );
4403        }
4404    }
4405
4406    /// window, you are
4407    /// responsible for invalidating both the old and new allocation of the
4408    /// widget when the widget is moved and responsible for invalidating
4409    /// regions newly when the widget increases size.
4410    /// ## `redraw_on_allocate`
4411    /// if [`true`], the entire widget will be redrawn
4412    ///  when it is allocated to a new size. Otherwise, only the
4413    ///  new portion of the widget will be redrawn.
4414    #[doc(alias = "gtk_widget_set_redraw_on_allocate")]
4415    fn set_redraw_on_allocate(&self, redraw_on_allocate: bool) {
4416        unsafe {
4417            ffi::gtk_widget_set_redraw_on_allocate(
4418                self.as_ref().to_glib_none().0,
4419                redraw_on_allocate.into_glib(),
4420            );
4421        }
4422    }
4423
4424    /// Sets the sensitivity of a widget. A widget is sensitive if the user
4425    /// can interact with it. Insensitive widgets are “grayed out” and the
4426    /// user can’t interact with them. Insensitive widgets are known as
4427    /// “inactive”, “disabled”, or “ghosted” in some other toolkits.
4428    /// ## `sensitive`
4429    /// [`true`] to make the widget sensitive
4430    #[doc(alias = "gtk_widget_set_sensitive")]
4431    #[doc(alias = "sensitive")]
4432    fn set_sensitive(&self, sensitive: bool) {
4433        unsafe {
4434            ffi::gtk_widget_set_sensitive(self.as_ref().to_glib_none().0, sensitive.into_glib());
4435        }
4436    }
4437
4438    /// Sets the minimum size of a widget; that is, the widget’s size
4439    /// request will be at least `width` by `height`. You can use this
4440    /// function to force a widget to be larger than it normally would be.
4441    ///
4442    /// In most cases, [`GtkWindowExt::set_default_size()`][crate::prelude::GtkWindowExt::set_default_size()] is a better choice for
4443    /// toplevel windows than this function; setting the default size will
4444    /// still allow users to shrink the window. Setting the size request
4445    /// will force them to leave the window at least as large as the size
4446    /// request. When dealing with window sizes,
4447    /// [`GtkWindowExt::set_geometry_hints()`][crate::prelude::GtkWindowExt::set_geometry_hints()] can be a useful function as well.
4448    ///
4449    /// Note the inherent danger of setting any fixed size - themes,
4450    /// translations into other languages, different fonts, and user action
4451    /// can all change the appropriate size for a given widget. So, it's
4452    /// basically impossible to hardcode a size that will always be
4453    /// correct.
4454    ///
4455    /// The size request of a widget is the smallest size a widget can
4456    /// accept while still functioning well and drawing itself correctly.
4457    /// However in some strange cases a widget may be allocated less than
4458    /// its requested size, and in many cases a widget may be allocated more
4459    /// space than it requested.
4460    ///
4461    /// If the size request in a given direction is -1 (unset), then
4462    /// the “natural” size request of the widget will be used instead.
4463    ///
4464    /// The size request set here does not include any margin from the
4465    /// [`Widget`][crate::Widget] properties margin-left, margin-right, margin-top, and
4466    /// margin-bottom, but it does include pretty much all other padding
4467    /// or border properties set by any subclass of [`Widget`][crate::Widget].
4468    /// ## `width`
4469    /// width `self` should request, or -1 to unset
4470    /// ## `height`
4471    /// height `self` should request, or -1 to unset
4472    #[doc(alias = "gtk_widget_set_size_request")]
4473    fn set_size_request(&self, width: i32, height: i32) {
4474        unsafe {
4475            ffi::gtk_widget_set_size_request(self.as_ref().to_glib_none().0, width, height);
4476        }
4477    }
4478
4479    /// This function is for use in widget implementations. Turns on flag
4480    /// values in the current widget state (insensitive, prelighted, etc.).
4481    ///
4482    /// This function accepts the values [`StateFlags::DIR_LTR`][crate::StateFlags::DIR_LTR] and
4483    /// [`StateFlags::DIR_RTL`][crate::StateFlags::DIR_RTL] but ignores them. If you want to set the widget's
4484    /// direction, use [`set_direction()`][Self::set_direction()].
4485    ///
4486    /// It is worth mentioning that any other state than [`StateFlags::INSENSITIVE`][crate::StateFlags::INSENSITIVE],
4487    /// will be propagated down to all non-internal children if `self` is a
4488    /// [`Container`][crate::Container], while [`StateFlags::INSENSITIVE`][crate::StateFlags::INSENSITIVE] itself will be propagated
4489    /// down to all [`Container`][crate::Container] children by different means than turning on the
4490    /// state flag down the hierarchy, both [`state_flags()`][Self::state_flags()] and
4491    /// [`is_sensitive()`][Self::is_sensitive()] will make use of these.
4492    /// ## `flags`
4493    /// State flags to turn on
4494    /// ## `clear`
4495    /// Whether to clear state before turning on `flags`
4496    #[doc(alias = "gtk_widget_set_state_flags")]
4497    fn set_state_flags(&self, flags: StateFlags, clear: bool) {
4498        unsafe {
4499            ffi::gtk_widget_set_state_flags(
4500                self.as_ref().to_glib_none().0,
4501                flags.into_glib(),
4502                clear.into_glib(),
4503            );
4504        }
4505    }
4506
4507    /// Enables or disables multiple pointer awareness. If this setting is [`true`],
4508    /// `self` will start receiving multiple, per device enter/leave events. Note
4509    /// that if custom `GdkWindows` are created in [`realize`][struct@crate::Widget#realize],
4510    /// [`Window::set_support_multidevice()`][crate::gdk::Window::set_support_multidevice()] will have to be called manually on them.
4511    /// ## `support_multidevice`
4512    /// [`true`] to support input from multiple devices.
4513    #[doc(alias = "gtk_widget_set_support_multidevice")]
4514    fn set_support_multidevice(&self, support_multidevice: bool) {
4515        unsafe {
4516            ffi::gtk_widget_set_support_multidevice(
4517                self.as_ref().to_glib_none().0,
4518                support_multidevice.into_glib(),
4519            );
4520        }
4521    }
4522
4523    /// Sets `markup` as the contents of the tooltip, which is marked up with
4524    ///  the [Pango text markup language][PangoMarkupFormat].
4525    ///
4526    /// This function will take care of setting [`has-tooltip`][struct@crate::Widget#has-tooltip] to [`true`]
4527    /// and of the default handler for the [`query-tooltip`][struct@crate::Widget#query-tooltip] signal.
4528    ///
4529    /// See also the [`tooltip-markup`][struct@crate::Widget#tooltip-markup] property and
4530    /// [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
4531    /// ## `markup`
4532    /// the contents of the tooltip for `self`, or [`None`]
4533    #[doc(alias = "gtk_widget_set_tooltip_markup")]
4534    #[doc(alias = "tooltip-markup")]
4535    fn set_tooltip_markup(&self, markup: Option<&str>) {
4536        unsafe {
4537            ffi::gtk_widget_set_tooltip_markup(
4538                self.as_ref().to_glib_none().0,
4539                markup.to_glib_none().0,
4540            );
4541        }
4542    }
4543
4544    /// Sets `text` as the contents of the tooltip. This function will take
4545    /// care of setting [`has-tooltip`][struct@crate::Widget#has-tooltip] to [`true`] and of the default
4546    /// handler for the [`query-tooltip`][struct@crate::Widget#query-tooltip] signal.
4547    ///
4548    /// See also the [`tooltip-text`][struct@crate::Widget#tooltip-text] property and [`Tooltip::set_text()`][crate::Tooltip::set_text()].
4549    /// ## `text`
4550    /// the contents of the tooltip for `self`
4551    #[doc(alias = "gtk_widget_set_tooltip_text")]
4552    #[doc(alias = "tooltip-text")]
4553    fn set_tooltip_text(&self, text: Option<&str>) {
4554        unsafe {
4555            ffi::gtk_widget_set_tooltip_text(self.as_ref().to_glib_none().0, text.to_glib_none().0);
4556        }
4557    }
4558
4559    /// Replaces the default window used for displaying
4560    /// tooltips with `custom_window`. GTK+ will take care of showing and
4561    /// hiding `custom_window` at the right moment, to behave likewise as
4562    /// the default tooltip window. If `custom_window` is [`None`], the default
4563    /// tooltip window will be used.
4564    /// ## `custom_window`
4565    /// a [`Window`][crate::Window], or [`None`]
4566    #[doc(alias = "gtk_widget_set_tooltip_window")]
4567    fn set_tooltip_window(&self, custom_window: Option<&impl IsA<Window>>) {
4568        unsafe {
4569            ffi::gtk_widget_set_tooltip_window(
4570                self.as_ref().to_glib_none().0,
4571                custom_window.map(|p| p.as_ref()).to_glib_none().0,
4572            );
4573        }
4574    }
4575
4576    /// Sets the vertical alignment of `self`.
4577    /// See the [`valign`][struct@crate::Widget#valign] property.
4578    /// ## `align`
4579    /// the vertical alignment
4580    #[doc(alias = "gtk_widget_set_valign")]
4581    #[doc(alias = "valign")]
4582    fn set_valign(&self, align: Align) {
4583        unsafe {
4584            ffi::gtk_widget_set_valign(self.as_ref().to_glib_none().0, align.into_glib());
4585        }
4586    }
4587
4588    /// Sets whether the widget would like any available extra vertical
4589    /// space.
4590    ///
4591    /// See [`set_hexpand()`][Self::set_hexpand()] for more detail.
4592    /// ## `expand`
4593    /// whether to expand
4594    #[doc(alias = "gtk_widget_set_vexpand")]
4595    #[doc(alias = "vexpand")]
4596    fn set_vexpand(&self, expand: bool) {
4597        unsafe {
4598            ffi::gtk_widget_set_vexpand(self.as_ref().to_glib_none().0, expand.into_glib());
4599        }
4600    }
4601
4602    /// Sets whether the vexpand flag (see [`vexpands()`][Self::vexpands()]) will
4603    /// be used.
4604    ///
4605    /// See [`set_hexpand_set()`][Self::set_hexpand_set()] for more detail.
4606    /// ## `set`
4607    /// value for vexpand-set property
4608    #[doc(alias = "gtk_widget_set_vexpand_set")]
4609    #[doc(alias = "vexpand-set")]
4610    fn set_vexpand_set(&self, set: bool) {
4611        unsafe {
4612            ffi::gtk_widget_set_vexpand_set(self.as_ref().to_glib_none().0, set.into_glib());
4613        }
4614    }
4615
4616    /// Sets the visibility state of `self`. Note that setting this to
4617    /// [`true`] doesn’t mean the widget is actually viewable, see
4618    /// [`get_visible()`][Self::get_visible()].
4619    ///
4620    /// This function simply calls [`show()`][Self::show()] or [`hide()`][Self::hide()]
4621    /// but is nicer to use when the visibility of the widget depends on
4622    /// some condition.
4623    /// ## `visible`
4624    /// whether the widget should be shown or not
4625    #[doc(alias = "gtk_widget_set_visible")]
4626    #[doc(alias = "visible")]
4627    fn set_visible(&self, visible: bool) {
4628        unsafe {
4629            ffi::gtk_widget_set_visible(self.as_ref().to_glib_none().0, visible.into_glib());
4630        }
4631    }
4632
4633    /// Sets the visual that should be used for by widget and its children for
4634    /// creating `GdkWindows`. The visual must be on the same [`gdk::Screen`][crate::gdk::Screen] as
4635    /// returned by [`screen()`][Self::screen()], so handling the
4636    /// [`screen-changed`][struct@crate::Widget#screen-changed] signal is necessary.
4637    ///
4638    /// Setting a new `visual` will not cause `self` to recreate its windows,
4639    /// so you should call this function before `self` is realized.
4640    /// ## `visual`
4641    /// visual to be used or [`None`] to unset a previous one
4642    #[doc(alias = "gtk_widget_set_visual")]
4643    fn set_visual(&self, visual: Option<&gdk::Visual>) {
4644        unsafe {
4645            ffi::gtk_widget_set_visual(self.as_ref().to_glib_none().0, visual.to_glib_none().0);
4646        }
4647    }
4648
4649    /// Sets a widget’s window. This function should only be used in a
4650    /// widget’s [`realize`][struct@crate::Widget#realize] implementation. The `window` passed is
4651    /// usually either new window created with [`gdk::Window::new()`][crate::gdk::Window::new()], or the
4652    /// window of its parent widget as returned by
4653    /// [`parent_window()`][Self::parent_window()].
4654    ///
4655    /// Widgets must indicate whether they will create their own [`gdk::Window`][crate::gdk::Window]
4656    /// by calling [`set_has_window()`][Self::set_has_window()]. This is usually done in the
4657    /// widget’s `init()` function.
4658    ///
4659    /// Note that this function does not add any reference to `window`.
4660    /// ## `window`
4661    /// a [`gdk::Window`][crate::gdk::Window]
4662    #[doc(alias = "gtk_widget_set_window")]
4663    fn set_window(&self, window: gdk::Window) {
4664        unsafe {
4665            ffi::gtk_widget_set_window(self.as_ref().to_glib_none().0, window.into_glib_ptr());
4666        }
4667    }
4668
4669    /// Sets a shape for this widget’s GDK window. This allows for
4670    /// transparent windows etc., see [`Window::shape_combine_region()`][crate::gdk::Window::shape_combine_region()]
4671    /// for more information.
4672    /// ## `region`
4673    /// shape to be added, or [`None`] to remove an existing shape
4674    #[doc(alias = "gtk_widget_shape_combine_region")]
4675    fn shape_combine_region(&self, region: Option<&cairo::Region>) {
4676        unsafe {
4677            ffi::gtk_widget_shape_combine_region(
4678                self.as_ref().to_glib_none().0,
4679                mut_override(region.to_glib_none().0),
4680            );
4681        }
4682    }
4683
4684    /// Flags a widget to be displayed. Any widget that isn’t shown will
4685    /// not appear on the screen. If you want to show all the widgets in a
4686    /// container, it’s easier to call [`show_all()`][Self::show_all()] on the
4687    /// container, instead of individually showing the widgets.
4688    ///
4689    /// Remember that you have to show the containers containing a widget,
4690    /// in addition to the widget itself, before it will appear onscreen.
4691    ///
4692    /// When a toplevel container is shown, it is immediately realized and
4693    /// mapped; other shown widgets are realized and mapped when their
4694    /// toplevel container is realized and mapped.
4695    #[doc(alias = "gtk_widget_show")]
4696    fn show(&self) {
4697        unsafe {
4698            ffi::gtk_widget_show(self.as_ref().to_glib_none().0);
4699        }
4700    }
4701
4702    /// Recursively shows a widget, and any child widgets (if the widget is
4703    /// a container).
4704    #[doc(alias = "gtk_widget_show_all")]
4705    fn show_all(&self) {
4706        unsafe {
4707            ffi::gtk_widget_show_all(self.as_ref().to_glib_none().0);
4708        }
4709    }
4710
4711    /// Shows a widget. If the widget is an unmapped toplevel widget
4712    /// (i.e. a [`Window`][crate::Window] that has not yet been shown), enter the main
4713    /// loop and wait for the window to actually be mapped. Be careful;
4714    /// because the main loop is running, anything can happen during
4715    /// this function.
4716    #[doc(alias = "gtk_widget_show_now")]
4717    fn show_now(&self) {
4718        unsafe {
4719            ffi::gtk_widget_show_now(self.as_ref().to_glib_none().0);
4720        }
4721    }
4722
4723    /// This function is only used by [`Container`][crate::Container] subclasses, to assign a size
4724    /// and position to their child widgets.
4725    ///
4726    /// In this function, the allocation may be adjusted. It will be forced
4727    /// to a 1x1 minimum size, and the adjust_size_allocation virtual
4728    /// method on the child will be used to adjust the allocation. Standard
4729    /// adjustments include removing the widget’s margins, and applying the
4730    /// widget’s [`halign`][struct@crate::Widget#halign] and [`valign`][struct@crate::Widget#valign] properties.
4731    ///
4732    /// For baseline support in containers you need to use [`size_allocate_with_baseline()`][Self::size_allocate_with_baseline()]
4733    /// instead.
4734    /// ## `allocation`
4735    /// position and size to be allocated to `self`
4736    #[doc(alias = "gtk_widget_size_allocate")]
4737    fn size_allocate(&self, allocation: &Allocation) {
4738        unsafe {
4739            ffi::gtk_widget_size_allocate(
4740                self.as_ref().to_glib_none().0,
4741                mut_override(allocation.to_glib_none().0),
4742            );
4743        }
4744    }
4745
4746    /// This function is only used by [`Container`][crate::Container] subclasses, to assign a size,
4747    /// position and (optionally) baseline to their child widgets.
4748    ///
4749    /// In this function, the allocation and baseline may be adjusted. It
4750    /// will be forced to a 1x1 minimum size, and the
4751    /// adjust_size_allocation virtual and adjust_baseline_allocation
4752    /// methods on the child will be used to adjust the allocation and
4753    /// baseline. Standard adjustments include removing the widget's
4754    /// margins, and applying the widget’s [`halign`][struct@crate::Widget#halign] and
4755    /// [`valign`][struct@crate::Widget#valign] properties.
4756    ///
4757    /// If the child widget does not have a valign of [`Align::Baseline`][crate::Align::Baseline] the
4758    /// baseline argument is ignored and -1 is used instead.
4759    /// ## `allocation`
4760    /// position and size to be allocated to `self`
4761    /// ## `baseline`
4762    /// The baseline of the child, or -1
4763    #[doc(alias = "gtk_widget_size_allocate_with_baseline")]
4764    fn size_allocate_with_baseline(&self, allocation: &mut Allocation, baseline: i32) {
4765        unsafe {
4766            ffi::gtk_widget_size_allocate_with_baseline(
4767                self.as_ref().to_glib_none().0,
4768                allocation.to_glib_none_mut().0,
4769                baseline,
4770            );
4771        }
4772    }
4773
4774    //#[doc(alias = "gtk_widget_style_get")]
4775    //fn style_get(&self, first_property_name: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
4776    //    unsafe { TODO: call ffi:gtk_widget_style_get() }
4777    //}
4778
4779    /// Gets the value of a style property of `self`.
4780    /// ## `property_name`
4781    /// the name of a style property
4782    ///
4783    /// # Returns
4784    ///
4785    ///
4786    /// ## `value`
4787    /// location to return the property value
4788    #[doc(alias = "gtk_widget_style_get_property")]
4789    fn style_get_property(&self, property_name: &str) -> glib::Value {
4790        unsafe {
4791            let mut value = glib::Value::uninitialized();
4792            ffi::gtk_widget_style_get_property(
4793                self.as_ref().to_glib_none().0,
4794                property_name.to_glib_none().0,
4795                value.to_glib_none_mut().0,
4796            );
4797            value
4798        }
4799    }
4800
4801    //#[doc(alias = "gtk_widget_style_get_valist")]
4802    //fn style_get_valist(&self, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
4803    //    unsafe { TODO: call ffi:gtk_widget_style_get_valist() }
4804    //}
4805
4806    /// Reverts the effect of a previous call to [`freeze_child_notify()`][Self::freeze_child_notify()].
4807    /// This causes all queued [`child-notify`][struct@crate::Widget#child-notify] signals on `self` to be
4808    /// emitted.
4809    #[doc(alias = "gtk_widget_thaw_child_notify")]
4810    fn thaw_child_notify(&self) {
4811        unsafe {
4812            ffi::gtk_widget_thaw_child_notify(self.as_ref().to_glib_none().0);
4813        }
4814    }
4815
4816    /// Translate coordinates relative to `self`’s allocation to coordinates
4817    /// relative to `dest_widget`’s allocations. In order to perform this
4818    /// operation, both widgets must be realized, and must share a common
4819    /// toplevel.
4820    /// ## `dest_widget`
4821    /// a [`Widget`][crate::Widget]
4822    /// ## `src_x`
4823    /// X position relative to `self`
4824    /// ## `src_y`
4825    /// Y position relative to `self`
4826    ///
4827    /// # Returns
4828    ///
4829    /// [`false`] if either widget was not realized, or there
4830    ///  was no common ancestor. In this case, nothing is stored in
4831    ///  *`dest_x` and *`dest_y`. Otherwise [`true`].
4832    ///
4833    /// ## `dest_x`
4834    /// location to store X position relative to `dest_widget`
4835    ///
4836    /// ## `dest_y`
4837    /// location to store Y position relative to `dest_widget`
4838    #[doc(alias = "gtk_widget_translate_coordinates")]
4839    fn translate_coordinates(
4840        &self,
4841        dest_widget: &impl IsA<Widget>,
4842        src_x: i32,
4843        src_y: i32,
4844    ) -> Option<(i32, i32)> {
4845        unsafe {
4846            let mut dest_x = std::mem::MaybeUninit::uninit();
4847            let mut dest_y = std::mem::MaybeUninit::uninit();
4848            let ret = from_glib(ffi::gtk_widget_translate_coordinates(
4849                self.as_ref().to_glib_none().0,
4850                dest_widget.as_ref().to_glib_none().0,
4851                src_x,
4852                src_y,
4853                dest_x.as_mut_ptr(),
4854                dest_y.as_mut_ptr(),
4855            ));
4856            if ret {
4857                Some((dest_x.assume_init(), dest_y.assume_init()))
4858            } else {
4859                None
4860            }
4861        }
4862    }
4863
4864    /// Triggers a tooltip query on the display where the toplevel of `self`
4865    /// is located. See [`Tooltip::trigger_tooltip_query()`][crate::Tooltip::trigger_tooltip_query()] for more
4866    /// information.
4867    #[doc(alias = "gtk_widget_trigger_tooltip_query")]
4868    fn trigger_tooltip_query(&self) {
4869        unsafe {
4870            ffi::gtk_widget_trigger_tooltip_query(self.as_ref().to_glib_none().0);
4871        }
4872    }
4873
4874    /// This function is only for use in widget implementations. Causes
4875    /// a widget to be unmapped if it’s currently mapped.
4876    #[doc(alias = "gtk_widget_unmap")]
4877    fn unmap(&self) {
4878        unsafe {
4879            ffi::gtk_widget_unmap(self.as_ref().to_glib_none().0);
4880        }
4881    }
4882
4883    /// This function is only for use in widget implementations.
4884    /// Should be called by implementations of the remove method
4885    /// on [`Container`][crate::Container], to dissociate a child from the container.
4886    #[doc(alias = "gtk_widget_unparent")]
4887    fn unparent(&self) {
4888        unsafe {
4889            ffi::gtk_widget_unparent(self.as_ref().to_glib_none().0);
4890        }
4891    }
4892
4893    /// window).
4894    #[doc(alias = "gtk_widget_unrealize")]
4895    fn unrealize(&self) {
4896        unsafe {
4897            ffi::gtk_widget_unrealize(self.as_ref().to_glib_none().0);
4898        }
4899    }
4900
4901    /// Unregisters a [`gdk::Window`][crate::gdk::Window] from the widget that was previously set up with
4902    /// [`register_window()`][Self::register_window()]. You need to call this when the window is
4903    /// no longer used by the widget, such as when you destroy it.
4904    /// ## `window`
4905    /// a [`gdk::Window`][crate::gdk::Window]
4906    #[doc(alias = "gtk_widget_unregister_window")]
4907    fn unregister_window(&self, window: &gdk::Window) {
4908        unsafe {
4909            ffi::gtk_widget_unregister_window(
4910                self.as_ref().to_glib_none().0,
4911                window.to_glib_none().0,
4912            );
4913        }
4914    }
4915
4916    /// This function is for use in widget implementations. Turns off flag
4917    /// values for the current widget state (insensitive, prelighted, etc.).
4918    /// See [`set_state_flags()`][Self::set_state_flags()].
4919    /// ## `flags`
4920    /// State flags to turn off
4921    #[doc(alias = "gtk_widget_unset_state_flags")]
4922    fn unset_state_flags(&self, flags: StateFlags) {
4923        unsafe {
4924            ffi::gtk_widget_unset_state_flags(self.as_ref().to_glib_none().0, flags.into_glib());
4925        }
4926    }
4927
4928    #[doc(alias = "composite-child")]
4929    fn is_composite_child(&self) -> bool {
4930        ObjectExt::property(self.as_ref(), "composite-child")
4931    }
4932
4933    /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
4934    fn expands(&self) -> bool {
4935        ObjectExt::property(self.as_ref(), "expand")
4936    }
4937
4938    /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
4939    fn set_expand(&self, expand: bool) {
4940        ObjectExt::set_property(self.as_ref(), "expand", expand)
4941    }
4942
4943    #[doc(alias = "has-default")]
4944    fn set_has_default(&self, has_default: bool) {
4945        ObjectExt::set_property(self.as_ref(), "has-default", has_default)
4946    }
4947
4948    #[doc(alias = "has-focus")]
4949    fn set_has_focus(&self, has_focus: bool) {
4950        ObjectExt::set_property(self.as_ref(), "has-focus", has_focus)
4951    }
4952
4953    #[doc(alias = "height-request")]
4954    fn height_request(&self) -> i32 {
4955        ObjectExt::property(self.as_ref(), "height-request")
4956    }
4957
4958    #[doc(alias = "height-request")]
4959    fn set_height_request(&self, height_request: i32) {
4960        ObjectExt::set_property(self.as_ref(), "height-request", height_request)
4961    }
4962
4963    #[doc(alias = "is-focus")]
4964    fn set_is_focus(&self, is_focus: bool) {
4965        ObjectExt::set_property(self.as_ref(), "is-focus", is_focus)
4966    }
4967
4968    /// Sets all four sides' margin at once. If read, returns max
4969    /// margin on any side.
4970    fn margin(&self) -> i32 {
4971        ObjectExt::property(self.as_ref(), "margin")
4972    }
4973
4974    /// Sets all four sides' margin at once. If read, returns max
4975    /// margin on any side.
4976    fn set_margin(&self, margin: i32) {
4977        ObjectExt::set_property(self.as_ref(), "margin", margin)
4978    }
4979
4980    #[doc(alias = "width-request")]
4981    fn width_request(&self) -> i32 {
4982        ObjectExt::property(self.as_ref(), "width-request")
4983    }
4984
4985    #[doc(alias = "width-request")]
4986    fn set_width_request(&self, width_request: i32) {
4987        ObjectExt::set_property(self.as_ref(), "width-request", width_request)
4988    }
4989
4990    #[doc(alias = "accel-closures-changed")]
4991    fn connect_accel_closures_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4992        unsafe extern "C" fn accel_closures_changed_trampoline<
4993            P: IsA<Widget>,
4994            F: Fn(&P) + 'static,
4995        >(
4996            this: *mut ffi::GtkWidget,
4997            f: glib::ffi::gpointer,
4998        ) {
4999            unsafe {
5000                let f: &F = &*(f as *const F);
5001                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
5002            }
5003        }
5004        unsafe {
5005            let f: Box_<F> = Box_::new(f);
5006            connect_raw(
5007                self.as_ptr() as *mut _,
5008                c"accel-closures-changed".as_ptr(),
5009                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5010                    accel_closures_changed_trampoline::<Self, F> as *const (),
5011                )),
5012                Box_::into_raw(f),
5013            )
5014        }
5015    }
5016
5017    /// The ::button-press-event signal will be emitted when a button
5018    /// (typically from a mouse) is pressed.
5019    ///
5020    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
5021    /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
5022    ///
5023    /// This signal will be sent to the grab widget if there is one.
5024    /// ## `event`
5025    /// the [`gdk::EventButton`][crate::gdk::EventButton] which triggered
5026    ///  this signal.
5027    ///
5028    /// # Returns
5029    ///
5030    /// [`true`] to stop other handlers from being invoked for the event.
5031    ///  [`false`] to propagate the event further.
5032    #[doc(alias = "button-press-event")]
5033    fn connect_button_press_event<
5034        F: Fn(&Self, &gdk::EventButton) -> glib::Propagation + 'static,
5035    >(
5036        &self,
5037        f: F,
5038    ) -> SignalHandlerId {
5039        unsafe extern "C" fn button_press_event_trampoline<
5040            P: IsA<Widget>,
5041            F: Fn(&P, &gdk::EventButton) -> glib::Propagation + 'static,
5042        >(
5043            this: *mut ffi::GtkWidget,
5044            event: *mut gdk::ffi::GdkEventButton,
5045            f: glib::ffi::gpointer,
5046        ) -> glib::ffi::gboolean {
5047            unsafe {
5048                let f: &F = &*(f as *const F);
5049                f(
5050                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
5051                    &from_glib_borrow(event),
5052                )
5053                .into_glib()
5054            }
5055        }
5056        unsafe {
5057            let f: Box_<F> = Box_::new(f);
5058            connect_raw(
5059                self.as_ptr() as *mut _,
5060                c"button-press-event".as_ptr(),
5061                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5062                    button_press_event_trampoline::<Self, F> as *const (),
5063                )),
5064                Box_::into_raw(f),
5065            )
5066        }
5067    }
5068
5069    /// The ::button-release-event signal will be emitted when a button
5070    /// (typically from a mouse) is released.
5071    ///
5072    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
5073    /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
5074    ///
5075    /// This signal will be sent to the grab widget if there is one.
5076    /// ## `event`
5077    /// the [`gdk::EventButton`][crate::gdk::EventButton] which triggered
5078    ///  this signal.
5079    ///
5080    /// # Returns
5081    ///
5082    /// [`true`] to stop other handlers from being invoked for the event.
5083    ///  [`false`] to propagate the event further.
5084    #[doc(alias = "button-release-event")]
5085    fn connect_button_release_event<
5086        F: Fn(&Self, &gdk::EventButton) -> glib::Propagation + 'static,
5087    >(
5088        &self,
5089        f: F,
5090    ) -> SignalHandlerId {
5091        unsafe extern "C" fn button_release_event_trampoline<
5092            P: IsA<Widget>,
5093            F: Fn(&P, &gdk::EventButton) -> glib::Propagation + 'static,
5094        >(
5095            this: *mut ffi::GtkWidget,
5096            event: *mut gdk::ffi::GdkEventButton,
5097            f: glib::ffi::gpointer,
5098        ) -> glib::ffi::gboolean {
5099            unsafe {
5100                let f: &F = &*(f as *const F);
5101                f(
5102                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
5103                    &from_glib_borrow(event),
5104                )
5105                .into_glib()
5106            }
5107        }
5108        unsafe {
5109            let f: Box_<F> = Box_::new(f);
5110            connect_raw(
5111                self.as_ptr() as *mut _,
5112                c"button-release-event".as_ptr(),
5113                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5114                    button_release_event_trampoline::<Self, F> as *const (),
5115                )),
5116                Box_::into_raw(f),
5117            )
5118        }
5119    }
5120
5121    /// The ::child-notify signal is emitted for each
5122    /// [child property][child-properties] that has
5123    /// changed on an object. The signal's detail holds the property name.
5124    /// ## `child_property`
5125    /// the [`glib::ParamSpec`][crate::glib::ParamSpec] of the changed child property
5126    #[doc(alias = "child-notify")]
5127    fn connect_child_notify<F: Fn(&Self, &glib::ParamSpec) + 'static>(
5128        &self,
5129        detail: Option<&str>,
5130        f: F,
5131    ) -> SignalHandlerId {
5132        unsafe extern "C" fn child_notify_trampoline<
5133            P: IsA<Widget>,
5134            F: Fn(&P, &glib::ParamSpec) + 'static,
5135        >(
5136            this: *mut ffi::GtkWidget,
5137            child_property: *mut glib::gobject_ffi::GParamSpec,
5138            f: glib::ffi::gpointer,
5139        ) {
5140            unsafe {
5141                let f: &F = &*(f as *const F);
5142                f(
5143                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
5144                    &from_glib_borrow(child_property),
5145                )
5146            }
5147        }
5148        unsafe {
5149            let f: Box_<F> = Box_::new(f);
5150            let detailed_signal_name = detail.map(|name| format!("child-notify::{name}\0"));
5151            let signal_name = detailed_signal_name.as_ref().map_or(c"child-notify", |n| {
5152                std::ffi::CStr::from_bytes_with_nul_unchecked(n.as_bytes())
5153            });
5154            connect_raw(
5155                self.as_ptr() as *mut _,
5156                signal_name.as_ptr(),
5157                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5158                    child_notify_trampoline::<Self, F> as *const (),
5159                )),
5160                Box_::into_raw(f),
5161            )
5162        }
5163    }
5164
5165    /// The ::configure-event signal will be emitted when the size, position or
5166    /// stacking of the `widget`'s window has changed.
5167    ///
5168    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
5169    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
5170    /// automatically for all new windows.
5171    /// ## `event`
5172    /// the [`gdk::EventConfigure`][crate::gdk::EventConfigure] which triggered
5173    ///  this signal.
5174    ///
5175    /// # Returns
5176    ///
5177    /// [`true`] to stop other handlers from being invoked for the event.
5178    ///  [`false`] to propagate the event further.
5179    #[doc(alias = "configure-event")]
5180    fn connect_configure_event<F: Fn(&Self, &gdk::EventConfigure) -> bool + 'static>(
5181        &self,
5182        f: F,
5183    ) -> SignalHandlerId {
5184        unsafe extern "C" fn configure_event_trampoline<
5185            P: IsA<Widget>,
5186            F: Fn(&P, &gdk::EventConfigure) -> bool + 'static,
5187        >(
5188            this: *mut ffi::GtkWidget,
5189            event: *mut gdk::ffi::GdkEventConfigure,
5190            f: glib::ffi::gpointer,
5191        ) -> glib::ffi::gboolean {
5192            unsafe {
5193                let f: &F = &*(f as *const F);
5194                f(
5195                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
5196                    &from_glib_borrow(event),
5197                )
5198                .into_glib()
5199            }
5200        }
5201        unsafe {
5202            let f: Box_<F> = Box_::new(f);
5203            connect_raw(
5204                self.as_ptr() as *mut _,
5205                c"configure-event".as_ptr(),
5206                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5207                    configure_event_trampoline::<Self, F> as *const (),
5208                )),
5209                Box_::into_raw(f),
5210            )
5211        }
5212    }
5213
5214    /// Emitted when a redirected window belonging to `widget` gets drawn into.
5215    /// The region/area members of the event shows what area of the redirected
5216    /// drawable was drawn into.
5217    /// ## `event`
5218    /// the [`gdk::EventExpose`][crate::gdk::EventExpose] event
5219    ///
5220    /// # Returns
5221    ///
5222    /// [`true`] to stop other handlers from being invoked for the event.
5223    ///  [`false`] to propagate the event further.
5224    #[doc(alias = "damage-event")]
5225    fn connect_damage_event<F: Fn(&Self, &gdk::EventExpose) -> bool + 'static>(
5226        &self,
5227        f: F,
5228    ) -> SignalHandlerId {
5229        unsafe extern "C" fn damage_event_trampoline<
5230            P: IsA<Widget>,
5231            F: Fn(&P, &gdk::EventExpose) -> bool + 'static,
5232        >(
5233            this: *mut ffi::GtkWidget,
5234            event: *mut gdk::ffi::GdkEventExpose,
5235            f: glib::ffi::gpointer,
5236        ) -> glib::ffi::gboolean {
5237            unsafe {
5238                let f: &F = &*(f as *const F);
5239                f(
5240                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
5241                    &from_glib_borrow(event),
5242                )
5243                .into_glib()
5244            }
5245        }
5246        unsafe {
5247            let f: Box_<F> = Box_::new(f);
5248            connect_raw(
5249                self.as_ptr() as *mut _,
5250                c"damage-event".as_ptr(),
5251                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5252                    damage_event_trampoline::<Self, F> as *const (),
5253                )),
5254                Box_::into_raw(f),
5255            )
5256        }
5257    }
5258
5259    /// The ::delete-event signal is emitted if a user requests that
5260    /// a toplevel window is closed. The default handler for this signal
5261    /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
5262    /// this signal will cause the window to be hidden instead, so that
5263    /// it can later be shown again without reconstructing it.
5264    /// ## `event`
5265    /// the event which triggered this signal
5266    ///
5267    /// # Returns
5268    ///
5269    /// [`true`] to stop other handlers from being invoked for the event.
5270    ///  [`false`] to propagate the event further.
5271    #[doc(alias = "delete-event")]
5272    fn connect_delete_event<F: Fn(&Self, &gdk::Event) -> glib::Propagation + 'static>(
5273        &self,
5274        f: F,
5275    ) -> SignalHandlerId {
5276        unsafe extern "C" fn delete_event_trampoline<
5277            P: IsA<Widget>,
5278            F: Fn(&P, &gdk::Event) -> glib::Propagation + 'static,
5279        >(
5280            this: *mut ffi::GtkWidget,
5281            event: *mut gdk::ffi::GdkEvent,
5282            f: glib::ffi::gpointer,
5283        ) -> glib::ffi::gboolean {
5284            unsafe {
5285                let f: &F = &*(f as *const F);
5286                f(
5287                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
5288                    &from_glib_none(event),
5289                )
5290                .into_glib()
5291            }
5292        }
5293        unsafe {
5294            let f: Box_<F> = Box_::new(f);
5295            connect_raw(
5296                self.as_ptr() as *mut _,
5297                c"delete-event".as_ptr(),
5298                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5299                    delete_event_trampoline::<Self, F> as *const (),
5300                )),
5301                Box_::into_raw(f),
5302            )
5303        }
5304    }
5305
5306    /// Signals that all holders of a reference to the widget should release
5307    /// the reference that they hold. May result in finalization of the widget
5308    /// if all references are released.
5309    ///
5310    /// This signal is not suitable for saving widget state.
5311    #[doc(alias = "destroy")]
5312    fn connect_destroy<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
5313        unsafe extern "C" fn destroy_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
5314            this: *mut ffi::GtkWidget,
5315            f: glib::ffi::gpointer,
5316        ) {
5317            unsafe {
5318                let f: &F = &*(f as *const F);
5319                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
5320            }
5321        }
5322        unsafe {
5323            let f: Box_<F> = Box_::new(f);
5324            connect_raw(
5325                self.as_ptr() as *mut _,
5326                c"destroy".as_ptr(),
5327                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5328                    destroy_trampoline::<Self, F> as *const (),
5329                )),
5330                Box_::into_raw(f),
5331            )
5332        }
5333    }
5334
5335    /// The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
5336    /// You rarely get this signal, because most widgets disconnect themselves
5337    /// from their window before they destroy it, so no widget owns the
5338    /// window at destroy time.
5339    ///
5340    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
5341    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
5342    /// automatically for all new windows.
5343    /// ## `event`
5344    /// the event which triggered this signal
5345    ///
5346    /// # Returns
5347    ///
5348    /// [`true`] to stop other handlers from being invoked for the event.
5349    ///  [`false`] to propagate the event further.
5350    #[doc(alias = "destroy-event")]
5351    fn connect_destroy_event<F: Fn(&Self, &gdk::Event) -> glib::Propagation + 'static>(
5352        &self,
5353        f: F,
5354    ) -> SignalHandlerId {
5355        unsafe extern "C" fn destroy_event_trampoline<
5356            P: IsA<Widget>,
5357            F: Fn(&P, &gdk::Event) -> glib::Propagation + 'static,
5358        >(
5359            this: *mut ffi::GtkWidget,
5360            event: *mut gdk::ffi::GdkEvent,
5361            f: glib::ffi::gpointer,
5362        ) -> glib::ffi::gboolean {
5363            unsafe {
5364                let f: &F = &*(f as *const F);
5365                f(
5366                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
5367                    &from_glib_none(event),
5368                )
5369                .into_glib()
5370            }
5371        }
5372        unsafe {
5373            let f: Box_<F> = Box_::new(f);
5374            connect_raw(
5375                self.as_ptr() as *mut _,
5376                c"destroy-event".as_ptr(),
5377                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5378                    destroy_event_trampoline::<Self, F> as *const (),
5379                )),
5380                Box_::into_raw(f),
5381            )
5382        }
5383    }
5384
5385    /// The ::direction-changed signal is emitted when the text direction
5386    /// of a widget changes.
5387    /// ## `previous_direction`
5388    /// the previous text direction of `widget`
5389    #[doc(alias = "direction-changed")]
5390    fn connect_direction_changed<F: Fn(&Self, TextDirection) + 'static>(
5391        &self,
5392        f: F,
5393    ) -> SignalHandlerId {
5394        unsafe extern "C" fn direction_changed_trampoline<
5395            P: IsA<Widget>,
5396            F: Fn(&P, TextDirection) + 'static,
5397        >(
5398            this: *mut ffi::GtkWidget,
5399            previous_direction: ffi::GtkTextDirection,
5400            f: glib::ffi::gpointer,
5401        ) {
5402            unsafe {
5403                let f: &F = &*(f as *const F);
5404                f(
5405                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
5406                    from_glib(previous_direction),
5407                )
5408            }
5409        }
5410        unsafe {
5411            let f: Box_<F> = Box_::new(f);
5412            connect_raw(
5413                self.as_ptr() as *mut _,
5414                c"direction-changed".as_ptr(),
5415                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5416                    direction_changed_trampoline::<Self, F> as *const (),
5417                )),
5418                Box_::into_raw(f),
5419            )
5420        }
5421    }
5422
5423    /// The ::drag-begin signal is emitted on the drag source when a drag is
5424    /// started. A typical reason to connect to this signal is to set up a
5425    /// custom drag icon with e.g. [`drag_source_set_icon_pixbuf()`][Self::drag_source_set_icon_pixbuf()].
5426    ///
5427    /// Note that some widgets set up a drag icon in the default handler of
5428    /// this signal, so you may have to use `g_signal_connect_after()` to
5429    /// override what the default handler did.
5430    /// ## `context`
5431    /// the drag context
5432    #[doc(alias = "drag-begin")]
5433    fn connect_drag_begin<F: Fn(&Self, &gdk::DragContext) + 'static>(
5434        &self,
5435        f: F,
5436    ) -> SignalHandlerId {
5437        unsafe extern "C" fn drag_begin_trampoline<
5438            P: IsA<Widget>,
5439            F: Fn(&P, &gdk::DragContext) + 'static,
5440        >(
5441            this: *mut ffi::GtkWidget,
5442            context: *mut gdk::ffi::GdkDragContext,
5443            f: glib::ffi::gpointer,
5444        ) {
5445            unsafe {
5446                let f: &F = &*(f as *const F);
5447                f(
5448                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
5449                    &from_glib_borrow(context),
5450                )
5451            }
5452        }
5453        unsafe {
5454            let f: Box_<F> = Box_::new(f);
5455            connect_raw(
5456                self.as_ptr() as *mut _,
5457                c"drag-begin".as_ptr(),
5458                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5459                    drag_begin_trampoline::<Self, F> as *const (),
5460                )),
5461                Box_::into_raw(f),
5462            )
5463        }
5464    }
5465
5466    /// The ::drag-data-delete signal is emitted on the drag source when a drag
5467    /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
5468    /// handler is responsible for deleting the data that has been dropped. What
5469    /// "delete" means depends on the context of the drag operation.
5470    /// ## `context`
5471    /// the drag context
5472    #[doc(alias = "drag-data-delete")]
5473    fn connect_drag_data_delete<F: Fn(&Self, &gdk::DragContext) + 'static>(
5474        &self,
5475        f: F,
5476    ) -> SignalHandlerId {
5477        unsafe extern "C" fn drag_data_delete_trampoline<
5478            P: IsA<Widget>,
5479            F: Fn(&P, &gdk::DragContext) + 'static,
5480        >(
5481            this: *mut ffi::GtkWidget,
5482            context: *mut gdk::ffi::GdkDragContext,
5483            f: glib::ffi::gpointer,
5484        ) {
5485            unsafe {
5486                let f: &F = &*(f as *const F);
5487                f(
5488                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
5489                    &from_glib_borrow(context),
5490                )
5491            }
5492        }
5493        unsafe {
5494            let f: Box_<F> = Box_::new(f);
5495            connect_raw(
5496                self.as_ptr() as *mut _,
5497                c"drag-data-delete".as_ptr(),
5498                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5499                    drag_data_delete_trampoline::<Self, F> as *const (),
5500                )),
5501                Box_::into_raw(f),
5502            )
5503        }
5504    }
5505
5506    /// The ::drag-data-get signal is emitted on the drag source when the drop
5507    /// site requests the data which is dragged. It is the responsibility of
5508    /// the signal handler to fill `data` with the data in the format which
5509    /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
5510    /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
5511    /// ## `context`
5512    /// the drag context
5513    /// ## `data`
5514    /// the [`SelectionData`][crate::SelectionData] to be filled with the dragged data
5515    /// ## `info`
5516    /// the info that has been registered with the target in the
5517    ///  [`TargetList`][crate::TargetList]
5518    /// ## `time`
5519    /// the timestamp at which the data was requested
5520    #[doc(alias = "drag-data-get")]
5521    fn connect_drag_data_get<
5522        F: Fn(&Self, &gdk::DragContext, &SelectionData, u32, u32) + 'static,
5523    >(
5524        &self,
5525        f: F,
5526    ) -> SignalHandlerId {
5527        unsafe extern "C" fn drag_data_get_trampoline<
5528            P: IsA<Widget>,
5529            F: Fn(&P, &gdk::DragContext, &SelectionData, u32, u32) + 'static,
5530        >(
5531            this: *mut ffi::GtkWidget,
5532            context: *mut gdk::ffi::GdkDragContext,
5533            data: *mut ffi::GtkSelectionData,
5534            info: std::ffi::c_uint,
5535            time: std::ffi::c_uint,
5536            f: glib::ffi::gpointer,
5537        ) {
5538            unsafe {
5539                let f: &F = &*(f as *const F);
5540                f(
5541                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
5542                    &from_glib_borrow(context),
5543                    &from_glib_borrow(data),
5544                    info,
5545                    time,
5546                )
5547            }
5548        }
5549        unsafe {
5550            let f: Box_<F> = Box_::new(f);
5551            connect_raw(
5552                self.as_ptr() as *mut _,
5553                c"drag-data-get".as_ptr(),
5554                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5555                    drag_data_get_trampoline::<Self, F> as *const (),
5556                )),
5557                Box_::into_raw(f),
5558            )
5559        }
5560    }
5561
5562    /// format == 8))
5563    ///  {
5564    ///  GdkDragAction action;
5565    ///
5566    ///  // handle data here
5567    ///
5568    ///  action = gdk_drag_context_get_selected_action (context);
5569    ///  if (action == GDK_ACTION_ASK)
5570    ///  {
5571    ///  GtkWidget *dialog;
5572    ///  gint response;
5573    ///
5574    ///  dialog = gtk_message_dialog_new (NULL,
5575    ///  GTK_DIALOG_MODAL |
5576    ///  GTK_DIALOG_DESTROY_WITH_PARENT,
5577    ///  GTK_MESSAGE_INFO,
5578    ///  GTK_BUTTONS_YES_NO,
5579    ///  "Move the data ?\n");
5580    ///  response = gtk_dialog_run (GTK_DIALOG (dialog));
5581    ///  gtk_widget_destroy (dialog);
5582    ///
5583    ///  if (response == GTK_RESPONSE_YES)
5584    ///  action = GDK_ACTION_MOVE;
5585    ///  else
5586    ///  action = GDK_ACTION_COPY;
5587    ///  }
5588    ///
5589    ///  gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
5590    ///  }
5591    ///  else
5592    ///  gtk_drag_finish (context, FALSE, FALSE, time);
5593    ///  }
5594    /// ]|
5595    /// ## `context`
5596    /// the drag context
5597    /// ## `x`
5598    /// where the drop happened
5599    /// ## `y`
5600    /// where the drop happened
5601    /// ## `data`
5602    /// the received data
5603    /// ## `info`
5604    /// the info that has been registered with the target in the
5605    ///  [`TargetList`][crate::TargetList]
5606    /// ## `time`
5607    /// the timestamp at which the data was received
5608    #[doc(alias = "drag-data-received")]
5609    fn connect_drag_data_received<
5610        F: Fn(&Self, &gdk::DragContext, i32, i32, &SelectionData, u32, u32) + 'static,
5611    >(
5612        &self,
5613        f: F,
5614    ) -> SignalHandlerId {
5615        unsafe extern "C" fn drag_data_received_trampoline<
5616            P: IsA<Widget>,
5617            F: Fn(&P, &gdk::DragContext, i32, i32, &SelectionData, u32, u32) + 'static,
5618        >(
5619            this: *mut ffi::GtkWidget,
5620            context: *mut gdk::ffi::GdkDragContext,
5621            x: std::ffi::c_int,
5622            y: std::ffi::c_int,
5623            data: *mut ffi::GtkSelectionData,
5624            info: std::ffi::c_uint,
5625            time: std::ffi::c_uint,
5626            f: glib::ffi::gpointer,
5627        ) {
5628            unsafe {
5629                let f: &F = &*(f as *const F);
5630                f(
5631                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
5632                    &from_glib_borrow(context),
5633                    x,
5634                    y,
5635                    &from_glib_borrow(data),
5636                    info,
5637                    time,
5638                )
5639            }
5640        }
5641        unsafe {
5642            let f: Box_<F> = Box_::new(f);
5643            connect_raw(
5644                self.as_ptr() as *mut _,
5645                c"drag-data-received".as_ptr(),
5646                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5647                    drag_data_received_trampoline::<Self, F> as *const (),
5648                )),
5649                Box_::into_raw(f),
5650            )
5651        }
5652    }
5653
5654    /// The ::drag-drop signal is emitted on the drop site when the user drops
5655    /// the data onto the widget. The signal handler must determine whether
5656    /// the cursor position is in a drop zone or not. If it is not in a drop
5657    /// zone, it returns [`false`] and no further processing is necessary.
5658    /// Otherwise, the handler returns [`true`]. In this case, the handler must
5659    /// ensure that `gtk_drag_finish()` is called to let the source know that
5660    /// the drop is done. The call to `gtk_drag_finish()` can be done either
5661    /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
5662    /// triggered by calling [`drag_get_data()`][Self::drag_get_data()] to receive the data for one
5663    /// or more of the supported targets.
5664    /// ## `context`
5665    /// the drag context
5666    /// ## `x`
5667    /// the x coordinate of the current cursor position
5668    /// ## `y`
5669    /// the y coordinate of the current cursor position
5670    /// ## `time`
5671    /// the timestamp of the motion event
5672    ///
5673    /// # Returns
5674    ///
5675    /// whether the cursor position is in a drop zone
5676    #[doc(alias = "drag-drop")]
5677    fn connect_drag_drop<F: Fn(&Self, &gdk::DragContext, i32, i32, u32) -> bool + 'static>(
5678        &self,
5679        f: F,
5680    ) -> SignalHandlerId {
5681        unsafe extern "C" fn drag_drop_trampoline<
5682            P: IsA<Widget>,
5683            F: Fn(&P, &gdk::DragContext, i32, i32, u32) -> bool + 'static,
5684        >(
5685            this: *mut ffi::GtkWidget,
5686            context: *mut gdk::ffi::GdkDragContext,
5687            x: std::ffi::c_int,
5688            y: std::ffi::c_int,
5689            time: std::ffi::c_uint,
5690            f: glib::ffi::gpointer,
5691        ) -> glib::ffi::gboolean {
5692            unsafe {
5693                let f: &F = &*(f as *const F);
5694                f(
5695                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
5696                    &from_glib_borrow(context),
5697                    x,
5698                    y,
5699                    time,
5700                )
5701                .into_glib()
5702            }
5703        }
5704        unsafe {
5705            let f: Box_<F> = Box_::new(f);
5706            connect_raw(
5707                self.as_ptr() as *mut _,
5708                c"drag-drop".as_ptr(),
5709                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5710                    drag_drop_trampoline::<Self, F> as *const (),
5711                )),
5712                Box_::into_raw(f),
5713            )
5714        }
5715    }
5716
5717    /// The ::drag-end signal is emitted on the drag source when a drag is
5718    /// finished. A typical reason to connect to this signal is to undo
5719    /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
5720    /// ## `context`
5721    /// the drag context
5722    #[doc(alias = "drag-end")]
5723    fn connect_drag_end<F: Fn(&Self, &gdk::DragContext) + 'static>(&self, f: F) -> SignalHandlerId {
5724        unsafe extern "C" fn drag_end_trampoline<
5725            P: IsA<Widget>,
5726            F: Fn(&P, &gdk::DragContext) + 'static,
5727        >(
5728            this: *mut ffi::GtkWidget,
5729            context: *mut gdk::ffi::GdkDragContext,
5730            f: glib::ffi::gpointer,
5731        ) {
5732            unsafe {
5733                let f: &F = &*(f as *const F);
5734                f(
5735                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
5736                    &from_glib_borrow(context),
5737                )
5738            }
5739        }
5740        unsafe {
5741            let f: Box_<F> = Box_::new(f);
5742            connect_raw(
5743                self.as_ptr() as *mut _,
5744                c"drag-end".as_ptr(),
5745                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5746                    drag_end_trampoline::<Self, F> as *const (),
5747                )),
5748                Box_::into_raw(f),
5749            )
5750        }
5751    }
5752
5753    /// The ::drag-failed signal is emitted on the drag source when a drag has
5754    /// failed. The signal handler may hook custom code to handle a failed DnD
5755    /// operation based on the type of error, it returns [`true`] is the failure has
5756    /// been already handled (not showing the default "drag operation failed"
5757    /// animation), otherwise it returns [`false`].
5758    /// ## `context`
5759    /// the drag context
5760    /// ## `result`
5761    /// the result of the drag operation
5762    ///
5763    /// # Returns
5764    ///
5765    /// [`true`] if the failed drag operation has been already handled.
5766    #[doc(alias = "drag-failed")]
5767    fn connect_drag_failed<
5768        F: Fn(&Self, &gdk::DragContext, DragResult) -> glib::Propagation + 'static,
5769    >(
5770        &self,
5771        f: F,
5772    ) -> SignalHandlerId {
5773        unsafe extern "C" fn drag_failed_trampoline<
5774            P: IsA<Widget>,
5775            F: Fn(&P, &gdk::DragContext, DragResult) -> glib::Propagation + 'static,
5776        >(
5777            this: *mut ffi::GtkWidget,
5778            context: *mut gdk::ffi::GdkDragContext,
5779            result: ffi::GtkDragResult,
5780            f: glib::ffi::gpointer,
5781        ) -> glib::ffi::gboolean {
5782            unsafe {
5783                let f: &F = &*(f as *const F);
5784                f(
5785                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
5786                    &from_glib_borrow(context),
5787                    from_glib(result),
5788                )
5789                .into_glib()
5790            }
5791        }
5792        unsafe {
5793            let f: Box_<F> = Box_::new(f);
5794            connect_raw(
5795                self.as_ptr() as *mut _,
5796                c"drag-failed".as_ptr(),
5797                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5798                    drag_failed_trampoline::<Self, F> as *const (),
5799                )),
5800                Box_::into_raw(f),
5801            )
5802        }
5803    }
5804
5805    /// The ::drag-leave signal is emitted on the drop site when the cursor
5806    /// leaves the widget. A typical reason to connect to this signal is to
5807    /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
5808    /// with [`drag_unhighlight()`][Self::drag_unhighlight()].
5809    ///
5810    ///
5811    /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
5812    /// ::drag-drop signal, for instance to allow cleaning up of a preview item
5813    /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
5814    /// ## `context`
5815    /// the drag context
5816    /// ## `time`
5817    /// the timestamp of the motion event
5818    #[doc(alias = "drag-leave")]
5819    fn connect_drag_leave<F: Fn(&Self, &gdk::DragContext, u32) + 'static>(
5820        &self,
5821        f: F,
5822    ) -> SignalHandlerId {
5823        unsafe extern "C" fn drag_leave_trampoline<
5824            P: IsA<Widget>,
5825            F: Fn(&P, &gdk::DragContext, u32) + 'static,
5826        >(
5827            this: *mut ffi::GtkWidget,
5828            context: *mut gdk::ffi::GdkDragContext,
5829            time: std::ffi::c_uint,
5830            f: glib::ffi::gpointer,
5831        ) {
5832            unsafe {
5833                let f: &F = &*(f as *const F);
5834                f(
5835                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
5836                    &from_glib_borrow(context),
5837                    time,
5838                )
5839            }
5840        }
5841        unsafe {
5842            let f: Box_<F> = Box_::new(f);
5843            connect_raw(
5844                self.as_ptr() as *mut _,
5845                c"drag-leave".as_ptr(),
5846                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5847                    drag_leave_trampoline::<Self, F> as *const (),
5848                )),
5849                Box_::into_raw(f),
5850            )
5851        }
5852    }
5853
5854    /// suggested_action,
5855    ///  time);
5856    ///  }
5857    ///  else
5858    ///  {
5859    ///  // accept the drop
5860    ///  }
5861    /// }
5862    /// ]|
5863    /// ## `context`
5864    /// the drag context
5865    /// ## `x`
5866    /// the x coordinate of the current cursor position
5867    /// ## `y`
5868    /// the y coordinate of the current cursor position
5869    /// ## `time`
5870    /// the timestamp of the motion event
5871    ///
5872    /// # Returns
5873    ///
5874    /// whether the cursor position is in a drop zone
5875    #[doc(alias = "drag-motion")]
5876    fn connect_drag_motion<F: Fn(&Self, &gdk::DragContext, i32, i32, u32) -> bool + 'static>(
5877        &self,
5878        f: F,
5879    ) -> SignalHandlerId {
5880        unsafe extern "C" fn drag_motion_trampoline<
5881            P: IsA<Widget>,
5882            F: Fn(&P, &gdk::DragContext, i32, i32, u32) -> bool + 'static,
5883        >(
5884            this: *mut ffi::GtkWidget,
5885            context: *mut gdk::ffi::GdkDragContext,
5886            x: std::ffi::c_int,
5887            y: std::ffi::c_int,
5888            time: std::ffi::c_uint,
5889            f: glib::ffi::gpointer,
5890        ) -> glib::ffi::gboolean {
5891            unsafe {
5892                let f: &F = &*(f as *const F);
5893                f(
5894                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
5895                    &from_glib_borrow(context),
5896                    x,
5897                    y,
5898                    time,
5899                )
5900                .into_glib()
5901            }
5902        }
5903        unsafe {
5904            let f: Box_<F> = Box_::new(f);
5905            connect_raw(
5906                self.as_ptr() as *mut _,
5907                c"drag-motion".as_ptr(),
5908                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5909                    drag_motion_trampoline::<Self, F> as *const (),
5910                )),
5911                Box_::into_raw(f),
5912            )
5913        }
5914    }
5915
5916    /// This signal is emitted when a widget is supposed to render itself.
5917    /// The `widget`'s top left corner must be painted at the origin of
5918    /// the passed in context and be sized to the values returned by
5919    /// [`allocated_width()`][Self::allocated_width()] and
5920    /// [`allocated_height()`][Self::allocated_height()].
5921    ///
5922    /// Signal handlers connected to this signal can modify the cairo
5923    /// context passed as `cr` in any way they like and don't need to
5924    /// restore it. The signal emission takes care of calling `cairo_save()`
5925    /// before and `cairo_restore()` after invoking the handler.
5926    ///
5927    /// The signal handler will get a `cr` with a clip region already set to the
5928    /// widget's dirty region, i.e. to the area that needs repainting. Complicated
5929    /// widgets that want to avoid redrawing themselves completely can get the full
5930    /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
5931    /// get a finer-grained representation of the dirty region with
5932    /// `cairo_copy_clip_rectangle_list()`.
5933    /// ## `cr`
5934    /// the cairo context to draw to
5935    ///
5936    /// # Returns
5937    ///
5938    /// [`true`] to stop other handlers from being invoked for the event.
5939    /// [`false`] to propagate the event further.
5940    #[doc(alias = "draw")]
5941    fn connect_draw<F: Fn(&Self, &cairo::Context) -> glib::Propagation + 'static>(
5942        &self,
5943        f: F,
5944    ) -> SignalHandlerId {
5945        unsafe extern "C" fn draw_trampoline<
5946            P: IsA<Widget>,
5947            F: Fn(&P, &cairo::Context) -> glib::Propagation + 'static,
5948        >(
5949            this: *mut ffi::GtkWidget,
5950            cr: *mut cairo::ffi::cairo_t,
5951            f: glib::ffi::gpointer,
5952        ) -> glib::ffi::gboolean {
5953            unsafe {
5954                let f: &F = &*(f as *const F);
5955                f(
5956                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
5957                    &from_glib_borrow(cr),
5958                )
5959                .into_glib()
5960            }
5961        }
5962        unsafe {
5963            let f: Box_<F> = Box_::new(f);
5964            connect_raw(
5965                self.as_ptr() as *mut _,
5966                c"draw".as_ptr(),
5967                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5968                    draw_trampoline::<Self, F> as *const (),
5969                )),
5970                Box_::into_raw(f),
5971            )
5972        }
5973    }
5974
5975    /// The ::enter-notify-event will be emitted when the pointer enters
5976    /// the `widget`'s window.
5977    ///
5978    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
5979    /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
5980    ///
5981    /// This signal will be sent to the grab widget if there is one.
5982    /// ## `event`
5983    /// the [`gdk::EventCrossing`][crate::gdk::EventCrossing] which triggered
5984    ///  this signal.
5985    ///
5986    /// # Returns
5987    ///
5988    /// [`true`] to stop other handlers from being invoked for the event.
5989    ///  [`false`] to propagate the event further.
5990    #[doc(alias = "enter-notify-event")]
5991    fn connect_enter_notify_event<
5992        F: Fn(&Self, &gdk::EventCrossing) -> glib::Propagation + 'static,
5993    >(
5994        &self,
5995        f: F,
5996    ) -> SignalHandlerId {
5997        unsafe extern "C" fn enter_notify_event_trampoline<
5998            P: IsA<Widget>,
5999            F: Fn(&P, &gdk::EventCrossing) -> glib::Propagation + 'static,
6000        >(
6001            this: *mut ffi::GtkWidget,
6002            event: *mut gdk::ffi::GdkEventCrossing,
6003            f: glib::ffi::gpointer,
6004        ) -> glib::ffi::gboolean {
6005            unsafe {
6006                let f: &F = &*(f as *const F);
6007                f(
6008                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
6009                    &from_glib_borrow(event),
6010                )
6011                .into_glib()
6012            }
6013        }
6014        unsafe {
6015            let f: Box_<F> = Box_::new(f);
6016            connect_raw(
6017                self.as_ptr() as *mut _,
6018                c"enter-notify-event".as_ptr(),
6019                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
6020                    enter_notify_event_trampoline::<Self, F> as *const (),
6021                )),
6022                Box_::into_raw(f),
6023            )
6024        }
6025    }
6026
6027    /// The GTK+ main loop will emit three signals for each GDK event delivered
6028    /// to a widget: one generic ::event signal, another, more specific,
6029    /// signal that matches the type of event delivered (e.g.
6030    /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
6031    /// [`event-after`][struct@crate::Widget#event-after] signal.
6032    /// ## `event`
6033    /// the `GdkEvent` which triggered this signal
6034    ///
6035    /// # Returns
6036    ///
6037    /// [`true`] to stop other handlers from being invoked for the event
6038    /// and to cancel the emission of the second specific ::event signal.
6039    ///  [`false`] to propagate the event further and to allow the emission of
6040    ///  the second signal. The ::event-after signal is emitted regardless of
6041    ///  the return value.
6042    #[doc(alias = "event")]
6043    fn connect_event<F: Fn(&Self, &gdk::Event) -> glib::Propagation + 'static>(
6044        &self,
6045        f: F,
6046    ) -> SignalHandlerId {
6047        unsafe extern "C" fn event_trampoline<
6048            P: IsA<Widget>,
6049            F: Fn(&P, &gdk::Event) -> glib::Propagation + 'static,
6050        >(
6051            this: *mut ffi::GtkWidget,
6052            event: *mut gdk::ffi::GdkEvent,
6053            f: glib::ffi::gpointer,
6054        ) -> glib::ffi::gboolean {
6055            unsafe {
6056                let f: &F = &*(f as *const F);
6057                f(
6058                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
6059                    &from_glib_none(event),
6060                )
6061                .into_glib()
6062            }
6063        }
6064        unsafe {
6065            let f: Box_<F> = Box_::new(f);
6066            connect_raw(
6067                self.as_ptr() as *mut _,
6068                c"event".as_ptr(),
6069                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
6070                    event_trampoline::<Self, F> as *const (),
6071                )),
6072                Box_::into_raw(f),
6073            )
6074        }
6075    }
6076
6077    /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
6078    /// the second more specific signal, ::event-after will be emitted
6079    /// regardless of the previous two signals handlers return values.
6080    /// ## `event`
6081    /// the `GdkEvent` which triggered this signal
6082    #[doc(alias = "event-after")]
6083    fn connect_event_after<F: Fn(&Self, &gdk::Event) + 'static>(&self, f: F) -> SignalHandlerId {
6084        unsafe extern "C" fn event_after_trampoline<
6085            P: IsA<Widget>,
6086            F: Fn(&P, &gdk::Event) + 'static,
6087        >(
6088            this: *mut ffi::GtkWidget,
6089            event: *mut gdk::ffi::GdkEvent,
6090            f: glib::ffi::gpointer,
6091        ) {
6092            unsafe {
6093                let f: &F = &*(f as *const F);
6094                f(
6095                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
6096                    &from_glib_none(event),
6097                )
6098            }
6099        }
6100        unsafe {
6101            let f: Box_<F> = Box_::new(f);
6102            connect_raw(
6103                self.as_ptr() as *mut _,
6104                c"event-after".as_ptr(),
6105                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
6106                    event_after_trampoline::<Self, F> as *const (),
6107                )),
6108                Box_::into_raw(f),
6109            )
6110        }
6111    }
6112
6113    ///
6114    /// # Returns
6115    ///
6116    /// [`true`] to stop other handlers from being invoked for the event. [`false`] to propagate the event further.
6117    #[doc(alias = "focus")]
6118    fn connect_focus<F: Fn(&Self, DirectionType) -> glib::Propagation + 'static>(
6119        &self,
6120        f: F,
6121    ) -> SignalHandlerId {
6122        unsafe extern "C" fn focus_trampoline<
6123            P: IsA<Widget>,
6124            F: Fn(&P, DirectionType) -> glib::Propagation + 'static,
6125        >(
6126            this: *mut ffi::GtkWidget,
6127            direction: ffi::GtkDirectionType,
6128            f: glib::ffi::gpointer,
6129        ) -> glib::ffi::gboolean {
6130            unsafe {
6131                let f: &F = &*(f as *const F);
6132                f(
6133                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
6134                    from_glib(direction),
6135                )
6136                .into_glib()
6137            }
6138        }
6139        unsafe {
6140            let f: Box_<F> = Box_::new(f);
6141            connect_raw(
6142                self.as_ptr() as *mut _,
6143                c"focus".as_ptr(),
6144                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
6145                    focus_trampoline::<Self, F> as *const (),
6146                )),
6147                Box_::into_raw(f),
6148            )
6149        }
6150    }
6151
6152    /// The ::focus-in-event signal will be emitted when the keyboard focus
6153    /// enters the `widget`'s window.
6154    ///
6155    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
6156    /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
6157    /// ## `event`
6158    /// the [`gdk::EventFocus`][crate::gdk::EventFocus] which triggered
6159    ///  this signal.
6160    ///
6161    /// # Returns
6162    ///
6163    /// [`true`] to stop other handlers from being invoked for the event.
6164    ///  [`false`] to propagate the event further.
6165    #[doc(alias = "focus-in-event")]
6166    fn connect_focus_in_event<F: Fn(&Self, &gdk::EventFocus) -> glib::Propagation + 'static>(
6167        &self,
6168        f: F,
6169    ) -> SignalHandlerId {
6170        unsafe extern "C" fn focus_in_event_trampoline<
6171            P: IsA<Widget>,
6172            F: Fn(&P, &gdk::EventFocus) -> glib::Propagation + 'static,
6173        >(
6174            this: *mut ffi::GtkWidget,
6175            event: *mut gdk::ffi::GdkEventFocus,
6176            f: glib::ffi::gpointer,
6177        ) -> glib::ffi::gboolean {
6178            unsafe {
6179                let f: &F = &*(f as *const F);
6180                f(
6181                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
6182                    &from_glib_borrow(event),
6183                )
6184                .into_glib()
6185            }
6186        }
6187        unsafe {
6188            let f: Box_<F> = Box_::new(f);
6189            connect_raw(
6190                self.as_ptr() as *mut _,
6191                c"focus-in-event".as_ptr(),
6192                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
6193                    focus_in_event_trampoline::<Self, F> as *const (),
6194                )),
6195                Box_::into_raw(f),
6196            )
6197        }
6198    }
6199
6200    /// The ::focus-out-event signal will be emitted when the keyboard focus
6201    /// leaves the `widget`'s window.
6202    ///
6203    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
6204    /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
6205    /// ## `event`
6206    /// the [`gdk::EventFocus`][crate::gdk::EventFocus] which triggered this
6207    ///  signal.
6208    ///
6209    /// # Returns
6210    ///
6211    /// [`true`] to stop other handlers from being invoked for the event.
6212    ///  [`false`] to propagate the event further.
6213    #[doc(alias = "focus-out-event")]
6214    fn connect_focus_out_event<F: Fn(&Self, &gdk::EventFocus) -> glib::Propagation + 'static>(
6215        &self,
6216        f: F,
6217    ) -> SignalHandlerId {
6218        unsafe extern "C" fn focus_out_event_trampoline<
6219            P: IsA<Widget>,
6220            F: Fn(&P, &gdk::EventFocus) -> glib::Propagation + 'static,
6221        >(
6222            this: *mut ffi::GtkWidget,
6223            event: *mut gdk::ffi::GdkEventFocus,
6224            f: glib::ffi::gpointer,
6225        ) -> glib::ffi::gboolean {
6226            unsafe {
6227                let f: &F = &*(f as *const F);
6228                f(
6229                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
6230                    &from_glib_borrow(event),
6231                )
6232                .into_glib()
6233            }
6234        }
6235        unsafe {
6236            let f: Box_<F> = Box_::new(f);
6237            connect_raw(
6238                self.as_ptr() as *mut _,
6239                c"focus-out-event".as_ptr(),
6240                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
6241                    focus_out_event_trampoline::<Self, F> as *const (),
6242                )),
6243                Box_::into_raw(f),
6244            )
6245        }
6246    }
6247
6248    /// Emitted when a pointer or keyboard grab on a window belonging
6249    /// to `widget` gets broken.
6250    ///
6251    /// On X11, this happens when the grab window becomes unviewable
6252    /// (i.e. it or one of its ancestors is unmapped), or if the same
6253    /// application grabs the pointer or keyboard again.
6254    /// ## `event`
6255    /// the [`gdk::EventGrabBroken`][crate::gdk::EventGrabBroken] event
6256    ///
6257    /// # Returns
6258    ///
6259    /// [`true`] to stop other handlers from being invoked for
6260    ///  the event. [`false`] to propagate the event further.
6261    #[doc(alias = "grab-broken-event")]
6262    fn connect_grab_broken_event<
6263        F: Fn(&Self, &gdk::EventGrabBroken) -> glib::Propagation + 'static,
6264    >(
6265        &self,
6266        f: F,
6267    ) -> SignalHandlerId {
6268        unsafe extern "C" fn grab_broken_event_trampoline<
6269            P: IsA<Widget>,
6270            F: Fn(&P, &gdk::EventGrabBroken) -> glib::Propagation + 'static,
6271        >(
6272            this: *mut ffi::GtkWidget,
6273            event: *mut gdk::ffi::GdkEventGrabBroken,
6274            f: glib::ffi::gpointer,
6275        ) -> glib::ffi::gboolean {
6276            unsafe {
6277                let f: &F = &*(f as *const F);
6278                f(
6279                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
6280                    &from_glib_borrow(event),
6281                )
6282                .into_glib()
6283            }
6284        }
6285        unsafe {
6286            let f: Box_<F> = Box_::new(f);
6287            connect_raw(
6288                self.as_ptr() as *mut _,
6289                c"grab-broken-event".as_ptr(),
6290                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
6291                    grab_broken_event_trampoline::<Self, F> as *const (),
6292                )),
6293                Box_::into_raw(f),
6294            )
6295        }
6296    }
6297
6298    #[doc(alias = "grab-focus")]
6299    fn connect_grab_focus<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
6300        unsafe extern "C" fn grab_focus_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
6301            this: *mut ffi::GtkWidget,
6302            f: glib::ffi::gpointer,
6303        ) {
6304            unsafe {
6305                let f: &F = &*(f as *const F);
6306                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
6307            }
6308        }
6309        unsafe {
6310            let f: Box_<F> = Box_::new(f);
6311            connect_raw(
6312                self.as_ptr() as *mut _,
6313                c"grab-focus".as_ptr(),
6314                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
6315                    grab_focus_trampoline::<Self, F> as *const (),
6316                )),
6317                Box_::into_raw(f),
6318            )
6319        }
6320    }
6321
6322    fn emit_grab_focus(&self) {
6323        self.emit_by_name::<()>("grab-focus", &[]);
6324    }
6325
6326    /// The ::grab-notify signal is emitted when a widget becomes
6327    /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
6328    /// another widget, or when it becomes unshadowed due to a grab
6329    /// being removed.
6330    ///
6331    /// A widget is shadowed by a [`grab_add()`][Self::grab_add()] when the topmost
6332    /// grab widget in the grab stack of its window group is not
6333    /// its ancestor.
6334    /// ## `was_grabbed`
6335    /// [`false`] if the widget becomes shadowed, [`true`]
6336    ///  if it becomes unshadowed
6337    #[doc(alias = "grab-notify")]
6338    fn connect_grab_notify<F: Fn(&Self, bool) + 'static>(&self, f: F) -> SignalHandlerId {
6339        unsafe extern "C" fn grab_notify_trampoline<P: IsA<Widget>, F: Fn(&P, bool) + 'static>(
6340            this: *mut ffi::GtkWidget,
6341            was_grabbed: glib::ffi::gboolean,
6342            f: glib::ffi::gpointer,
6343        ) {
6344            unsafe {
6345                let f: &F = &*(f as *const F);
6346                f(
6347                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
6348                    from_glib(was_grabbed),
6349                )
6350            }
6351        }
6352        unsafe {
6353            let f: Box_<F> = Box_::new(f);
6354            connect_raw(
6355                self.as_ptr() as *mut _,
6356                c"grab-notify".as_ptr(),
6357                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
6358                    grab_notify_trampoline::<Self, F> as *const (),
6359                )),
6360                Box_::into_raw(f),
6361            )
6362        }
6363    }
6364
6365    /// The ::hide signal is emitted when `widget` is hidden, for example with
6366    /// [`hide()`][Self::hide()].
6367    #[doc(alias = "hide")]
6368    fn connect_hide<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
6369        unsafe extern "C" fn hide_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
6370            this: *mut ffi::GtkWidget,
6371            f: glib::ffi::gpointer,
6372        ) {
6373            unsafe {
6374                let f: &F = &*(f as *const F);
6375                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
6376            }
6377        }
6378        unsafe {
6379            let f: Box_<F> = Box_::new(f);
6380            connect_raw(
6381                self.as_ptr() as *mut _,
6382                c"hide".as_ptr(),
6383                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
6384                    hide_trampoline::<Self, F> as *const (),
6385                )),
6386                Box_::into_raw(f),
6387            )
6388        }
6389    }
6390
6391    /// The ::hierarchy-changed signal is emitted when the
6392    /// anchored state of a widget changes. A widget is
6393    /// “anchored” when its toplevel
6394    /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
6395    /// a widget changes from un-anchored to anchored or vice-versa.
6396    /// ## `previous_toplevel`
6397    /// the previous toplevel ancestor, or [`None`]
6398    ///  if the widget was previously unanchored
6399    #[doc(alias = "hierarchy-changed")]
6400    fn connect_hierarchy_changed<F: Fn(&Self, Option<&Widget>) + 'static>(
6401        &self,
6402        f: F,
6403    ) -> SignalHandlerId {
6404        unsafe extern "C" fn hierarchy_changed_trampoline<
6405            P: IsA<Widget>,
6406            F: Fn(&P, Option<&Widget>) + 'static,
6407        >(
6408            this: *mut ffi::GtkWidget,
6409            previous_toplevel: *mut ffi::GtkWidget,
6410            f: glib::ffi::gpointer,
6411        ) {
6412            unsafe {
6413                let f: &F = &*(f as *const F);
6414                f(
6415                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
6416                    Option::<Widget>::from_glib_borrow(previous_toplevel)
6417                        .as_ref()
6418                        .as_ref(),
6419                )
6420            }
6421        }
6422        unsafe {
6423            let f: Box_<F> = Box_::new(f);
6424            connect_raw(
6425                self.as_ptr() as *mut _,
6426                c"hierarchy-changed".as_ptr(),
6427                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
6428                    hierarchy_changed_trampoline::<Self, F> as *const (),
6429                )),
6430                Box_::into_raw(f),
6431            )
6432        }
6433    }
6434
6435    /// The ::key-press-event signal is emitted when a key is pressed. The signal
6436    /// emission will reoccur at the key-repeat rate when the key is kept pressed.
6437    ///
6438    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
6439    /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
6440    ///
6441    /// This signal will be sent to the grab widget if there is one.
6442    /// ## `event`
6443    /// the [`gdk::EventKey`][crate::gdk::EventKey] which triggered this signal.
6444    ///
6445    /// # Returns
6446    ///
6447    /// [`true`] to stop other handlers from being invoked for the event.
6448    ///  [`false`] to propagate the event further.
6449    #[doc(alias = "key-press-event")]
6450    fn connect_key_press_event<F: Fn(&Self, &gdk::EventKey) -> glib::Propagation + 'static>(
6451        &self,
6452        f: F,
6453    ) -> SignalHandlerId {
6454        unsafe extern "C" fn key_press_event_trampoline<
6455            P: IsA<Widget>,
6456            F: Fn(&P, &gdk::EventKey) -> glib::Propagation + 'static,
6457        >(
6458            this: *mut ffi::GtkWidget,
6459            event: *mut gdk::ffi::GdkEventKey,
6460            f: glib::ffi::gpointer,
6461        ) -> glib::ffi::gboolean {
6462            unsafe {
6463                let f: &F = &*(f as *const F);
6464                f(
6465                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
6466                    &from_glib_borrow(event),
6467                )
6468                .into_glib()
6469            }
6470        }
6471        unsafe {
6472            let f: Box_<F> = Box_::new(f);
6473            connect_raw(
6474                self.as_ptr() as *mut _,
6475                c"key-press-event".as_ptr(),
6476                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
6477                    key_press_event_trampoline::<Self, F> as *const (),
6478                )),
6479                Box_::into_raw(f),
6480            )
6481        }
6482    }
6483
6484    /// The ::key-release-event signal is emitted when a key is released.
6485    ///
6486    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
6487    /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
6488    ///
6489    /// This signal will be sent to the grab widget if there is one.
6490    /// ## `event`
6491    /// the [`gdk::EventKey`][crate::gdk::EventKey] which triggered this signal.
6492    ///
6493    /// # Returns
6494    ///
6495    /// [`true`] to stop other handlers from being invoked for the event.
6496    ///  [`false`] to propagate the event further.
6497    #[doc(alias = "key-release-event")]
6498    fn connect_key_release_event<F: Fn(&Self, &gdk::EventKey) -> glib::Propagation + 'static>(
6499        &self,
6500        f: F,
6501    ) -> SignalHandlerId {
6502        unsafe extern "C" fn key_release_event_trampoline<
6503            P: IsA<Widget>,
6504            F: Fn(&P, &gdk::EventKey) -> glib::Propagation + 'static,
6505        >(
6506            this: *mut ffi::GtkWidget,
6507            event: *mut gdk::ffi::GdkEventKey,
6508            f: glib::ffi::gpointer,
6509        ) -> glib::ffi::gboolean {
6510            unsafe {
6511                let f: &F = &*(f as *const F);
6512                f(
6513                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
6514                    &from_glib_borrow(event),
6515                )
6516                .into_glib()
6517            }
6518        }
6519        unsafe {
6520            let f: Box_<F> = Box_::new(f);
6521            connect_raw(
6522                self.as_ptr() as *mut _,
6523                c"key-release-event".as_ptr(),
6524                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
6525                    key_release_event_trampoline::<Self, F> as *const (),
6526                )),
6527                Box_::into_raw(f),
6528            )
6529        }
6530    }
6531
6532    /// Gets emitted if keyboard navigation fails.
6533    /// See [`keynav_failed()`][Self::keynav_failed()] for details.
6534    /// ## `direction`
6535    /// the direction of movement
6536    ///
6537    /// # Returns
6538    ///
6539    /// [`true`] if stopping keyboard navigation is fine, [`false`]
6540    ///  if the emitting widget should try to handle the keyboard
6541    ///  navigation attempt in its parent container(s).
6542    #[doc(alias = "keynav-failed")]
6543    fn connect_keynav_failed<F: Fn(&Self, DirectionType) -> glib::Propagation + 'static>(
6544        &self,
6545        f: F,
6546    ) -> SignalHandlerId {
6547        unsafe extern "C" fn keynav_failed_trampoline<
6548            P: IsA<Widget>,
6549            F: Fn(&P, DirectionType) -> glib::Propagation + 'static,
6550        >(
6551            this: *mut ffi::GtkWidget,
6552            direction: ffi::GtkDirectionType,
6553            f: glib::ffi::gpointer,
6554        ) -> glib::ffi::gboolean {
6555            unsafe {
6556                let f: &F = &*(f as *const F);
6557                f(
6558                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
6559                    from_glib(direction),
6560                )
6561                .into_glib()
6562            }
6563        }
6564        unsafe {
6565            let f: Box_<F> = Box_::new(f);
6566            connect_raw(
6567                self.as_ptr() as *mut _,
6568                c"keynav-failed".as_ptr(),
6569                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
6570                    keynav_failed_trampoline::<Self, F> as *const (),
6571                )),
6572                Box_::into_raw(f),
6573            )
6574        }
6575    }
6576
6577    /// The ::leave-notify-event will be emitted when the pointer leaves
6578    /// the `widget`'s window.
6579    ///
6580    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
6581    /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
6582    ///
6583    /// This signal will be sent to the grab widget if there is one.
6584    /// ## `event`
6585    /// the [`gdk::EventCrossing`][crate::gdk::EventCrossing] which triggered
6586    ///  this signal.
6587    ///
6588    /// # Returns
6589    ///
6590    /// [`true`] to stop other handlers from being invoked for the event.
6591    ///  [`false`] to propagate the event further.
6592    #[doc(alias = "leave-notify-event")]
6593    fn connect_leave_notify_event<
6594        F: Fn(&Self, &gdk::EventCrossing) -> glib::Propagation + 'static,
6595    >(
6596        &self,
6597        f: F,
6598    ) -> SignalHandlerId {
6599        unsafe extern "C" fn leave_notify_event_trampoline<
6600            P: IsA<Widget>,
6601            F: Fn(&P, &gdk::EventCrossing) -> glib::Propagation + 'static,
6602        >(
6603            this: *mut ffi::GtkWidget,
6604            event: *mut gdk::ffi::GdkEventCrossing,
6605            f: glib::ffi::gpointer,
6606        ) -> glib::ffi::gboolean {
6607            unsafe {
6608                let f: &F = &*(f as *const F);
6609                f(
6610                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
6611                    &from_glib_borrow(event),
6612                )
6613                .into_glib()
6614            }
6615        }
6616        unsafe {
6617            let f: Box_<F> = Box_::new(f);
6618            connect_raw(
6619                self.as_ptr() as *mut _,
6620                c"leave-notify-event".as_ptr(),
6621                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
6622                    leave_notify_event_trampoline::<Self, F> as *const (),
6623                )),
6624                Box_::into_raw(f),
6625            )
6626        }
6627    }
6628
6629    /// The ::map signal is emitted when `widget` is going to be mapped, that is
6630    /// when the widget is visible (which is controlled with
6631    /// [`set_visible()`][Self::set_visible()]) and all its parents up to the toplevel widget
6632    /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
6633    /// be emitted.
6634    ///
6635    /// The ::map signal can be used to determine whether a widget will be drawn,
6636    /// for instance it can resume an animation that was stopped during the
6637    /// emission of [`unmap`][struct@crate::Widget#unmap].
6638    #[doc(alias = "map")]
6639    fn connect_map<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
6640        unsafe extern "C" fn map_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
6641            this: *mut ffi::GtkWidget,
6642            f: glib::ffi::gpointer,
6643        ) {
6644            unsafe {
6645                let f: &F = &*(f as *const F);
6646                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
6647            }
6648        }
6649        unsafe {
6650            let f: Box_<F> = Box_::new(f);
6651            connect_raw(
6652                self.as_ptr() as *mut _,
6653                c"map".as_ptr(),
6654                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
6655                    map_trampoline::<Self, F> as *const (),
6656                )),
6657                Box_::into_raw(f),
6658            )
6659        }
6660    }
6661
6662    /// The default handler for this signal activates `widget` if `group_cycling`
6663    /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
6664    /// ## `group_cycling`
6665    /// [`true`] if there are other widgets with the same mnemonic
6666    ///
6667    /// # Returns
6668    ///
6669    /// [`true`] to stop other handlers from being invoked for the event.
6670    /// [`false`] to propagate the event further.
6671    #[doc(alias = "mnemonic-activate")]
6672    fn connect_mnemonic_activate<F: Fn(&Self, bool) -> glib::Propagation + 'static>(
6673        &self,
6674        f: F,
6675    ) -> SignalHandlerId {
6676        unsafe extern "C" fn mnemonic_activate_trampoline<
6677            P: IsA<Widget>,
6678            F: Fn(&P, bool) -> glib::Propagation + 'static,
6679        >(
6680            this: *mut ffi::GtkWidget,
6681            group_cycling: glib::ffi::gboolean,
6682            f: glib::ffi::gpointer,
6683        ) -> glib::ffi::gboolean {
6684            unsafe {
6685                let f: &F = &*(f as *const F);
6686                f(
6687                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
6688                    from_glib(group_cycling),
6689                )
6690                .into_glib()
6691            }
6692        }
6693        unsafe {
6694            let f: Box_<F> = Box_::new(f);
6695            connect_raw(
6696                self.as_ptr() as *mut _,
6697                c"mnemonic-activate".as_ptr(),
6698                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
6699                    mnemonic_activate_trampoline::<Self, F> as *const (),
6700                )),
6701                Box_::into_raw(f),
6702            )
6703        }
6704    }
6705
6706    /// The ::motion-notify-event signal is emitted when the pointer moves
6707    /// over the widget's [`gdk::Window`][crate::gdk::Window].
6708    ///
6709    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
6710    /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
6711    ///
6712    /// This signal will be sent to the grab widget if there is one.
6713    /// ## `event`
6714    /// the [`gdk::EventMotion`][crate::gdk::EventMotion] which triggered
6715    ///  this signal.
6716    ///
6717    /// # Returns
6718    ///
6719    /// [`true`] to stop other handlers from being invoked for the event.
6720    ///  [`false`] to propagate the event further.
6721    #[doc(alias = "motion-notify-event")]
6722    fn connect_motion_notify_event<
6723        F: Fn(&Self, &gdk::EventMotion) -> glib::Propagation + 'static,
6724    >(
6725        &self,
6726        f: F,
6727    ) -> SignalHandlerId {
6728        unsafe extern "C" fn motion_notify_event_trampoline<
6729            P: IsA<Widget>,
6730            F: Fn(&P, &gdk::EventMotion) -> glib::Propagation + 'static,
6731        >(
6732            this: *mut ffi::GtkWidget,
6733            event: *mut gdk::ffi::GdkEventMotion,
6734            f: glib::ffi::gpointer,
6735        ) -> glib::ffi::gboolean {
6736            unsafe {
6737                let f: &F = &*(f as *const F);
6738                f(
6739                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
6740                    &from_glib_borrow(event),
6741                )
6742                .into_glib()
6743            }
6744        }
6745        unsafe {
6746            let f: Box_<F> = Box_::new(f);
6747            connect_raw(
6748                self.as_ptr() as *mut _,
6749                c"motion-notify-event".as_ptr(),
6750                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
6751                    motion_notify_event_trampoline::<Self, F> as *const (),
6752                )),
6753                Box_::into_raw(f),
6754            )
6755        }
6756    }
6757
6758    #[doc(alias = "move-focus")]
6759    fn connect_move_focus<F: Fn(&Self, DirectionType) + 'static>(&self, f: F) -> SignalHandlerId {
6760        unsafe extern "C" fn move_focus_trampoline<
6761            P: IsA<Widget>,
6762            F: Fn(&P, DirectionType) + 'static,
6763        >(
6764            this: *mut ffi::GtkWidget,
6765            direction: ffi::GtkDirectionType,
6766            f: glib::ffi::gpointer,
6767        ) {
6768            unsafe {
6769                let f: &F = &*(f as *const F);
6770                f(
6771                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
6772                    from_glib(direction),
6773                )
6774            }
6775        }
6776        unsafe {
6777            let f: Box_<F> = Box_::new(f);
6778            connect_raw(
6779                self.as_ptr() as *mut _,
6780                c"move-focus".as_ptr(),
6781                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
6782                    move_focus_trampoline::<Self, F> as *const (),
6783                )),
6784                Box_::into_raw(f),
6785            )
6786        }
6787    }
6788
6789    fn emit_move_focus(&self, direction: DirectionType) {
6790        self.emit_by_name::<()>("move-focus", &[&direction]);
6791    }
6792
6793    /// The ::parent-set signal is emitted when a new parent
6794    /// has been set on a widget.
6795    /// ## `old_parent`
6796    /// the previous parent, or [`None`] if the widget
6797    ///  just got its initial parent.
6798    #[doc(alias = "parent-set")]
6799    fn connect_parent_set<F: Fn(&Self, Option<&Widget>) + 'static>(&self, f: F) -> SignalHandlerId {
6800        unsafe extern "C" fn parent_set_trampoline<
6801            P: IsA<Widget>,
6802            F: Fn(&P, Option<&Widget>) + 'static,
6803        >(
6804            this: *mut ffi::GtkWidget,
6805            old_parent: *mut ffi::GtkWidget,
6806            f: glib::ffi::gpointer,
6807        ) {
6808            unsafe {
6809                let f: &F = &*(f as *const F);
6810                f(
6811                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
6812                    Option::<Widget>::from_glib_borrow(old_parent)
6813                        .as_ref()
6814                        .as_ref(),
6815                )
6816            }
6817        }
6818        unsafe {
6819            let f: Box_<F> = Box_::new(f);
6820            connect_raw(
6821                self.as_ptr() as *mut _,
6822                c"parent-set".as_ptr(),
6823                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
6824                    parent_set_trampoline::<Self, F> as *const (),
6825                )),
6826                Box_::into_raw(f),
6827            )
6828        }
6829    }
6830
6831    /// This signal gets emitted whenever a widget should pop up a context
6832    /// menu. This usually happens through the standard key binding mechanism;
6833    /// by pressing a certain key while a widget is focused, the user can cause
6834    /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
6835    /// a menu with clipboard commands. See the
6836    /// [Popup Menu Migration Checklist][checklist-popup-menu]
6837    /// for an example of how to use this signal.
6838    ///
6839    /// # Returns
6840    ///
6841    /// [`true`] if a menu was activated
6842    #[doc(alias = "popup-menu")]
6843    fn connect_popup_menu<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId {
6844        unsafe extern "C" fn popup_menu_trampoline<P: IsA<Widget>, F: Fn(&P) -> bool + 'static>(
6845            this: *mut ffi::GtkWidget,
6846            f: glib::ffi::gpointer,
6847        ) -> glib::ffi::gboolean {
6848            unsafe {
6849                let f: &F = &*(f as *const F);
6850                f(Widget::from_glib_borrow(this).unsafe_cast_ref()).into_glib()
6851            }
6852        }
6853        unsafe {
6854            let f: Box_<F> = Box_::new(f);
6855            connect_raw(
6856                self.as_ptr() as *mut _,
6857                c"popup-menu".as_ptr(),
6858                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
6859                    popup_menu_trampoline::<Self, F> as *const (),
6860                )),
6861                Box_::into_raw(f),
6862            )
6863        }
6864    }
6865
6866    fn emit_popup_menu(&self) -> bool {
6867        self.emit_by_name("popup-menu", &[])
6868    }
6869
6870    /// The ::property-notify-event signal will be emitted when a property on
6871    /// the `widget`'s window has been changed or deleted.
6872    ///
6873    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
6874    /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
6875    /// ## `event`
6876    /// the [`gdk::EventProperty`][crate::gdk::EventProperty] which triggered
6877    ///  this signal.
6878    ///
6879    /// # Returns
6880    ///
6881    /// [`true`] to stop other handlers from being invoked for the event.
6882    ///  [`false`] to propagate the event further.
6883    #[doc(alias = "property-notify-event")]
6884    fn connect_property_notify_event<
6885        F: Fn(&Self, &gdk::EventProperty) -> glib::Propagation + 'static,
6886    >(
6887        &self,
6888        f: F,
6889    ) -> SignalHandlerId {
6890        unsafe extern "C" fn property_notify_event_trampoline<
6891            P: IsA<Widget>,
6892            F: Fn(&P, &gdk::EventProperty) -> glib::Propagation + 'static,
6893        >(
6894            this: *mut ffi::GtkWidget,
6895            event: *mut gdk::ffi::GdkEventProperty,
6896            f: glib::ffi::gpointer,
6897        ) -> glib::ffi::gboolean {
6898            unsafe {
6899                let f: &F = &*(f as *const F);
6900                f(
6901                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
6902                    &from_glib_borrow(event),
6903                )
6904                .into_glib()
6905            }
6906        }
6907        unsafe {
6908            let f: Box_<F> = Box_::new(f);
6909            connect_raw(
6910                self.as_ptr() as *mut _,
6911                c"property-notify-event".as_ptr(),
6912                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
6913                    property_notify_event_trampoline::<Self, F> as *const (),
6914                )),
6915                Box_::into_raw(f),
6916            )
6917        }
6918    }
6919
6920    /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
6921    /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
6922    ///
6923    /// This signal will be sent to the grab widget if there is one.
6924    /// ## `event`
6925    /// the [`gdk::EventProximity`][crate::gdk::EventProximity] which triggered
6926    ///  this signal.
6927    ///
6928    /// # Returns
6929    ///
6930    /// [`true`] to stop other handlers from being invoked for the event.
6931    ///  [`false`] to propagate the event further.
6932    #[doc(alias = "proximity-in-event")]
6933    fn connect_proximity_in_event<
6934        F: Fn(&Self, &gdk::EventProximity) -> glib::Propagation + 'static,
6935    >(
6936        &self,
6937        f: F,
6938    ) -> SignalHandlerId {
6939        unsafe extern "C" fn proximity_in_event_trampoline<
6940            P: IsA<Widget>,
6941            F: Fn(&P, &gdk::EventProximity) -> glib::Propagation + 'static,
6942        >(
6943            this: *mut ffi::GtkWidget,
6944            event: *mut gdk::ffi::GdkEventProximity,
6945            f: glib::ffi::gpointer,
6946        ) -> glib::ffi::gboolean {
6947            unsafe {
6948                let f: &F = &*(f as *const F);
6949                f(
6950                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
6951                    &from_glib_borrow(event),
6952                )
6953                .into_glib()
6954            }
6955        }
6956        unsafe {
6957            let f: Box_<F> = Box_::new(f);
6958            connect_raw(
6959                self.as_ptr() as *mut _,
6960                c"proximity-in-event".as_ptr(),
6961                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
6962                    proximity_in_event_trampoline::<Self, F> as *const (),
6963                )),
6964                Box_::into_raw(f),
6965            )
6966        }
6967    }
6968
6969    /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
6970    /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
6971    ///
6972    /// This signal will be sent to the grab widget if there is one.
6973    /// ## `event`
6974    /// the [`gdk::EventProximity`][crate::gdk::EventProximity] which triggered
6975    ///  this signal.
6976    ///
6977    /// # Returns
6978    ///
6979    /// [`true`] to stop other handlers from being invoked for the event.
6980    ///  [`false`] to propagate the event further.
6981    #[doc(alias = "proximity-out-event")]
6982    fn connect_proximity_out_event<
6983        F: Fn(&Self, &gdk::EventProximity) -> glib::Propagation + 'static,
6984    >(
6985        &self,
6986        f: F,
6987    ) -> SignalHandlerId {
6988        unsafe extern "C" fn proximity_out_event_trampoline<
6989            P: IsA<Widget>,
6990            F: Fn(&P, &gdk::EventProximity) -> glib::Propagation + 'static,
6991        >(
6992            this: *mut ffi::GtkWidget,
6993            event: *mut gdk::ffi::GdkEventProximity,
6994            f: glib::ffi::gpointer,
6995        ) -> glib::ffi::gboolean {
6996            unsafe {
6997                let f: &F = &*(f as *const F);
6998                f(
6999                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
7000                    &from_glib_borrow(event),
7001                )
7002                .into_glib()
7003            }
7004        }
7005        unsafe {
7006            let f: Box_<F> = Box_::new(f);
7007            connect_raw(
7008                self.as_ptr() as *mut _,
7009                c"proximity-out-event".as_ptr(),
7010                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
7011                    proximity_out_event_trampoline::<Self, F> as *const (),
7012                )),
7013                Box_::into_raw(f),
7014            )
7015        }
7016    }
7017
7018    /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
7019    /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
7020    /// focus in keyboard mode.
7021    ///
7022    /// Using the given coordinates, the signal handler should determine
7023    /// whether a tooltip should be shown for `widget`. If this is the case
7024    /// [`true`] should be returned, [`false`] otherwise. Note that if
7025    /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
7026    /// should not be used.
7027    ///
7028    /// The signal handler is free to manipulate `tooltip` with the therefore
7029    /// destined function calls.
7030    /// ## `x`
7031    /// the x coordinate of the cursor position where the request has
7032    ///  been emitted, relative to `widget`'s left side
7033    /// ## `y`
7034    /// the y coordinate of the cursor position where the request has
7035    ///  been emitted, relative to `widget`'s top
7036    /// ## `keyboard_mode`
7037    /// [`true`] if the tooltip was triggered using the keyboard
7038    /// ## `tooltip`
7039    /// a [`Tooltip`][crate::Tooltip]
7040    ///
7041    /// # Returns
7042    ///
7043    /// [`true`] if `tooltip` should be shown right now, [`false`] otherwise.
7044    #[doc(alias = "query-tooltip")]
7045    fn connect_query_tooltip<F: Fn(&Self, i32, i32, bool, &Tooltip) -> bool + 'static>(
7046        &self,
7047        f: F,
7048    ) -> SignalHandlerId {
7049        unsafe extern "C" fn query_tooltip_trampoline<
7050            P: IsA<Widget>,
7051            F: Fn(&P, i32, i32, bool, &Tooltip) -> bool + 'static,
7052        >(
7053            this: *mut ffi::GtkWidget,
7054            x: std::ffi::c_int,
7055            y: std::ffi::c_int,
7056            keyboard_mode: glib::ffi::gboolean,
7057            tooltip: *mut ffi::GtkTooltip,
7058            f: glib::ffi::gpointer,
7059        ) -> glib::ffi::gboolean {
7060            unsafe {
7061                let f: &F = &*(f as *const F);
7062                f(
7063                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
7064                    x,
7065                    y,
7066                    from_glib(keyboard_mode),
7067                    &from_glib_borrow(tooltip),
7068                )
7069                .into_glib()
7070            }
7071        }
7072        unsafe {
7073            let f: Box_<F> = Box_::new(f);
7074            connect_raw(
7075                self.as_ptr() as *mut _,
7076                c"query-tooltip".as_ptr(),
7077                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
7078                    query_tooltip_trampoline::<Self, F> as *const (),
7079                )),
7080                Box_::into_raw(f),
7081            )
7082        }
7083    }
7084
7085    /// The ::realize signal is emitted when `widget` is associated with a
7086    /// [`gdk::Window`][crate::gdk::Window], which means that [`realize()`][Self::realize()] has been called or the
7087    /// widget has been mapped (that is, it is going to be drawn).
7088    #[doc(alias = "realize")]
7089    fn connect_realize<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
7090        unsafe extern "C" fn realize_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
7091            this: *mut ffi::GtkWidget,
7092            f: glib::ffi::gpointer,
7093        ) {
7094            unsafe {
7095                let f: &F = &*(f as *const F);
7096                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
7097            }
7098        }
7099        unsafe {
7100            let f: Box_<F> = Box_::new(f);
7101            connect_raw(
7102                self.as_ptr() as *mut _,
7103                c"realize".as_ptr(),
7104                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
7105                    realize_trampoline::<Self, F> as *const (),
7106                )),
7107                Box_::into_raw(f),
7108            )
7109        }
7110    }
7111
7112    /// The ::screen-changed signal gets emitted when the
7113    /// screen of a widget has changed.
7114    /// ## `previous_screen`
7115    /// the previous screen, or [`None`] if the
7116    ///  widget was not associated with a screen before
7117    #[doc(alias = "screen-changed")]
7118    fn connect_screen_changed<F: Fn(&Self, Option<&gdk::Screen>) + 'static>(
7119        &self,
7120        f: F,
7121    ) -> SignalHandlerId {
7122        unsafe extern "C" fn screen_changed_trampoline<
7123            P: IsA<Widget>,
7124            F: Fn(&P, Option<&gdk::Screen>) + 'static,
7125        >(
7126            this: *mut ffi::GtkWidget,
7127            previous_screen: *mut gdk::ffi::GdkScreen,
7128            f: glib::ffi::gpointer,
7129        ) {
7130            unsafe {
7131                let f: &F = &*(f as *const F);
7132                f(
7133                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
7134                    Option::<gdk::Screen>::from_glib_borrow(previous_screen)
7135                        .as_ref()
7136                        .as_ref(),
7137                )
7138            }
7139        }
7140        unsafe {
7141            let f: Box_<F> = Box_::new(f);
7142            connect_raw(
7143                self.as_ptr() as *mut _,
7144                c"screen-changed".as_ptr(),
7145                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
7146                    screen_changed_trampoline::<Self, F> as *const (),
7147                )),
7148                Box_::into_raw(f),
7149            )
7150        }
7151    }
7152
7153    /// The ::scroll-event signal is emitted when a button in the 4 to 7
7154    /// range is pressed. Wheel mice are usually configured to generate
7155    /// button press events for buttons 4 and 5 when the wheel is turned.
7156    ///
7157    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
7158    /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
7159    ///
7160    /// This signal will be sent to the grab widget if there is one.
7161    /// ## `event`
7162    /// the [`gdk::EventScroll`][crate::gdk::EventScroll] which triggered
7163    ///  this signal.
7164    ///
7165    /// # Returns
7166    ///
7167    /// [`true`] to stop other handlers from being invoked for the event.
7168    ///  [`false`] to propagate the event further.
7169    #[doc(alias = "scroll-event")]
7170    fn connect_scroll_event<F: Fn(&Self, &gdk::EventScroll) -> glib::Propagation + 'static>(
7171        &self,
7172        f: F,
7173    ) -> SignalHandlerId {
7174        unsafe extern "C" fn scroll_event_trampoline<
7175            P: IsA<Widget>,
7176            F: Fn(&P, &gdk::EventScroll) -> glib::Propagation + 'static,
7177        >(
7178            this: *mut ffi::GtkWidget,
7179            event: *mut gdk::ffi::GdkEventScroll,
7180            f: glib::ffi::gpointer,
7181        ) -> glib::ffi::gboolean {
7182            unsafe {
7183                let f: &F = &*(f as *const F);
7184                f(
7185                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
7186                    &from_glib_borrow(event),
7187                )
7188                .into_glib()
7189            }
7190        }
7191        unsafe {
7192            let f: Box_<F> = Box_::new(f);
7193            connect_raw(
7194                self.as_ptr() as *mut _,
7195                c"scroll-event".as_ptr(),
7196                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
7197                    scroll_event_trampoline::<Self, F> as *const (),
7198                )),
7199                Box_::into_raw(f),
7200            )
7201        }
7202    }
7203
7204    /// The ::selection-clear-event signal will be emitted when the
7205    /// the `widget`'s window has lost ownership of a selection.
7206    /// ## `event`
7207    /// the [`gdk::EventSelection`][crate::gdk::EventSelection] which triggered
7208    ///  this signal.
7209    ///
7210    /// # Returns
7211    ///
7212    /// [`true`] to stop other handlers from being invoked for the event.
7213    ///  [`false`] to propagate the event further.
7214    #[doc(alias = "selection-clear-event")]
7215    fn connect_selection_clear_event<
7216        F: Fn(&Self, &gdk::EventSelection) -> glib::Propagation + 'static,
7217    >(
7218        &self,
7219        f: F,
7220    ) -> SignalHandlerId {
7221        unsafe extern "C" fn selection_clear_event_trampoline<
7222            P: IsA<Widget>,
7223            F: Fn(&P, &gdk::EventSelection) -> glib::Propagation + 'static,
7224        >(
7225            this: *mut ffi::GtkWidget,
7226            event: *mut gdk::ffi::GdkEventSelection,
7227            f: glib::ffi::gpointer,
7228        ) -> glib::ffi::gboolean {
7229            unsafe {
7230                let f: &F = &*(f as *const F);
7231                f(
7232                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
7233                    &from_glib_borrow(event),
7234                )
7235                .into_glib()
7236            }
7237        }
7238        unsafe {
7239            let f: Box_<F> = Box_::new(f);
7240            connect_raw(
7241                self.as_ptr() as *mut _,
7242                c"selection-clear-event".as_ptr(),
7243                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
7244                    selection_clear_event_trampoline::<Self, F> as *const (),
7245                )),
7246                Box_::into_raw(f),
7247            )
7248        }
7249    }
7250
7251    #[doc(alias = "selection-get")]
7252    fn connect_selection_get<F: Fn(&Self, &SelectionData, u32, u32) + 'static>(
7253        &self,
7254        f: F,
7255    ) -> SignalHandlerId {
7256        unsafe extern "C" fn selection_get_trampoline<
7257            P: IsA<Widget>,
7258            F: Fn(&P, &SelectionData, u32, u32) + 'static,
7259        >(
7260            this: *mut ffi::GtkWidget,
7261            data: *mut ffi::GtkSelectionData,
7262            info: std::ffi::c_uint,
7263            time: std::ffi::c_uint,
7264            f: glib::ffi::gpointer,
7265        ) {
7266            unsafe {
7267                let f: &F = &*(f as *const F);
7268                f(
7269                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
7270                    &from_glib_borrow(data),
7271                    info,
7272                    time,
7273                )
7274            }
7275        }
7276        unsafe {
7277            let f: Box_<F> = Box_::new(f);
7278            connect_raw(
7279                self.as_ptr() as *mut _,
7280                c"selection-get".as_ptr(),
7281                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
7282                    selection_get_trampoline::<Self, F> as *const (),
7283                )),
7284                Box_::into_raw(f),
7285            )
7286        }
7287    }
7288
7289    ///
7290    /// # Returns
7291    ///
7292    /// [`true`] to stop other handlers from being invoked for the event. [`false`] to propagate the event further.
7293    #[doc(alias = "selection-notify-event")]
7294    fn connect_selection_notify_event<
7295        F: Fn(&Self, &gdk::EventSelection) -> glib::Propagation + 'static,
7296    >(
7297        &self,
7298        f: F,
7299    ) -> SignalHandlerId {
7300        unsafe extern "C" fn selection_notify_event_trampoline<
7301            P: IsA<Widget>,
7302            F: Fn(&P, &gdk::EventSelection) -> glib::Propagation + 'static,
7303        >(
7304            this: *mut ffi::GtkWidget,
7305            event: *mut gdk::ffi::GdkEventSelection,
7306            f: glib::ffi::gpointer,
7307        ) -> glib::ffi::gboolean {
7308            unsafe {
7309                let f: &F = &*(f as *const F);
7310                f(
7311                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
7312                    &from_glib_borrow(event),
7313                )
7314                .into_glib()
7315            }
7316        }
7317        unsafe {
7318            let f: Box_<F> = Box_::new(f);
7319            connect_raw(
7320                self.as_ptr() as *mut _,
7321                c"selection-notify-event".as_ptr(),
7322                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
7323                    selection_notify_event_trampoline::<Self, F> as *const (),
7324                )),
7325                Box_::into_raw(f),
7326            )
7327        }
7328    }
7329
7330    #[doc(alias = "selection-received")]
7331    fn connect_selection_received<F: Fn(&Self, &SelectionData, u32) + 'static>(
7332        &self,
7333        f: F,
7334    ) -> SignalHandlerId {
7335        unsafe extern "C" fn selection_received_trampoline<
7336            P: IsA<Widget>,
7337            F: Fn(&P, &SelectionData, u32) + 'static,
7338        >(
7339            this: *mut ffi::GtkWidget,
7340            data: *mut ffi::GtkSelectionData,
7341            time: std::ffi::c_uint,
7342            f: glib::ffi::gpointer,
7343        ) {
7344            unsafe {
7345                let f: &F = &*(f as *const F);
7346                f(
7347                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
7348                    &from_glib_borrow(data),
7349                    time,
7350                )
7351            }
7352        }
7353        unsafe {
7354            let f: Box_<F> = Box_::new(f);
7355            connect_raw(
7356                self.as_ptr() as *mut _,
7357                c"selection-received".as_ptr(),
7358                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
7359                    selection_received_trampoline::<Self, F> as *const (),
7360                )),
7361                Box_::into_raw(f),
7362            )
7363        }
7364    }
7365
7366    /// The ::selection-request-event signal will be emitted when
7367    /// another client requests ownership of the selection owned by
7368    /// the `widget`'s window.
7369    /// ## `event`
7370    /// the [`gdk::EventSelection`][crate::gdk::EventSelection] which triggered
7371    ///  this signal.
7372    ///
7373    /// # Returns
7374    ///
7375    /// [`true`] to stop other handlers from being invoked for the event.
7376    ///  [`false`] to propagate the event further.
7377    #[doc(alias = "selection-request-event")]
7378    fn connect_selection_request_event<
7379        F: Fn(&Self, &gdk::EventSelection) -> glib::Propagation + 'static,
7380    >(
7381        &self,
7382        f: F,
7383    ) -> SignalHandlerId {
7384        unsafe extern "C" fn selection_request_event_trampoline<
7385            P: IsA<Widget>,
7386            F: Fn(&P, &gdk::EventSelection) -> glib::Propagation + 'static,
7387        >(
7388            this: *mut ffi::GtkWidget,
7389            event: *mut gdk::ffi::GdkEventSelection,
7390            f: glib::ffi::gpointer,
7391        ) -> glib::ffi::gboolean {
7392            unsafe {
7393                let f: &F = &*(f as *const F);
7394                f(
7395                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
7396                    &from_glib_borrow(event),
7397                )
7398                .into_glib()
7399            }
7400        }
7401        unsafe {
7402            let f: Box_<F> = Box_::new(f);
7403            connect_raw(
7404                self.as_ptr() as *mut _,
7405                c"selection-request-event".as_ptr(),
7406                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
7407                    selection_request_event_trampoline::<Self, F> as *const (),
7408                )),
7409                Box_::into_raw(f),
7410            )
7411        }
7412    }
7413
7414    /// The ::show signal is emitted when `widget` is shown, for example with
7415    /// [`show()`][Self::show()].
7416    #[doc(alias = "show")]
7417    fn connect_show<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
7418        unsafe extern "C" fn show_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
7419            this: *mut ffi::GtkWidget,
7420            f: glib::ffi::gpointer,
7421        ) {
7422            unsafe {
7423                let f: &F = &*(f as *const F);
7424                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
7425            }
7426        }
7427        unsafe {
7428            let f: Box_<F> = Box_::new(f);
7429            connect_raw(
7430                self.as_ptr() as *mut _,
7431                c"show".as_ptr(),
7432                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
7433                    show_trampoline::<Self, F> as *const (),
7434                )),
7435                Box_::into_raw(f),
7436            )
7437        }
7438    }
7439
7440    ///
7441    /// # Returns
7442    ///
7443    /// [`true`] to stop other handlers from being invoked for the event.
7444    /// [`false`] to propagate the event further.
7445    #[doc(alias = "show-help")]
7446    fn connect_show_help<F: Fn(&Self, WidgetHelpType) -> bool + 'static>(
7447        &self,
7448        f: F,
7449    ) -> SignalHandlerId {
7450        unsafe extern "C" fn show_help_trampoline<
7451            P: IsA<Widget>,
7452            F: Fn(&P, WidgetHelpType) -> bool + 'static,
7453        >(
7454            this: *mut ffi::GtkWidget,
7455            help_type: ffi::GtkWidgetHelpType,
7456            f: glib::ffi::gpointer,
7457        ) -> glib::ffi::gboolean {
7458            unsafe {
7459                let f: &F = &*(f as *const F);
7460                f(
7461                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
7462                    from_glib(help_type),
7463                )
7464                .into_glib()
7465            }
7466        }
7467        unsafe {
7468            let f: Box_<F> = Box_::new(f);
7469            connect_raw(
7470                self.as_ptr() as *mut _,
7471                c"show-help".as_ptr(),
7472                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
7473                    show_help_trampoline::<Self, F> as *const (),
7474                )),
7475                Box_::into_raw(f),
7476            )
7477        }
7478    }
7479
7480    fn emit_show_help(&self, help_type: WidgetHelpType) -> bool {
7481        self.emit_by_name("show-help", &[&help_type])
7482    }
7483
7484    /// ## `allocation`
7485    /// the region which has been
7486    ///  allocated to the widget.
7487    #[doc(alias = "size-allocate")]
7488    fn connect_size_allocate<F: Fn(&Self, &Allocation) + 'static>(&self, f: F) -> SignalHandlerId {
7489        unsafe extern "C" fn size_allocate_trampoline<
7490            P: IsA<Widget>,
7491            F: Fn(&P, &Allocation) + 'static,
7492        >(
7493            this: *mut ffi::GtkWidget,
7494            allocation: *mut ffi::GtkAllocation,
7495            f: glib::ffi::gpointer,
7496        ) {
7497            unsafe {
7498                let f: &F = &*(f as *const F);
7499                f(
7500                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
7501                    &from_glib_none(allocation),
7502                )
7503            }
7504        }
7505        unsafe {
7506            let f: Box_<F> = Box_::new(f);
7507            connect_raw(
7508                self.as_ptr() as *mut _,
7509                c"size-allocate".as_ptr(),
7510                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
7511                    size_allocate_trampoline::<Self, F> as *const (),
7512                )),
7513                Box_::into_raw(f),
7514            )
7515        }
7516    }
7517
7518    /// The ::state-flags-changed signal is emitted when the widget state
7519    /// changes, see [`state_flags()`][Self::state_flags()].
7520    /// ## `flags`
7521    /// The previous state flags.
7522    #[doc(alias = "state-flags-changed")]
7523    fn connect_state_flags_changed<F: Fn(&Self, StateFlags) + 'static>(
7524        &self,
7525        f: F,
7526    ) -> SignalHandlerId {
7527        unsafe extern "C" fn state_flags_changed_trampoline<
7528            P: IsA<Widget>,
7529            F: Fn(&P, StateFlags) + 'static,
7530        >(
7531            this: *mut ffi::GtkWidget,
7532            flags: ffi::GtkStateFlags,
7533            f: glib::ffi::gpointer,
7534        ) {
7535            unsafe {
7536                let f: &F = &*(f as *const F);
7537                f(
7538                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
7539                    from_glib(flags),
7540                )
7541            }
7542        }
7543        unsafe {
7544            let f: Box_<F> = Box_::new(f);
7545            connect_raw(
7546                self.as_ptr() as *mut _,
7547                c"state-flags-changed".as_ptr(),
7548                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
7549                    state_flags_changed_trampoline::<Self, F> as *const (),
7550                )),
7551                Box_::into_raw(f),
7552            )
7553        }
7554    }
7555
7556    /// The ::style-updated signal is a convenience signal that is emitted when the
7557    /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
7558    /// [`StyleContext`][crate::StyleContext] as returned by [`style_context()`][Self::style_context()].
7559    ///
7560    /// Note that style-modifying functions like `gtk_widget_override_color()` also
7561    /// cause this signal to be emitted.
7562    #[doc(alias = "style-updated")]
7563    fn connect_style_updated<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
7564        unsafe extern "C" fn style_updated_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
7565            this: *mut ffi::GtkWidget,
7566            f: glib::ffi::gpointer,
7567        ) {
7568            unsafe {
7569                let f: &F = &*(f as *const F);
7570                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
7571            }
7572        }
7573        unsafe {
7574            let f: Box_<F> = Box_::new(f);
7575            connect_raw(
7576                self.as_ptr() as *mut _,
7577                c"style-updated".as_ptr(),
7578                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
7579                    style_updated_trampoline::<Self, F> as *const (),
7580                )),
7581                Box_::into_raw(f),
7582            )
7583        }
7584    }
7585
7586    #[doc(alias = "touch-event")]
7587    fn connect_touch_event<F: Fn(&Self, &gdk::Event) -> glib::Propagation + 'static>(
7588        &self,
7589        f: F,
7590    ) -> SignalHandlerId {
7591        unsafe extern "C" fn touch_event_trampoline<
7592            P: IsA<Widget>,
7593            F: Fn(&P, &gdk::Event) -> glib::Propagation + 'static,
7594        >(
7595            this: *mut ffi::GtkWidget,
7596            object: *mut gdk::ffi::GdkEvent,
7597            f: glib::ffi::gpointer,
7598        ) -> glib::ffi::gboolean {
7599            unsafe {
7600                let f: &F = &*(f as *const F);
7601                f(
7602                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
7603                    &from_glib_none(object),
7604                )
7605                .into_glib()
7606            }
7607        }
7608        unsafe {
7609            let f: Box_<F> = Box_::new(f);
7610            connect_raw(
7611                self.as_ptr() as *mut _,
7612                c"touch-event".as_ptr(),
7613                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
7614                    touch_event_trampoline::<Self, F> as *const (),
7615                )),
7616                Box_::into_raw(f),
7617            )
7618        }
7619    }
7620
7621    /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
7622    /// means that either it or any of its parents up to the toplevel widget have
7623    /// been set as hidden.
7624    ///
7625    /// As ::unmap indicates that a widget will not be shown any longer, it can be
7626    /// used to, for example, stop an animation on the widget.
7627    #[doc(alias = "unmap")]
7628    fn connect_unmap<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
7629        unsafe extern "C" fn unmap_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
7630            this: *mut ffi::GtkWidget,
7631            f: glib::ffi::gpointer,
7632        ) {
7633            unsafe {
7634                let f: &F = &*(f as *const F);
7635                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
7636            }
7637        }
7638        unsafe {
7639            let f: Box_<F> = Box_::new(f);
7640            connect_raw(
7641                self.as_ptr() as *mut _,
7642                c"unmap".as_ptr(),
7643                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
7644                    unmap_trampoline::<Self, F> as *const (),
7645                )),
7646                Box_::into_raw(f),
7647            )
7648        }
7649    }
7650
7651    /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
7652    /// `widget` is destroyed, which means that [`unrealize()`][Self::unrealize()] has been
7653    /// called or the widget has been unmapped (that is, it is going to be
7654    /// hidden).
7655    #[doc(alias = "unrealize")]
7656    fn connect_unrealize<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
7657        unsafe extern "C" fn unrealize_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
7658            this: *mut ffi::GtkWidget,
7659            f: glib::ffi::gpointer,
7660        ) {
7661            unsafe {
7662                let f: &F = &*(f as *const F);
7663                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
7664            }
7665        }
7666        unsafe {
7667            let f: Box_<F> = Box_::new(f);
7668            connect_raw(
7669                self.as_ptr() as *mut _,
7670                c"unrealize".as_ptr(),
7671                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
7672                    unrealize_trampoline::<Self, F> as *const (),
7673                )),
7674                Box_::into_raw(f),
7675            )
7676        }
7677    }
7678
7679    /// The ::window-state-event will be emitted when the state of the
7680    /// toplevel window associated to the `widget` changes.
7681    ///
7682    /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
7683    /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
7684    /// this mask automatically for all new windows.
7685    /// ## `event`
7686    /// the [`gdk::EventWindowState`][crate::gdk::EventWindowState] which
7687    ///  triggered this signal.
7688    ///
7689    /// # Returns
7690    ///
7691    /// [`true`] to stop other handlers from being invoked for the
7692    ///  event. [`false`] to propagate the event further.
7693    #[doc(alias = "window-state-event")]
7694    fn connect_window_state_event<
7695        F: Fn(&Self, &gdk::EventWindowState) -> glib::Propagation + 'static,
7696    >(
7697        &self,
7698        f: F,
7699    ) -> SignalHandlerId {
7700        unsafe extern "C" fn window_state_event_trampoline<
7701            P: IsA<Widget>,
7702            F: Fn(&P, &gdk::EventWindowState) -> glib::Propagation + 'static,
7703        >(
7704            this: *mut ffi::GtkWidget,
7705            event: *mut gdk::ffi::GdkEventWindowState,
7706            f: glib::ffi::gpointer,
7707        ) -> glib::ffi::gboolean {
7708            unsafe {
7709                let f: &F = &*(f as *const F);
7710                f(
7711                    Widget::from_glib_borrow(this).unsafe_cast_ref(),
7712                    &from_glib_borrow(event),
7713                )
7714                .into_glib()
7715            }
7716        }
7717        unsafe {
7718            let f: Box_<F> = Box_::new(f);
7719            connect_raw(
7720                self.as_ptr() as *mut _,
7721                c"window-state-event".as_ptr(),
7722                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
7723                    window_state_event_trampoline::<Self, F> as *const (),
7724                )),
7725                Box_::into_raw(f),
7726            )
7727        }
7728    }
7729
7730    #[doc(alias = "app-paintable")]
7731    fn connect_app_paintable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
7732        unsafe extern "C" fn notify_app_paintable_trampoline<
7733            P: IsA<Widget>,
7734            F: Fn(&P) + 'static,
7735        >(
7736            this: *mut ffi::GtkWidget,
7737            _param_spec: glib::ffi::gpointer,
7738            f: glib::ffi::gpointer,
7739        ) {
7740            unsafe {
7741                let f: &F = &*(f as *const F);
7742                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
7743            }
7744        }
7745        unsafe {
7746            let f: Box_<F> = Box_::new(f);
7747            connect_raw(
7748                self.as_ptr() as *mut _,
7749                c"notify::app-paintable".as_ptr(),
7750                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
7751                    notify_app_paintable_trampoline::<Self, F> as *const (),
7752                )),
7753                Box_::into_raw(f),
7754            )
7755        }
7756    }
7757
7758    #[doc(alias = "can-default")]
7759    fn connect_can_default_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
7760        unsafe extern "C" fn notify_can_default_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
7761            this: *mut ffi::GtkWidget,
7762            _param_spec: glib::ffi::gpointer,
7763            f: glib::ffi::gpointer,
7764        ) {
7765            unsafe {
7766                let f: &F = &*(f as *const F);
7767                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
7768            }
7769        }
7770        unsafe {
7771            let f: Box_<F> = Box_::new(f);
7772            connect_raw(
7773                self.as_ptr() as *mut _,
7774                c"notify::can-default".as_ptr(),
7775                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
7776                    notify_can_default_trampoline::<Self, F> as *const (),
7777                )),
7778                Box_::into_raw(f),
7779            )
7780        }
7781    }
7782
7783    #[doc(alias = "can-focus")]
7784    fn connect_can_focus_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
7785        unsafe extern "C" fn notify_can_focus_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
7786            this: *mut ffi::GtkWidget,
7787            _param_spec: glib::ffi::gpointer,
7788            f: glib::ffi::gpointer,
7789        ) {
7790            unsafe {
7791                let f: &F = &*(f as *const F);
7792                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
7793            }
7794        }
7795        unsafe {
7796            let f: Box_<F> = Box_::new(f);
7797            connect_raw(
7798                self.as_ptr() as *mut _,
7799                c"notify::can-focus".as_ptr(),
7800                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
7801                    notify_can_focus_trampoline::<Self, F> as *const (),
7802                )),
7803                Box_::into_raw(f),
7804            )
7805        }
7806    }
7807
7808    #[doc(alias = "composite-child")]
7809    fn connect_composite_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
7810        unsafe extern "C" fn notify_composite_child_trampoline<
7811            P: IsA<Widget>,
7812            F: Fn(&P) + 'static,
7813        >(
7814            this: *mut ffi::GtkWidget,
7815            _param_spec: glib::ffi::gpointer,
7816            f: glib::ffi::gpointer,
7817        ) {
7818            unsafe {
7819                let f: &F = &*(f as *const F);
7820                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
7821            }
7822        }
7823        unsafe {
7824            let f: Box_<F> = Box_::new(f);
7825            connect_raw(
7826                self.as_ptr() as *mut _,
7827                c"notify::composite-child".as_ptr(),
7828                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
7829                    notify_composite_child_trampoline::<Self, F> as *const (),
7830                )),
7831                Box_::into_raw(f),
7832            )
7833        }
7834    }
7835
7836    #[doc(alias = "events")]
7837    fn connect_events_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
7838        unsafe extern "C" fn notify_events_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
7839            this: *mut ffi::GtkWidget,
7840            _param_spec: glib::ffi::gpointer,
7841            f: glib::ffi::gpointer,
7842        ) {
7843            unsafe {
7844                let f: &F = &*(f as *const F);
7845                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
7846            }
7847        }
7848        unsafe {
7849            let f: Box_<F> = Box_::new(f);
7850            connect_raw(
7851                self.as_ptr() as *mut _,
7852                c"notify::events".as_ptr(),
7853                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
7854                    notify_events_trampoline::<Self, F> as *const (),
7855                )),
7856                Box_::into_raw(f),
7857            )
7858        }
7859    }
7860
7861    #[doc(alias = "expand")]
7862    fn connect_expand_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
7863        unsafe extern "C" fn notify_expand_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
7864            this: *mut ffi::GtkWidget,
7865            _param_spec: glib::ffi::gpointer,
7866            f: glib::ffi::gpointer,
7867        ) {
7868            unsafe {
7869                let f: &F = &*(f as *const F);
7870                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
7871            }
7872        }
7873        unsafe {
7874            let f: Box_<F> = Box_::new(f);
7875            connect_raw(
7876                self.as_ptr() as *mut _,
7877                c"notify::expand".as_ptr(),
7878                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
7879                    notify_expand_trampoline::<Self, F> as *const (),
7880                )),
7881                Box_::into_raw(f),
7882            )
7883        }
7884    }
7885
7886    #[doc(alias = "focus-on-click")]
7887    fn connect_focus_on_click_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
7888        unsafe extern "C" fn notify_focus_on_click_trampoline<
7889            P: IsA<Widget>,
7890            F: Fn(&P) + 'static,
7891        >(
7892            this: *mut ffi::GtkWidget,
7893            _param_spec: glib::ffi::gpointer,
7894            f: glib::ffi::gpointer,
7895        ) {
7896            unsafe {
7897                let f: &F = &*(f as *const F);
7898                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
7899            }
7900        }
7901        unsafe {
7902            let f: Box_<F> = Box_::new(f);
7903            connect_raw(
7904                self.as_ptr() as *mut _,
7905                c"notify::focus-on-click".as_ptr(),
7906                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
7907                    notify_focus_on_click_trampoline::<Self, F> as *const (),
7908                )),
7909                Box_::into_raw(f),
7910            )
7911        }
7912    }
7913
7914    #[doc(alias = "halign")]
7915    fn connect_halign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
7916        unsafe extern "C" fn notify_halign_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
7917            this: *mut ffi::GtkWidget,
7918            _param_spec: glib::ffi::gpointer,
7919            f: glib::ffi::gpointer,
7920        ) {
7921            unsafe {
7922                let f: &F = &*(f as *const F);
7923                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
7924            }
7925        }
7926        unsafe {
7927            let f: Box_<F> = Box_::new(f);
7928            connect_raw(
7929                self.as_ptr() as *mut _,
7930                c"notify::halign".as_ptr(),
7931                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
7932                    notify_halign_trampoline::<Self, F> as *const (),
7933                )),
7934                Box_::into_raw(f),
7935            )
7936        }
7937    }
7938
7939    #[doc(alias = "has-default")]
7940    fn connect_has_default_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
7941        unsafe extern "C" fn notify_has_default_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
7942            this: *mut ffi::GtkWidget,
7943            _param_spec: glib::ffi::gpointer,
7944            f: glib::ffi::gpointer,
7945        ) {
7946            unsafe {
7947                let f: &F = &*(f as *const F);
7948                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
7949            }
7950        }
7951        unsafe {
7952            let f: Box_<F> = Box_::new(f);
7953            connect_raw(
7954                self.as_ptr() as *mut _,
7955                c"notify::has-default".as_ptr(),
7956                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
7957                    notify_has_default_trampoline::<Self, F> as *const (),
7958                )),
7959                Box_::into_raw(f),
7960            )
7961        }
7962    }
7963
7964    #[doc(alias = "has-focus")]
7965    fn connect_has_focus_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
7966        unsafe extern "C" fn notify_has_focus_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
7967            this: *mut ffi::GtkWidget,
7968            _param_spec: glib::ffi::gpointer,
7969            f: glib::ffi::gpointer,
7970        ) {
7971            unsafe {
7972                let f: &F = &*(f as *const F);
7973                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
7974            }
7975        }
7976        unsafe {
7977            let f: Box_<F> = Box_::new(f);
7978            connect_raw(
7979                self.as_ptr() as *mut _,
7980                c"notify::has-focus".as_ptr(),
7981                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
7982                    notify_has_focus_trampoline::<Self, F> as *const (),
7983                )),
7984                Box_::into_raw(f),
7985            )
7986        }
7987    }
7988
7989    #[doc(alias = "has-tooltip")]
7990    fn connect_has_tooltip_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
7991        unsafe extern "C" fn notify_has_tooltip_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
7992            this: *mut ffi::GtkWidget,
7993            _param_spec: glib::ffi::gpointer,
7994            f: glib::ffi::gpointer,
7995        ) {
7996            unsafe {
7997                let f: &F = &*(f as *const F);
7998                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
7999            }
8000        }
8001        unsafe {
8002            let f: Box_<F> = Box_::new(f);
8003            connect_raw(
8004                self.as_ptr() as *mut _,
8005                c"notify::has-tooltip".as_ptr(),
8006                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
8007                    notify_has_tooltip_trampoline::<Self, F> as *const (),
8008                )),
8009                Box_::into_raw(f),
8010            )
8011        }
8012    }
8013
8014    #[doc(alias = "height-request")]
8015    fn connect_height_request_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
8016        unsafe extern "C" fn notify_height_request_trampoline<
8017            P: IsA<Widget>,
8018            F: Fn(&P) + 'static,
8019        >(
8020            this: *mut ffi::GtkWidget,
8021            _param_spec: glib::ffi::gpointer,
8022            f: glib::ffi::gpointer,
8023        ) {
8024            unsafe {
8025                let f: &F = &*(f as *const F);
8026                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
8027            }
8028        }
8029        unsafe {
8030            let f: Box_<F> = Box_::new(f);
8031            connect_raw(
8032                self.as_ptr() as *mut _,
8033                c"notify::height-request".as_ptr(),
8034                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
8035                    notify_height_request_trampoline::<Self, F> as *const (),
8036                )),
8037                Box_::into_raw(f),
8038            )
8039        }
8040    }
8041
8042    #[doc(alias = "hexpand")]
8043    fn connect_hexpand_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
8044        unsafe extern "C" fn notify_hexpand_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
8045            this: *mut ffi::GtkWidget,
8046            _param_spec: glib::ffi::gpointer,
8047            f: glib::ffi::gpointer,
8048        ) {
8049            unsafe {
8050                let f: &F = &*(f as *const F);
8051                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
8052            }
8053        }
8054        unsafe {
8055            let f: Box_<F> = Box_::new(f);
8056            connect_raw(
8057                self.as_ptr() as *mut _,
8058                c"notify::hexpand".as_ptr(),
8059                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
8060                    notify_hexpand_trampoline::<Self, F> as *const (),
8061                )),
8062                Box_::into_raw(f),
8063            )
8064        }
8065    }
8066
8067    #[doc(alias = "hexpand-set")]
8068    fn connect_hexpand_set_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
8069        unsafe extern "C" fn notify_hexpand_set_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
8070            this: *mut ffi::GtkWidget,
8071            _param_spec: glib::ffi::gpointer,
8072            f: glib::ffi::gpointer,
8073        ) {
8074            unsafe {
8075                let f: &F = &*(f as *const F);
8076                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
8077            }
8078        }
8079        unsafe {
8080            let f: Box_<F> = Box_::new(f);
8081            connect_raw(
8082                self.as_ptr() as *mut _,
8083                c"notify::hexpand-set".as_ptr(),
8084                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
8085                    notify_hexpand_set_trampoline::<Self, F> as *const (),
8086                )),
8087                Box_::into_raw(f),
8088            )
8089        }
8090    }
8091
8092    #[doc(alias = "is-focus")]
8093    fn connect_is_focus_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
8094        unsafe extern "C" fn notify_is_focus_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
8095            this: *mut ffi::GtkWidget,
8096            _param_spec: glib::ffi::gpointer,
8097            f: glib::ffi::gpointer,
8098        ) {
8099            unsafe {
8100                let f: &F = &*(f as *const F);
8101                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
8102            }
8103        }
8104        unsafe {
8105            let f: Box_<F> = Box_::new(f);
8106            connect_raw(
8107                self.as_ptr() as *mut _,
8108                c"notify::is-focus".as_ptr(),
8109                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
8110                    notify_is_focus_trampoline::<Self, F> as *const (),
8111                )),
8112                Box_::into_raw(f),
8113            )
8114        }
8115    }
8116
8117    #[doc(alias = "margin")]
8118    fn connect_margin_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
8119        unsafe extern "C" fn notify_margin_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
8120            this: *mut ffi::GtkWidget,
8121            _param_spec: glib::ffi::gpointer,
8122            f: glib::ffi::gpointer,
8123        ) {
8124            unsafe {
8125                let f: &F = &*(f as *const F);
8126                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
8127            }
8128        }
8129        unsafe {
8130            let f: Box_<F> = Box_::new(f);
8131            connect_raw(
8132                self.as_ptr() as *mut _,
8133                c"notify::margin".as_ptr(),
8134                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
8135                    notify_margin_trampoline::<Self, F> as *const (),
8136                )),
8137                Box_::into_raw(f),
8138            )
8139        }
8140    }
8141
8142    #[doc(alias = "margin-bottom")]
8143    fn connect_margin_bottom_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
8144        unsafe extern "C" fn notify_margin_bottom_trampoline<
8145            P: IsA<Widget>,
8146            F: Fn(&P) + 'static,
8147        >(
8148            this: *mut ffi::GtkWidget,
8149            _param_spec: glib::ffi::gpointer,
8150            f: glib::ffi::gpointer,
8151        ) {
8152            unsafe {
8153                let f: &F = &*(f as *const F);
8154                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
8155            }
8156        }
8157        unsafe {
8158            let f: Box_<F> = Box_::new(f);
8159            connect_raw(
8160                self.as_ptr() as *mut _,
8161                c"notify::margin-bottom".as_ptr(),
8162                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
8163                    notify_margin_bottom_trampoline::<Self, F> as *const (),
8164                )),
8165                Box_::into_raw(f),
8166            )
8167        }
8168    }
8169
8170    #[doc(alias = "margin-end")]
8171    fn connect_margin_end_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
8172        unsafe extern "C" fn notify_margin_end_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
8173            this: *mut ffi::GtkWidget,
8174            _param_spec: glib::ffi::gpointer,
8175            f: glib::ffi::gpointer,
8176        ) {
8177            unsafe {
8178                let f: &F = &*(f as *const F);
8179                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
8180            }
8181        }
8182        unsafe {
8183            let f: Box_<F> = Box_::new(f);
8184            connect_raw(
8185                self.as_ptr() as *mut _,
8186                c"notify::margin-end".as_ptr(),
8187                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
8188                    notify_margin_end_trampoline::<Self, F> as *const (),
8189                )),
8190                Box_::into_raw(f),
8191            )
8192        }
8193    }
8194
8195    #[doc(alias = "margin-start")]
8196    fn connect_margin_start_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
8197        unsafe extern "C" fn notify_margin_start_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
8198            this: *mut ffi::GtkWidget,
8199            _param_spec: glib::ffi::gpointer,
8200            f: glib::ffi::gpointer,
8201        ) {
8202            unsafe {
8203                let f: &F = &*(f as *const F);
8204                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
8205            }
8206        }
8207        unsafe {
8208            let f: Box_<F> = Box_::new(f);
8209            connect_raw(
8210                self.as_ptr() as *mut _,
8211                c"notify::margin-start".as_ptr(),
8212                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
8213                    notify_margin_start_trampoline::<Self, F> as *const (),
8214                )),
8215                Box_::into_raw(f),
8216            )
8217        }
8218    }
8219
8220    #[doc(alias = "margin-top")]
8221    fn connect_margin_top_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
8222        unsafe extern "C" fn notify_margin_top_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
8223            this: *mut ffi::GtkWidget,
8224            _param_spec: glib::ffi::gpointer,
8225            f: glib::ffi::gpointer,
8226        ) {
8227            unsafe {
8228                let f: &F = &*(f as *const F);
8229                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
8230            }
8231        }
8232        unsafe {
8233            let f: Box_<F> = Box_::new(f);
8234            connect_raw(
8235                self.as_ptr() as *mut _,
8236                c"notify::margin-top".as_ptr(),
8237                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
8238                    notify_margin_top_trampoline::<Self, F> as *const (),
8239                )),
8240                Box_::into_raw(f),
8241            )
8242        }
8243    }
8244
8245    #[doc(alias = "name")]
8246    fn connect_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
8247        unsafe extern "C" fn notify_name_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
8248            this: *mut ffi::GtkWidget,
8249            _param_spec: glib::ffi::gpointer,
8250            f: glib::ffi::gpointer,
8251        ) {
8252            unsafe {
8253                let f: &F = &*(f as *const F);
8254                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
8255            }
8256        }
8257        unsafe {
8258            let f: Box_<F> = Box_::new(f);
8259            connect_raw(
8260                self.as_ptr() as *mut _,
8261                c"notify::name".as_ptr(),
8262                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
8263                    notify_name_trampoline::<Self, F> as *const (),
8264                )),
8265                Box_::into_raw(f),
8266            )
8267        }
8268    }
8269
8270    #[doc(alias = "no-show-all")]
8271    fn connect_no_show_all_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
8272        unsafe extern "C" fn notify_no_show_all_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
8273            this: *mut ffi::GtkWidget,
8274            _param_spec: glib::ffi::gpointer,
8275            f: glib::ffi::gpointer,
8276        ) {
8277            unsafe {
8278                let f: &F = &*(f as *const F);
8279                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
8280            }
8281        }
8282        unsafe {
8283            let f: Box_<F> = Box_::new(f);
8284            connect_raw(
8285                self.as_ptr() as *mut _,
8286                c"notify::no-show-all".as_ptr(),
8287                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
8288                    notify_no_show_all_trampoline::<Self, F> as *const (),
8289                )),
8290                Box_::into_raw(f),
8291            )
8292        }
8293    }
8294
8295    #[doc(alias = "opacity")]
8296    fn connect_opacity_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
8297        unsafe extern "C" fn notify_opacity_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
8298            this: *mut ffi::GtkWidget,
8299            _param_spec: glib::ffi::gpointer,
8300            f: glib::ffi::gpointer,
8301        ) {
8302            unsafe {
8303                let f: &F = &*(f as *const F);
8304                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
8305            }
8306        }
8307        unsafe {
8308            let f: Box_<F> = Box_::new(f);
8309            connect_raw(
8310                self.as_ptr() as *mut _,
8311                c"notify::opacity".as_ptr(),
8312                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
8313                    notify_opacity_trampoline::<Self, F> as *const (),
8314                )),
8315                Box_::into_raw(f),
8316            )
8317        }
8318    }
8319
8320    #[doc(alias = "parent")]
8321    fn connect_parent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
8322        unsafe extern "C" fn notify_parent_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
8323            this: *mut ffi::GtkWidget,
8324            _param_spec: glib::ffi::gpointer,
8325            f: glib::ffi::gpointer,
8326        ) {
8327            unsafe {
8328                let f: &F = &*(f as *const F);
8329                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
8330            }
8331        }
8332        unsafe {
8333            let f: Box_<F> = Box_::new(f);
8334            connect_raw(
8335                self.as_ptr() as *mut _,
8336                c"notify::parent".as_ptr(),
8337                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
8338                    notify_parent_trampoline::<Self, F> as *const (),
8339                )),
8340                Box_::into_raw(f),
8341            )
8342        }
8343    }
8344
8345    #[doc(alias = "receives-default")]
8346    fn connect_receives_default_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
8347        unsafe extern "C" fn notify_receives_default_trampoline<
8348            P: IsA<Widget>,
8349            F: Fn(&P) + 'static,
8350        >(
8351            this: *mut ffi::GtkWidget,
8352            _param_spec: glib::ffi::gpointer,
8353            f: glib::ffi::gpointer,
8354        ) {
8355            unsafe {
8356                let f: &F = &*(f as *const F);
8357                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
8358            }
8359        }
8360        unsafe {
8361            let f: Box_<F> = Box_::new(f);
8362            connect_raw(
8363                self.as_ptr() as *mut _,
8364                c"notify::receives-default".as_ptr(),
8365                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
8366                    notify_receives_default_trampoline::<Self, F> as *const (),
8367                )),
8368                Box_::into_raw(f),
8369            )
8370        }
8371    }
8372
8373    #[doc(alias = "scale-factor")]
8374    fn connect_scale_factor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
8375        unsafe extern "C" fn notify_scale_factor_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
8376            this: *mut ffi::GtkWidget,
8377            _param_spec: glib::ffi::gpointer,
8378            f: glib::ffi::gpointer,
8379        ) {
8380            unsafe {
8381                let f: &F = &*(f as *const F);
8382                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
8383            }
8384        }
8385        unsafe {
8386            let f: Box_<F> = Box_::new(f);
8387            connect_raw(
8388                self.as_ptr() as *mut _,
8389                c"notify::scale-factor".as_ptr(),
8390                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
8391                    notify_scale_factor_trampoline::<Self, F> as *const (),
8392                )),
8393                Box_::into_raw(f),
8394            )
8395        }
8396    }
8397
8398    #[doc(alias = "sensitive")]
8399    fn connect_sensitive_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
8400        unsafe extern "C" fn notify_sensitive_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
8401            this: *mut ffi::GtkWidget,
8402            _param_spec: glib::ffi::gpointer,
8403            f: glib::ffi::gpointer,
8404        ) {
8405            unsafe {
8406                let f: &F = &*(f as *const F);
8407                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
8408            }
8409        }
8410        unsafe {
8411            let f: Box_<F> = Box_::new(f);
8412            connect_raw(
8413                self.as_ptr() as *mut _,
8414                c"notify::sensitive".as_ptr(),
8415                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
8416                    notify_sensitive_trampoline::<Self, F> as *const (),
8417                )),
8418                Box_::into_raw(f),
8419            )
8420        }
8421    }
8422
8423    #[doc(alias = "tooltip-markup")]
8424    fn connect_tooltip_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
8425        unsafe extern "C" fn notify_tooltip_markup_trampoline<
8426            P: IsA<Widget>,
8427            F: Fn(&P) + 'static,
8428        >(
8429            this: *mut ffi::GtkWidget,
8430            _param_spec: glib::ffi::gpointer,
8431            f: glib::ffi::gpointer,
8432        ) {
8433            unsafe {
8434                let f: &F = &*(f as *const F);
8435                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
8436            }
8437        }
8438        unsafe {
8439            let f: Box_<F> = Box_::new(f);
8440            connect_raw(
8441                self.as_ptr() as *mut _,
8442                c"notify::tooltip-markup".as_ptr(),
8443                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
8444                    notify_tooltip_markup_trampoline::<Self, F> as *const (),
8445                )),
8446                Box_::into_raw(f),
8447            )
8448        }
8449    }
8450
8451    #[doc(alias = "tooltip-text")]
8452    fn connect_tooltip_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
8453        unsafe extern "C" fn notify_tooltip_text_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
8454            this: *mut ffi::GtkWidget,
8455            _param_spec: glib::ffi::gpointer,
8456            f: glib::ffi::gpointer,
8457        ) {
8458            unsafe {
8459                let f: &F = &*(f as *const F);
8460                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
8461            }
8462        }
8463        unsafe {
8464            let f: Box_<F> = Box_::new(f);
8465            connect_raw(
8466                self.as_ptr() as *mut _,
8467                c"notify::tooltip-text".as_ptr(),
8468                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
8469                    notify_tooltip_text_trampoline::<Self, F> as *const (),
8470                )),
8471                Box_::into_raw(f),
8472            )
8473        }
8474    }
8475
8476    #[doc(alias = "valign")]
8477    fn connect_valign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
8478        unsafe extern "C" fn notify_valign_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
8479            this: *mut ffi::GtkWidget,
8480            _param_spec: glib::ffi::gpointer,
8481            f: glib::ffi::gpointer,
8482        ) {
8483            unsafe {
8484                let f: &F = &*(f as *const F);
8485                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
8486            }
8487        }
8488        unsafe {
8489            let f: Box_<F> = Box_::new(f);
8490            connect_raw(
8491                self.as_ptr() as *mut _,
8492                c"notify::valign".as_ptr(),
8493                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
8494                    notify_valign_trampoline::<Self, F> as *const (),
8495                )),
8496                Box_::into_raw(f),
8497            )
8498        }
8499    }
8500
8501    #[doc(alias = "vexpand")]
8502    fn connect_vexpand_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
8503        unsafe extern "C" fn notify_vexpand_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
8504            this: *mut ffi::GtkWidget,
8505            _param_spec: glib::ffi::gpointer,
8506            f: glib::ffi::gpointer,
8507        ) {
8508            unsafe {
8509                let f: &F = &*(f as *const F);
8510                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
8511            }
8512        }
8513        unsafe {
8514            let f: Box_<F> = Box_::new(f);
8515            connect_raw(
8516                self.as_ptr() as *mut _,
8517                c"notify::vexpand".as_ptr(),
8518                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
8519                    notify_vexpand_trampoline::<Self, F> as *const (),
8520                )),
8521                Box_::into_raw(f),
8522            )
8523        }
8524    }
8525
8526    #[doc(alias = "vexpand-set")]
8527    fn connect_vexpand_set_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
8528        unsafe extern "C" fn notify_vexpand_set_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
8529            this: *mut ffi::GtkWidget,
8530            _param_spec: glib::ffi::gpointer,
8531            f: glib::ffi::gpointer,
8532        ) {
8533            unsafe {
8534                let f: &F = &*(f as *const F);
8535                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
8536            }
8537        }
8538        unsafe {
8539            let f: Box_<F> = Box_::new(f);
8540            connect_raw(
8541                self.as_ptr() as *mut _,
8542                c"notify::vexpand-set".as_ptr(),
8543                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
8544                    notify_vexpand_set_trampoline::<Self, F> as *const (),
8545                )),
8546                Box_::into_raw(f),
8547            )
8548        }
8549    }
8550
8551    #[doc(alias = "visible")]
8552    fn connect_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
8553        unsafe extern "C" fn notify_visible_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
8554            this: *mut ffi::GtkWidget,
8555            _param_spec: glib::ffi::gpointer,
8556            f: glib::ffi::gpointer,
8557        ) {
8558            unsafe {
8559                let f: &F = &*(f as *const F);
8560                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
8561            }
8562        }
8563        unsafe {
8564            let f: Box_<F> = Box_::new(f);
8565            connect_raw(
8566                self.as_ptr() as *mut _,
8567                c"notify::visible".as_ptr(),
8568                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
8569                    notify_visible_trampoline::<Self, F> as *const (),
8570                )),
8571                Box_::into_raw(f),
8572            )
8573        }
8574    }
8575
8576    #[doc(alias = "width-request")]
8577    fn connect_width_request_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
8578        unsafe extern "C" fn notify_width_request_trampoline<
8579            P: IsA<Widget>,
8580            F: Fn(&P) + 'static,
8581        >(
8582            this: *mut ffi::GtkWidget,
8583            _param_spec: glib::ffi::gpointer,
8584            f: glib::ffi::gpointer,
8585        ) {
8586            unsafe {
8587                let f: &F = &*(f as *const F);
8588                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
8589            }
8590        }
8591        unsafe {
8592            let f: Box_<F> = Box_::new(f);
8593            connect_raw(
8594                self.as_ptr() as *mut _,
8595                c"notify::width-request".as_ptr(),
8596                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
8597                    notify_width_request_trampoline::<Self, F> as *const (),
8598                )),
8599                Box_::into_raw(f),
8600            )
8601        }
8602    }
8603
8604    #[doc(alias = "window")]
8605    fn connect_window_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
8606        unsafe extern "C" fn notify_window_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
8607            this: *mut ffi::GtkWidget,
8608            _param_spec: glib::ffi::gpointer,
8609            f: glib::ffi::gpointer,
8610        ) {
8611            unsafe {
8612                let f: &F = &*(f as *const F);
8613                f(Widget::from_glib_borrow(this).unsafe_cast_ref())
8614            }
8615        }
8616        unsafe {
8617            let f: Box_<F> = Box_::new(f);
8618            connect_raw(
8619                self.as_ptr() as *mut _,
8620                c"notify::window".as_ptr(),
8621                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
8622                    notify_window_trampoline::<Self, F> as *const (),
8623                )),
8624                Box_::into_raw(f),
8625            )
8626        }
8627    }
8628}
8629
8630impl<O: IsA<Widget>> WidgetExt for O {}