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