gtk4/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#![allow(deprecated)]
5
6use crate::{
7    ffi, Accessible, Align, Allocation, Buildable, ConstraintTarget, DirectionType,
8    EventController, LayoutManager, Native, Orientation, Overflow, PickFlags, Requisition, Root,
9    Settings, SizeRequestMode, Snapshot, StateFlags, StyleContext, TextDirection, Tooltip,
10};
11use glib::{
12    object::ObjectType as _,
13    prelude::*,
14    signal::{connect_raw, SignalHandlerId},
15    translate::*,
16};
17use std::boxed::Box as Box_;
18
19glib::wrapper! {
20    /// The base class for all widgets.
21    ///
22    /// It manages the widget lifecycle, layout, states and style.
23    ///
24    /// ### Height-for-width Geometry Management
25    ///
26    /// GTK uses a height-for-width (and width-for-height) geometry management
27    /// system. Height-for-width means that a widget can change how much
28    /// vertical space it needs, depending on the amount of horizontal space
29    /// that it is given (and similar for width-for-height). The most common
30    /// example is a label that reflows to fill up the available width, wraps
31    /// to fewer lines, and therefore needs less height.
32    ///
33    /// Height-for-width geometry management is implemented in GTK by way
34    /// of two virtual methods:
35    ///
36    /// - [`WidgetImpl::request_mode()`][crate::subclass::prelude::WidgetImpl::request_mode()]
37    /// - [`WidgetImpl::measure()`][crate::subclass::prelude::WidgetImpl::measure()]
38    ///
39    /// There are some important things to keep in mind when implementing
40    /// height-for-width and when using it in widget implementations.
41    ///
42    /// If you implement a direct [`Widget`][crate::Widget] subclass that supports
43    /// height-for-width or width-for-height geometry management for itself
44    /// or its child widgets, the [`WidgetImpl::request_mode()`][crate::subclass::prelude::WidgetImpl::request_mode()] virtual
45    /// function must be implemented as well and return the widget's preferred
46    /// request mode. The default implementation of this virtual function
47    /// returns [`SizeRequestMode::ConstantSize`][crate::SizeRequestMode::ConstantSize], which means that the widget will
48    /// only ever get -1 passed as the for_size value to its
49    /// [`WidgetImpl::measure()`][crate::subclass::prelude::WidgetImpl::measure()] implementation.
50    ///
51    /// The geometry management system will query a widget hierarchy in
52    /// only one orientation at a time. When widgets are initially queried
53    /// for their minimum sizes it is generally done in two initial passes
54    /// in the [`SizeRequestMode`][crate::SizeRequestMode] chosen by the toplevel.
55    ///
56    /// For example, when queried in the normal [`SizeRequestMode::HeightForWidth`][crate::SizeRequestMode::HeightForWidth] mode:
57    ///
58    /// First, the default minimum and natural width for each widget
59    /// in the interface will be computed using [`WidgetExt::measure()`][crate::prelude::WidgetExt::measure()] with an
60    /// orientation of [`Orientation::Horizontal`][crate::Orientation::Horizontal] and a for_size of -1.
61    /// Because the preferred widths for each widget depend on the preferred
62    /// widths of their children, this information propagates up the hierarchy,
63    /// and finally a minimum and natural width is determined for the entire
64    /// toplevel. Next, the toplevel will use the minimum width to query for the
65    /// minimum height contextual to that width using [`WidgetExt::measure()`][crate::prelude::WidgetExt::measure()] with an
66    /// orientation of [`Orientation::Vertical`][crate::Orientation::Vertical] and a for_size of the just computed
67    /// width. This will also be a highly recursive operation. The minimum height
68    /// for the minimum width is normally used to set the minimum size constraint
69    /// on the toplevel.
70    ///
71    /// After the toplevel window has initially requested its size in both
72    /// dimensions it can go on to allocate itself a reasonable size (or a size
73    /// previously specified with [`GtkWindowExt::set_default_size()`][crate::prelude::GtkWindowExt::set_default_size()]). During the
74    /// recursive allocation process it’s important to note that request cycles
75    /// will be recursively executed while widgets allocate their children.
76    /// Each widget, once allocated a size, will go on to first share the
77    /// space in one orientation among its children and then request each child's
78    /// height for its target allocated width or its width for allocated height,
79    /// depending. In this way a widget will typically be requested its size
80    /// a number of times before actually being allocated a size. The size a
81    /// widget is finally allocated can of course differ from the size it has
82    /// requested. For this reason, [`Widget`][crate::Widget] caches a  small number of results
83    /// to avoid re-querying for the same sizes in one allocation cycle.
84    ///
85    /// If a widget does move content around to intelligently use up the
86    /// allocated size then it must support the request in both
87    /// [`SizeRequestMode`][crate::SizeRequestMode]s even if the widget in question only
88    /// trades sizes in a single orientation.
89    ///
90    /// For instance, a [`Label`][crate::Label] that does height-for-width word wrapping
91    /// will not expect to have [`WidgetImpl::measure()`][crate::subclass::prelude::WidgetImpl::measure()] with an orientation of
92    /// [`Orientation::Vertical`][crate::Orientation::Vertical] called because that call is specific to a
93    /// width-for-height request. In this case the label must return the height
94    /// required for its own minimum possible width. By following this rule any
95    /// widget that handles height-for-width or width-for-height requests will
96    /// always be allocated at least enough space to fit its own content.
97    ///
98    /// Here are some examples of how a [`SizeRequestMode::HeightForWidth`][crate::SizeRequestMode::HeightForWidth] widget
99    /// generally deals with width-for-height requests:
100    ///
101    /// **⚠️ The following code is in c ⚠️**
102    ///
103    /// ```c
104    /// static void
105    /// foo_widget_measure (GtkWidget      *widget,
106    ///                     GtkOrientation  orientation,
107    ///                     int             for_size,
108    ///                     int            *minimum_size,
109    ///                     int            *natural_size,
110    ///                     int            *minimum_baseline,
111    ///                     int            *natural_baseline)
112    /// {
113    ///   if (orientation == GTK_ORIENTATION_HORIZONTAL)
114    ///     {
115    ///       // Calculate minimum and natural width
116    ///     }
117    ///   else // VERTICAL
118    ///     {
119    ///       if (i_am_in_height_for_width_mode)
120    ///         {
121    ///           int min_width, dummy;
122    ///
123    ///           // First, get the minimum width of our widget
124    ///           GTK_WIDGET_GET_CLASS (widget)->measure (widget, GTK_ORIENTATION_HORIZONTAL, -1,
125    ///                                                   &min_width, &dummy, &dummy, &dummy);
126    ///
127    ///           // Now use the minimum width to retrieve the minimum and natural height to display
128    ///           // that width.
129    ///           GTK_WIDGET_GET_CLASS (widget)->measure (widget, GTK_ORIENTATION_VERTICAL, min_width,
130    ///                                                   minimum_size, natural_size, &dummy, &dummy);
131    ///         }
132    ///       else
133    ///         {
134    ///           // ... some widgets do both.
135    ///         }
136    ///     }
137    /// }
138    /// ```
139    ///
140    /// Often a widget needs to get its own request during size request or
141    /// allocation. For example, when computing height it may need to also
142    /// compute width. Or when deciding how to use an allocation, the widget
143    /// may need to know its natural size. In these cases, the widget should
144    /// be careful to call its virtual methods directly, like in the code
145    /// example above.
146    ///
147    /// It will not work to use the wrapper function [`WidgetExt::measure()`][crate::prelude::WidgetExt::measure()]
148    /// inside your own [`WidgetImpl::size_allocate()`][crate::subclass::prelude::WidgetImpl::size_allocate()] implementation.
149    /// These return a request adjusted by [`SizeGroup`][crate::SizeGroup], the widget's
150    /// align and expand flags, as well as its CSS style.
151    ///
152    /// If a widget used the wrappers inside its virtual method implementations,
153    /// then the adjustments (such as widget margins) would be applied
154    /// twice. GTK therefore does not allow this and will warn if you try
155    /// to do it.
156    ///
157    /// Of course if you are getting the size request for another widget, such
158    /// as a child widget, you must use [`WidgetExt::measure()`][crate::prelude::WidgetExt::measure()]; otherwise, you
159    /// would not properly consider widget margins, [`SizeGroup`][crate::SizeGroup], and
160    /// so forth.
161    ///
162    /// GTK also supports baseline vertical alignment of widgets. This
163    /// means that widgets are positioned such that the typographical baseline of
164    /// widgets in the same row are aligned. This happens if a widget supports
165    /// baselines, has a vertical alignment using baselines, and is inside
166    /// a widget that supports baselines and has a natural “row” that it aligns to
167    /// the baseline, or a baseline assigned to it by the grandparent.
168    ///
169    /// Baseline alignment support for a widget is also done by the
170    /// [`WidgetImpl::measure()`][crate::subclass::prelude::WidgetImpl::measure()] virtual function. It allows you to report
171    /// both a minimum and natural size.
172    ///
173    /// If a widget ends up baseline aligned it will be allocated all the space in
174    /// the parent as if it was [`Align::Fill`][crate::Align::Fill], but the selected baseline can be
175    /// found via [`WidgetExt::baseline()`][crate::prelude::WidgetExt::baseline()]. If the baseline has a
176    /// value other than -1 you need to align the widget such that the baseline
177    /// appears at the position.
178    ///
179    /// ### GtkWidget as GtkBuildable
180    ///
181    /// The [`Widget`][crate::Widget] implementation of the [`Buildable`][crate::Buildable] interface
182    /// supports various custom elements to specify additional aspects of widgets
183    /// that are not directly expressed as properties.
184    ///
185    /// If the widget uses a [`LayoutManager`][crate::LayoutManager], [`Widget`][crate::Widget] supports
186    /// a custom `<layout>` element, used to define layout properties:
187    ///
188    /// ```xml
189    /// <object class="GtkGrid" id="my_grid">
190    ///   <child>
191    ///     <object class="GtkLabel" id="label1">
192    ///       <property name="label">Description</property>
193    ///       <layout>
194    ///         <property name="column">0</property>
195    ///         <property name="row">0</property>
196    ///         <property name="row-span">1</property>
197    ///         <property name="column-span">1</property>
198    ///       </layout>
199    ///     </object>
200    ///   </child>
201    ///   <child>
202    ///     <object class="GtkEntry" id="description_entry">
203    ///       <layout>
204    ///         <property name="column">1</property>
205    ///         <property name="row">0</property>
206    ///         <property name="row-span">1</property>
207    ///         <property name="column-span">1</property>
208    ///       </layout>
209    ///     </object>
210    ///   </child>
211    /// </object>
212    /// ```
213    ///
214    /// [`Widget`][crate::Widget] allows style information such as style classes to
215    /// be associated with widgets, using the custom `<style>` element:
216    ///
217    /// ```xml
218    /// <object class="GtkButton" id="button1">
219    ///   <style>
220    ///     <class name="my-special-button-class"/>
221    ///     <class name="dark-button"/>
222    ///   </style>
223    /// </object>
224    /// ```
225    ///
226    /// [`Widget`][crate::Widget] allows defining accessibility information, such as properties,
227    /// relations, and states, using the custom `<accessibility>` element:
228    ///
229    /// ```xml
230    /// <object class="GtkButton" id="button1">
231    ///   <accessibility>
232    ///     <property name="label">Download</property>
233    ///     <relation name="labelled-by">label1</relation>
234    ///   </accessibility>
235    /// </object>
236    /// ```
237    ///
238    /// ### Building composite widgets from template XML
239    ///
240    /// `GtkWidget `exposes some facilities to automate the procedure
241    /// of creating composite widgets using "templates".
242    ///
243    /// To create composite widgets with [`Builder`][crate::Builder] XML, one must associate
244    /// the interface description with the widget class at class initialization
245    /// time using [`WidgetClassExt::set_template()`][crate::subclass::prelude::WidgetClassExt::set_template()].
246    ///
247    /// The interface description semantics expected in composite template descriptions
248    /// is slightly different from regular [`Builder`][crate::Builder] XML.
249    ///
250    /// Unlike regular interface descriptions, [`WidgetClassExt::set_template()`][crate::subclass::prelude::WidgetClassExt::set_template()]
251    /// will expect a `<template>` tag as a direct child of the toplevel
252    /// `<interface>` tag. The `<template>` tag must specify the “class” attribute
253    /// which must be the type name of the widget. Optionally, the “parent”
254    /// attribute may be specified to specify the direct parent type of the widget
255    /// type; this is ignored by [`Builder`][crate::Builder] but can be used by UI design tools to
256    /// introspect what kind of properties and internal children exist for a given
257    /// type when the actual type does not exist.
258    ///
259    /// The XML which is contained inside the `<template>` tag behaves as if it were
260    /// added to the `<object>` tag defining the widget itself. You may set properties
261    /// on a widget by inserting `<property>` tags into the `<template>` tag, and also
262    /// add `<child>` tags to add children and extend a widget in the normal way you
263    /// would with `<object>` tags.
264    ///
265    /// Additionally, `<object>` tags can also be added before and after the initial
266    /// `<template>` tag in the normal way, allowing one to define auxiliary objects
267    /// which might be referenced by other widgets declared as children of the
268    /// `<template>` tag.
269    ///
270    /// Since, unlike the `<object>` tag, the `<template>` tag does not contain an
271    /// “id” attribute, if you need to refer to the instance of the object itself that
272    /// the template will create, simply refer to the template class name in an
273    /// applicable element content.
274    ///
275    /// Here is an example of a template definition, which includes an example of
276    /// this in the `<signal>` tag:
277    ///
278    /// ```xml
279    /// <interface>
280    ///   <template class="FooWidget" parent="GtkBox">
281    ///     <property name="orientation">horizontal</property>
282    ///     <property name="spacing">4</property>
283    ///     <child>
284    ///       <object class="GtkButton" id="hello_button">
285    ///         <property name="label">Hello World</property>
286    ///         <signal name="clicked" handler="hello_button_clicked" object="FooWidget" swapped="yes"/>
287    ///       </object>
288    ///     </child>
289    ///     <child>
290    ///       <object class="GtkButton" id="goodbye_button">
291    ///         <property name="label">Goodbye World</property>
292    ///       </object>
293    ///     </child>
294    ///   </template>
295    /// </interface>
296    /// ```
297    ///
298    /// Typically, you'll place the template fragment into a file that is
299    /// bundled with your project, using `GResource`. In order to load the
300    /// template, you need to call [`WidgetClassExt::set_template_from_resource()`][crate::subclass::prelude::WidgetClassExt::set_template_from_resource()]
301    /// from the class initialization of your [`Widget`][crate::Widget] type:
302    ///
303    /// **⚠️ The following code is in c ⚠️**
304    ///
305    /// ```c
306    /// static void
307    /// foo_widget_class_init (FooWidgetClass *klass)
308    /// {
309    ///   // ...
310    ///
311    ///   gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass),
312    ///                                                "/com/example/ui/foowidget.ui");
313    /// }
314    /// ```
315    ///
316    /// You will also need to call `Gtk::Widget::init_template()` from the
317    /// instance initialization function:
318    ///
319    /// **⚠️ The following code is in c ⚠️**
320    ///
321    /// ```c
322    /// static void
323    /// foo_widget_init (FooWidget *self)
324    /// {
325    ///   gtk_widget_init_template (GTK_WIDGET (self));
326    ///
327    ///   // Initialize the rest of the widget...
328    /// }
329    /// ```
330    ///
331    /// as well as calling `Gtk::Widget::dispose_template()` from the dispose
332    /// function:
333    ///
334    /// **⚠️ The following code is in c ⚠️**
335    ///
336    /// ```c
337    /// static void
338    /// foo_widget_dispose (GObject *gobject)
339    /// {
340    ///   FooWidget *self = FOO_WIDGET (gobject);
341    ///
342    ///   // Dispose objects for which you have a reference...
343    ///
344    ///   // Clear the template children for this widget type
345    ///   gtk_widget_dispose_template (GTK_WIDGET (self), FOO_TYPE_WIDGET);
346    ///
347    ///   G_OBJECT_CLASS (foo_widget_parent_class)->dispose (gobject);
348    /// }
349    /// ```
350    ///
351    /// You can access widgets defined in the template using the
352    /// `Gtk::Widget::get_template_child()` function, but you will typically declare
353    /// a pointer in the instance private data structure of your type using the same
354    /// name as the widget in the template definition, and call
355    /// [`WidgetClassExt::bind_template_child_full()`][crate::subclass::prelude::WidgetClassExt::bind_template_child_full()] (or one of its wrapper macros
356    /// `widget_class_bind_template_child()` and `widget_class_bind_template_child_private()`)
357    /// with that name, e.g.
358    ///
359    /// **⚠️ The following code is in c ⚠️**
360    ///
361    /// ```c
362    /// typedef struct {
363    ///   GtkWidget *hello_button;
364    ///   GtkWidget *goodbye_button;
365    /// } FooWidgetPrivate;
366    ///
367    /// G_DEFINE_TYPE_WITH_PRIVATE (FooWidget, foo_widget, GTK_TYPE_BOX)
368    ///
369    /// static void
370    /// foo_widget_dispose (GObject *gobject)
371    /// {
372    ///   gtk_widget_dispose_template (GTK_WIDGET (gobject), FOO_TYPE_WIDGET);
373    ///
374    ///   G_OBJECT_CLASS (foo_widget_parent_class)->dispose (gobject);
375    /// }
376    ///
377    /// static void
378    /// foo_widget_class_init (FooWidgetClass *klass)
379    /// {
380    ///   // ...
381    ///   G_OBJECT_CLASS (klass)->dispose = foo_widget_dispose;
382    ///
383    ///   gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass),
384    ///                                                "/com/example/ui/foowidget.ui");
385    ///   gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass),
386    ///                                                 FooWidget, hello_button);
387    ///   gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass),
388    ///                                                 FooWidget, goodbye_button);
389    /// }
390    ///
391    /// static void
392    /// foo_widget_init (FooWidget *widget)
393    /// {
394    ///   gtk_widget_init_template (GTK_WIDGET (widget));
395    /// }
396    /// ```
397    ///
398    /// You can also use [`WidgetClassExt::bind_template_callback_full()`][crate::subclass::prelude::WidgetClassExt::bind_template_callback_full()] (or
399    /// is wrapper macro `widget_class_bind_template_callback()`) to connect
400    /// a signal callback defined in the template with a function visible in the
401    /// scope of the class, e.g.
402    ///
403    /// **⚠️ The following code is in c ⚠️**
404    ///
405    /// ```c
406    /// // the signal handler has the instance and user data swapped
407    /// // because of the swapped="yes" attribute in the template XML
408    /// static void
409    /// hello_button_clicked (FooWidget *self,
410    ///                       GtkButton *button)
411    /// {
412    ///   g_print ("Hello, world!\n");
413    /// }
414    ///
415    /// static void
416    /// foo_widget_class_init (FooWidgetClass *klass)
417    /// {
418    ///   // ...
419    ///   gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass),
420    ///                                                "/com/example/ui/foowidget.ui");
421    ///   gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (klass), hello_button_clicked);
422    /// }
423    /// ```
424    ///
425    /// This is an Abstract Base Class, you cannot instantiate it.
426    ///
427    /// ## Properties
428    ///
429    ///
430    /// #### `can-focus`
431    ///  Whether the widget or any of its descendents can accept
432    /// the input focus.
433    ///
434    /// This property is meant to be set by widget implementations,
435    /// typically in their instance init function.
436    ///
437    /// Readable | Writeable
438    ///
439    ///
440    /// #### `can-target`
441    ///  Whether the widget can receive pointer events.
442    ///
443    /// Readable | Writeable
444    ///
445    ///
446    /// #### `css-classes`
447    ///  A list of css classes applied to this widget.
448    ///
449    /// Readable | Writeable
450    ///
451    ///
452    /// #### `css-name`
453    ///  The name of this widget in the CSS tree.
454    ///
455    /// This property is meant to be set by widget implementations,
456    /// typically in their instance init function.
457    ///
458    /// Readable | Writeable | Construct Only
459    ///
460    ///
461    /// #### `cursor`
462    ///  The cursor used by @widget.
463    ///
464    /// Readable | Writeable
465    ///
466    ///
467    /// #### `focus-on-click`
468    ///  Whether the widget should grab focus when it is clicked with the mouse.
469    ///
470    /// This property is only relevant for widgets that can take focus.
471    ///
472    /// Readable | Writeable
473    ///
474    ///
475    /// #### `focusable`
476    ///  Whether this widget itself will accept the input focus.
477    ///
478    /// Readable | Writeable
479    ///
480    ///
481    /// #### `halign`
482    ///  How to distribute horizontal space if widget gets extra space.
483    ///
484    /// Readable | Writeable
485    ///
486    ///
487    /// #### `has-default`
488    ///  Whether the widget is the default widget.
489    ///
490    /// Readable
491    ///
492    ///
493    /// #### `has-focus`
494    ///  Whether the widget has the input focus.
495    ///
496    /// Readable
497    ///
498    ///
499    /// #### `has-tooltip`
500    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
501    /// signal on @widget.
502    ///
503    /// A true value indicates that @widget can have a tooltip, in this case
504    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
505    /// determine whether it will provide a tooltip or not.
506    ///
507    /// Readable | Writeable
508    ///
509    ///
510    /// #### `height-request`
511    ///  Overrides for height request of the widget.
512    ///
513    /// If this is -1, the natural request will be used.
514    ///
515    /// Readable | Writeable
516    ///
517    ///
518    /// #### `hexpand`
519    ///  Whether to expand horizontally.
520    ///
521    /// Readable | Writeable
522    ///
523    ///
524    /// #### `hexpand-set`
525    ///  Whether to use the `hexpand` property.
526    ///
527    /// Readable | Writeable
528    ///
529    ///
530    /// #### `layout-manager`
531    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
532    /// the preferred size of the widget, and allocate its children.
533    ///
534    /// This property is meant to be set by widget implementations,
535    /// typically in their instance init function.
536    ///
537    /// Readable | Writeable
538    ///
539    ///
540    /// #### `limit-events`
541    ///  Makes this widget act like a modal dialog, with respect to
542    /// event delivery.
543    ///
544    /// Global event controllers will not handle events with targets
545    /// inside the widget, unless they are set up to ignore propagation
546    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
547    ///
548    /// Readable | Writeable
549    ///
550    ///
551    /// #### `margin-bottom`
552    ///  Margin on bottom side of widget.
553    ///
554    /// This property adds margin outside of the widget's normal size
555    /// request, the margin will be added in addition to the size from
556    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
557    ///
558    /// Readable | Writeable
559    ///
560    ///
561    /// #### `margin-end`
562    ///  Margin on end of widget, horizontally.
563    ///
564    /// This property supports left-to-right and right-to-left text
565    /// directions.
566    ///
567    /// This property adds margin outside of the widget's normal size
568    /// request, the margin will be added in addition to the size from
569    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
570    ///
571    /// Readable | Writeable
572    ///
573    ///
574    /// #### `margin-start`
575    ///  Margin on start of widget, horizontally.
576    ///
577    /// This property supports left-to-right and right-to-left text
578    /// directions.
579    ///
580    /// This property adds margin outside of the widget's normal size
581    /// request, the margin will be added in addition to the size from
582    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
583    ///
584    /// Readable | Writeable
585    ///
586    ///
587    /// #### `margin-top`
588    ///  Margin on top side of widget.
589    ///
590    /// This property adds margin outside of the widget's normal size
591    /// request, the margin will be added in addition to the size from
592    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
593    ///
594    /// Readable | Writeable
595    ///
596    ///
597    /// #### `name`
598    ///  The name of the widget.
599    ///
600    /// Readable | Writeable
601    ///
602    ///
603    /// #### `opacity`
604    ///  The requested opacity of the widget.
605    ///
606    /// Readable | Writeable
607    ///
608    ///
609    /// #### `overflow`
610    ///  How content outside the widget's content area is treated.
611    ///
612    /// This property is meant to be set by widget implementations,
613    /// typically in their instance init function.
614    ///
615    /// Readable | Writeable
616    ///
617    ///
618    /// #### `parent`
619    ///  The parent widget of this widget.
620    ///
621    /// Readable
622    ///
623    ///
624    /// #### `receives-default`
625    ///  Whether the widget will receive the default action when it is focused.
626    ///
627    /// Readable | Writeable
628    ///
629    ///
630    /// #### `root`
631    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
632    ///
633    /// This will be `NULL` if the widget is not contained in a root widget.
634    ///
635    /// Readable
636    ///
637    ///
638    /// #### `scale-factor`
639    ///  The scale factor of the widget.
640    ///
641    /// Readable
642    ///
643    ///
644    /// #### `sensitive`
645    ///  Whether the widget responds to input.
646    ///
647    /// Readable | Writeable
648    ///
649    ///
650    /// #### `tooltip-markup`
651    ///  Sets the text of tooltip to be the given string, which is marked up
652    /// with Pango markup.
653    ///
654    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
655    ///
656    /// This is a convenience property which will take care of getting the
657    /// tooltip shown if the given string is not `NULL`:
658    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
659    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
660    /// the default signal handler.
661    ///
662    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
663    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
664    ///
665    /// Readable | Writeable
666    ///
667    ///
668    /// #### `tooltip-text`
669    ///  Sets the text of tooltip to be the given string.
670    ///
671    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
672    ///
673    /// This is a convenience property which will take care of getting the
674    /// tooltip shown if the given string is not `NULL`:
675    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
676    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
677    /// the default signal handler.
678    ///
679    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
680    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
681    ///
682    /// Readable | Writeable
683    ///
684    ///
685    /// #### `valign`
686    ///  How to distribute vertical space if widget gets extra space.
687    ///
688    /// Readable | Writeable
689    ///
690    ///
691    /// #### `vexpand`
692    ///  Whether to expand vertically.
693    ///
694    /// Readable | Writeable
695    ///
696    ///
697    /// #### `vexpand-set`
698    ///  Whether to use the `vexpand` property.
699    ///
700    /// Readable | Writeable
701    ///
702    ///
703    /// #### `visible`
704    ///  Whether the widget is visible.
705    ///
706    /// Readable | Writeable
707    ///
708    ///
709    /// #### `width-request`
710    ///  Overrides for width request of the widget.
711    ///
712    /// If this is -1, the natural request will be used.
713    ///
714    /// Readable | Writeable
715    /// <details><summary><h4>Accessible</h4></summary>
716    ///
717    ///
718    /// #### `accessible-role`
719    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
720    ///
721    /// The accessible role cannot be changed once set.
722    ///
723    /// Readable | Writeable
724    /// </details>
725    ///
726    /// ## Signals
727    ///
728    ///
729    /// #### `destroy`
730    ///  Signals that all holders of a reference to the widget should release
731    /// the reference that they hold.
732    ///
733    /// May result in finalization of the widget if all references are released.
734    ///
735    /// This signal is not suitable for saving widget state.
736    ///
737    ///
738    ///
739    ///
740    /// #### `direction-changed`
741    ///  Emitted when the text direction of a widget changes.
742    ///
743    ///
744    ///
745    ///
746    /// #### `hide`
747    ///  Emitted when @widget is hidden.
748    ///
749    ///
750    ///
751    ///
752    /// #### `keynav-failed`
753    ///  Emitted if keyboard navigation fails.
754    ///
755    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
756    ///
757    ///
758    ///
759    ///
760    /// #### `map`
761    ///  Emitted when @widget is going to be mapped.
762    ///
763    /// A widget is mapped when the widget is visible (which is controlled with
764    /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
765    /// are also visible.
766    ///
767    /// The `::map` signal can be used to determine whether a widget will be drawn,
768    /// for instance it can resume an animation that was stopped during the
769    /// emission of [`unmap`][struct@crate::Widget#unmap].
770    ///
771    ///
772    ///
773    ///
774    /// #### `mnemonic-activate`
775    ///  Emitted when a widget is activated via a mnemonic.
776    ///
777    /// The default handler for this signal activates @widget if @group_cycling
778    /// is false, or just makes @widget grab focus if @group_cycling is true.
779    ///
780    ///
781    ///
782    ///
783    /// #### `move-focus`
784    ///  Emitted when the focus is moved.
785    ///
786    /// The `::move-focus` signal is a [keybinding signal](class.SignalAction.html).
787    ///
788    /// The default bindings for this signal are <kbd>Tab</kbd> to move forward,
789    /// and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move backward.
790    ///
791    /// Action
792    ///
793    ///
794    /// #### `query-tooltip`
795    ///  Emitted when the widget’s tooltip is about to be shown.
796    ///
797    /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
798    /// is true and the hover timeout has expired with the cursor hovering
799    /// above @widget; or emitted when @widget got focus in keyboard mode.
800    ///
801    /// Using the given coordinates, the signal handler should determine
802    /// whether a tooltip should be shown for @widget. If this is the case
803    /// true should be returned, false otherwise. Note that if @keyboard_mode
804    /// is true, the values of @x and @y are undefined and should not be used.
805    ///
806    /// The signal handler is free to manipulate @tooltip with the therefore
807    /// destined function calls.
808    ///
809    ///
810    ///
811    ///
812    /// #### `realize`
813    ///  Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
814    ///
815    /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
816    /// or the widget has been mapped (that is, it is going to be drawn).
817    ///
818    ///
819    ///
820    ///
821    /// #### `show`
822    ///  Emitted when @widget is shown.
823    ///
824    ///
825    ///
826    ///
827    /// #### `state-flags-changed`
828    ///  Emitted when the widget state changes.
829    ///
830    /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
831    ///
832    ///
833    ///
834    ///
835    /// #### `unmap`
836    ///  Emitted when @widget is going to be unmapped.
837    ///
838    /// A widget is unmapped when either it or any of its parents up to the
839    /// toplevel widget have been set as hidden.
840    ///
841    /// As `::unmap` indicates that a widget will not be shown any longer,
842    /// it can be used to, for example, stop an animation on the widget.
843    ///
844    ///
845    ///
846    ///
847    /// #### `unrealize`
848    ///  Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
849    ///
850    /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
851    /// or the widget has been unmapped (that is, it is going to be hidden).
852    ///
853    ///
854    ///
855    /// # Implements
856    ///
857    /// [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
858    #[doc(alias = "GtkWidget")]
859    pub struct Widget(Object<ffi::GtkWidget, ffi::GtkWidgetClass>) @implements Accessible, Buildable, ConstraintTarget;
860
861    match fn {
862        type_ => || ffi::gtk_widget_get_type(),
863    }
864}
865
866impl Widget {
867    pub const NONE: Option<&'static Widget> = None;
868
869    /// Obtains the default reading direction.
870    ///
871    /// See [`set_default_direction()`][Self::set_default_direction()].
872    ///
873    /// # Returns
874    ///
875    /// the current default direction
876    #[doc(alias = "gtk_widget_get_default_direction")]
877    #[doc(alias = "get_default_direction")]
878    pub fn default_direction() -> TextDirection {
879        assert_initialized_main_thread!();
880        unsafe { from_glib(ffi::gtk_widget_get_default_direction()) }
881    }
882
883    /// Sets the default reading direction for widgets.
884    ///
885    /// See [`WidgetExt::set_direction()`][crate::prelude::WidgetExt::set_direction()].
886    /// ## `dir`
887    /// the new default direction, either [enum@Gtk.TextDirection.ltr]
888    ///   or [enum@Gtk.TextDirection.rtl]
889    #[doc(alias = "gtk_widget_set_default_direction")]
890    pub fn set_default_direction(dir: TextDirection) {
891        assert_initialized_main_thread!();
892        unsafe {
893            ffi::gtk_widget_set_default_direction(dir.into_glib());
894        }
895    }
896}
897
898impl std::fmt::Display for Widget {
899    #[inline]
900    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
901        f.write_str(&WidgetExt::widget_name(self))
902    }
903}
904
905mod sealed {
906    pub trait Sealed {}
907    impl<T: super::IsA<super::Widget>> Sealed for T {}
908}
909
910/// Trait containing all [`struct@Widget`] methods.
911///
912/// # Implementors
913///
914/// [`ActionBar`][struct@crate::ActionBar], [`Actionable`][struct@crate::Actionable], [`AppChooserButton`][struct@crate::AppChooserButton], [`AppChooserWidget`][struct@crate::AppChooserWidget], [`AppChooser`][struct@crate::AppChooser], [`AspectFrame`][struct@crate::AspectFrame], [`Box`][struct@crate::Box], [`Button`][struct@crate::Button], [`Calendar`][struct@crate::Calendar], [`CellEditable`][struct@crate::CellEditable], [`CellView`][struct@crate::CellView], [`CenterBox`][struct@crate::CenterBox], [`CheckButton`][struct@crate::CheckButton], [`ColorButton`][struct@crate::ColorButton], [`ColorChooserWidget`][struct@crate::ColorChooserWidget], [`ColorDialogButton`][struct@crate::ColorDialogButton], [`ColumnView`][struct@crate::ColumnView], [`ComboBox`][struct@crate::ComboBox], [`DragIcon`][struct@crate::DragIcon], [`DrawingArea`][struct@crate::DrawingArea], [`DropDown`][struct@crate::DropDown], [`EditableLabel`][struct@crate::EditableLabel], [`Editable`][struct@crate::Editable], [`Entry`][struct@crate::Entry], [`Expander`][struct@crate::Expander], [`FileChooserWidget`][struct@crate::FileChooserWidget], [`Fixed`][struct@crate::Fixed], [`FlowBoxChild`][struct@crate::FlowBoxChild], [`FlowBox`][struct@crate::FlowBox], [`FontButton`][struct@crate::FontButton], [`FontChooserWidget`][struct@crate::FontChooserWidget], [`FontDialogButton`][struct@crate::FontDialogButton], [`Frame`][struct@crate::Frame], [`GLArea`][struct@crate::GLArea], [`GraphicsOffload`][struct@crate::GraphicsOffload], [`Grid`][struct@crate::Grid], [`HeaderBar`][struct@crate::HeaderBar], [`IconView`][struct@crate::IconView], [`Image`][struct@crate::Image], [`InfoBar`][struct@crate::InfoBar], [`Inscription`][struct@crate::Inscription], [`Label`][struct@crate::Label], [`LevelBar`][struct@crate::LevelBar], [`ListBase`][struct@crate::ListBase], [`ListBoxRow`][struct@crate::ListBoxRow], [`ListBox`][struct@crate::ListBox], [`MediaControls`][struct@crate::MediaControls], [`MenuButton`][struct@crate::MenuButton], [`Native`][struct@crate::Native], [`Notebook`][struct@crate::Notebook], [`Overlay`][struct@crate::Overlay], [`Paned`][struct@crate::Paned], [`PasswordEntry`][struct@crate::PasswordEntry], [`Picture`][struct@crate::Picture], [`PopoverMenuBar`][struct@crate::PopoverMenuBar], [`Popover`][struct@crate::Popover], [`ProgressBar`][struct@crate::ProgressBar], [`Range`][struct@crate::Range], [`Revealer`][struct@crate::Revealer], [`Root`][struct@crate::Root], [`ScaleButton`][struct@crate::ScaleButton], [`Scrollbar`][struct@crate::Scrollbar], [`ScrolledWindow`][struct@crate::ScrolledWindow], [`SearchBar`][struct@crate::SearchBar], [`SearchEntry`][struct@crate::SearchEntry], [`Separator`][struct@crate::Separator], [`ShortcutLabel`][struct@crate::ShortcutLabel], [`ShortcutsShortcut`][struct@crate::ShortcutsShortcut], [`SpinButton`][struct@crate::SpinButton], [`Spinner`][struct@crate::Spinner], [`StackSidebar`][struct@crate::StackSidebar], [`StackSwitcher`][struct@crate::StackSwitcher], [`Stack`][struct@crate::Stack], [`Statusbar`][struct@crate::Statusbar], [`Switch`][struct@crate::Switch], [`TextView`][struct@crate::TextView], [`Text`][struct@crate::Text], [`TreeExpander`][struct@crate::TreeExpander], [`TreeView`][struct@crate::TreeView], [`Video`][struct@crate::Video], [`Viewport`][struct@crate::Viewport], [`Widget`][struct@crate::Widget], [`WindowControls`][struct@crate::WindowControls], [`WindowHandle`][struct@crate::WindowHandle], [`Window`][struct@crate::Window]
915pub trait WidgetExt: IsA<Widget> + sealed::Sealed + 'static {
916    /// Enables or disables an action installed with
917    /// [`WidgetClassExt::install_action()`][crate::subclass::prelude::WidgetClassExt::install_action()].
918    /// ## `action_name`
919    /// action name, such as "clipboard.paste"
920    /// ## `enabled`
921    /// whether the action is now enabled
922    #[doc(alias = "gtk_widget_action_set_enabled")]
923    fn action_set_enabled(&self, action_name: &str, enabled: bool) {
924        unsafe {
925            ffi::gtk_widget_action_set_enabled(
926                self.as_ref().to_glib_none().0,
927                action_name.to_glib_none().0,
928                enabled.into_glib(),
929            );
930        }
931    }
932
933    /// Activates the widget.
934    ///
935    /// The activation will emit the signal set using
936    /// [`WidgetClassExt::set_activate_signal()`][crate::subclass::prelude::WidgetClassExt::set_activate_signal()]
937    /// during class initialization.
938    ///
939    /// Activation is what happens when you press <kbd>Enter</kbd>
940    /// on a widget.
941    ///
942    /// If you wish to handle the activation keybinding yourself,
943    /// it is recommended to use [`WidgetClassExt::add_shortcut()`][crate::subclass::prelude::WidgetClassExt::add_shortcut()]
944    /// with an action created with [`SignalAction::new()`][crate::SignalAction::new()].
945    ///
946    /// If @self is not activatable, the function returns false.
947    ///
948    /// # Returns
949    ///
950    /// true if the widget was activated
951    #[doc(alias = "gtk_widget_activate")]
952    fn activate(&self) -> bool {
953        unsafe { from_glib(ffi::gtk_widget_activate(self.as_ref().to_glib_none().0)) }
954    }
955
956    /// Activates an action for the widget.
957    ///
958    /// The action is looked up in the action groups associated with
959    /// @self and its ancestors.
960    ///
961    /// If the action is in an action group added with
962    /// [`insert_action_group()`][Self::insert_action_group()], the @name is expected
963    /// to be prefixed with the prefix that was used when the group was
964    /// inserted.
965    ///
966    /// The arguments must match the actions expected parameter type,
967    /// as returned by [`ActionExtManual::parameter_type()`][crate::gio::prelude::ActionExtManual::parameter_type()].
968    /// ## `name`
969    /// the name of the action to activate
970    /// ## `args`
971    /// parameters to use
972    ///
973    /// # Returns
974    ///
975    /// true if the action was activated
976    #[doc(alias = "gtk_widget_activate_action_variant")]
977    #[doc(alias = "activate_action_variant")]
978    fn activate_action(
979        &self,
980        name: &str,
981        args: Option<&glib::Variant>,
982    ) -> Result<(), glib::error::BoolError> {
983        unsafe {
984            glib::result_from_gboolean!(
985                ffi::gtk_widget_activate_action_variant(
986                    self.as_ref().to_glib_none().0,
987                    name.to_glib_none().0,
988                    args.to_glib_none().0
989                ),
990                "Action does not exist"
991            )
992        }
993    }
994
995    /// Activates the `default.activate` action for the widget.
996    ///
997    /// The action is looked up in the same was as for
998    /// `Gtk::Widget::activate_action()`.
999    #[doc(alias = "gtk_widget_activate_default")]
1000    fn activate_default(&self) {
1001        unsafe {
1002            ffi::gtk_widget_activate_default(self.as_ref().to_glib_none().0);
1003        }
1004    }
1005
1006    /// Adds an event controller to the widget.
1007    ///
1008    /// The event controllers of a widget handle the events that are
1009    /// propagated to the widget.
1010    ///
1011    /// You will usually want to call this function right after
1012    /// creating any kind of [`EventController`][crate::EventController].
1013    /// ## `controller`
1014    /// an event controller that hasn't been
1015    ///   added to a widget yet
1016    #[doc(alias = "gtk_widget_add_controller")]
1017    fn add_controller(&self, controller: impl IsA<EventController>) {
1018        unsafe {
1019            ffi::gtk_widget_add_controller(
1020                self.as_ref().to_glib_none().0,
1021                controller.upcast().into_glib_ptr(),
1022            );
1023        }
1024    }
1025
1026    /// Adds a style class to the widget.
1027    ///
1028    /// After calling this function, the widget’s style will match
1029    /// for @css_class, according to CSS matching rules.
1030    ///
1031    /// Use [`remove_css_class()`][Self::remove_css_class()] to remove the
1032    /// style again.
1033    /// ## `css_class`
1034    /// style class to add to @self, without the leading period
1035    #[doc(alias = "gtk_widget_add_css_class")]
1036    fn add_css_class(&self, css_class: &str) {
1037        unsafe {
1038            ffi::gtk_widget_add_css_class(
1039                self.as_ref().to_glib_none().0,
1040                css_class.to_glib_none().0,
1041            );
1042        }
1043    }
1044
1045    /// Adds a widget to the list of mnemonic labels for this widget.
1046    ///
1047    /// See [`list_mnemonic_labels()`][Self::list_mnemonic_labels()].
1048    ///
1049    /// Note that the list of mnemonic labels for the widget is cleared
1050    /// when the widget is destroyed, so the caller must make sure
1051    /// to update its internal state at this point as well.
1052    /// ## `label`
1053    /// a widget that acts as a mnemonic label for @self
1054    #[doc(alias = "gtk_widget_add_mnemonic_label")]
1055    fn add_mnemonic_label(&self, label: &impl IsA<Widget>) {
1056        unsafe {
1057            ffi::gtk_widget_add_mnemonic_label(
1058                self.as_ref().to_glib_none().0,
1059                label.as_ref().to_glib_none().0,
1060            );
1061        }
1062    }
1063
1064    /// Assigns size, position, (optionally) a baseline and transform
1065    /// to a child widget.
1066    ///
1067    /// In this function, the allocation and baseline may be adjusted.
1068    /// The given allocation will be forced to be bigger than the
1069    /// widget's minimum size, as well as at least 0×0 in size.
1070    ///
1071    /// This function is only used by widget implementations.
1072    ///
1073    /// For a version that does not take a transform, see
1074    /// [`size_allocate()`][Self::size_allocate()].
1075    /// ## `width`
1076    /// new width
1077    /// ## `height`
1078    /// new height
1079    /// ## `baseline`
1080    /// new baseline, or -1
1081    /// ## `transform`
1082    /// transformation to be applied
1083    #[doc(alias = "gtk_widget_allocate")]
1084    fn allocate(&self, width: i32, height: i32, baseline: i32, transform: Option<gsk::Transform>) {
1085        unsafe {
1086            ffi::gtk_widget_allocate(
1087                self.as_ref().to_glib_none().0,
1088                width,
1089                height,
1090                baseline,
1091                transform.into_glib_ptr(),
1092            );
1093        }
1094    }
1095
1096    /// Called by widgets as the user moves around the window using
1097    /// keyboard shortcuts.
1098    ///
1099    /// The @direction argument indicates what kind of motion is taking
1100    /// place (up, down, left, right, tab forward, tab backward).
1101    ///
1102    /// This function calls the [`WidgetImpl::focus()`][crate::subclass::prelude::WidgetImpl::focus()] virtual function;
1103    /// widgets can override the virtual function in order to implement
1104    /// appropriate focus behavior.
1105    ///
1106    /// The default `focus()` virtual function for a widget should return
1107    /// true if moving in @direction left the focus on a focusable location
1108    /// inside that widget, and false if moving in @direction moved the focus
1109    /// outside the widget. When returning true, widgets normally call
1110    /// [`grab_focus()`][Self::grab_focus()] to place the focus accordingly;
1111    /// when returning false, they don’t modify the current focus location.
1112    ///
1113    /// This function is used by custom widget implementations; if you're
1114    /// writing an app, you’d use [`grab_focus()`][Self::grab_focus()] to move
1115    /// the focus to a particular widget.
1116    /// ## `direction`
1117    /// direction of focus movement
1118    ///
1119    /// # Returns
1120    ///
1121    /// true if focus ended up inside @self
1122    #[doc(alias = "gtk_widget_child_focus")]
1123    fn child_focus(&self, direction: DirectionType) -> bool {
1124        unsafe {
1125            from_glib(ffi::gtk_widget_child_focus(
1126                self.as_ref().to_glib_none().0,
1127                direction.into_glib(),
1128            ))
1129        }
1130    }
1131
1132    /// Computes the bounds for @self in the coordinate space of @target.
1133    ///
1134    /// The bounds of widget are (the bounding box of) the region that it is
1135    /// expected to draw in. See the [coordinate system](coordinates.html)
1136    /// overview to learn more.
1137    ///
1138    /// If the operation is successful, true is returned. If @self has no
1139    /// bounds or the bounds cannot be expressed in @target's coordinate space
1140    /// (for example if both widgets are in different windows), false is
1141    /// returned and @bounds is set to the zero rectangle.
1142    ///
1143    /// It is valid for @self and @target to be the same widget.
1144    /// ## `target`
1145    /// the target widget
1146    ///
1147    /// # Returns
1148    ///
1149    /// true if the bounds could be computed
1150    ///
1151    /// ## `out_bounds`
1152    /// the rectangle taking the bounds
1153    #[doc(alias = "gtk_widget_compute_bounds")]
1154    fn compute_bounds(&self, target: &impl IsA<Widget>) -> Option<graphene::Rect> {
1155        unsafe {
1156            let mut out_bounds = graphene::Rect::uninitialized();
1157            let ret = from_glib(ffi::gtk_widget_compute_bounds(
1158                self.as_ref().to_glib_none().0,
1159                target.as_ref().to_glib_none().0,
1160                out_bounds.to_glib_none_mut().0,
1161            ));
1162            if ret {
1163                Some(out_bounds)
1164            } else {
1165                None
1166            }
1167        }
1168    }
1169
1170    /// Computes whether a parent widget should give this widget
1171    /// extra space when possible.
1172    ///
1173    /// Widgets with children should check this, rather than looking at
1174    /// [`hexpands()`][Self::hexpands()] or [`vexpands()`][Self::vexpands()].
1175    ///
1176    /// This function already checks whether the widget is visible, so
1177    /// visibility does not need to be checked separately. Non-visible
1178    /// widgets are not expanded.
1179    ///
1180    /// The computed expand value uses either the expand setting explicitly
1181    /// set on the widget itself, or, if none has been explicitly set,
1182    /// the widget may expand if some of its children do.
1183    /// ## `orientation`
1184    /// expand direction
1185    ///
1186    /// # Returns
1187    ///
1188    /// whether widget tree rooted here should be expanded
1189    #[doc(alias = "gtk_widget_compute_expand")]
1190    fn compute_expand(&self, orientation: Orientation) -> bool {
1191        unsafe {
1192            from_glib(ffi::gtk_widget_compute_expand(
1193                self.as_ref().to_glib_none().0,
1194                orientation.into_glib(),
1195            ))
1196        }
1197    }
1198
1199    /// Translates the given @point in @self's coordinates to coordinates
1200    /// in @target’s coordinate system.
1201    ///
1202    /// In order to perform this operation, both widgets must share a
1203    /// a common ancestor. If that is not the case, @out_point is set
1204    /// to (0, 0) and false is returned.
1205    /// ## `target`
1206    /// the widget to transform into
1207    /// ## `point`
1208    /// a point in @self's coordinate system
1209    ///
1210    /// # Returns
1211    ///
1212    /// true if @src_widget and @dest_widget have a common
1213    ///   ancestor, false otherwise
1214    ///
1215    /// ## `out_point`
1216    /// set to the corresponding coordinates in
1217    ///   @target's coordinate system
1218    #[doc(alias = "gtk_widget_compute_point")]
1219    fn compute_point(
1220        &self,
1221        target: &impl IsA<Widget>,
1222        point: &graphene::Point,
1223    ) -> Option<graphene::Point> {
1224        unsafe {
1225            let mut out_point = graphene::Point::uninitialized();
1226            let ret = from_glib(ffi::gtk_widget_compute_point(
1227                self.as_ref().to_glib_none().0,
1228                target.as_ref().to_glib_none().0,
1229                point.to_glib_none().0,
1230                out_point.to_glib_none_mut().0,
1231            ));
1232            if ret {
1233                Some(out_point)
1234            } else {
1235                None
1236            }
1237        }
1238    }
1239
1240    /// Computes a matrix suitable to describe a transformation from
1241    /// @self's coordinate system into @target's coordinate system.
1242    ///
1243    /// The transform can not be computed in certain cases, for example
1244    /// when @self and @target do not share a common ancestor. In that
1245    /// case @out_transform gets set to the identity matrix.
1246    ///
1247    /// To learn more about widget coordinate systems, see the coordinate
1248    /// system [overview](coordinates.html).
1249    /// ## `target`
1250    /// the target widget that the matrix will transform to
1251    ///
1252    /// # Returns
1253    ///
1254    /// true if the transform could be computed
1255    ///
1256    /// ## `out_transform`
1257    /// location to
1258    ///   store the final transformation
1259    #[doc(alias = "gtk_widget_compute_transform")]
1260    fn compute_transform(&self, target: &impl IsA<Widget>) -> Option<graphene::Matrix> {
1261        unsafe {
1262            let mut out_transform = graphene::Matrix::uninitialized();
1263            let ret = from_glib(ffi::gtk_widget_compute_transform(
1264                self.as_ref().to_glib_none().0,
1265                target.as_ref().to_glib_none().0,
1266                out_transform.to_glib_none_mut().0,
1267            ));
1268            if ret {
1269                Some(out_transform)
1270            } else {
1271                None
1272            }
1273        }
1274    }
1275
1276    /// Tests if a given point is contained in the widget.
1277    ///
1278    /// The coordinates for (x, y) must be in widget coordinates, so
1279    /// (0, 0) is assumed to be the top left of @self's content area.
1280    /// ## `x`
1281    /// X coordinate to test, relative to @self's origin
1282    /// ## `y`
1283    /// Y coordinate to test, relative to @self's origin
1284    ///
1285    /// # Returns
1286    ///
1287    /// true if @self contains the point (x, y)
1288    #[doc(alias = "gtk_widget_contains")]
1289    fn contains(&self, x: f64, y: f64) -> bool {
1290        unsafe {
1291            from_glib(ffi::gtk_widget_contains(
1292                self.as_ref().to_glib_none().0,
1293                x,
1294                y,
1295            ))
1296        }
1297    }
1298
1299    /// Creates a new [`pango::Context`][crate::pango::Context] that is configured for the widget.
1300    ///
1301    /// The [`pango::Context`][crate::pango::Context] will have the appropriate font map,
1302    /// font options, font description, and base direction set.
1303    ///
1304    /// See also [`pango_context()`][Self::pango_context()].
1305    ///
1306    /// # Returns
1307    ///
1308    /// the new [`pango::Context`][crate::pango::Context]
1309    #[doc(alias = "gtk_widget_create_pango_context")]
1310    fn create_pango_context(&self) -> pango::Context {
1311        unsafe {
1312            from_glib_full(ffi::gtk_widget_create_pango_context(
1313                self.as_ref().to_glib_none().0,
1314            ))
1315        }
1316    }
1317
1318    /// Creates a new [`pango::Layout`][crate::pango::Layout] that is configured for the widget.
1319    ///
1320    /// The [`pango::Layout`][crate::pango::Layout] will have the appropriate font map,
1321    /// font description, and base direction set.
1322    ///
1323    /// If you keep a [`pango::Layout`][crate::pango::Layout] created in this way around,
1324    /// you need to re-create it when the widgets [`pango::Context`][crate::pango::Context]
1325    /// is replaced. This can be tracked by listening to changes
1326    /// of the [`root`][struct@crate::Widget#root] property on the widget.
1327    /// ## `text`
1328    /// text to set on the layout
1329    ///
1330    /// # Returns
1331    ///
1332    /// the new [`pango::Layout`][crate::pango::Layout]
1333    #[doc(alias = "gtk_widget_create_pango_layout")]
1334    fn create_pango_layout(&self, text: Option<&str>) -> pango::Layout {
1335        unsafe {
1336            from_glib_full(ffi::gtk_widget_create_pango_layout(
1337                self.as_ref().to_glib_none().0,
1338                text.to_glib_none().0,
1339            ))
1340        }
1341    }
1342
1343    /// Checks to see if a drag movement has passed the GTK drag threshold.
1344    /// ## `start_x`
1345    /// X coordinate of start of drag
1346    /// ## `start_y`
1347    /// Y coordinate of start of drag
1348    /// ## `current_x`
1349    /// current X coordinate
1350    /// ## `current_y`
1351    /// current Y coordinate
1352    ///
1353    /// # Returns
1354    ///
1355    /// true if the drag threshold has been passed
1356    #[doc(alias = "gtk_drag_check_threshold")]
1357    fn drag_check_threshold(
1358        &self,
1359        start_x: i32,
1360        start_y: i32,
1361        current_x: i32,
1362        current_y: i32,
1363    ) -> bool {
1364        unsafe {
1365            from_glib(ffi::gtk_drag_check_threshold(
1366                self.as_ref().to_glib_none().0,
1367                start_x,
1368                start_y,
1369                current_x,
1370                current_y,
1371            ))
1372        }
1373    }
1374
1375    /// Notifies the user about an input-related error on the widget.
1376    ///
1377    /// If the [`gtk-error-bell`][struct@crate::Settings#gtk-error-bell] setting is true,
1378    /// it calls `Gdk::Surface::beep()`, otherwise it does nothing.
1379    ///
1380    /// Note that the effect of `Gdk::Surface::beep()` can be configured
1381    /// in many ways, depending on the windowing backend and the desktop
1382    /// environment or window manager that is used.
1383    #[doc(alias = "gtk_widget_error_bell")]
1384    fn error_bell(&self) {
1385        unsafe {
1386            ffi::gtk_widget_error_bell(self.as_ref().to_glib_none().0);
1387        }
1388    }
1389
1390    /// Returns the baseline that has currently been allocated to the widget.
1391    ///
1392    /// This function is intended to be used when implementing handlers
1393    /// for the [`Widget`][crate::Widget]Class.snapshot() function, and when allocating
1394    /// child widgets in [`Widget`][crate::Widget]Class.size_allocate().
1395    ///
1396    /// # Deprecated since 4.12
1397    ///
1398    /// Use [`baseline()`][Self::baseline()] instead
1399    ///
1400    /// # Returns
1401    ///
1402    /// the baseline of the @self, or -1 if none
1403    #[cfg_attr(feature = "v4_12", deprecated = "Since 4.12")]
1404    #[allow(deprecated)]
1405    #[doc(alias = "gtk_widget_get_allocated_baseline")]
1406    #[doc(alias = "get_allocated_baseline")]
1407    fn allocated_baseline(&self) -> i32 {
1408        unsafe { ffi::gtk_widget_get_allocated_baseline(self.as_ref().to_glib_none().0) }
1409    }
1410
1411    /// Returns the height that has currently been allocated to the widget.
1412    ///
1413    /// To learn more about widget sizes, see the coordinate
1414    /// system [overview](coordinates.html).
1415    ///
1416    /// # Deprecated since 4.12
1417    ///
1418    /// Use [`height()`][Self::height()] instead
1419    ///
1420    /// # Returns
1421    ///
1422    /// the height of the @self
1423    #[cfg_attr(feature = "v4_12", deprecated = "Since 4.12")]
1424    #[allow(deprecated)]
1425    #[doc(alias = "gtk_widget_get_allocated_height")]
1426    #[doc(alias = "get_allocated_height")]
1427    fn allocated_height(&self) -> i32 {
1428        unsafe { ffi::gtk_widget_get_allocated_height(self.as_ref().to_glib_none().0) }
1429    }
1430
1431    /// Returns the width that has currently been allocated to the widget.
1432    ///
1433    /// To learn more about widget sizes, see the coordinate
1434    /// system [overview](coordinates.html).
1435    ///
1436    /// # Deprecated since 4.12
1437    ///
1438    /// Use [`width()`][Self::width()] instead
1439    ///
1440    /// # Returns
1441    ///
1442    /// the width of the @self
1443    #[cfg_attr(feature = "v4_12", deprecated = "Since 4.12")]
1444    #[allow(deprecated)]
1445    #[doc(alias = "gtk_widget_get_allocated_width")]
1446    #[doc(alias = "get_allocated_width")]
1447    fn allocated_width(&self) -> i32 {
1448        unsafe { ffi::gtk_widget_get_allocated_width(self.as_ref().to_glib_none().0) }
1449    }
1450
1451    /// Retrieves the widget’s allocation.
1452    ///
1453    /// Note, when implementing a layout widget: a widget’s allocation
1454    /// will be its “adjusted” allocation, that is, the widget’s parent
1455    /// typically calls [`size_allocate()`][Self::size_allocate()] with an allocation,
1456    /// and that allocation is then adjusted (to handle margin
1457    /// and alignment for example) before assignment to the widget.
1458    /// [`allocation()`][Self::allocation()] returns the adjusted allocation that
1459    /// was actually assigned to the widget. The adjusted allocation is
1460    /// guaranteed to be completely contained within the
1461    /// [`size_allocate()`][Self::size_allocate()] allocation, however.
1462    ///
1463    /// So a layout widget is guaranteed that its children stay inside
1464    /// the assigned bounds, but not that they have exactly the bounds the
1465    /// widget assigned.
1466    ///
1467    /// # Deprecated since 4.12
1468    ///
1469    /// Use [`compute_bounds()`][Self::compute_bounds()],
1470    /// [`width()`][Self::width()] or [`height()`][Self::height()] instead.
1471    ///
1472    /// # Returns
1473    ///
1474    ///
1475    /// ## `allocation`
1476    /// a pointer to a `GtkAllocation` to copy to
1477    #[cfg_attr(feature = "v4_12", deprecated = "Since 4.12")]
1478    #[allow(deprecated)]
1479    #[doc(alias = "gtk_widget_get_allocation")]
1480    #[doc(alias = "get_allocation")]
1481    fn allocation(&self) -> Allocation {
1482        unsafe {
1483            let mut allocation = Allocation::uninitialized();
1484            ffi::gtk_widget_get_allocation(
1485                self.as_ref().to_glib_none().0,
1486                allocation.to_glib_none_mut().0,
1487            );
1488            allocation
1489        }
1490    }
1491
1492    /// Gets the first ancestor of the widget with type @widget_type.
1493    ///
1494    /// For example, `gtk_widget_get_ancestor (widget, GTK_TYPE_BOX)`
1495    /// gets the first [`Box`][crate::Box] that’s an ancestor of @self. No
1496    /// reference will be added to the returned widget; it should
1497    /// not be unreferenced.
1498    ///
1499    /// Note that unlike [`is_ancestor()`][Self::is_ancestor()], this function
1500    /// considers @self to be an ancestor of itself.
1501    /// ## `widget_type`
1502    /// ancestor type
1503    ///
1504    /// # Returns
1505    ///
1506    /// the ancestor widget
1507    #[doc(alias = "gtk_widget_get_ancestor")]
1508    #[doc(alias = "get_ancestor")]
1509    #[must_use]
1510    fn ancestor(&self, widget_type: glib::types::Type) -> Option<Widget> {
1511        unsafe {
1512            from_glib_none(ffi::gtk_widget_get_ancestor(
1513                self.as_ref().to_glib_none().0,
1514                widget_type.into_glib(),
1515            ))
1516        }
1517    }
1518
1519    /// Returns the baseline that has currently been allocated to the widget.
1520    ///
1521    /// This function is intended to be used when implementing handlers
1522    /// for the `GtkWidgetClass.snapshot()` function, and when allocating
1523    /// child widgets in `GtkWidgetClass.size_allocate()`.
1524    ///
1525    /// # Returns
1526    ///
1527    /// the baseline of the @self, or -1 if none
1528    #[cfg(feature = "v4_12")]
1529    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
1530    #[doc(alias = "gtk_widget_get_baseline")]
1531    #[doc(alias = "get_baseline")]
1532    fn baseline(&self) -> i32 {
1533        unsafe { ffi::gtk_widget_get_baseline(self.as_ref().to_glib_none().0) }
1534    }
1535
1536    /// Determines whether the input focus can enter the widget or any
1537    /// of its children.
1538    ///
1539    /// See [`set_can_focus()`][Self::set_can_focus()].
1540    ///
1541    /// # Returns
1542    ///
1543    /// true if the input focus can enter @self
1544    #[doc(alias = "gtk_widget_get_can_focus")]
1545    #[doc(alias = "get_can_focus")]
1546    #[doc(alias = "can-focus")]
1547    fn can_focus(&self) -> bool {
1548        unsafe {
1549            from_glib(ffi::gtk_widget_get_can_focus(
1550                self.as_ref().to_glib_none().0,
1551            ))
1552        }
1553    }
1554
1555    /// Queries whether the widget can be the target of pointer events.
1556    ///
1557    /// # Returns
1558    ///
1559    /// true if @self can receive pointer events
1560    #[doc(alias = "gtk_widget_get_can_target")]
1561    #[doc(alias = "get_can_target")]
1562    #[doc(alias = "can-target")]
1563    fn can_target(&self) -> bool {
1564        unsafe {
1565            from_glib(ffi::gtk_widget_get_can_target(
1566                self.as_ref().to_glib_none().0,
1567            ))
1568        }
1569    }
1570
1571    /// Gets the value set with [`set_child_visible()`][Self::set_child_visible()].
1572    ///
1573    /// If you feel a need to use this function, your code probably
1574    /// needs reorganization.
1575    ///
1576    /// This function is only useful for widget implementations
1577    /// and should never be called by an application.
1578    ///
1579    /// # Returns
1580    ///
1581    /// true if the widget is mapped with the parent
1582    #[doc(alias = "gtk_widget_get_child_visible")]
1583    #[doc(alias = "get_child_visible")]
1584    fn is_child_visible(&self) -> bool {
1585        unsafe {
1586            from_glib(ffi::gtk_widget_get_child_visible(
1587                self.as_ref().to_glib_none().0,
1588            ))
1589        }
1590    }
1591
1592    /// Gets the clipboard object for the widget.
1593    ///
1594    /// This is a utility function to get the clipboard object for the
1595    /// display that @self is using.
1596    ///
1597    /// Note that this function always works, even when @self is not
1598    /// realized yet.
1599    ///
1600    /// # Returns
1601    ///
1602    /// the appropriate clipboard object
1603    #[doc(alias = "gtk_widget_get_clipboard")]
1604    #[doc(alias = "get_clipboard")]
1605    fn clipboard(&self) -> gdk::Clipboard {
1606        unsafe {
1607            from_glib_none(ffi::gtk_widget_get_clipboard(
1608                self.as_ref().to_glib_none().0,
1609            ))
1610        }
1611    }
1612
1613    /// Gets the current foreground color for the widget’s style.
1614    ///
1615    /// This function should only be used in snapshot
1616    /// implementations that need to do custom drawing
1617    /// with the foreground color.
1618    ///
1619    /// # Returns
1620    ///
1621    ///
1622    /// ## `color`
1623    /// return location for the color
1624    #[cfg(feature = "v4_10")]
1625    #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
1626    #[doc(alias = "gtk_widget_get_color")]
1627    #[doc(alias = "get_color")]
1628    fn color(&self) -> gdk::RGBA {
1629        unsafe {
1630            let mut color = gdk::RGBA::uninitialized();
1631            ffi::gtk_widget_get_color(self.as_ref().to_glib_none().0, color.to_glib_none_mut().0);
1632            color
1633        }
1634    }
1635
1636    /// Returns the list of style classes applied to the widget.
1637    ///
1638    /// # Returns
1639    ///
1640    /// a `NULL`-terminated list of
1641    ///   css classes currently applied to @self
1642    #[doc(alias = "gtk_widget_get_css_classes")]
1643    #[doc(alias = "get_css_classes")]
1644    #[doc(alias = "css-classes")]
1645    fn css_classes(&self) -> Vec<glib::GString> {
1646        unsafe {
1647            FromGlibPtrContainer::from_glib_full(ffi::gtk_widget_get_css_classes(
1648                self.as_ref().to_glib_none().0,
1649            ))
1650        }
1651    }
1652
1653    /// Returns the CSS name of the widget.
1654    ///
1655    /// # Returns
1656    ///
1657    /// the CSS name
1658    #[doc(alias = "gtk_widget_get_css_name")]
1659    #[doc(alias = "get_css_name")]
1660    #[doc(alias = "css-name")]
1661    fn css_name(&self) -> glib::GString {
1662        unsafe { from_glib_none(ffi::gtk_widget_get_css_name(self.as_ref().to_glib_none().0)) }
1663    }
1664
1665    /// Gets the cursor set on the widget.
1666    ///
1667    /// See [`set_cursor()`][Self::set_cursor()] for details.
1668    ///
1669    /// # Returns
1670    ///
1671    /// the cursor
1672    ///   that is set on @self
1673    #[doc(alias = "gtk_widget_get_cursor")]
1674    #[doc(alias = "get_cursor")]
1675    fn cursor(&self) -> Option<gdk::Cursor> {
1676        unsafe { from_glib_none(ffi::gtk_widget_get_cursor(self.as_ref().to_glib_none().0)) }
1677    }
1678
1679    /// Gets the reading direction for the widget.
1680    ///
1681    /// See [`set_direction()`][Self::set_direction()].
1682    ///
1683    /// # Returns
1684    ///
1685    /// the reading direction for the widget
1686    #[doc(alias = "gtk_widget_get_direction")]
1687    #[doc(alias = "get_direction")]
1688    fn direction(&self) -> TextDirection {
1689        unsafe {
1690            from_glib(ffi::gtk_widget_get_direction(
1691                self.as_ref().to_glib_none().0,
1692            ))
1693        }
1694    }
1695
1696    /// Get the display for the window that the widget belongs to.
1697    ///
1698    /// This function can only be called after the widget has been
1699    /// added to a widget hierarchy with a [`Root`][crate::Root] at the top.
1700    ///
1701    /// In general, you should only create display-specific
1702    /// resources when a widget has been realized, and you should
1703    /// free those resources when the widget is unrealized.
1704    ///
1705    /// # Returns
1706    ///
1707    /// the display for this widget
1708    #[doc(alias = "gtk_widget_get_display")]
1709    #[doc(alias = "get_display")]
1710    fn display(&self) -> gdk::Display {
1711        unsafe { from_glib_none(ffi::gtk_widget_get_display(self.as_ref().to_glib_none().0)) }
1712    }
1713
1714    /// Returns the widget’s first child.
1715    ///
1716    /// This function is primarily meant for widget implementations.
1717    ///
1718    /// # Returns
1719    ///
1720    /// the widget's first child
1721    #[doc(alias = "gtk_widget_get_first_child")]
1722    #[doc(alias = "get_first_child")]
1723    #[must_use]
1724    fn first_child(&self) -> Option<Widget> {
1725        unsafe {
1726            from_glib_none(ffi::gtk_widget_get_first_child(
1727                self.as_ref().to_glib_none().0,
1728            ))
1729        }
1730    }
1731
1732    /// Returns the focus child of the widget.
1733    ///
1734    /// # Returns
1735    ///
1736    /// the current focus
1737    ///   child of @self
1738    #[doc(alias = "gtk_widget_get_focus_child")]
1739    #[doc(alias = "get_focus_child")]
1740    #[must_use]
1741    fn focus_child(&self) -> Option<Widget> {
1742        unsafe {
1743            from_glib_none(ffi::gtk_widget_get_focus_child(
1744                self.as_ref().to_glib_none().0,
1745            ))
1746        }
1747    }
1748
1749    /// Returns whether the widget should grab focus when it is clicked
1750    /// with the mouse.
1751    ///
1752    /// See [`set_focus_on_click()`][Self::set_focus_on_click()].
1753    ///
1754    /// # Returns
1755    ///
1756    /// true if the widget should grab focus when it is
1757    ///   clicked with the mouse
1758    #[doc(alias = "gtk_widget_get_focus_on_click")]
1759    #[doc(alias = "get_focus_on_click")]
1760    #[doc(alias = "focus-on-click")]
1761    fn gets_focus_on_click(&self) -> bool {
1762        unsafe {
1763            from_glib(ffi::gtk_widget_get_focus_on_click(
1764                self.as_ref().to_glib_none().0,
1765            ))
1766        }
1767    }
1768
1769    /// Determines whether the widget can own the input focus.
1770    ///
1771    /// See [`set_focusable()`][Self::set_focusable()].
1772    ///
1773    /// # Returns
1774    ///
1775    /// true if @self can own the input focus
1776    #[doc(alias = "gtk_widget_get_focusable")]
1777    #[doc(alias = "get_focusable")]
1778    #[doc(alias = "focusable")]
1779    fn is_focusable(&self) -> bool {
1780        unsafe {
1781            from_glib(ffi::gtk_widget_get_focusable(
1782                self.as_ref().to_glib_none().0,
1783            ))
1784        }
1785    }
1786
1787    /// Gets the font map of the widget.
1788    ///
1789    /// See [`set_font_map()`][Self::set_font_map()].
1790    ///
1791    /// # Returns
1792    ///
1793    /// the font map of @self
1794    #[doc(alias = "gtk_widget_get_font_map")]
1795    #[doc(alias = "get_font_map")]
1796    fn font_map(&self) -> Option<pango::FontMap> {
1797        unsafe { from_glib_none(ffi::gtk_widget_get_font_map(self.as_ref().to_glib_none().0)) }
1798    }
1799
1800    /// Returns the [`cairo::FontOptions`][crate::cairo::FontOptions] of the widget.
1801    ///
1802    /// Seee [`set_font_options()`][Self::set_font_options()].
1803    ///
1804    /// # Deprecated since 4.16
1805    ///
1806    ///
1807    /// # Returns
1808    ///
1809    /// the [`cairo::FontOptions`][crate::cairo::FontOptions] of widget
1810    #[cfg_attr(feature = "v4_16", deprecated = "Since 4.16")]
1811    #[allow(deprecated)]
1812    #[doc(alias = "gtk_widget_get_font_options")]
1813    #[doc(alias = "get_font_options")]
1814    fn font_options(&self) -> Option<cairo::FontOptions> {
1815        unsafe {
1816            from_glib_none(ffi::gtk_widget_get_font_options(
1817                self.as_ref().to_glib_none().0,
1818            ))
1819        }
1820    }
1821
1822    /// Obtains the frame clock for a widget.
1823    ///
1824    /// The frame clock is a global “ticker” that can be used to drive
1825    /// animations and repaints. The most common reason to get the frame
1826    /// clock is to call [`FrameClock::frame_time()`][crate::gdk::FrameClock::frame_time()], in order
1827    /// to get a time to use for animating. For example you might record
1828    /// the start of the animation with an initial value from
1829    /// [`FrameClock::frame_time()`][crate::gdk::FrameClock::frame_time()], and then update the animation
1830    /// by calling [`FrameClock::frame_time()`][crate::gdk::FrameClock::frame_time()] again during each repaint.
1831    ///
1832    /// [`FrameClock::request_phase()`][crate::gdk::FrameClock::request_phase()] will result in a new frame on the
1833    /// clock, but won’t necessarily repaint any widgets. To repaint a widget,
1834    /// you have to use [`queue_draw()`][Self::queue_draw()] which invalidates the
1835    /// widget (thus scheduling it to receive a draw on the next frame).
1836    /// [`queue_draw()`][Self::queue_draw()] will also end up requesting a frame
1837    /// on the appropriate frame clock.
1838    ///
1839    /// A widget’s frame clock will not change while the widget is mapped.
1840    /// Reparenting a widget (which implies a temporary unmap) can change
1841    /// the widget’s frame clock.
1842    ///
1843    /// Unrealized widgets do not have a frame clock.
1844    ///
1845    /// # Returns
1846    ///
1847    /// the frame clock
1848    #[doc(alias = "gtk_widget_get_frame_clock")]
1849    #[doc(alias = "get_frame_clock")]
1850    fn frame_clock(&self) -> Option<gdk::FrameClock> {
1851        unsafe {
1852            from_glib_none(ffi::gtk_widget_get_frame_clock(
1853                self.as_ref().to_glib_none().0,
1854            ))
1855        }
1856    }
1857
1858    /// Gets the horizontal alignment of the widget.
1859    ///
1860    /// For backwards compatibility reasons this method will never return
1861    /// one of the baseline alignments, but instead it will convert it to
1862    /// [enum@Gtk.Align.fill] or [enum@Gtk.Align.center].
1863    ///
1864    /// Baselines are not supported for horizontal alignment.
1865    ///
1866    /// # Returns
1867    ///
1868    /// the horizontal alignment of @self
1869    #[doc(alias = "gtk_widget_get_halign")]
1870    #[doc(alias = "get_halign")]
1871    fn halign(&self) -> Align {
1872        unsafe { from_glib(ffi::gtk_widget_get_halign(self.as_ref().to_glib_none().0)) }
1873    }
1874
1875    /// Returns the current value of the `has-tooltip` property.
1876    ///
1877    /// # Returns
1878    ///
1879    /// current value of `has-tooltip` on @self
1880    #[doc(alias = "gtk_widget_get_has_tooltip")]
1881    #[doc(alias = "get_has_tooltip")]
1882    #[doc(alias = "has-tooltip")]
1883    fn has_tooltip(&self) -> bool {
1884        unsafe {
1885            from_glib(ffi::gtk_widget_get_has_tooltip(
1886                self.as_ref().to_glib_none().0,
1887            ))
1888        }
1889    }
1890
1891    /// Returns the content height of the widget.
1892    ///
1893    /// This function returns the height passed to its
1894    /// size-allocate implementation, which is the height you
1895    /// should be using in [`WidgetImpl::snapshot()`][crate::subclass::prelude::WidgetImpl::snapshot()].
1896    ///
1897    /// For pointer events, see [`contains()`][Self::contains()].
1898    ///
1899    /// To learn more about widget sizes, see the coordinate
1900    /// system [overview](coordinates.html).
1901    ///
1902    /// # Returns
1903    ///
1904    /// The height of @self
1905    #[doc(alias = "gtk_widget_get_height")]
1906    #[doc(alias = "get_height")]
1907    fn height(&self) -> i32 {
1908        unsafe { ffi::gtk_widget_get_height(self.as_ref().to_glib_none().0) }
1909    }
1910
1911    /// Gets whether the widget would like any available extra horizontal
1912    /// space.
1913    ///
1914    /// When a user resizes a window, widgets with expand set to true generally
1915    /// receive the extra space. For example, a list or scrollable area
1916    /// or document in your window would often be set to expand.
1917    ///
1918    /// Widgets with children should use [`compute_expand()`][Self::compute_expand()]
1919    /// rather than this function, to see whether any of its children,
1920    /// has the expand flag set. If any child of a widget wants to
1921    /// expand, the parent may ask to expand also.
1922    ///
1923    /// This function only looks at the widget’s own hexpand flag, rather
1924    /// than computing whether the entire widget tree rooted at this widget
1925    /// wants to expand.
1926    ///
1927    /// # Returns
1928    ///
1929    /// whether hexpand flag is set
1930    #[doc(alias = "gtk_widget_get_hexpand")]
1931    #[doc(alias = "get_hexpand")]
1932    #[doc(alias = "hexpand")]
1933    fn hexpands(&self) -> bool {
1934        unsafe { from_glib(ffi::gtk_widget_get_hexpand(self.as_ref().to_glib_none().0)) }
1935    }
1936
1937    /// Gets whether the `hexpand` flag has been explicitly set.
1938    ///
1939    /// If [`hexpand`][struct@crate::Widget#hexpand] property is set, then it
1940    /// overrides any computed expand value based on child widgets.
1941    /// If `hexpand` is not set, then the expand value depends on
1942    /// whether any children of the widget would like to expand.
1943    ///
1944    /// There are few reasons to use this function, but it’s here
1945    /// for completeness and consistency.
1946    ///
1947    /// # Returns
1948    ///
1949    /// whether hexpand has been explicitly set
1950    #[doc(alias = "gtk_widget_get_hexpand_set")]
1951    #[doc(alias = "get_hexpand_set")]
1952    #[doc(alias = "hexpand-set")]
1953    fn is_hexpand_set(&self) -> bool {
1954        unsafe {
1955            from_glib(ffi::gtk_widget_get_hexpand_set(
1956                self.as_ref().to_glib_none().0,
1957            ))
1958        }
1959    }
1960
1961    /// Returns the widget’s last child.
1962    ///
1963    /// This function is primarily meant for widget implementations.
1964    ///
1965    /// # Returns
1966    ///
1967    /// the widget's last child
1968    #[doc(alias = "gtk_widget_get_last_child")]
1969    #[doc(alias = "get_last_child")]
1970    #[must_use]
1971    fn last_child(&self) -> Option<Widget> {
1972        unsafe {
1973            from_glib_none(ffi::gtk_widget_get_last_child(
1974                self.as_ref().to_glib_none().0,
1975            ))
1976        }
1977    }
1978
1979    /// Retrieves the layout manager of the widget.
1980    ///
1981    /// See [`set_layout_manager()`][Self::set_layout_manager()].
1982    ///
1983    /// # Returns
1984    ///
1985    /// the layout manager of @self
1986    #[doc(alias = "gtk_widget_get_layout_manager")]
1987    #[doc(alias = "get_layout_manager")]
1988    #[doc(alias = "layout-manager")]
1989    fn layout_manager(&self) -> Option<LayoutManager> {
1990        unsafe {
1991            from_glib_none(ffi::gtk_widget_get_layout_manager(
1992                self.as_ref().to_glib_none().0,
1993            ))
1994        }
1995    }
1996
1997    /// Gets the value of the [`limit-events`][struct@crate::Widget#limit-events] property.
1998    #[cfg(feature = "v4_18")]
1999    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
2000    #[doc(alias = "gtk_widget_get_limit_events")]
2001    #[doc(alias = "get_limit_events")]
2002    #[doc(alias = "limit-events")]
2003    fn is_limit_events(&self) -> bool {
2004        unsafe {
2005            from_glib(ffi::gtk_widget_get_limit_events(
2006                self.as_ref().to_glib_none().0,
2007            ))
2008        }
2009    }
2010
2011    /// Returns whether the widget is mapped.
2012    ///
2013    /// # Returns
2014    ///
2015    /// true if the widget is mapped
2016    #[doc(alias = "gtk_widget_get_mapped")]
2017    #[doc(alias = "get_mapped")]
2018    fn is_mapped(&self) -> bool {
2019        unsafe { from_glib(ffi::gtk_widget_get_mapped(self.as_ref().to_glib_none().0)) }
2020    }
2021
2022    /// Gets the bottom margin of the widget.
2023    ///
2024    /// # Returns
2025    ///
2026    /// The bottom margin of @self
2027    #[doc(alias = "gtk_widget_get_margin_bottom")]
2028    #[doc(alias = "get_margin_bottom")]
2029    #[doc(alias = "margin-bottom")]
2030    fn margin_bottom(&self) -> i32 {
2031        unsafe { ffi::gtk_widget_get_margin_bottom(self.as_ref().to_glib_none().0) }
2032    }
2033
2034    /// Gets the end margin of the widget.
2035    ///
2036    /// # Returns
2037    ///
2038    /// The end margin of @self
2039    #[doc(alias = "gtk_widget_get_margin_end")]
2040    #[doc(alias = "get_margin_end")]
2041    #[doc(alias = "margin-end")]
2042    fn margin_end(&self) -> i32 {
2043        unsafe { ffi::gtk_widget_get_margin_end(self.as_ref().to_glib_none().0) }
2044    }
2045
2046    /// Gets the start margin of the widget.
2047    ///
2048    /// # Returns
2049    ///
2050    /// The start margin of @self
2051    #[doc(alias = "gtk_widget_get_margin_start")]
2052    #[doc(alias = "get_margin_start")]
2053    #[doc(alias = "margin-start")]
2054    fn margin_start(&self) -> i32 {
2055        unsafe { ffi::gtk_widget_get_margin_start(self.as_ref().to_glib_none().0) }
2056    }
2057
2058    /// Gets the top margin of the widget.
2059    ///
2060    /// # Returns
2061    ///
2062    /// The top margin of @self
2063    #[doc(alias = "gtk_widget_get_margin_top")]
2064    #[doc(alias = "get_margin_top")]
2065    #[doc(alias = "margin-top")]
2066    fn margin_top(&self) -> i32 {
2067        unsafe { ffi::gtk_widget_get_margin_top(self.as_ref().to_glib_none().0) }
2068    }
2069
2070    /// Retrieves the name of a widget.
2071    ///
2072    /// See [`set_widget_name()`][Self::set_widget_name()] for the significance of widget names.
2073    ///
2074    /// # Returns
2075    ///
2076    /// name of the widget
2077    #[doc(alias = "gtk_widget_get_name")]
2078    #[doc(alias = "get_name")]
2079    #[doc(alias = "name")]
2080    fn widget_name(&self) -> glib::GString {
2081        unsafe { from_glib_none(ffi::gtk_widget_get_name(self.as_ref().to_glib_none().0)) }
2082    }
2083
2084    /// Returns the nearest [`Native`][crate::Native] ancestor of the widget.
2085    ///
2086    /// This function will return `NULL` if the widget is not
2087    /// contained inside a widget tree with a native ancestor.
2088    ///
2089    /// [`Native`][crate::Native] widgets will return themselves here.
2090    ///
2091    /// # Returns
2092    ///
2093    /// the [`Native`][crate::Native] ancestor of @self
2094    #[doc(alias = "gtk_widget_get_native")]
2095    #[doc(alias = "get_native")]
2096    fn native(&self) -> Option<Native> {
2097        unsafe { from_glib_none(ffi::gtk_widget_get_native(self.as_ref().to_glib_none().0)) }
2098    }
2099
2100    /// Returns the widget’s next sibling.
2101    ///
2102    /// This function is primarily meant for widget implementations.
2103    ///
2104    /// # Returns
2105    ///
2106    /// the widget's next sibling
2107    #[doc(alias = "gtk_widget_get_next_sibling")]
2108    #[doc(alias = "get_next_sibling")]
2109    #[must_use]
2110    fn next_sibling(&self) -> Option<Widget> {
2111        unsafe {
2112            from_glib_none(ffi::gtk_widget_get_next_sibling(
2113                self.as_ref().to_glib_none().0,
2114            ))
2115        }
2116    }
2117
2118    /// Fetches the requested opacity for the widget.
2119    ///
2120    /// See [`set_opacity()`][Self::set_opacity()].
2121    ///
2122    /// # Returns
2123    ///
2124    /// the requested opacity for this widget
2125    #[doc(alias = "gtk_widget_get_opacity")]
2126    #[doc(alias = "get_opacity")]
2127    fn opacity(&self) -> f64 {
2128        unsafe { ffi::gtk_widget_get_opacity(self.as_ref().to_glib_none().0) }
2129    }
2130
2131    /// Returns the widget’s overflow value.
2132    ///
2133    /// # Returns
2134    ///
2135    /// The widget's overflow value
2136    #[doc(alias = "gtk_widget_get_overflow")]
2137    #[doc(alias = "get_overflow")]
2138    fn overflow(&self) -> Overflow {
2139        unsafe { from_glib(ffi::gtk_widget_get_overflow(self.as_ref().to_glib_none().0)) }
2140    }
2141
2142    /// Gets a [`pango::Context`][crate::pango::Context] that is configured for the widget.
2143    ///
2144    /// The [`pango::Context`][crate::pango::Context] will have the appropriate font map, font description,
2145    /// and base direction set.
2146    ///
2147    /// Unlike the context returned by [`create_pango_context()`][Self::create_pango_context()],
2148    /// this context is owned by the widget (it can be used until the screen
2149    /// for the widget changes or the widget is removed from its toplevel),
2150    /// and will be updated to match any changes to the widget’s attributes.
2151    /// This can be tracked by listening to changes of the
2152    /// [`root`][struct@crate::Widget#root] property on the widget.
2153    ///
2154    /// # Returns
2155    ///
2156    /// the [`pango::Context`][crate::pango::Context] for the widget
2157    #[doc(alias = "gtk_widget_get_pango_context")]
2158    #[doc(alias = "get_pango_context")]
2159    fn pango_context(&self) -> pango::Context {
2160        unsafe {
2161            from_glib_none(ffi::gtk_widget_get_pango_context(
2162                self.as_ref().to_glib_none().0,
2163            ))
2164        }
2165    }
2166
2167    /// Returns the parent widget of the widget.
2168    ///
2169    /// # Returns
2170    ///
2171    /// the parent widget of @self
2172    #[doc(alias = "gtk_widget_get_parent")]
2173    #[doc(alias = "get_parent")]
2174    #[must_use]
2175    fn parent(&self) -> Option<Widget> {
2176        unsafe { from_glib_none(ffi::gtk_widget_get_parent(self.as_ref().to_glib_none().0)) }
2177    }
2178
2179    /// Retrieves the minimum and natural size of a widget, taking
2180    /// into account the widget’s preference for height-for-width management.
2181    ///
2182    /// This is used to retrieve a suitable size by container widgets which do
2183    /// not impose any restrictions on the child placement. It can be used
2184    /// to deduce toplevel window and menu sizes as well as child widgets in
2185    /// free-form containers such as [`Fixed`][crate::Fixed].
2186    ///
2187    /// Handle with care. Note that the natural height of a height-for-width
2188    /// widget will generally be a smaller size than the minimum height, since
2189    /// the required height for the natural width is generally smaller than the
2190    /// required height for the minimum width.
2191    ///
2192    /// Use [`measure()`][Self::measure()] if you want to support baseline alignment.
2193    ///
2194    /// # Returns
2195    ///
2196    ///
2197    /// ## `minimum_size`
2198    /// location for storing the minimum size
2199    ///
2200    /// ## `natural_size`
2201    /// location for storing the natural size
2202    #[doc(alias = "gtk_widget_get_preferred_size")]
2203    #[doc(alias = "get_preferred_size")]
2204    fn preferred_size(&self) -> (Requisition, Requisition) {
2205        unsafe {
2206            let mut minimum_size = Requisition::uninitialized();
2207            let mut natural_size = Requisition::uninitialized();
2208            ffi::gtk_widget_get_preferred_size(
2209                self.as_ref().to_glib_none().0,
2210                minimum_size.to_glib_none_mut().0,
2211                natural_size.to_glib_none_mut().0,
2212            );
2213            (minimum_size, natural_size)
2214        }
2215    }
2216
2217    /// Returns the widget’s previous sibling.
2218    ///
2219    /// This function is primarily meant for widget implementations.
2220    ///
2221    /// # Returns
2222    ///
2223    /// the widget's previous sibling
2224    #[doc(alias = "gtk_widget_get_prev_sibling")]
2225    #[doc(alias = "get_prev_sibling")]
2226    #[must_use]
2227    fn prev_sibling(&self) -> Option<Widget> {
2228        unsafe {
2229            from_glib_none(ffi::gtk_widget_get_prev_sibling(
2230                self.as_ref().to_glib_none().0,
2231            ))
2232        }
2233    }
2234
2235    /// Gets the primary clipboard of the widget.
2236    ///
2237    /// This is a utility function to get the primary clipboard object
2238    /// for the display that @self is using.
2239    ///
2240    /// Note that this function always works, even when @self is not
2241    /// realized yet.
2242    ///
2243    /// # Returns
2244    ///
2245    /// the appropriate clipboard object
2246    #[doc(alias = "gtk_widget_get_primary_clipboard")]
2247    #[doc(alias = "get_primary_clipboard")]
2248    fn primary_clipboard(&self) -> gdk::Clipboard {
2249        unsafe {
2250            from_glib_none(ffi::gtk_widget_get_primary_clipboard(
2251                self.as_ref().to_glib_none().0,
2252            ))
2253        }
2254    }
2255
2256    /// Determines whether the widget is realized.
2257    ///
2258    /// # Returns
2259    ///
2260    /// true if @self is realized
2261    #[doc(alias = "gtk_widget_get_realized")]
2262    #[doc(alias = "get_realized")]
2263    fn is_realized(&self) -> bool {
2264        unsafe { from_glib(ffi::gtk_widget_get_realized(self.as_ref().to_glib_none().0)) }
2265    }
2266
2267    /// Determines whether the widget is always treated as the default widget
2268    /// within its toplevel when it has the focus, even if another widget
2269    /// is the default.
2270    ///
2271    /// See [`set_receives_default()`][Self::set_receives_default()].
2272    ///
2273    /// # Returns
2274    ///
2275    /// true if @self acts as the default widget when focused
2276    #[doc(alias = "gtk_widget_get_receives_default")]
2277    #[doc(alias = "get_receives_default")]
2278    #[doc(alias = "receives-default")]
2279    fn receives_default(&self) -> bool {
2280        unsafe {
2281            from_glib(ffi::gtk_widget_get_receives_default(
2282                self.as_ref().to_glib_none().0,
2283            ))
2284        }
2285    }
2286
2287    /// Gets whether the widget prefers a height-for-width layout
2288    /// or a width-for-height layout.
2289    ///
2290    /// Single-child widgets generally propagate the preference of
2291    /// their child, more complex widgets need to request something
2292    /// either in context of their children or in context of their
2293    /// allocation capabilities.
2294    ///
2295    /// # Returns
2296    ///
2297    /// The [`SizeRequestMode`][crate::SizeRequestMode] preferred by @self.
2298    #[doc(alias = "gtk_widget_get_request_mode")]
2299    #[doc(alias = "get_request_mode")]
2300    fn request_mode(&self) -> SizeRequestMode {
2301        unsafe {
2302            from_glib(ffi::gtk_widget_get_request_mode(
2303                self.as_ref().to_glib_none().0,
2304            ))
2305        }
2306    }
2307
2308    /// Returns the [`Root`][crate::Root] widget of the widget.
2309    ///
2310    /// This function will return `NULL` if the widget is not contained
2311    /// inside a widget tree with a root widget.
2312    ///
2313    /// [`Root`][crate::Root] widgets will return themselves here.
2314    ///
2315    /// # Returns
2316    ///
2317    /// the root widget of @self
2318    #[doc(alias = "gtk_widget_get_root")]
2319    #[doc(alias = "get_root")]
2320    fn root(&self) -> Option<Root> {
2321        unsafe { from_glib_none(ffi::gtk_widget_get_root(self.as_ref().to_glib_none().0)) }
2322    }
2323
2324    /// Retrieves the internal scale factor that maps from window
2325    /// coordinates to the actual device pixels.
2326    ///
2327    /// On traditional systems this is 1, on high density outputs,
2328    /// it can be a higher value (typically 2).
2329    ///
2330    /// See `Gdk::Surface::get_scale_factor()`.
2331    ///
2332    /// Note that modern systems may support *fractional* scaling,
2333    /// where the scale factor is not an integer. On such systems,
2334    /// this function will return the next higher integer value,
2335    /// but you probably want to use [`SurfaceExtManual::scale()`][crate::gdk::prelude::SurfaceExtManual::scale()]
2336    /// to get the fractional scale value.
2337    ///
2338    /// # Returns
2339    ///
2340    /// the scale factor for @self
2341    #[doc(alias = "gtk_widget_get_scale_factor")]
2342    #[doc(alias = "get_scale_factor")]
2343    #[doc(alias = "scale-factor")]
2344    fn scale_factor(&self) -> i32 {
2345        unsafe { ffi::gtk_widget_get_scale_factor(self.as_ref().to_glib_none().0) }
2346    }
2347
2348    /// Returns the widget’s sensitivity.
2349    ///
2350    /// This function returns the value that has been set using
2351    /// [`set_sensitive()`][Self::set_sensitive()]).
2352    ///
2353    /// The effective sensitivity of a widget is however determined
2354    /// by both its own and its parent widget’s sensitivity.
2355    /// See [`is_sensitive()`][Self::is_sensitive()].
2356    ///
2357    /// # Returns
2358    ///
2359    /// true if the widget is sensitive
2360    #[doc(alias = "gtk_widget_get_sensitive")]
2361    #[doc(alias = "sensitive")]
2362    fn get_sensitive(&self) -> bool {
2363        unsafe {
2364            from_glib(ffi::gtk_widget_get_sensitive(
2365                self.as_ref().to_glib_none().0,
2366            ))
2367        }
2368    }
2369
2370    /// Gets the settings object holding the settings used for the widget.
2371    ///
2372    /// Note that this function can only be called when the [`Widget`][crate::Widget]
2373    /// is attached to a toplevel, since the settings object is specific
2374    /// to a particular display. If you want to monitor the widget for
2375    /// changes in its settings, connect to the `notify::display` signal.
2376    ///
2377    /// # Returns
2378    ///
2379    /// the relevant settings object
2380    #[doc(alias = "gtk_widget_get_settings")]
2381    #[doc(alias = "get_settings")]
2382    fn settings(&self) -> Settings {
2383        unsafe { from_glib_none(ffi::gtk_widget_get_settings(self.as_ref().to_glib_none().0)) }
2384    }
2385
2386    /// Returns the content width or height of the widget.
2387    ///
2388    /// Which dimension is returned depends on @orientation.
2389    ///
2390    /// This is equivalent to calling [`width()`][Self::width()]
2391    /// for [enum@Gtk.Orientation.horizontal] or [`height()`][Self::height()]
2392    /// for [enum@Gtk.Orientation.vertical], but can be used when
2393    /// writing orientation-independent code, such as when
2394    /// implementing [`Orientable`][crate::Orientable] widgets.
2395    ///
2396    /// To learn more about widget sizes, see the coordinate
2397    /// system [overview](coordinates.html).
2398    /// ## `orientation`
2399    /// the orientation to query
2400    ///
2401    /// # Returns
2402    ///
2403    /// the size of @self in @orientation
2404    #[doc(alias = "gtk_widget_get_size")]
2405    #[doc(alias = "get_size")]
2406    fn size(&self, orientation: Orientation) -> i32 {
2407        unsafe { ffi::gtk_widget_get_size(self.as_ref().to_glib_none().0, orientation.into_glib()) }
2408    }
2409
2410    /// Gets the size request that was explicitly set for the widget.
2411    ///
2412    /// A value of -1 stored in @width or @height indicates that that
2413    /// dimension has not been set explicitly and the natural requisition
2414    /// of the widget will be used instead.
2415    ///
2416    /// See [`set_size_request()`][Self::set_size_request()].
2417    ///
2418    /// To get the size a widget will actually request, call
2419    /// [`measure()`][Self::measure()] instead of this function.
2420    ///
2421    /// # Returns
2422    ///
2423    ///
2424    /// ## `width`
2425    /// return location for width
2426    ///
2427    /// ## `height`
2428    /// return location for height
2429    #[doc(alias = "gtk_widget_get_size_request")]
2430    #[doc(alias = "get_size_request")]
2431    fn size_request(&self) -> (i32, i32) {
2432        unsafe {
2433            let mut width = std::mem::MaybeUninit::uninit();
2434            let mut height = std::mem::MaybeUninit::uninit();
2435            ffi::gtk_widget_get_size_request(
2436                self.as_ref().to_glib_none().0,
2437                width.as_mut_ptr(),
2438                height.as_mut_ptr(),
2439            );
2440            (width.assume_init(), height.assume_init())
2441        }
2442    }
2443
2444    /// Returns the widget state as a flag set.
2445    ///
2446    /// It is worth mentioning that the effective [flags@Gtk.StateFlags.insensitive]
2447    /// state will be returned, that is, also based on parent insensitivity,
2448    /// even if @self itself is sensitive.
2449    ///
2450    /// Also note that if you are looking for a way to obtain the
2451    /// [`StateFlags`][crate::StateFlags] to pass to a [`StyleContext`][crate::StyleContext]
2452    /// method, you should look at [`StyleContextExt::state()`][crate::prelude::StyleContextExt::state()].
2453    ///
2454    /// # Returns
2455    ///
2456    /// the state flags of widget
2457    #[doc(alias = "gtk_widget_get_state_flags")]
2458    #[doc(alias = "get_state_flags")]
2459    fn state_flags(&self) -> StateFlags {
2460        unsafe {
2461            from_glib(ffi::gtk_widget_get_state_flags(
2462                self.as_ref().to_glib_none().0,
2463            ))
2464        }
2465    }
2466
2467    /// Returns the style context associated to the widget.
2468    ///
2469    /// The returned object is guaranteed to be the same
2470    /// for the lifetime of @self.
2471    ///
2472    /// # Deprecated since 4.10
2473    ///
2474    /// Style contexts will be removed in GTK 5
2475    ///
2476    /// # Returns
2477    ///
2478    /// the widgets style context
2479    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2480    #[allow(deprecated)]
2481    #[doc(alias = "gtk_widget_get_style_context")]
2482    #[doc(alias = "get_style_context")]
2483    fn style_context(&self) -> StyleContext {
2484        unsafe {
2485            from_glib_none(ffi::gtk_widget_get_style_context(
2486                self.as_ref().to_glib_none().0,
2487            ))
2488        }
2489    }
2490
2491    /// Gets the contents of the tooltip for the widget.
2492    ///
2493    /// If the tooltip has not been set using
2494    /// [`set_tooltip_markup()`][Self::set_tooltip_markup()], this
2495    /// function returns `NULL`.
2496    ///
2497    /// # Returns
2498    ///
2499    /// the tooltip text
2500    #[doc(alias = "gtk_widget_get_tooltip_markup")]
2501    #[doc(alias = "get_tooltip_markup")]
2502    #[doc(alias = "tooltip-markup")]
2503    fn tooltip_markup(&self) -> Option<glib::GString> {
2504        unsafe {
2505            from_glib_none(ffi::gtk_widget_get_tooltip_markup(
2506                self.as_ref().to_glib_none().0,
2507            ))
2508        }
2509    }
2510
2511    /// Gets the contents of the tooltip for the widget.
2512    ///
2513    /// If the @self's tooltip was set using
2514    /// [`set_tooltip_markup()`][Self::set_tooltip_markup()],
2515    /// this function will return the escaped text.
2516    ///
2517    /// # Returns
2518    ///
2519    /// the tooltip text
2520    #[doc(alias = "gtk_widget_get_tooltip_text")]
2521    #[doc(alias = "get_tooltip_text")]
2522    #[doc(alias = "tooltip-text")]
2523    fn tooltip_text(&self) -> Option<glib::GString> {
2524        unsafe {
2525            from_glib_none(ffi::gtk_widget_get_tooltip_text(
2526                self.as_ref().to_glib_none().0,
2527            ))
2528        }
2529    }
2530
2531    /// Gets the vertical alignment of the widget.
2532    ///
2533    /// # Returns
2534    ///
2535    /// the vertical alignment of @self
2536    #[doc(alias = "gtk_widget_get_valign")]
2537    #[doc(alias = "get_valign")]
2538    fn valign(&self) -> Align {
2539        unsafe { from_glib(ffi::gtk_widget_get_valign(self.as_ref().to_glib_none().0)) }
2540    }
2541
2542    /// Gets whether the widget would like any available extra vertical
2543    /// space.
2544    ///
2545    /// See [`hexpands()`][Self::hexpands()] for more detail.
2546    ///
2547    /// # Returns
2548    ///
2549    /// whether vexpand flag is set
2550    #[doc(alias = "gtk_widget_get_vexpand")]
2551    #[doc(alias = "get_vexpand")]
2552    #[doc(alias = "vexpand")]
2553    fn vexpands(&self) -> bool {
2554        unsafe { from_glib(ffi::gtk_widget_get_vexpand(self.as_ref().to_glib_none().0)) }
2555    }
2556
2557    /// Gets whether the `vexpand` flag has been explicitly set.
2558    ///
2559    /// See [`is_hexpand_set()`][Self::is_hexpand_set()] for more detail.
2560    ///
2561    /// # Returns
2562    ///
2563    /// whether vexpand has been explicitly set
2564    #[doc(alias = "gtk_widget_get_vexpand_set")]
2565    #[doc(alias = "get_vexpand_set")]
2566    #[doc(alias = "vexpand-set")]
2567    fn is_vexpand_set(&self) -> bool {
2568        unsafe {
2569            from_glib(ffi::gtk_widget_get_vexpand_set(
2570                self.as_ref().to_glib_none().0,
2571            ))
2572        }
2573    }
2574
2575    /// Determines whether the widget is visible.
2576    ///
2577    /// If you want to take into account whether the widget’s
2578    /// parent is also marked as visible, use
2579    /// [`is_visible()`][Self::is_visible()] instead.
2580    ///
2581    /// This function does not check if the widget is
2582    /// obscured in any way.
2583    ///
2584    /// See [`set_visible()`][Self::set_visible()].
2585    ///
2586    /// # Returns
2587    ///
2588    /// true if the widget is visible
2589    #[doc(alias = "gtk_widget_get_visible")]
2590    #[doc(alias = "visible")]
2591    fn get_visible(&self) -> bool {
2592        unsafe { from_glib(ffi::gtk_widget_get_visible(self.as_ref().to_glib_none().0)) }
2593    }
2594
2595    /// Returns the content width of the widget.
2596    ///
2597    /// This function returns the width passed to its
2598    /// size-allocate implementation, which is the width you
2599    /// should be using in [`WidgetImpl::snapshot()`][crate::subclass::prelude::WidgetImpl::snapshot()].
2600    ///
2601    /// For pointer events, see [`contains()`][Self::contains()].
2602    ///
2603    /// To learn more about widget sizes, see the coordinate
2604    /// system [overview](coordinates.html).
2605    ///
2606    /// # Returns
2607    ///
2608    /// The width of @self
2609    #[doc(alias = "gtk_widget_get_width")]
2610    #[doc(alias = "get_width")]
2611    fn width(&self) -> i32 {
2612        unsafe { ffi::gtk_widget_get_width(self.as_ref().to_glib_none().0) }
2613    }
2614
2615    /// Causes @self to have the keyboard focus for the window
2616    /// that it belongs to.
2617    ///
2618    /// If @self is not focusable, or its [`WidgetImpl::grab_focus()`][crate::subclass::prelude::WidgetImpl::grab_focus()]
2619    /// implementation cannot transfer the focus to a descendant of @self
2620    /// that is focusable, it will not take focus and false will be returned.
2621    ///
2622    /// Calling [`grab_focus()`][Self::grab_focus()] on an already focused widget
2623    /// is allowed, should not have an effect, and return true.
2624    ///
2625    /// # Returns
2626    ///
2627    /// true if focus is now inside @self
2628    #[doc(alias = "gtk_widget_grab_focus")]
2629    fn grab_focus(&self) -> bool {
2630        unsafe { from_glib(ffi::gtk_widget_grab_focus(self.as_ref().to_glib_none().0)) }
2631    }
2632
2633    /// Returns whether a style class is currently applied to the widget.
2634    /// ## `css_class`
2635    /// style class, without the leading period
2636    ///
2637    /// # Returns
2638    ///
2639    /// true if @css_class is currently applied to @self
2640    #[doc(alias = "gtk_widget_has_css_class")]
2641    fn has_css_class(&self, css_class: &str) -> bool {
2642        unsafe {
2643            from_glib(ffi::gtk_widget_has_css_class(
2644                self.as_ref().to_glib_none().0,
2645                css_class.to_glib_none().0,
2646            ))
2647        }
2648    }
2649
2650    /// Determines whether the widget is the current default widget
2651    /// within its toplevel.
2652    ///
2653    /// # Returns
2654    ///
2655    /// true if @self is the current default widget
2656    ///   within its toplevel
2657    #[doc(alias = "gtk_widget_has_default")]
2658    #[doc(alias = "has-default")]
2659    fn has_default(&self) -> bool {
2660        unsafe { from_glib(ffi::gtk_widget_has_default(self.as_ref().to_glib_none().0)) }
2661    }
2662
2663    /// Determines if the widget has the global input focus.
2664    ///
2665    /// See [`is_focus()`][Self::is_focus()] for the difference between
2666    /// having the global input focus, and only having the focus
2667    /// within a toplevel.
2668    ///
2669    /// # Returns
2670    ///
2671    /// true if the widget has the global input focus
2672    #[doc(alias = "gtk_widget_has_focus")]
2673    #[doc(alias = "has-focus")]
2674    fn has_focus(&self) -> bool {
2675        unsafe { from_glib(ffi::gtk_widget_has_focus(self.as_ref().to_glib_none().0)) }
2676    }
2677
2678    /// Determines if the widget should show a visible indication that
2679    /// it has the global input focus.
2680    ///
2681    /// This is a convenience function that takes into account whether
2682    /// focus indication should currently be shown in the toplevel window
2683    /// of @self. See [`GtkWindowExt::gets_focus_visible()`][crate::prelude::GtkWindowExt::gets_focus_visible()] for more
2684    /// information about focus indication.
2685    ///
2686    /// To find out if the widget has the global input focus, use
2687    /// [`has_focus()`][Self::has_focus()].
2688    ///
2689    /// # Returns
2690    ///
2691    /// true if the widget should display a “focus rectangle”
2692    #[doc(alias = "gtk_widget_has_visible_focus")]
2693    fn has_visible_focus(&self) -> bool {
2694        unsafe {
2695            from_glib(ffi::gtk_widget_has_visible_focus(
2696                self.as_ref().to_glib_none().0,
2697            ))
2698        }
2699    }
2700
2701    /// Reverses the effects of [method.Gtk.Widget.show].
2702    ///
2703    /// This is causing the widget to be hidden (invisible to the user).
2704    ///
2705    /// # Deprecated since 4.10
2706    ///
2707    /// Use [`set_visible()`][Self::set_visible()] instead
2708    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2709    #[allow(deprecated)]
2710    #[doc(alias = "gtk_widget_hide")]
2711    fn hide(&self) {
2712        unsafe {
2713            ffi::gtk_widget_hide(self.as_ref().to_glib_none().0);
2714        }
2715    }
2716
2717    /// Returns whether the widget is currently being destroyed.
2718    ///
2719    /// This information can sometimes be used to avoid doing
2720    /// unnecessary work.
2721    ///
2722    /// # Returns
2723    ///
2724    /// true if @self is being destroyed
2725    #[doc(alias = "gtk_widget_in_destruction")]
2726    fn in_destruction(&self) -> bool {
2727        unsafe {
2728            from_glib(ffi::gtk_widget_in_destruction(
2729                self.as_ref().to_glib_none().0,
2730            ))
2731        }
2732    }
2733
2734    /// Inserts an action group into the widget's actions.
2735    ///
2736    /// Children of @self that implement [`Actionable`][crate::Actionable] can
2737    /// then be associated with actions in @group by setting their
2738    /// “action-name” to @prefix.`action-name`.
2739    ///
2740    /// Note that inheritance is defined for individual actions. I.e.
2741    /// even if you insert a group with prefix @prefix, actions with
2742    /// the same prefix will still be inherited from the parent, unless
2743    /// the group contains an action with the same name.
2744    ///
2745    /// If @group is `NULL`, a previously inserted group for @name is
2746    /// removed from @self.
2747    /// ## `name`
2748    /// the prefix for actions in @group
2749    /// ## `group`
2750    /// an action group
2751    #[doc(alias = "gtk_widget_insert_action_group")]
2752    fn insert_action_group(&self, name: &str, group: Option<&impl IsA<gio::ActionGroup>>) {
2753        unsafe {
2754            ffi::gtk_widget_insert_action_group(
2755                self.as_ref().to_glib_none().0,
2756                name.to_glib_none().0,
2757                group.map(|p| p.as_ref()).to_glib_none().0,
2758            );
2759        }
2760    }
2761
2762    /// Sets the parent widget of the widget.
2763    ///
2764    /// In contrast to [`set_parent()`][Self::set_parent()], this function
2765    /// inserts @self at a specific position into the list of children
2766    /// of the @parent widget.
2767    ///
2768    /// It will be placed after @previous_sibling, or at the beginning if
2769    /// @previous_sibling is `NULL`.
2770    ///
2771    /// After calling this function, `gtk_widget_get_prev_sibling (widget)`
2772    /// will return @previous_sibling.
2773    ///
2774    /// If @parent is already set as the parent widget of @self, this
2775    /// function can also be used to reorder @self in the child widget
2776    /// list of @parent.
2777    ///
2778    /// This function is primarily meant for widget implementations; if you are
2779    /// just using a widget, you *must* use its own API for adding children.
2780    /// ## `parent`
2781    /// the parent widget to insert @self into
2782    /// ## `previous_sibling`
2783    /// the new previous sibling of @self
2784    #[doc(alias = "gtk_widget_insert_after")]
2785    fn insert_after(&self, parent: &impl IsA<Widget>, previous_sibling: Option<&impl IsA<Widget>>) {
2786        unsafe {
2787            ffi::gtk_widget_insert_after(
2788                self.as_ref().to_glib_none().0,
2789                parent.as_ref().to_glib_none().0,
2790                previous_sibling.map(|p| p.as_ref()).to_glib_none().0,
2791            );
2792        }
2793    }
2794
2795    /// Sets the parent widget of the widget.
2796    ///
2797    /// In contrast to [`set_parent()`][Self::set_parent()], this function
2798    /// inserts @self at a specific position into the list of children
2799    /// of the @parent widget.
2800    ///
2801    /// It will be placed before @next_sibling, or at the end if
2802    /// @next_sibling is `NULL`.
2803    ///
2804    /// After calling this function, `gtk_widget_get_next_sibling (widget)`
2805    /// will return @next_sibling.
2806    ///
2807    /// If @parent is already set as the parent widget of @self, this function
2808    /// can also be used to reorder @self in the child widget list of @parent.
2809    ///
2810    /// This function is primarily meant for widget implementations; if you are
2811    /// just using a widget, you *must* use its own API for adding children.
2812    /// ## `parent`
2813    /// the parent widget to insert @self into
2814    /// ## `next_sibling`
2815    /// the new next sibling of @self
2816    #[doc(alias = "gtk_widget_insert_before")]
2817    fn insert_before(&self, parent: &impl IsA<Widget>, next_sibling: Option<&impl IsA<Widget>>) {
2818        unsafe {
2819            ffi::gtk_widget_insert_before(
2820                self.as_ref().to_glib_none().0,
2821                parent.as_ref().to_glib_none().0,
2822                next_sibling.map(|p| p.as_ref()).to_glib_none().0,
2823            );
2824        }
2825    }
2826
2827    /// Determines whether the widget is a descendent of @ancestor.
2828    /// ## `ancestor`
2829    /// another [`Widget`][crate::Widget]
2830    ///
2831    /// # Returns
2832    ///
2833    /// true if @ancestor contains @self as a child,
2834    ///   grandchild, great grandchild, etc
2835    #[doc(alias = "gtk_widget_is_ancestor")]
2836    fn is_ancestor(&self, ancestor: &impl IsA<Widget>) -> bool {
2837        unsafe {
2838            from_glib(ffi::gtk_widget_is_ancestor(
2839                self.as_ref().to_glib_none().0,
2840                ancestor.as_ref().to_glib_none().0,
2841            ))
2842        }
2843    }
2844
2845    /// Determines whether the widget can be drawn to.
2846    ///
2847    /// A widget can be drawn if it is mapped and visible.
2848    ///
2849    /// # Returns
2850    ///
2851    /// true if @self is drawable
2852    #[doc(alias = "gtk_widget_is_drawable")]
2853    fn is_drawable(&self) -> bool {
2854        unsafe { from_glib(ffi::gtk_widget_is_drawable(self.as_ref().to_glib_none().0)) }
2855    }
2856
2857    /// Determines if the widget is the focus widget within its
2858    /// toplevel.
2859    ///
2860    /// This does not mean that the [`has-focus`][struct@crate::Widget#has-focus]
2861    /// property is necessarily set; [`has-focus`][struct@crate::Widget#has-focus]
2862    /// will only be set if the toplevel widget additionally has the
2863    /// global input focus.
2864    ///
2865    /// # Returns
2866    ///
2867    /// true if the widget is the focus widget
2868    #[doc(alias = "gtk_widget_is_focus")]
2869    fn is_focus(&self) -> bool {
2870        unsafe { from_glib(ffi::gtk_widget_is_focus(self.as_ref().to_glib_none().0)) }
2871    }
2872
2873    /// Returns the widget’s effective sensitivity.
2874    ///
2875    /// This means it is sensitive itself and also its
2876    /// parent widget is sensitive.
2877    ///
2878    /// # Returns
2879    ///
2880    /// true if the widget is effectively sensitive
2881    #[doc(alias = "gtk_widget_is_sensitive")]
2882    #[doc(alias = "sensitive")]
2883    fn is_sensitive(&self) -> bool {
2884        unsafe { from_glib(ffi::gtk_widget_is_sensitive(self.as_ref().to_glib_none().0)) }
2885    }
2886
2887    /// Determines whether the widget and all its parents are marked as
2888    /// visible.
2889    ///
2890    /// This function does not check if the widget is obscured in any way.
2891    ///
2892    /// See also [`get_visible()`][Self::get_visible()] and
2893    /// [`set_visible()`][Self::set_visible()].
2894    ///
2895    /// # Returns
2896    ///
2897    /// true if the widget and all its parents are visible
2898    #[doc(alias = "gtk_widget_is_visible")]
2899    #[doc(alias = "visible")]
2900    fn is_visible(&self) -> bool {
2901        unsafe { from_glib(ffi::gtk_widget_is_visible(self.as_ref().to_glib_none().0)) }
2902    }
2903
2904    /// Emits the [`keynav-failed`][struct@crate::Widget#keynav-failed] signal on the widget.
2905    ///
2906    /// This function should be called whenever keyboard navigation
2907    /// within a single widget hits a boundary.
2908    ///
2909    /// The return value of this function should be interpreted
2910    /// in a way similar to the return value of
2911    /// [`child_focus()`][Self::child_focus()]. When true is returned,
2912    /// stay in the widget, the failed keyboard navigation is ok
2913    /// and/or there is nowhere we can/should move the focus to.
2914    /// When false is returned, the caller should continue with
2915    /// keyboard navigation outside the widget, e.g. by calling
2916    /// [`child_focus()`][Self::child_focus()] on the widget’s toplevel.
2917    ///
2918    /// The default [`keynav-failed`][struct@crate::Widget#keynav-failed] handler returns
2919    /// false for [enum@Gtk.DirectionType.tab-forward] and
2920    /// [enum@Gtk.DirectionType.tab-backward]. For the other values
2921    /// of [`DirectionType`][crate::DirectionType] it returns true.
2922    ///
2923    /// Whenever the default handler returns true, it also calls
2924    /// [`error_bell()`][Self::error_bell()] to notify the user of the
2925    /// failed keyboard navigation.
2926    ///
2927    /// A use case for providing an own implementation of `::keynav-failed`
2928    /// (either by connecting to it or by overriding it) would be a row of
2929    /// [`Entry`][crate::Entry] widgets where the user should be able to navigate
2930    /// the entire row with the cursor keys, as e.g. known from user
2931    /// interfaces that require entering license keys.
2932    /// ## `direction`
2933    /// direction of focus movement
2934    ///
2935    /// # Returns
2936    ///
2937    /// true if stopping keyboard navigation is fine, false
2938    ///   if the emitting widget should try to handle the keyboard
2939    ///   navigation attempt in its parent widget
2940    #[doc(alias = "gtk_widget_keynav_failed")]
2941    fn keynav_failed(&self, direction: DirectionType) -> bool {
2942        unsafe {
2943            from_glib(ffi::gtk_widget_keynav_failed(
2944                self.as_ref().to_glib_none().0,
2945                direction.into_glib(),
2946            ))
2947        }
2948    }
2949
2950    /// Returns the widgets for which this widget is the target of a
2951    /// mnemonic.
2952    ///
2953    /// Typically, these widgets will be labels. See, for example,
2954    /// [`Label::set_mnemonic_widget()`][crate::Label::set_mnemonic_widget()].
2955    ///
2956    /// The widgets in the list are not individually referenced.
2957    /// If you want to iterate through the list and perform actions
2958    /// involving callbacks that might destroy the widgets, you
2959    /// must call `g_list_foreach (result, (GFunc)g_object_ref, NULL)`
2960    /// first, and then unref all the widgets afterwards.
2961    ///
2962    /// # Returns
2963    ///
2964    /// the list
2965    ///   of mnemonic labels
2966    #[doc(alias = "gtk_widget_list_mnemonic_labels")]
2967    fn list_mnemonic_labels(&self) -> Vec<Widget> {
2968        unsafe {
2969            FromGlibPtrContainer::from_glib_container(ffi::gtk_widget_list_mnemonic_labels(
2970                self.as_ref().to_glib_none().0,
2971            ))
2972        }
2973    }
2974
2975    /// Causes a widget to be mapped if it isn’t already.
2976    ///
2977    /// This function is only for use in widget implementations.
2978    #[doc(alias = "gtk_widget_map")]
2979    fn map(&self) {
2980        unsafe {
2981            ffi::gtk_widget_map(self.as_ref().to_glib_none().0);
2982        }
2983    }
2984
2985    /// Measures @self in the orientation @orientation and for the given @for_size.
2986    ///
2987    /// As an example, if @orientation is [`Orientation::Horizontal`][crate::Orientation::Horizontal] and @for_size
2988    /// is 300, this functions will compute the minimum and natural width of @self
2989    /// if it is allocated at a height of 300 pixels.
2990    ///
2991    /// See [GtkWidget’s geometry management section](class.Widget.html#height-for-width-geometry-management) for
2992    /// a more details on implementing `GtkWidgetClass.measure()`.
2993    /// ## `orientation`
2994    /// the orientation to measure
2995    /// ## `for_size`
2996    /// Size for the opposite of @orientation, i.e.
2997    ///   if @orientation is [`Orientation::Horizontal`][crate::Orientation::Horizontal], this is
2998    ///   the height the widget should be measured with. The [`Orientation::Vertical`][crate::Orientation::Vertical]
2999    ///   case is analogous. This way, both height-for-width and width-for-height
3000    ///   requests can be implemented. If no size is known, -1 can be passed.
3001    ///
3002    /// # Returns
3003    ///
3004    ///
3005    /// ## `minimum`
3006    /// location to store the minimum size
3007    ///
3008    /// ## `natural`
3009    /// location to store the natural size
3010    ///
3011    /// ## `minimum_baseline`
3012    /// location to store the baseline
3013    ///   position for the minimum size, or -1 to report no baseline
3014    ///
3015    /// ## `natural_baseline`
3016    /// location to store the baseline
3017    ///   position for the natural size, or -1 to report no baseline
3018    #[doc(alias = "gtk_widget_measure")]
3019    fn measure(&self, orientation: Orientation, for_size: i32) -> (i32, i32, i32, i32) {
3020        unsafe {
3021            let mut minimum = std::mem::MaybeUninit::uninit();
3022            let mut natural = std::mem::MaybeUninit::uninit();
3023            let mut minimum_baseline = std::mem::MaybeUninit::uninit();
3024            let mut natural_baseline = std::mem::MaybeUninit::uninit();
3025            ffi::gtk_widget_measure(
3026                self.as_ref().to_glib_none().0,
3027                orientation.into_glib(),
3028                for_size,
3029                minimum.as_mut_ptr(),
3030                natural.as_mut_ptr(),
3031                minimum_baseline.as_mut_ptr(),
3032                natural_baseline.as_mut_ptr(),
3033            );
3034            (
3035                minimum.assume_init(),
3036                natural.assume_init(),
3037                minimum_baseline.assume_init(),
3038                natural_baseline.assume_init(),
3039            )
3040        }
3041    }
3042
3043    /// Emits the [`mnemonic-activate`][struct@crate::Widget#mnemonic-activate] signal.
3044    /// ## `group_cycling`
3045    /// true if there are other widgets with the same mnemonic
3046    ///
3047    /// # Returns
3048    ///
3049    /// true if the signal has been handled
3050    #[doc(alias = "gtk_widget_mnemonic_activate")]
3051    fn mnemonic_activate(&self, group_cycling: bool) -> bool {
3052        unsafe {
3053            from_glib(ffi::gtk_widget_mnemonic_activate(
3054                self.as_ref().to_glib_none().0,
3055                group_cycling.into_glib(),
3056            ))
3057        }
3058    }
3059
3060    /// Returns a list model to track the children of the widget.
3061    ///
3062    /// Calling this function will enable extra internal bookkeeping
3063    /// to track children and emit signals on the returned listmodel.
3064    /// It may slow down operations a lot.
3065    ///
3066    /// Applications should try hard to avoid calling this function
3067    /// because of the slowdowns.
3068    ///
3069    /// # Returns
3070    ///
3071    ///
3072    ///   a list model tracking @self's children
3073    #[doc(alias = "gtk_widget_observe_children")]
3074    fn observe_children(&self) -> gio::ListModel {
3075        unsafe {
3076            from_glib_full(ffi::gtk_widget_observe_children(
3077                self.as_ref().to_glib_none().0,
3078            ))
3079        }
3080    }
3081
3082    /// Returns a list model to track the event controllers of the widget.
3083    ///
3084    /// Calling this function will enable extra internal bookkeeping
3085    /// to track controllers and emit signals on the returned listmodel.
3086    /// It may slow down operations a lot.
3087    ///
3088    /// Applications should try hard to avoid calling this function
3089    /// because of the slowdowns.
3090    ///
3091    /// # Returns
3092    ///
3093    ///
3094    ///   a list model tracking @self's controllers
3095    #[doc(alias = "gtk_widget_observe_controllers")]
3096    fn observe_controllers(&self) -> gio::ListModel {
3097        unsafe {
3098            from_glib_full(ffi::gtk_widget_observe_controllers(
3099                self.as_ref().to_glib_none().0,
3100            ))
3101        }
3102    }
3103
3104    /// Finds the descendant of the widget closest to a point.
3105    ///
3106    /// The point (x, y) must be given in widget coordinates, so (0, 0)
3107    /// is assumed to be the top left of @self's content area.
3108    ///
3109    /// Usually widgets will return `NULL` if the given coordinate is not
3110    /// contained in @self checked via [`contains()`][Self::contains()].
3111    /// Otherwise they will recursively try to find a child that does
3112    /// not return `NULL`. Widgets are however free to customize their
3113    /// picking algorithm.
3114    ///
3115    /// This function is used on the toplevel to determine the widget
3116    /// below the mouse cursor for purposes of hover highlighting and
3117    /// delivering events.
3118    /// ## `x`
3119    /// x coordinate to test, relative to @self's origin
3120    /// ## `y`
3121    /// y coordinate to test, relative to @self's origin
3122    /// ## `flags`
3123    /// flags to influence what is picked
3124    ///
3125    /// # Returns
3126    ///
3127    /// the widget's descendant at (x, y)
3128    #[doc(alias = "gtk_widget_pick")]
3129    #[must_use]
3130    fn pick(&self, x: f64, y: f64, flags: PickFlags) -> Option<Widget> {
3131        unsafe {
3132            from_glib_none(ffi::gtk_widget_pick(
3133                self.as_ref().to_glib_none().0,
3134                x,
3135                y,
3136                flags.into_glib(),
3137            ))
3138        }
3139    }
3140
3141    /// Flags the widget for a rerun of the [`WidgetImpl::size_allocate()`][crate::subclass::prelude::WidgetImpl::size_allocate()]
3142    /// function.
3143    ///
3144    /// Use this function instead of [`queue_resize()`][Self::queue_resize()]
3145    /// when the @self's size request didn't change but it wants to
3146    /// reposition its contents.
3147    ///
3148    /// An example user of this function is [`set_halign()`][Self::set_halign()].
3149    ///
3150    /// This function is only for use in widget implementations.
3151    #[doc(alias = "gtk_widget_queue_allocate")]
3152    fn queue_allocate(&self) {
3153        unsafe {
3154            ffi::gtk_widget_queue_allocate(self.as_ref().to_glib_none().0);
3155        }
3156    }
3157
3158    /// Schedules this widget to be redrawn.
3159    ///
3160    /// The redraw will happen in the paint phase
3161    /// of the current or the next frame.
3162    ///
3163    /// This means @self's [`WidgetImpl::snapshot()`][crate::subclass::prelude::WidgetImpl::snapshot()]
3164    /// implementation will be called.
3165    #[doc(alias = "gtk_widget_queue_draw")]
3166    fn queue_draw(&self) {
3167        unsafe {
3168            ffi::gtk_widget_queue_draw(self.as_ref().to_glib_none().0);
3169        }
3170    }
3171
3172    /// Flags a widget to have its size renegotiated.
3173    ///
3174    /// This should be called when a widget for some reason has a new
3175    /// size request. For example, when you change the text in a
3176    /// [`Label`][crate::Label], the label queues a resize to ensure there’s
3177    /// enough space for the new text.
3178    ///
3179    /// Note that you cannot call gtk_widget_queue_resize() on a widget
3180    /// from inside its implementation of the [`WidgetImpl::size_allocate()`][crate::subclass::prelude::WidgetImpl::size_allocate()]
3181    /// virtual method. Calls to gtk_widget_queue_resize() from inside
3182    /// [`WidgetImpl::size_allocate()`][crate::subclass::prelude::WidgetImpl::size_allocate()] will be silently ignored.
3183    ///
3184    /// This function is only for use in widget implementations.
3185    #[doc(alias = "gtk_widget_queue_resize")]
3186    fn queue_resize(&self) {
3187        unsafe {
3188            ffi::gtk_widget_queue_resize(self.as_ref().to_glib_none().0);
3189        }
3190    }
3191
3192    /// Creates the GDK resources associated with a widget.
3193    ///
3194    /// Normally realization happens implicitly; if you show a widget
3195    /// and all its parent containers, then the widget will be realized
3196    /// and mapped automatically.
3197    ///
3198    /// Realizing a widget requires all the widget’s parent widgets to be
3199    /// realized; calling this function realizes the widget’s parents
3200    /// in addition to @self itself. If a widget is not yet inside a
3201    /// toplevel window when you realize it, bad things will happen.
3202    ///
3203    /// This function is primarily used in widget implementations, and
3204    /// isn’t very useful otherwise. Many times when you think you might
3205    /// need it, a better approach is to connect to a signal that will be
3206    /// called after the widget is realized automatically, such as
3207    /// [`realize`][struct@crate::Widget#realize].
3208    #[doc(alias = "gtk_widget_realize")]
3209    fn realize(&self) {
3210        unsafe {
3211            ffi::gtk_widget_realize(self.as_ref().to_glib_none().0);
3212        }
3213    }
3214
3215    /// Removes an event controller from the widget.
3216    ///
3217    /// The removed event controller will not receive any more events,
3218    /// and should not be used again.
3219    ///
3220    /// Widgets will remove all event controllers automatically when they
3221    /// are destroyed, there is normally no need to call this function.
3222    /// ## `controller`
3223    /// an event controller
3224    #[doc(alias = "gtk_widget_remove_controller")]
3225    fn remove_controller(&self, controller: &impl IsA<EventController>) {
3226        unsafe {
3227            ffi::gtk_widget_remove_controller(
3228                self.as_ref().to_glib_none().0,
3229                controller.as_ref().to_glib_none().0,
3230            );
3231        }
3232    }
3233
3234    /// Removes a style from the widget.
3235    ///
3236    /// After this, the style of @self will stop matching for @css_class.
3237    /// ## `css_class`
3238    /// style class to remove from @self, without the leading period
3239    #[doc(alias = "gtk_widget_remove_css_class")]
3240    fn remove_css_class(&self, css_class: &str) {
3241        unsafe {
3242            ffi::gtk_widget_remove_css_class(
3243                self.as_ref().to_glib_none().0,
3244                css_class.to_glib_none().0,
3245            );
3246        }
3247    }
3248
3249    /// Removes a widget from the list of mnemonic labels for this widget.
3250    ///
3251    /// See [`list_mnemonic_labels()`][Self::list_mnemonic_labels()].
3252    ///
3253    /// The widget must have previously been added to the list with
3254    /// [`add_mnemonic_label()`][Self::add_mnemonic_label()].
3255    /// ## `label`
3256    /// a widget that is a mnemonic label for @self
3257    #[doc(alias = "gtk_widget_remove_mnemonic_label")]
3258    fn remove_mnemonic_label(&self, label: &impl IsA<Widget>) {
3259        unsafe {
3260            ffi::gtk_widget_remove_mnemonic_label(
3261                self.as_ref().to_glib_none().0,
3262                label.as_ref().to_glib_none().0,
3263            );
3264        }
3265    }
3266
3267    /// Sets whether the input focus can enter the widget or
3268    /// any of its children.
3269    ///
3270    /// Applications should set @can_focus to false to mark a
3271    /// widget as for pointer/touch use only.
3272    ///
3273    /// Note that having @can_focus be true is only one of the
3274    /// necessary conditions for being focusable. A widget must
3275    /// also be sensitive and focusable and not have an ancestor
3276    /// that is marked as not can-focus in order to receive input
3277    /// focus.
3278    ///
3279    /// See [`grab_focus()`][Self::grab_focus()] for actually setting
3280    /// the input focus on a widget.
3281    /// ## `can_focus`
3282    /// whether the input focus can enter
3283    ///   the widget or any of its children
3284    #[doc(alias = "gtk_widget_set_can_focus")]
3285    #[doc(alias = "can-focus")]
3286    fn set_can_focus(&self, can_focus: bool) {
3287        unsafe {
3288            ffi::gtk_widget_set_can_focus(self.as_ref().to_glib_none().0, can_focus.into_glib());
3289        }
3290    }
3291
3292    /// Sets whether the widget can be the target of pointer events.
3293    /// ## `can_target`
3294    /// whether this widget should be able to
3295    ///   receive pointer events
3296    #[doc(alias = "gtk_widget_set_can_target")]
3297    #[doc(alias = "can-target")]
3298    fn set_can_target(&self, can_target: bool) {
3299        unsafe {
3300            ffi::gtk_widget_set_can_target(self.as_ref().to_glib_none().0, can_target.into_glib());
3301        }
3302    }
3303
3304    /// Sets whether the widget should be mapped along with its parent.
3305    ///
3306    /// The child visibility can be set for widget before it is added
3307    /// to a container with [`set_parent()`][Self::set_parent()], to avoid
3308    /// mapping children unnecessary before immediately unmapping them.
3309    /// However it will be reset to its default state of true when the
3310    /// widget is removed from a container.
3311    ///
3312    /// Note that changing the child visibility of a widget does not
3313    /// queue a resize on the widget. Most of the time, the size of
3314    /// a widget is computed from all visible children, whether or
3315    /// not they are mapped. If this is not the case, the container
3316    /// can queue a resize itself.
3317    ///
3318    /// This function is only useful for widget implementations
3319    /// and should never be called by an application.
3320    /// ## `child_visible`
3321    /// whether @self should be mapped along
3322    ///   with its parent
3323    #[doc(alias = "gtk_widget_set_child_visible")]
3324    fn set_child_visible(&self, child_visible: bool) {
3325        unsafe {
3326            ffi::gtk_widget_set_child_visible(
3327                self.as_ref().to_glib_none().0,
3328                child_visible.into_glib(),
3329            );
3330        }
3331    }
3332
3333    /// Replaces the current style classes of the widget with @classes.
3334    /// ## `classes`
3335    ///
3336    ///   `NULL`-terminated list of style classes
3337    #[doc(alias = "gtk_widget_set_css_classes")]
3338    #[doc(alias = "css-classes")]
3339    fn set_css_classes(&self, classes: &[&str]) {
3340        unsafe {
3341            ffi::gtk_widget_set_css_classes(
3342                self.as_ref().to_glib_none().0,
3343                classes.to_glib_none().0,
3344            );
3345        }
3346    }
3347
3348    /// Sets the cursor to be shown when the pointer hovers over
3349    /// the widget.
3350    ///
3351    /// If the @cursor is `NULL`, @self will use the cursor
3352    /// inherited from its parent.
3353    /// ## `cursor`
3354    /// the new cursor
3355    #[doc(alias = "gtk_widget_set_cursor")]
3356    #[doc(alias = "cursor")]
3357    fn set_cursor(&self, cursor: Option<&gdk::Cursor>) {
3358        unsafe {
3359            ffi::gtk_widget_set_cursor(self.as_ref().to_glib_none().0, cursor.to_glib_none().0);
3360        }
3361    }
3362
3363    /// Sets the cursor to be shown when the pointer hovers over
3364    /// the widget.
3365    ///
3366    /// This is a utility function that creates a cursor via
3367    /// [`gdk::Cursor::from_name()`][crate::gdk::Cursor::from_name()] and then sets it on @self
3368    /// with [`set_cursor()`][Self::set_cursor()]. See those functions for
3369    /// details.
3370    ///
3371    /// On top of that, this function allows @name to be `NULL`, which
3372    /// will do the same as calling [`set_cursor()`][Self::set_cursor()]
3373    /// with a `NULL` cursor.
3374    /// ## `name`
3375    /// the name of the cursor
3376    #[doc(alias = "gtk_widget_set_cursor_from_name")]
3377    fn set_cursor_from_name(&self, name: Option<&str>) {
3378        unsafe {
3379            ffi::gtk_widget_set_cursor_from_name(
3380                self.as_ref().to_glib_none().0,
3381                name.to_glib_none().0,
3382            );
3383        }
3384    }
3385
3386    /// Sets the reading direction on the widget.
3387    ///
3388    /// This direction controls the primary direction for widgets
3389    /// containing text, and also the direction in which the children
3390    /// of a container are packed. The ability to set the direction is
3391    /// present in order so that correct localization into languages with
3392    /// right-to-left reading directions can be done.
3393    ///
3394    /// Generally, applications will let the default reading direction
3395    /// prevail, except for widgets where the children are arranged in
3396    /// an order that is explicitly visual rather than logical (such as
3397    /// buttons for text justification).
3398    ///
3399    /// If the direction is set to [enum@Gtk.TextDirection.none], then
3400    /// the value set by [`Widget::set_default_direction()`][crate::Widget::set_default_direction()] will be used.
3401    /// ## `dir`
3402    /// the new direction
3403    #[doc(alias = "gtk_widget_set_direction")]
3404    fn set_direction(&self, dir: TextDirection) {
3405        unsafe {
3406            ffi::gtk_widget_set_direction(self.as_ref().to_glib_none().0, dir.into_glib());
3407        }
3408    }
3409
3410    /// Set the focus child of the widget.
3411    ///
3412    /// This function is only suitable for widget implementations.
3413    /// If you want a certain widget to get the input focus, call
3414    /// [`grab_focus()`][Self::grab_focus()] on it.
3415    /// ## `child`
3416    /// a direct child widget of @self
3417    ///   or `NULL` to unset the focus child
3418    #[doc(alias = "gtk_widget_set_focus_child")]
3419    fn set_focus_child(&self, child: Option<&impl IsA<Widget>>) {
3420        unsafe {
3421            ffi::gtk_widget_set_focus_child(
3422                self.as_ref().to_glib_none().0,
3423                child.map(|p| p.as_ref()).to_glib_none().0,
3424            );
3425        }
3426    }
3427
3428    /// Sets whether the widget should grab focus when it is clicked
3429    /// with the mouse.
3430    ///
3431    /// Making mouse clicks not grab focus is useful in places like
3432    /// toolbars where you don’t want the keyboard focus removed from
3433    /// the main area of the application.
3434    /// ## `focus_on_click`
3435    /// whether the widget should grab focus when clicked
3436    ///   with the mouse
3437    #[doc(alias = "gtk_widget_set_focus_on_click")]
3438    #[doc(alias = "focus-on-click")]
3439    fn set_focus_on_click(&self, focus_on_click: bool) {
3440        unsafe {
3441            ffi::gtk_widget_set_focus_on_click(
3442                self.as_ref().to_glib_none().0,
3443                focus_on_click.into_glib(),
3444            );
3445        }
3446    }
3447
3448    /// Sets whether the widget can own the input focus.
3449    ///
3450    /// Widget implementations should set @focusable to true in
3451    /// their init() function if they want to receive keyboard input.
3452    ///
3453    /// Note that having @focusable be true is only one of the
3454    /// necessary conditions for being focusable. A widget must
3455    /// also be sensitive and can-focus and not have an ancestor
3456    /// that is marked as not can-focus in order to receive input
3457    /// focus.
3458    ///
3459    /// See [`grab_focus()`][Self::grab_focus()] for actually setting
3460    /// the input focus on a widget.
3461    /// ## `focusable`
3462    /// whether or not @self can own the input focus
3463    #[doc(alias = "gtk_widget_set_focusable")]
3464    #[doc(alias = "focusable")]
3465    fn set_focusable(&self, focusable: bool) {
3466        unsafe {
3467            ffi::gtk_widget_set_focusable(self.as_ref().to_glib_none().0, focusable.into_glib());
3468        }
3469    }
3470
3471    /// Sets the font map to use for text rendering in the widget.
3472    ///
3473    /// The font map is the object that is used to look up fonts.
3474    /// Setting a custom font map can be useful in special situations,
3475    /// e.g. when you need to add application-specific fonts to the set
3476    /// of available fonts.
3477    ///
3478    /// When not set, the widget will inherit the font map from its parent.
3479    /// ## `font_map`
3480    /// a [`pango::FontMap`][crate::pango::FontMap]
3481    #[doc(alias = "gtk_widget_set_font_map")]
3482    fn set_font_map(&self, font_map: Option<&impl IsA<pango::FontMap>>) {
3483        unsafe {
3484            ffi::gtk_widget_set_font_map(
3485                self.as_ref().to_glib_none().0,
3486                font_map.map(|p| p.as_ref()).to_glib_none().0,
3487            );
3488        }
3489    }
3490
3491    /// Sets the [`cairo::FontOptions`][crate::cairo::FontOptions] used for text rendering
3492    /// in the widget.
3493    ///
3494    /// When not set, the default font options for the [`gdk::Display`][crate::gdk::Display]
3495    /// will be used.
3496    ///
3497    /// # Deprecated since 4.16
3498    ///
3499    /// ## `options`
3500    /// a [`cairo::FontOptions`][crate::cairo::FontOptions] struct
3501    ///   to unset any previously set default font options
3502    #[cfg_attr(feature = "v4_16", deprecated = "Since 4.16")]
3503    #[allow(deprecated)]
3504    #[doc(alias = "gtk_widget_set_font_options")]
3505    fn set_font_options(&self, options: Option<&cairo::FontOptions>) {
3506        unsafe {
3507            ffi::gtk_widget_set_font_options(
3508                self.as_ref().to_glib_none().0,
3509                options.to_glib_none().0,
3510            );
3511        }
3512    }
3513
3514    /// Sets the horizontal alignment of the widget.
3515    /// ## `align`
3516    /// the horizontal alignment
3517    #[doc(alias = "gtk_widget_set_halign")]
3518    #[doc(alias = "halign")]
3519    fn set_halign(&self, align: Align) {
3520        unsafe {
3521            ffi::gtk_widget_set_halign(self.as_ref().to_glib_none().0, align.into_glib());
3522        }
3523    }
3524
3525    /// Sets the `has-tooltip` property on the widget.
3526    /// ## `has_tooltip`
3527    /// whether or not @self has a tooltip
3528    #[doc(alias = "gtk_widget_set_has_tooltip")]
3529    #[doc(alias = "has-tooltip")]
3530    fn set_has_tooltip(&self, has_tooltip: bool) {
3531        unsafe {
3532            ffi::gtk_widget_set_has_tooltip(
3533                self.as_ref().to_glib_none().0,
3534                has_tooltip.into_glib(),
3535            );
3536        }
3537    }
3538
3539    /// Sets whether the widget would like any available extra horizontal
3540    /// space.
3541    ///
3542    /// When a user resizes a window, widgets with expand set to true generally
3543    /// receive the extra space. For example, a list or scrollable area
3544    /// or document in your window would often be set to expand.
3545    ///
3546    /// Call this function to set the expand flag if you would like your
3547    /// widget to become larger horizontally when the window has extra
3548    /// room.
3549    ///
3550    /// By default, widgets automatically expand if any of their children
3551    /// want to expand. (To see if a widget will automatically expand given
3552    /// its current children and state, call [`compute_expand()`][Self::compute_expand()].
3553    /// A widget can decide how the expandability of children affects its
3554    /// own expansion by overriding the `compute_expand` virtual method on
3555    /// [`Widget`][crate::Widget].).
3556    ///
3557    /// Setting hexpand explicitly with this function will override the
3558    /// automatic expand behavior.
3559    ///
3560    /// This function forces the widget to expand or not to expand,
3561    /// regardless of children. The override occurs because
3562    /// [`set_hexpand()`][Self::set_hexpand()] sets the hexpand-set property (see
3563    /// [`set_hexpand_set()`][Self::set_hexpand_set()]) which causes the widget’s hexpand
3564    /// value to be used, rather than looking at children and widget state.
3565    /// ## `expand`
3566    /// whether to expand
3567    #[doc(alias = "gtk_widget_set_hexpand")]
3568    #[doc(alias = "hexpand")]
3569    fn set_hexpand(&self, expand: bool) {
3570        unsafe {
3571            ffi::gtk_widget_set_hexpand(self.as_ref().to_glib_none().0, expand.into_glib());
3572        }
3573    }
3574
3575    /// Sets whether the hexpand flag will be used.
3576    ///
3577    /// The [`hexpand-set`][struct@crate::Widget#hexpand-set] property will be set
3578    /// automatically when you call [`set_hexpand()`][Self::set_hexpand()]
3579    /// to set hexpand, so the most likely reason to use this function
3580    /// would be to unset an explicit expand flag.
3581    ///
3582    /// If hexpand is set, then it overrides any computed
3583    /// expand value based on child widgets. If hexpand is not
3584    /// set, then the expand value depends on whether any
3585    /// children of the widget would like to expand.
3586    ///
3587    /// There are few reasons to use this function, but it’s here
3588    /// for completeness and consistency.
3589    /// ## `set`
3590    /// value for hexpand-set property
3591    #[doc(alias = "gtk_widget_set_hexpand_set")]
3592    #[doc(alias = "hexpand-set")]
3593    fn set_hexpand_set(&self, set: bool) {
3594        unsafe {
3595            ffi::gtk_widget_set_hexpand_set(self.as_ref().to_glib_none().0, set.into_glib());
3596        }
3597    }
3598
3599    /// Sets the layout manager to use for measuring and allocating children
3600    /// of the widget.
3601    /// ## `layout_manager`
3602    /// a layout manager
3603    #[doc(alias = "gtk_widget_set_layout_manager")]
3604    #[doc(alias = "layout-manager")]
3605    fn set_layout_manager(&self, layout_manager: Option<impl IsA<LayoutManager>>) {
3606        unsafe {
3607            ffi::gtk_widget_set_layout_manager(
3608                self.as_ref().to_glib_none().0,
3609                layout_manager.map(|p| p.upcast()).into_glib_ptr(),
3610            );
3611        }
3612    }
3613
3614    /// Sets whether the widget acts like a modal dialog,
3615    /// with respect to event delivery.
3616    /// ## `limit_events`
3617    /// whether to limit events
3618    #[cfg(feature = "v4_18")]
3619    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
3620    #[doc(alias = "gtk_widget_set_limit_events")]
3621    #[doc(alias = "limit-events")]
3622    fn set_limit_events(&self, limit_events: bool) {
3623        unsafe {
3624            ffi::gtk_widget_set_limit_events(
3625                self.as_ref().to_glib_none().0,
3626                limit_events.into_glib(),
3627            );
3628        }
3629    }
3630
3631    /// Sets the bottom margin of the widget.
3632    /// ## `margin`
3633    /// the bottom margin
3634    #[doc(alias = "gtk_widget_set_margin_bottom")]
3635    #[doc(alias = "margin-bottom")]
3636    fn set_margin_bottom(&self, margin: i32) {
3637        unsafe {
3638            ffi::gtk_widget_set_margin_bottom(self.as_ref().to_glib_none().0, margin);
3639        }
3640    }
3641
3642    /// Sets the end margin of the widget.
3643    /// ## `margin`
3644    /// the end margin
3645    #[doc(alias = "gtk_widget_set_margin_end")]
3646    #[doc(alias = "margin-end")]
3647    fn set_margin_end(&self, margin: i32) {
3648        unsafe {
3649            ffi::gtk_widget_set_margin_end(self.as_ref().to_glib_none().0, margin);
3650        }
3651    }
3652
3653    /// Sets the start margin of the widget.
3654    /// ## `margin`
3655    /// the start margin
3656    #[doc(alias = "gtk_widget_set_margin_start")]
3657    #[doc(alias = "margin-start")]
3658    fn set_margin_start(&self, margin: i32) {
3659        unsafe {
3660            ffi::gtk_widget_set_margin_start(self.as_ref().to_glib_none().0, margin);
3661        }
3662    }
3663
3664    /// Sets the top margin of the widget.
3665    /// ## `margin`
3666    /// the top margin
3667    #[doc(alias = "gtk_widget_set_margin_top")]
3668    #[doc(alias = "margin-top")]
3669    fn set_margin_top(&self, margin: i32) {
3670        unsafe {
3671            ffi::gtk_widget_set_margin_top(self.as_ref().to_glib_none().0, margin);
3672        }
3673    }
3674
3675    /// Sets a widgets name.
3676    ///
3677    /// Setting a name allows you to refer to the widget from a
3678    /// CSS file. You can apply a style to widgets with a particular name
3679    /// in the CSS file. See the documentation for the CSS syntax (on the
3680    /// same page as the docs for [`StyleContext`][crate::StyleContext].
3681    ///
3682    /// Note that the CSS syntax has certain special characters to delimit
3683    /// and represent elements in a selector (period, #, >, *...), so using
3684    /// these will make your widget impossible to match by name. Any combination
3685    /// of alphanumeric symbols, dashes and underscores will suffice.
3686    /// ## `name`
3687    /// name for the widget
3688    #[doc(alias = "gtk_widget_set_name")]
3689    #[doc(alias = "set_name")]
3690    #[doc(alias = "name")]
3691    fn set_widget_name(&self, name: &str) {
3692        unsafe {
3693            ffi::gtk_widget_set_name(self.as_ref().to_glib_none().0, name.to_glib_none().0);
3694        }
3695    }
3696
3697    /// Requests the widget to be rendered partially transparent.
3698    ///
3699    /// An opacity of 0 is fully transparent and an opacity of 1
3700    /// is fully opaque.
3701    ///
3702    /// Opacity works on both toplevel widgets and child widgets, although
3703    /// there are some limitations: For toplevel widgets, applying opacity
3704    /// depends on the capabilities of the windowing system. On X11, this
3705    /// has any effect only on X displays with a compositing manager, see
3706    /// `Gdk::Display::is_composited()`. On Windows and Wayland it will
3707    /// always work, although setting a window’s opacity after the window
3708    /// has been shown may cause some flicker.
3709    ///
3710    /// Note that the opacity is inherited through inclusion — if you set
3711    /// a toplevel to be partially translucent, all of its content will
3712    /// appear translucent, since it is ultimatively rendered on that
3713    /// toplevel. The opacity value itself is not inherited by child
3714    /// widgets (since that would make widgets deeper in the hierarchy
3715    /// progressively more translucent). As a consequence, [`Popover`][crate::Popover]
3716    /// instances and other [`Native`][crate::Native] widgets with their own surface
3717    /// will use their own opacity value, and thus by default appear
3718    /// non-translucent, even if they are attached to a toplevel that
3719    /// is translucent.
3720    /// ## `opacity`
3721    /// desired opacity, between 0 and 1
3722    #[doc(alias = "gtk_widget_set_opacity")]
3723    #[doc(alias = "opacity")]
3724    fn set_opacity(&self, opacity: f64) {
3725        unsafe {
3726            ffi::gtk_widget_set_opacity(self.as_ref().to_glib_none().0, opacity);
3727        }
3728    }
3729
3730    /// Sets how the widget treats content that is drawn outside the
3731    /// it's content area.
3732    ///
3733    /// See the definition of [`Overflow`][crate::Overflow] for details.
3734    ///
3735    /// This setting is provided for widget implementations and
3736    /// should not be used by application code.
3737    ///
3738    /// The default value is [enum@Gtk.Overflow.visible].
3739    /// ## `overflow`
3740    /// desired overflow value
3741    #[doc(alias = "gtk_widget_set_overflow")]
3742    #[doc(alias = "overflow")]
3743    fn set_overflow(&self, overflow: Overflow) {
3744        unsafe {
3745            ffi::gtk_widget_set_overflow(self.as_ref().to_glib_none().0, overflow.into_glib());
3746        }
3747    }
3748
3749    /// Sets the parent widget of the widget.
3750    ///
3751    /// This takes care of details such as updating the state and style
3752    /// of the child to reflect its new location and resizing the parent.
3753    /// The opposite function is [`unparent()`][Self::unparent()].
3754    ///
3755    /// This function is useful only when implementing subclasses of
3756    /// [`Widget`][crate::Widget].
3757    /// ## `parent`
3758    /// parent widget
3759    #[doc(alias = "gtk_widget_set_parent")]
3760    fn set_parent(&self, parent: &impl IsA<Widget>) {
3761        unsafe {
3762            ffi::gtk_widget_set_parent(
3763                self.as_ref().to_glib_none().0,
3764                parent.as_ref().to_glib_none().0,
3765            );
3766        }
3767    }
3768
3769    /// Sets whether the widget will be treated as the default
3770    /// widget within its toplevel when it has the focus, even if
3771    /// another widget is the default.
3772    /// ## `receives_default`
3773    /// whether or not @self can be a default widget
3774    #[doc(alias = "gtk_widget_set_receives_default")]
3775    #[doc(alias = "receives-default")]
3776    fn set_receives_default(&self, receives_default: bool) {
3777        unsafe {
3778            ffi::gtk_widget_set_receives_default(
3779                self.as_ref().to_glib_none().0,
3780                receives_default.into_glib(),
3781            );
3782        }
3783    }
3784
3785    /// Sets the sensitivity of the widget.
3786    ///
3787    /// A widget is sensitive if the user can interact with it.
3788    /// Insensitive widgets are “grayed out” and the user can’t
3789    /// interact with them. Insensitive widgets are known as
3790    /// “inactive”, “disabled”, or “ghosted” in some other toolkits.
3791    /// ## `sensitive`
3792    /// true to make the widget sensitive
3793    #[doc(alias = "gtk_widget_set_sensitive")]
3794    #[doc(alias = "sensitive")]
3795    fn set_sensitive(&self, sensitive: bool) {
3796        unsafe {
3797            ffi::gtk_widget_set_sensitive(self.as_ref().to_glib_none().0, sensitive.into_glib());
3798        }
3799    }
3800
3801    /// Sets the minimum size of the widget.
3802    ///
3803    /// That is, the widget’s size request will be at least @width
3804    /// by @height. You can use this function to force a widget to
3805    /// be larger than it normally would be.
3806    ///
3807    /// In most cases, [`GtkWindowExt::set_default_size()`][crate::prelude::GtkWindowExt::set_default_size()] is a better
3808    /// choice for toplevel windows than this function; setting the default
3809    /// size will still allow users to shrink the window. Setting the size
3810    /// request will force them to leave the window at least as large as
3811    /// the size request.
3812    ///
3813    /// Note the inherent danger of setting any fixed size - themes,
3814    /// translations into other languages, different fonts, and user action
3815    /// can all change the appropriate size for a given widget. So, it is
3816    /// basically impossible to hardcode a size that will always work.
3817    ///
3818    /// The size request of a widget is the smallest size a widget can
3819    /// accept while still functioning well and drawing itself correctly.
3820    /// However in some strange cases a widget may be allocated less than
3821    /// its requested size, and in many cases a widget may be allocated more
3822    /// space than it requested.
3823    ///
3824    /// If the size request in a given direction is -1 (unset), then
3825    /// the “natural” size request of the widget will be used instead.
3826    ///
3827    /// The size request set here does not include any margin from the
3828    /// properties
3829    /// [`margin-start`][struct@crate::Widget#margin-start],
3830    /// [`margin-end`][struct@crate::Widget#margin-end],
3831    /// [`margin-top`][struct@crate::Widget#margin-top], and
3832    /// [`margin-bottom`][struct@crate::Widget#margin-bottom], but it does include pretty
3833    /// much all other padding or border properties set by any subclass
3834    /// of [`Widget`][crate::Widget].
3835    /// ## `width`
3836    /// width @self should request, or -1 to unset
3837    /// ## `height`
3838    /// height @self should request, or -1 to unset
3839    #[doc(alias = "gtk_widget_set_size_request")]
3840    fn set_size_request(&self, width: i32, height: i32) {
3841        unsafe {
3842            ffi::gtk_widget_set_size_request(self.as_ref().to_glib_none().0, width, height);
3843        }
3844    }
3845
3846    /// Turns on flag values in the current widget state.
3847    ///
3848    /// Typical widget states are insensitive, prelighted, etc.
3849    ///
3850    /// This function accepts the values [flags@Gtk.StateFlags.dir-ltr] and
3851    /// [flags@Gtk.StateFlags.dir-rtl] but ignores them. If you want to set
3852    /// the widget's direction, use [`set_direction()`][Self::set_direction()].
3853    ///
3854    /// This function is for use in widget implementations.
3855    /// ## `flags`
3856    /// state flags to turn on
3857    /// ## `clear`
3858    /// whether to clear state before turning on @flags
3859    #[doc(alias = "gtk_widget_set_state_flags")]
3860    fn set_state_flags(&self, flags: StateFlags, clear: bool) {
3861        unsafe {
3862            ffi::gtk_widget_set_state_flags(
3863                self.as_ref().to_glib_none().0,
3864                flags.into_glib(),
3865                clear.into_glib(),
3866            );
3867        }
3868    }
3869
3870    /// Sets the contents of the tooltip for widget.
3871    ///
3872    /// @markup must contain Pango markup.
3873    ///
3874    /// This function will take care of setting the
3875    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] as a side effect, and of the
3876    /// default handler for the [`query-tooltip`][struct@crate::Widget#query-tooltip] signal.
3877    ///
3878    /// See also [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
3879    /// ## `markup`
3880    /// the contents of the tooltip for @self
3881    #[doc(alias = "gtk_widget_set_tooltip_markup")]
3882    #[doc(alias = "tooltip-markup")]
3883    fn set_tooltip_markup(&self, markup: Option<&str>) {
3884        unsafe {
3885            ffi::gtk_widget_set_tooltip_markup(
3886                self.as_ref().to_glib_none().0,
3887                markup.to_glib_none().0,
3888            );
3889        }
3890    }
3891
3892    /// Sets the contents of the tooltip for the widget.
3893    ///
3894    /// If @text contains any markup, it will be escaped.
3895    ///
3896    /// This function will take care of setting
3897    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] as a side effect,
3898    /// and of the default handler for the
3899    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] signal.
3900    ///
3901    /// See also [`Tooltip::set_text()`][crate::Tooltip::set_text()].
3902    /// ## `text`
3903    /// the contents of the tooltip for @self
3904    #[doc(alias = "gtk_widget_set_tooltip_text")]
3905    #[doc(alias = "tooltip-text")]
3906    fn set_tooltip_text(&self, text: Option<&str>) {
3907        unsafe {
3908            ffi::gtk_widget_set_tooltip_text(self.as_ref().to_glib_none().0, text.to_glib_none().0);
3909        }
3910    }
3911
3912    /// Sets the vertical alignment of the widget.
3913    /// ## `align`
3914    /// the vertical alignment
3915    #[doc(alias = "gtk_widget_set_valign")]
3916    #[doc(alias = "valign")]
3917    fn set_valign(&self, align: Align) {
3918        unsafe {
3919            ffi::gtk_widget_set_valign(self.as_ref().to_glib_none().0, align.into_glib());
3920        }
3921    }
3922
3923    /// Sets whether the widget would like any available extra vertical
3924    /// space.
3925    ///
3926    /// See [`set_hexpand()`][Self::set_hexpand()] for more detail.
3927    /// ## `expand`
3928    /// whether to expand
3929    #[doc(alias = "gtk_widget_set_vexpand")]
3930    #[doc(alias = "vexpand")]
3931    fn set_vexpand(&self, expand: bool) {
3932        unsafe {
3933            ffi::gtk_widget_set_vexpand(self.as_ref().to_glib_none().0, expand.into_glib());
3934        }
3935    }
3936
3937    /// Sets whether the vexpand flag will be used.
3938    ///
3939    /// See [`set_hexpand_set()`][Self::set_hexpand_set()] for more detail.
3940    /// ## `set`
3941    /// value for vexpand-set property
3942    #[doc(alias = "gtk_widget_set_vexpand_set")]
3943    #[doc(alias = "vexpand-set")]
3944    fn set_vexpand_set(&self, set: bool) {
3945        unsafe {
3946            ffi::gtk_widget_set_vexpand_set(self.as_ref().to_glib_none().0, set.into_glib());
3947        }
3948    }
3949
3950    /// Sets the visibility state of @self.
3951    ///
3952    /// Note that setting this to true doesn’t mean the widget is
3953    /// actually viewable, see [`get_visible()`][Self::get_visible()].
3954    /// ## `visible`
3955    /// whether the widget should be shown or not
3956    #[doc(alias = "gtk_widget_set_visible")]
3957    #[doc(alias = "visible")]
3958    fn set_visible(&self, visible: bool) {
3959        unsafe {
3960            ffi::gtk_widget_set_visible(self.as_ref().to_glib_none().0, visible.into_glib());
3961        }
3962    }
3963
3964    /// Returns whether the widget should contribute to
3965    /// the measuring and allocation of its parent.
3966    ///
3967    /// This is false for invisible children, but also
3968    /// for children that have their own surface, such
3969    /// as [`Popover`][crate::Popover] instances.
3970    ///
3971    /// # Returns
3972    ///
3973    /// true if child should be included in
3974    ///   measuring and allocating
3975    #[doc(alias = "gtk_widget_should_layout")]
3976    fn should_layout(&self) -> bool {
3977        unsafe {
3978            from_glib(ffi::gtk_widget_should_layout(
3979                self.as_ref().to_glib_none().0,
3980            ))
3981        }
3982    }
3983
3984    /// Flags a widget to be displayed.
3985    ///
3986    /// Any widget that isn’t shown will not appear on the screen.
3987    ///
3988    /// Remember that you have to show the containers containing a widget,
3989    /// in addition to the widget itself, before it will appear onscreen.
3990    ///
3991    /// When a toplevel widget is shown, it is immediately realized and
3992    /// mapped; other shown widgets are realized and mapped when their
3993    /// toplevel widget is realized and mapped.
3994    ///
3995    /// # Deprecated since 4.10
3996    ///
3997    /// Use [`set_visible()`][Self::set_visible()] instead
3998    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
3999    #[allow(deprecated)]
4000    #[doc(alias = "gtk_widget_show")]
4001    fn show(&self) {
4002        unsafe {
4003            ffi::gtk_widget_show(self.as_ref().to_glib_none().0);
4004        }
4005    }
4006
4007    /// Allocates widget with a transformation that translates
4008    /// the origin to the position in @allocation.
4009    ///
4010    /// This is a simple form of [`allocate()`][Self::allocate()].
4011    /// ## `allocation`
4012    /// position and size to be allocated to @self
4013    /// ## `baseline`
4014    /// the baseline of the child, or -1
4015    #[doc(alias = "gtk_widget_size_allocate")]
4016    fn size_allocate(&self, allocation: &Allocation, baseline: i32) {
4017        unsafe {
4018            ffi::gtk_widget_size_allocate(
4019                self.as_ref().to_glib_none().0,
4020                allocation.to_glib_none().0,
4021                baseline,
4022            );
4023        }
4024    }
4025
4026    /// Snapshots a child of the widget.
4027    ///
4028    /// When a widget receives a call to the snapshot function,
4029    /// it must send synthetic [`WidgetImpl::snapshot()`][crate::subclass::prelude::WidgetImpl::snapshot()] calls
4030    /// to all children. This function provides a convenient way
4031    /// of doing this. A widget, when it receives a call to its
4032    /// [`WidgetImpl::snapshot()`][crate::subclass::prelude::WidgetImpl::snapshot()] function, calls
4033    /// gtk_widget_snapshot_child() once for each child, passing in
4034    /// the @snapshot the widget received.
4035    ///
4036    /// This function takes care of translating the origin of @snapshot,
4037    /// and deciding whether the child needs to be snapshot.
4038    ///
4039    /// It does nothing for children that implement [`Native`][crate::Native].
4040    /// ## `child`
4041    /// a child of @self
4042    /// ## `snapshot`
4043    /// snapshot as passed to the widget. In particular, no
4044    ///   calls to [`SnapshotExt::translate()`][crate::prelude::SnapshotExt::translate()] or other transform calls
4045    ///   should have been made
4046    #[doc(alias = "gtk_widget_snapshot_child")]
4047    fn snapshot_child(&self, child: &impl IsA<Widget>, snapshot: &impl IsA<Snapshot>) {
4048        unsafe {
4049            ffi::gtk_widget_snapshot_child(
4050                self.as_ref().to_glib_none().0,
4051                child.as_ref().to_glib_none().0,
4052                snapshot.as_ref().to_glib_none().0,
4053            );
4054        }
4055    }
4056
4057    /// Translates coordinates relative to @self’s allocation
4058    /// to coordinates relative to @dest_widget’s allocations.
4059    ///
4060    /// In order to perform this operation, both widget must share
4061    /// a common ancestor. If that is not the case, @dest_x and @dest_y
4062    /// are set to 0 and false is returned.
4063    ///
4064    /// # Deprecated since 4.12
4065    ///
4066    /// Use [`compute_point()`][Self::compute_point()] instead
4067    /// ## `dest_widget`
4068    /// another widget
4069    /// ## `src_x`
4070    /// X position in widget coordinates of @self
4071    /// ## `src_y`
4072    /// Y position in widget coordinates of @self
4073    ///
4074    /// # Returns
4075    ///
4076    /// true if @self and @dest_widget have a common
4077    ///   ancestor, false otherwise
4078    ///
4079    /// ## `dest_x`
4080    /// location to store X position in widget coordinates of @dest_widget
4081    ///
4082    /// ## `dest_y`
4083    /// location to store Y position in widget coordinates of @dest_widget
4084    #[cfg_attr(feature = "v4_12", deprecated = "Since 4.12")]
4085    #[allow(deprecated)]
4086    #[doc(alias = "gtk_widget_translate_coordinates")]
4087    fn translate_coordinates(
4088        &self,
4089        dest_widget: &impl IsA<Widget>,
4090        src_x: f64,
4091        src_y: f64,
4092    ) -> Option<(f64, f64)> {
4093        unsafe {
4094            let mut dest_x = std::mem::MaybeUninit::uninit();
4095            let mut dest_y = std::mem::MaybeUninit::uninit();
4096            let ret = from_glib(ffi::gtk_widget_translate_coordinates(
4097                self.as_ref().to_glib_none().0,
4098                dest_widget.as_ref().to_glib_none().0,
4099                src_x,
4100                src_y,
4101                dest_x.as_mut_ptr(),
4102                dest_y.as_mut_ptr(),
4103            ));
4104            if ret {
4105                Some((dest_x.assume_init(), dest_y.assume_init()))
4106            } else {
4107                None
4108            }
4109        }
4110    }
4111
4112    /// Triggers a tooltip query on the display of the widget.
4113    #[doc(alias = "gtk_widget_trigger_tooltip_query")]
4114    fn trigger_tooltip_query(&self) {
4115        unsafe {
4116            ffi::gtk_widget_trigger_tooltip_query(self.as_ref().to_glib_none().0);
4117        }
4118    }
4119
4120    /// Causes a widget to be unmapped if it’s currently mapped.
4121    ///
4122    /// This function is only for use in widget implementations.
4123    #[doc(alias = "gtk_widget_unmap")]
4124    fn unmap(&self) {
4125        unsafe {
4126            ffi::gtk_widget_unmap(self.as_ref().to_glib_none().0);
4127        }
4128    }
4129
4130    /// Removes @self from its parent.
4131    ///
4132    /// This function is only for use in widget implementations,
4133    /// typically in dispose.
4134    #[doc(alias = "gtk_widget_unparent")]
4135    fn unparent(&self) {
4136        unsafe {
4137            ffi::gtk_widget_unparent(self.as_ref().to_glib_none().0);
4138        }
4139    }
4140
4141    /// Causes a widget to be unrealized.
4142    ///
4143    /// This frees all GDK resources associated with the widget.
4144    ///
4145    /// This function is only useful in widget implementations.
4146    #[doc(alias = "gtk_widget_unrealize")]
4147    fn unrealize(&self) {
4148        unsafe {
4149            ffi::gtk_widget_unrealize(self.as_ref().to_glib_none().0);
4150        }
4151    }
4152
4153    /// Turns off flag values for the current widget state.
4154    ///
4155    /// See [`set_state_flags()`][Self::set_state_flags()].
4156    ///
4157    /// This function is for use in widget implementations.
4158    /// ## `flags`
4159    /// state flags to turn off
4160    #[doc(alias = "gtk_widget_unset_state_flags")]
4161    fn unset_state_flags(&self, flags: StateFlags) {
4162        unsafe {
4163            ffi::gtk_widget_unset_state_flags(self.as_ref().to_glib_none().0, flags.into_glib());
4164        }
4165    }
4166
4167    /// Overrides for height request of the widget.
4168    ///
4169    /// If this is -1, the natural request will be used.
4170    #[doc(alias = "height-request")]
4171    fn height_request(&self) -> i32 {
4172        ObjectExt::property(self.as_ref(), "height-request")
4173    }
4174
4175    /// Overrides for height request of the widget.
4176    ///
4177    /// If this is -1, the natural request will be used.
4178    #[doc(alias = "height-request")]
4179    fn set_height_request(&self, height_request: i32) {
4180        ObjectExt::set_property(self.as_ref(), "height-request", height_request)
4181    }
4182
4183    /// Overrides for width request of the widget.
4184    ///
4185    /// If this is -1, the natural request will be used.
4186    #[doc(alias = "width-request")]
4187    fn width_request(&self) -> i32 {
4188        ObjectExt::property(self.as_ref(), "width-request")
4189    }
4190
4191    /// Overrides for width request of the widget.
4192    ///
4193    /// If this is -1, the natural request will be used.
4194    #[doc(alias = "width-request")]
4195    fn set_width_request(&self, width_request: i32) {
4196        ObjectExt::set_property(self.as_ref(), "width-request", width_request)
4197    }
4198
4199    /// Signals that all holders of a reference to the widget should release
4200    /// the reference that they hold.
4201    ///
4202    /// May result in finalization of the widget if all references are released.
4203    ///
4204    /// This signal is not suitable for saving widget state.
4205    #[doc(alias = "destroy")]
4206    fn connect_destroy<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4207        unsafe extern "C" fn destroy_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
4208            this: *mut ffi::GtkWidget,
4209            f: glib::ffi::gpointer,
4210        ) {
4211            let f: &F = &*(f as *const F);
4212            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
4213        }
4214        unsafe {
4215            let f: Box_<F> = Box_::new(f);
4216            connect_raw(
4217                self.as_ptr() as *mut _,
4218                b"destroy\0".as_ptr() as *const _,
4219                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4220                    destroy_trampoline::<Self, F> as *const (),
4221                )),
4222                Box_::into_raw(f),
4223            )
4224        }
4225    }
4226
4227    /// Emitted when the text direction of a widget changes.
4228    /// ## `previous_direction`
4229    /// the previous text direction
4230    #[doc(alias = "direction-changed")]
4231    fn connect_direction_changed<F: Fn(&Self, TextDirection) + 'static>(
4232        &self,
4233        f: F,
4234    ) -> SignalHandlerId {
4235        unsafe extern "C" fn direction_changed_trampoline<
4236            P: IsA<Widget>,
4237            F: Fn(&P, TextDirection) + 'static,
4238        >(
4239            this: *mut ffi::GtkWidget,
4240            previous_direction: ffi::GtkTextDirection,
4241            f: glib::ffi::gpointer,
4242        ) {
4243            let f: &F = &*(f as *const F);
4244            f(
4245                Widget::from_glib_borrow(this).unsafe_cast_ref(),
4246                from_glib(previous_direction),
4247            )
4248        }
4249        unsafe {
4250            let f: Box_<F> = Box_::new(f);
4251            connect_raw(
4252                self.as_ptr() as *mut _,
4253                b"direction-changed\0".as_ptr() as *const _,
4254                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4255                    direction_changed_trampoline::<Self, F> as *const (),
4256                )),
4257                Box_::into_raw(f),
4258            )
4259        }
4260    }
4261
4262    /// Emitted when @widget is hidden.
4263    #[doc(alias = "hide")]
4264    fn connect_hide<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4265        unsafe extern "C" fn hide_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
4266            this: *mut ffi::GtkWidget,
4267            f: glib::ffi::gpointer,
4268        ) {
4269            let f: &F = &*(f as *const F);
4270            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
4271        }
4272        unsafe {
4273            let f: Box_<F> = Box_::new(f);
4274            connect_raw(
4275                self.as_ptr() as *mut _,
4276                b"hide\0".as_ptr() as *const _,
4277                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4278                    hide_trampoline::<Self, F> as *const (),
4279                )),
4280                Box_::into_raw(f),
4281            )
4282        }
4283    }
4284
4285    /// Emitted if keyboard navigation fails.
4286    ///
4287    /// See [`keynav_failed()`][Self::keynav_failed()] for details.
4288    /// ## `direction`
4289    /// the direction of movement
4290    ///
4291    /// # Returns
4292    ///
4293    /// true if stopping keyboard navigation is fine, false
4294    ///   if the emitting widget should try to handle the keyboard
4295    ///   navigation attempt in its parent widget
4296    #[doc(alias = "keynav-failed")]
4297    fn connect_keynav_failed<F: Fn(&Self, DirectionType) -> glib::Propagation + 'static>(
4298        &self,
4299        f: F,
4300    ) -> SignalHandlerId {
4301        unsafe extern "C" fn keynav_failed_trampoline<
4302            P: IsA<Widget>,
4303            F: Fn(&P, DirectionType) -> glib::Propagation + 'static,
4304        >(
4305            this: *mut ffi::GtkWidget,
4306            direction: ffi::GtkDirectionType,
4307            f: glib::ffi::gpointer,
4308        ) -> glib::ffi::gboolean {
4309            let f: &F = &*(f as *const F);
4310            f(
4311                Widget::from_glib_borrow(this).unsafe_cast_ref(),
4312                from_glib(direction),
4313            )
4314            .into_glib()
4315        }
4316        unsafe {
4317            let f: Box_<F> = Box_::new(f);
4318            connect_raw(
4319                self.as_ptr() as *mut _,
4320                b"keynav-failed\0".as_ptr() as *const _,
4321                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4322                    keynav_failed_trampoline::<Self, F> as *const (),
4323                )),
4324                Box_::into_raw(f),
4325            )
4326        }
4327    }
4328
4329    /// Emitted when @widget is going to be mapped.
4330    ///
4331    /// A widget is mapped when the widget is visible (which is controlled with
4332    /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
4333    /// are also visible.
4334    ///
4335    /// The `::map` signal can be used to determine whether a widget will be drawn,
4336    /// for instance it can resume an animation that was stopped during the
4337    /// emission of [`unmap`][struct@crate::Widget#unmap].
4338    #[doc(alias = "map")]
4339    fn connect_map<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4340        unsafe extern "C" fn map_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
4341            this: *mut ffi::GtkWidget,
4342            f: glib::ffi::gpointer,
4343        ) {
4344            let f: &F = &*(f as *const F);
4345            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
4346        }
4347        unsafe {
4348            let f: Box_<F> = Box_::new(f);
4349            connect_raw(
4350                self.as_ptr() as *mut _,
4351                b"map\0".as_ptr() as *const _,
4352                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4353                    map_trampoline::<Self, F> as *const (),
4354                )),
4355                Box_::into_raw(f),
4356            )
4357        }
4358    }
4359
4360    /// Emitted when a widget is activated via a mnemonic.
4361    ///
4362    /// The default handler for this signal activates @widget if @group_cycling
4363    /// is false, or just makes @widget grab focus if @group_cycling is true.
4364    /// ## `group_cycling`
4365    /// true if there are other widgets with the same mnemonic
4366    ///
4367    /// # Returns
4368    ///
4369    /// true to stop other handlers from being invoked for the event,
4370    ///   false to propagate the event further
4371    #[doc(alias = "mnemonic-activate")]
4372    fn connect_mnemonic_activate<F: Fn(&Self, bool) -> glib::Propagation + 'static>(
4373        &self,
4374        f: F,
4375    ) -> SignalHandlerId {
4376        unsafe extern "C" fn mnemonic_activate_trampoline<
4377            P: IsA<Widget>,
4378            F: Fn(&P, bool) -> glib::Propagation + 'static,
4379        >(
4380            this: *mut ffi::GtkWidget,
4381            group_cycling: glib::ffi::gboolean,
4382            f: glib::ffi::gpointer,
4383        ) -> glib::ffi::gboolean {
4384            let f: &F = &*(f as *const F);
4385            f(
4386                Widget::from_glib_borrow(this).unsafe_cast_ref(),
4387                from_glib(group_cycling),
4388            )
4389            .into_glib()
4390        }
4391        unsafe {
4392            let f: Box_<F> = Box_::new(f);
4393            connect_raw(
4394                self.as_ptr() as *mut _,
4395                b"mnemonic-activate\0".as_ptr() as *const _,
4396                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4397                    mnemonic_activate_trampoline::<Self, F> as *const (),
4398                )),
4399                Box_::into_raw(f),
4400            )
4401        }
4402    }
4403
4404    /// Emitted when the focus is moved.
4405    ///
4406    /// The `::move-focus` signal is a [keybinding signal](class.SignalAction.html).
4407    ///
4408    /// The default bindings for this signal are <kbd>Tab</kbd> to move forward,
4409    /// and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move backward.
4410    /// ## `direction`
4411    /// the direction of the focus move
4412    #[doc(alias = "move-focus")]
4413    fn connect_move_focus<F: Fn(&Self, DirectionType) + 'static>(&self, f: F) -> SignalHandlerId {
4414        unsafe extern "C" fn move_focus_trampoline<
4415            P: IsA<Widget>,
4416            F: Fn(&P, DirectionType) + 'static,
4417        >(
4418            this: *mut ffi::GtkWidget,
4419            direction: ffi::GtkDirectionType,
4420            f: glib::ffi::gpointer,
4421        ) {
4422            let f: &F = &*(f as *const F);
4423            f(
4424                Widget::from_glib_borrow(this).unsafe_cast_ref(),
4425                from_glib(direction),
4426            )
4427        }
4428        unsafe {
4429            let f: Box_<F> = Box_::new(f);
4430            connect_raw(
4431                self.as_ptr() as *mut _,
4432                b"move-focus\0".as_ptr() as *const _,
4433                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4434                    move_focus_trampoline::<Self, F> as *const (),
4435                )),
4436                Box_::into_raw(f),
4437            )
4438        }
4439    }
4440
4441    fn emit_move_focus(&self, direction: DirectionType) {
4442        self.emit_by_name::<()>("move-focus", &[&direction]);
4443    }
4444
4445    /// Emitted when the widget’s tooltip is about to be shown.
4446    ///
4447    /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
4448    /// is true and the hover timeout has expired with the cursor hovering
4449    /// above @widget; or emitted when @widget got focus in keyboard mode.
4450    ///
4451    /// Using the given coordinates, the signal handler should determine
4452    /// whether a tooltip should be shown for @widget. If this is the case
4453    /// true should be returned, false otherwise. Note that if @keyboard_mode
4454    /// is true, the values of @x and @y are undefined and should not be used.
4455    ///
4456    /// The signal handler is free to manipulate @tooltip with the therefore
4457    /// destined function calls.
4458    /// ## `x`
4459    /// the x coordinate of the cursor position in widget coordinates
4460    /// ## `y`
4461    /// the y coordinate of the cursor position in widget coordinates
4462    /// ## `keyboard_mode`
4463    /// true if the tooltip was triggered using the keyboard
4464    /// ## `tooltip`
4465    /// a [`Tooltip`][crate::Tooltip]
4466    ///
4467    /// # Returns
4468    ///
4469    /// true if @tooltip should be shown right now, false otherwise
4470    #[doc(alias = "query-tooltip")]
4471    fn connect_query_tooltip<F: Fn(&Self, i32, i32, bool, &Tooltip) -> bool + 'static>(
4472        &self,
4473        f: F,
4474    ) -> SignalHandlerId {
4475        unsafe extern "C" fn query_tooltip_trampoline<
4476            P: IsA<Widget>,
4477            F: Fn(&P, i32, i32, bool, &Tooltip) -> bool + 'static,
4478        >(
4479            this: *mut ffi::GtkWidget,
4480            x: std::ffi::c_int,
4481            y: std::ffi::c_int,
4482            keyboard_mode: glib::ffi::gboolean,
4483            tooltip: *mut ffi::GtkTooltip,
4484            f: glib::ffi::gpointer,
4485        ) -> glib::ffi::gboolean {
4486            let f: &F = &*(f as *const F);
4487            f(
4488                Widget::from_glib_borrow(this).unsafe_cast_ref(),
4489                x,
4490                y,
4491                from_glib(keyboard_mode),
4492                &from_glib_borrow(tooltip),
4493            )
4494            .into_glib()
4495        }
4496        unsafe {
4497            let f: Box_<F> = Box_::new(f);
4498            connect_raw(
4499                self.as_ptr() as *mut _,
4500                b"query-tooltip\0".as_ptr() as *const _,
4501                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4502                    query_tooltip_trampoline::<Self, F> as *const (),
4503                )),
4504                Box_::into_raw(f),
4505            )
4506        }
4507    }
4508
4509    /// Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
4510    ///
4511    /// This means that [`realize()`][Self::realize()] has been called
4512    /// or the widget has been mapped (that is, it is going to be drawn).
4513    #[doc(alias = "realize")]
4514    fn connect_realize<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4515        unsafe extern "C" fn realize_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
4516            this: *mut ffi::GtkWidget,
4517            f: glib::ffi::gpointer,
4518        ) {
4519            let f: &F = &*(f as *const F);
4520            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
4521        }
4522        unsafe {
4523            let f: Box_<F> = Box_::new(f);
4524            connect_raw(
4525                self.as_ptr() as *mut _,
4526                b"realize\0".as_ptr() as *const _,
4527                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4528                    realize_trampoline::<Self, F> as *const (),
4529                )),
4530                Box_::into_raw(f),
4531            )
4532        }
4533    }
4534
4535    /// Emitted when @widget is shown.
4536    #[doc(alias = "show")]
4537    fn connect_show<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4538        unsafe extern "C" fn show_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
4539            this: *mut ffi::GtkWidget,
4540            f: glib::ffi::gpointer,
4541        ) {
4542            let f: &F = &*(f as *const F);
4543            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
4544        }
4545        unsafe {
4546            let f: Box_<F> = Box_::new(f);
4547            connect_raw(
4548                self.as_ptr() as *mut _,
4549                b"show\0".as_ptr() as *const _,
4550                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4551                    show_trampoline::<Self, F> as *const (),
4552                )),
4553                Box_::into_raw(f),
4554            )
4555        }
4556    }
4557
4558    /// Emitted when the widget state changes.
4559    ///
4560    /// See [`state_flags()`][Self::state_flags()].
4561    /// ## `flags`
4562    /// the previous state flags
4563    #[doc(alias = "state-flags-changed")]
4564    fn connect_state_flags_changed<F: Fn(&Self, StateFlags) + 'static>(
4565        &self,
4566        f: F,
4567    ) -> SignalHandlerId {
4568        unsafe extern "C" fn state_flags_changed_trampoline<
4569            P: IsA<Widget>,
4570            F: Fn(&P, StateFlags) + 'static,
4571        >(
4572            this: *mut ffi::GtkWidget,
4573            flags: ffi::GtkStateFlags,
4574            f: glib::ffi::gpointer,
4575        ) {
4576            let f: &F = &*(f as *const F);
4577            f(
4578                Widget::from_glib_borrow(this).unsafe_cast_ref(),
4579                from_glib(flags),
4580            )
4581        }
4582        unsafe {
4583            let f: Box_<F> = Box_::new(f);
4584            connect_raw(
4585                self.as_ptr() as *mut _,
4586                b"state-flags-changed\0".as_ptr() as *const _,
4587                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4588                    state_flags_changed_trampoline::<Self, F> as *const (),
4589                )),
4590                Box_::into_raw(f),
4591            )
4592        }
4593    }
4594
4595    /// Emitted when @widget is going to be unmapped.
4596    ///
4597    /// A widget is unmapped when either it or any of its parents up to the
4598    /// toplevel widget have been set as hidden.
4599    ///
4600    /// As `::unmap` indicates that a widget will not be shown any longer,
4601    /// it can be used to, for example, stop an animation on the widget.
4602    #[doc(alias = "unmap")]
4603    fn connect_unmap<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4604        unsafe extern "C" fn unmap_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
4605            this: *mut ffi::GtkWidget,
4606            f: glib::ffi::gpointer,
4607        ) {
4608            let f: &F = &*(f as *const F);
4609            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
4610        }
4611        unsafe {
4612            let f: Box_<F> = Box_::new(f);
4613            connect_raw(
4614                self.as_ptr() as *mut _,
4615                b"unmap\0".as_ptr() as *const _,
4616                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4617                    unmap_trampoline::<Self, F> as *const (),
4618                )),
4619                Box_::into_raw(f),
4620            )
4621        }
4622    }
4623
4624    /// Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
4625    ///
4626    /// This means that [`unrealize()`][Self::unrealize()] has been called
4627    /// or the widget has been unmapped (that is, it is going to be hidden).
4628    #[doc(alias = "unrealize")]
4629    fn connect_unrealize<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4630        unsafe extern "C" fn unrealize_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
4631            this: *mut ffi::GtkWidget,
4632            f: glib::ffi::gpointer,
4633        ) {
4634            let f: &F = &*(f as *const F);
4635            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
4636        }
4637        unsafe {
4638            let f: Box_<F> = Box_::new(f);
4639            connect_raw(
4640                self.as_ptr() as *mut _,
4641                b"unrealize\0".as_ptr() as *const _,
4642                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4643                    unrealize_trampoline::<Self, F> as *const (),
4644                )),
4645                Box_::into_raw(f),
4646            )
4647        }
4648    }
4649
4650    #[doc(alias = "can-focus")]
4651    fn connect_can_focus_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4652        unsafe extern "C" fn notify_can_focus_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
4653            this: *mut ffi::GtkWidget,
4654            _param_spec: glib::ffi::gpointer,
4655            f: glib::ffi::gpointer,
4656        ) {
4657            let f: &F = &*(f as *const F);
4658            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
4659        }
4660        unsafe {
4661            let f: Box_<F> = Box_::new(f);
4662            connect_raw(
4663                self.as_ptr() as *mut _,
4664                b"notify::can-focus\0".as_ptr() as *const _,
4665                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4666                    notify_can_focus_trampoline::<Self, F> as *const (),
4667                )),
4668                Box_::into_raw(f),
4669            )
4670        }
4671    }
4672
4673    #[doc(alias = "can-target")]
4674    fn connect_can_target_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4675        unsafe extern "C" fn notify_can_target_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
4676            this: *mut ffi::GtkWidget,
4677            _param_spec: glib::ffi::gpointer,
4678            f: glib::ffi::gpointer,
4679        ) {
4680            let f: &F = &*(f as *const F);
4681            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
4682        }
4683        unsafe {
4684            let f: Box_<F> = Box_::new(f);
4685            connect_raw(
4686                self.as_ptr() as *mut _,
4687                b"notify::can-target\0".as_ptr() as *const _,
4688                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4689                    notify_can_target_trampoline::<Self, F> as *const (),
4690                )),
4691                Box_::into_raw(f),
4692            )
4693        }
4694    }
4695
4696    #[doc(alias = "css-classes")]
4697    fn connect_css_classes_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4698        unsafe extern "C" fn notify_css_classes_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
4699            this: *mut ffi::GtkWidget,
4700            _param_spec: glib::ffi::gpointer,
4701            f: glib::ffi::gpointer,
4702        ) {
4703            let f: &F = &*(f as *const F);
4704            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
4705        }
4706        unsafe {
4707            let f: Box_<F> = Box_::new(f);
4708            connect_raw(
4709                self.as_ptr() as *mut _,
4710                b"notify::css-classes\0".as_ptr() as *const _,
4711                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4712                    notify_css_classes_trampoline::<Self, F> as *const (),
4713                )),
4714                Box_::into_raw(f),
4715            )
4716        }
4717    }
4718
4719    #[doc(alias = "cursor")]
4720    fn connect_cursor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4721        unsafe extern "C" fn notify_cursor_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
4722            this: *mut ffi::GtkWidget,
4723            _param_spec: glib::ffi::gpointer,
4724            f: glib::ffi::gpointer,
4725        ) {
4726            let f: &F = &*(f as *const F);
4727            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
4728        }
4729        unsafe {
4730            let f: Box_<F> = Box_::new(f);
4731            connect_raw(
4732                self.as_ptr() as *mut _,
4733                b"notify::cursor\0".as_ptr() as *const _,
4734                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4735                    notify_cursor_trampoline::<Self, F> as *const (),
4736                )),
4737                Box_::into_raw(f),
4738            )
4739        }
4740    }
4741
4742    #[doc(alias = "focus-on-click")]
4743    fn connect_focus_on_click_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4744        unsafe extern "C" fn notify_focus_on_click_trampoline<
4745            P: IsA<Widget>,
4746            F: Fn(&P) + 'static,
4747        >(
4748            this: *mut ffi::GtkWidget,
4749            _param_spec: glib::ffi::gpointer,
4750            f: glib::ffi::gpointer,
4751        ) {
4752            let f: &F = &*(f as *const F);
4753            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
4754        }
4755        unsafe {
4756            let f: Box_<F> = Box_::new(f);
4757            connect_raw(
4758                self.as_ptr() as *mut _,
4759                b"notify::focus-on-click\0".as_ptr() as *const _,
4760                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4761                    notify_focus_on_click_trampoline::<Self, F> as *const (),
4762                )),
4763                Box_::into_raw(f),
4764            )
4765        }
4766    }
4767
4768    #[doc(alias = "focusable")]
4769    fn connect_focusable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4770        unsafe extern "C" fn notify_focusable_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
4771            this: *mut ffi::GtkWidget,
4772            _param_spec: glib::ffi::gpointer,
4773            f: glib::ffi::gpointer,
4774        ) {
4775            let f: &F = &*(f as *const F);
4776            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
4777        }
4778        unsafe {
4779            let f: Box_<F> = Box_::new(f);
4780            connect_raw(
4781                self.as_ptr() as *mut _,
4782                b"notify::focusable\0".as_ptr() as *const _,
4783                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4784                    notify_focusable_trampoline::<Self, F> as *const (),
4785                )),
4786                Box_::into_raw(f),
4787            )
4788        }
4789    }
4790
4791    #[doc(alias = "halign")]
4792    fn connect_halign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4793        unsafe extern "C" fn notify_halign_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
4794            this: *mut ffi::GtkWidget,
4795            _param_spec: glib::ffi::gpointer,
4796            f: glib::ffi::gpointer,
4797        ) {
4798            let f: &F = &*(f as *const F);
4799            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
4800        }
4801        unsafe {
4802            let f: Box_<F> = Box_::new(f);
4803            connect_raw(
4804                self.as_ptr() as *mut _,
4805                b"notify::halign\0".as_ptr() as *const _,
4806                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4807                    notify_halign_trampoline::<Self, F> as *const (),
4808                )),
4809                Box_::into_raw(f),
4810            )
4811        }
4812    }
4813
4814    #[doc(alias = "has-default")]
4815    fn connect_has_default_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4816        unsafe extern "C" fn notify_has_default_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
4817            this: *mut ffi::GtkWidget,
4818            _param_spec: glib::ffi::gpointer,
4819            f: glib::ffi::gpointer,
4820        ) {
4821            let f: &F = &*(f as *const F);
4822            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
4823        }
4824        unsafe {
4825            let f: Box_<F> = Box_::new(f);
4826            connect_raw(
4827                self.as_ptr() as *mut _,
4828                b"notify::has-default\0".as_ptr() as *const _,
4829                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4830                    notify_has_default_trampoline::<Self, F> as *const (),
4831                )),
4832                Box_::into_raw(f),
4833            )
4834        }
4835    }
4836
4837    #[doc(alias = "has-focus")]
4838    fn connect_has_focus_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4839        unsafe extern "C" fn notify_has_focus_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
4840            this: *mut ffi::GtkWidget,
4841            _param_spec: glib::ffi::gpointer,
4842            f: glib::ffi::gpointer,
4843        ) {
4844            let f: &F = &*(f as *const F);
4845            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
4846        }
4847        unsafe {
4848            let f: Box_<F> = Box_::new(f);
4849            connect_raw(
4850                self.as_ptr() as *mut _,
4851                b"notify::has-focus\0".as_ptr() as *const _,
4852                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4853                    notify_has_focus_trampoline::<Self, F> as *const (),
4854                )),
4855                Box_::into_raw(f),
4856            )
4857        }
4858    }
4859
4860    #[doc(alias = "has-tooltip")]
4861    fn connect_has_tooltip_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4862        unsafe extern "C" fn notify_has_tooltip_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
4863            this: *mut ffi::GtkWidget,
4864            _param_spec: glib::ffi::gpointer,
4865            f: glib::ffi::gpointer,
4866        ) {
4867            let f: &F = &*(f as *const F);
4868            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
4869        }
4870        unsafe {
4871            let f: Box_<F> = Box_::new(f);
4872            connect_raw(
4873                self.as_ptr() as *mut _,
4874                b"notify::has-tooltip\0".as_ptr() as *const _,
4875                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4876                    notify_has_tooltip_trampoline::<Self, F> as *const (),
4877                )),
4878                Box_::into_raw(f),
4879            )
4880        }
4881    }
4882
4883    #[doc(alias = "height-request")]
4884    fn connect_height_request_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4885        unsafe extern "C" fn notify_height_request_trampoline<
4886            P: IsA<Widget>,
4887            F: Fn(&P) + 'static,
4888        >(
4889            this: *mut ffi::GtkWidget,
4890            _param_spec: glib::ffi::gpointer,
4891            f: glib::ffi::gpointer,
4892        ) {
4893            let f: &F = &*(f as *const F);
4894            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
4895        }
4896        unsafe {
4897            let f: Box_<F> = Box_::new(f);
4898            connect_raw(
4899                self.as_ptr() as *mut _,
4900                b"notify::height-request\0".as_ptr() as *const _,
4901                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4902                    notify_height_request_trampoline::<Self, F> as *const (),
4903                )),
4904                Box_::into_raw(f),
4905            )
4906        }
4907    }
4908
4909    #[doc(alias = "hexpand")]
4910    fn connect_hexpand_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4911        unsafe extern "C" fn notify_hexpand_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
4912            this: *mut ffi::GtkWidget,
4913            _param_spec: glib::ffi::gpointer,
4914            f: glib::ffi::gpointer,
4915        ) {
4916            let f: &F = &*(f as *const F);
4917            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
4918        }
4919        unsafe {
4920            let f: Box_<F> = Box_::new(f);
4921            connect_raw(
4922                self.as_ptr() as *mut _,
4923                b"notify::hexpand\0".as_ptr() as *const _,
4924                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4925                    notify_hexpand_trampoline::<Self, F> as *const (),
4926                )),
4927                Box_::into_raw(f),
4928            )
4929        }
4930    }
4931
4932    #[doc(alias = "hexpand-set")]
4933    fn connect_hexpand_set_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4934        unsafe extern "C" fn notify_hexpand_set_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
4935            this: *mut ffi::GtkWidget,
4936            _param_spec: glib::ffi::gpointer,
4937            f: glib::ffi::gpointer,
4938        ) {
4939            let f: &F = &*(f as *const F);
4940            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
4941        }
4942        unsafe {
4943            let f: Box_<F> = Box_::new(f);
4944            connect_raw(
4945                self.as_ptr() as *mut _,
4946                b"notify::hexpand-set\0".as_ptr() as *const _,
4947                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4948                    notify_hexpand_set_trampoline::<Self, F> as *const (),
4949                )),
4950                Box_::into_raw(f),
4951            )
4952        }
4953    }
4954
4955    #[doc(alias = "layout-manager")]
4956    fn connect_layout_manager_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4957        unsafe extern "C" fn notify_layout_manager_trampoline<
4958            P: IsA<Widget>,
4959            F: Fn(&P) + 'static,
4960        >(
4961            this: *mut ffi::GtkWidget,
4962            _param_spec: glib::ffi::gpointer,
4963            f: glib::ffi::gpointer,
4964        ) {
4965            let f: &F = &*(f as *const F);
4966            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
4967        }
4968        unsafe {
4969            let f: Box_<F> = Box_::new(f);
4970            connect_raw(
4971                self.as_ptr() as *mut _,
4972                b"notify::layout-manager\0".as_ptr() as *const _,
4973                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4974                    notify_layout_manager_trampoline::<Self, F> as *const (),
4975                )),
4976                Box_::into_raw(f),
4977            )
4978        }
4979    }
4980
4981    #[cfg(feature = "v4_18")]
4982    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
4983    #[doc(alias = "limit-events")]
4984    fn connect_limit_events_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4985        unsafe extern "C" fn notify_limit_events_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
4986            this: *mut ffi::GtkWidget,
4987            _param_spec: glib::ffi::gpointer,
4988            f: glib::ffi::gpointer,
4989        ) {
4990            let f: &F = &*(f as *const F);
4991            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
4992        }
4993        unsafe {
4994            let f: Box_<F> = Box_::new(f);
4995            connect_raw(
4996                self.as_ptr() as *mut _,
4997                b"notify::limit-events\0".as_ptr() as *const _,
4998                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4999                    notify_limit_events_trampoline::<Self, F> as *const (),
5000                )),
5001                Box_::into_raw(f),
5002            )
5003        }
5004    }
5005
5006    #[doc(alias = "margin-bottom")]
5007    fn connect_margin_bottom_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
5008        unsafe extern "C" fn notify_margin_bottom_trampoline<
5009            P: IsA<Widget>,
5010            F: Fn(&P) + 'static,
5011        >(
5012            this: *mut ffi::GtkWidget,
5013            _param_spec: glib::ffi::gpointer,
5014            f: glib::ffi::gpointer,
5015        ) {
5016            let f: &F = &*(f as *const F);
5017            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
5018        }
5019        unsafe {
5020            let f: Box_<F> = Box_::new(f);
5021            connect_raw(
5022                self.as_ptr() as *mut _,
5023                b"notify::margin-bottom\0".as_ptr() as *const _,
5024                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5025                    notify_margin_bottom_trampoline::<Self, F> as *const (),
5026                )),
5027                Box_::into_raw(f),
5028            )
5029        }
5030    }
5031
5032    #[doc(alias = "margin-end")]
5033    fn connect_margin_end_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
5034        unsafe extern "C" fn notify_margin_end_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
5035            this: *mut ffi::GtkWidget,
5036            _param_spec: glib::ffi::gpointer,
5037            f: glib::ffi::gpointer,
5038        ) {
5039            let f: &F = &*(f as *const F);
5040            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
5041        }
5042        unsafe {
5043            let f: Box_<F> = Box_::new(f);
5044            connect_raw(
5045                self.as_ptr() as *mut _,
5046                b"notify::margin-end\0".as_ptr() as *const _,
5047                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5048                    notify_margin_end_trampoline::<Self, F> as *const (),
5049                )),
5050                Box_::into_raw(f),
5051            )
5052        }
5053    }
5054
5055    #[doc(alias = "margin-start")]
5056    fn connect_margin_start_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
5057        unsafe extern "C" fn notify_margin_start_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
5058            this: *mut ffi::GtkWidget,
5059            _param_spec: glib::ffi::gpointer,
5060            f: glib::ffi::gpointer,
5061        ) {
5062            let f: &F = &*(f as *const F);
5063            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
5064        }
5065        unsafe {
5066            let f: Box_<F> = Box_::new(f);
5067            connect_raw(
5068                self.as_ptr() as *mut _,
5069                b"notify::margin-start\0".as_ptr() as *const _,
5070                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5071                    notify_margin_start_trampoline::<Self, F> as *const (),
5072                )),
5073                Box_::into_raw(f),
5074            )
5075        }
5076    }
5077
5078    #[doc(alias = "margin-top")]
5079    fn connect_margin_top_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
5080        unsafe extern "C" fn notify_margin_top_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
5081            this: *mut ffi::GtkWidget,
5082            _param_spec: glib::ffi::gpointer,
5083            f: glib::ffi::gpointer,
5084        ) {
5085            let f: &F = &*(f as *const F);
5086            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
5087        }
5088        unsafe {
5089            let f: Box_<F> = Box_::new(f);
5090            connect_raw(
5091                self.as_ptr() as *mut _,
5092                b"notify::margin-top\0".as_ptr() as *const _,
5093                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5094                    notify_margin_top_trampoline::<Self, F> as *const (),
5095                )),
5096                Box_::into_raw(f),
5097            )
5098        }
5099    }
5100
5101    #[doc(alias = "name")]
5102    fn connect_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
5103        unsafe extern "C" fn notify_name_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
5104            this: *mut ffi::GtkWidget,
5105            _param_spec: glib::ffi::gpointer,
5106            f: glib::ffi::gpointer,
5107        ) {
5108            let f: &F = &*(f as *const F);
5109            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
5110        }
5111        unsafe {
5112            let f: Box_<F> = Box_::new(f);
5113            connect_raw(
5114                self.as_ptr() as *mut _,
5115                b"notify::name\0".as_ptr() as *const _,
5116                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5117                    notify_name_trampoline::<Self, F> as *const (),
5118                )),
5119                Box_::into_raw(f),
5120            )
5121        }
5122    }
5123
5124    #[doc(alias = "opacity")]
5125    fn connect_opacity_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
5126        unsafe extern "C" fn notify_opacity_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
5127            this: *mut ffi::GtkWidget,
5128            _param_spec: glib::ffi::gpointer,
5129            f: glib::ffi::gpointer,
5130        ) {
5131            let f: &F = &*(f as *const F);
5132            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
5133        }
5134        unsafe {
5135            let f: Box_<F> = Box_::new(f);
5136            connect_raw(
5137                self.as_ptr() as *mut _,
5138                b"notify::opacity\0".as_ptr() as *const _,
5139                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5140                    notify_opacity_trampoline::<Self, F> as *const (),
5141                )),
5142                Box_::into_raw(f),
5143            )
5144        }
5145    }
5146
5147    #[doc(alias = "overflow")]
5148    fn connect_overflow_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
5149        unsafe extern "C" fn notify_overflow_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
5150            this: *mut ffi::GtkWidget,
5151            _param_spec: glib::ffi::gpointer,
5152            f: glib::ffi::gpointer,
5153        ) {
5154            let f: &F = &*(f as *const F);
5155            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
5156        }
5157        unsafe {
5158            let f: Box_<F> = Box_::new(f);
5159            connect_raw(
5160                self.as_ptr() as *mut _,
5161                b"notify::overflow\0".as_ptr() as *const _,
5162                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5163                    notify_overflow_trampoline::<Self, F> as *const (),
5164                )),
5165                Box_::into_raw(f),
5166            )
5167        }
5168    }
5169
5170    #[doc(alias = "parent")]
5171    fn connect_parent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
5172        unsafe extern "C" fn notify_parent_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
5173            this: *mut ffi::GtkWidget,
5174            _param_spec: glib::ffi::gpointer,
5175            f: glib::ffi::gpointer,
5176        ) {
5177            let f: &F = &*(f as *const F);
5178            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
5179        }
5180        unsafe {
5181            let f: Box_<F> = Box_::new(f);
5182            connect_raw(
5183                self.as_ptr() as *mut _,
5184                b"notify::parent\0".as_ptr() as *const _,
5185                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5186                    notify_parent_trampoline::<Self, F> as *const (),
5187                )),
5188                Box_::into_raw(f),
5189            )
5190        }
5191    }
5192
5193    #[doc(alias = "receives-default")]
5194    fn connect_receives_default_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
5195        unsafe extern "C" fn notify_receives_default_trampoline<
5196            P: IsA<Widget>,
5197            F: Fn(&P) + 'static,
5198        >(
5199            this: *mut ffi::GtkWidget,
5200            _param_spec: glib::ffi::gpointer,
5201            f: glib::ffi::gpointer,
5202        ) {
5203            let f: &F = &*(f as *const F);
5204            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
5205        }
5206        unsafe {
5207            let f: Box_<F> = Box_::new(f);
5208            connect_raw(
5209                self.as_ptr() as *mut _,
5210                b"notify::receives-default\0".as_ptr() as *const _,
5211                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5212                    notify_receives_default_trampoline::<Self, F> as *const (),
5213                )),
5214                Box_::into_raw(f),
5215            )
5216        }
5217    }
5218
5219    #[doc(alias = "root")]
5220    fn connect_root_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
5221        unsafe extern "C" fn notify_root_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
5222            this: *mut ffi::GtkWidget,
5223            _param_spec: glib::ffi::gpointer,
5224            f: glib::ffi::gpointer,
5225        ) {
5226            let f: &F = &*(f as *const F);
5227            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
5228        }
5229        unsafe {
5230            let f: Box_<F> = Box_::new(f);
5231            connect_raw(
5232                self.as_ptr() as *mut _,
5233                b"notify::root\0".as_ptr() as *const _,
5234                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5235                    notify_root_trampoline::<Self, F> as *const (),
5236                )),
5237                Box_::into_raw(f),
5238            )
5239        }
5240    }
5241
5242    #[doc(alias = "scale-factor")]
5243    fn connect_scale_factor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
5244        unsafe extern "C" fn notify_scale_factor_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
5245            this: *mut ffi::GtkWidget,
5246            _param_spec: glib::ffi::gpointer,
5247            f: glib::ffi::gpointer,
5248        ) {
5249            let f: &F = &*(f as *const F);
5250            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
5251        }
5252        unsafe {
5253            let f: Box_<F> = Box_::new(f);
5254            connect_raw(
5255                self.as_ptr() as *mut _,
5256                b"notify::scale-factor\0".as_ptr() as *const _,
5257                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5258                    notify_scale_factor_trampoline::<Self, F> as *const (),
5259                )),
5260                Box_::into_raw(f),
5261            )
5262        }
5263    }
5264
5265    #[doc(alias = "sensitive")]
5266    fn connect_sensitive_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
5267        unsafe extern "C" fn notify_sensitive_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
5268            this: *mut ffi::GtkWidget,
5269            _param_spec: glib::ffi::gpointer,
5270            f: glib::ffi::gpointer,
5271        ) {
5272            let f: &F = &*(f as *const F);
5273            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
5274        }
5275        unsafe {
5276            let f: Box_<F> = Box_::new(f);
5277            connect_raw(
5278                self.as_ptr() as *mut _,
5279                b"notify::sensitive\0".as_ptr() as *const _,
5280                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5281                    notify_sensitive_trampoline::<Self, F> as *const (),
5282                )),
5283                Box_::into_raw(f),
5284            )
5285        }
5286    }
5287
5288    #[doc(alias = "tooltip-markup")]
5289    fn connect_tooltip_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
5290        unsafe extern "C" fn notify_tooltip_markup_trampoline<
5291            P: IsA<Widget>,
5292            F: Fn(&P) + 'static,
5293        >(
5294            this: *mut ffi::GtkWidget,
5295            _param_spec: glib::ffi::gpointer,
5296            f: glib::ffi::gpointer,
5297        ) {
5298            let f: &F = &*(f as *const F);
5299            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
5300        }
5301        unsafe {
5302            let f: Box_<F> = Box_::new(f);
5303            connect_raw(
5304                self.as_ptr() as *mut _,
5305                b"notify::tooltip-markup\0".as_ptr() as *const _,
5306                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5307                    notify_tooltip_markup_trampoline::<Self, F> as *const (),
5308                )),
5309                Box_::into_raw(f),
5310            )
5311        }
5312    }
5313
5314    #[doc(alias = "tooltip-text")]
5315    fn connect_tooltip_text_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
5316        unsafe extern "C" fn notify_tooltip_text_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
5317            this: *mut ffi::GtkWidget,
5318            _param_spec: glib::ffi::gpointer,
5319            f: glib::ffi::gpointer,
5320        ) {
5321            let f: &F = &*(f as *const F);
5322            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
5323        }
5324        unsafe {
5325            let f: Box_<F> = Box_::new(f);
5326            connect_raw(
5327                self.as_ptr() as *mut _,
5328                b"notify::tooltip-text\0".as_ptr() as *const _,
5329                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5330                    notify_tooltip_text_trampoline::<Self, F> as *const (),
5331                )),
5332                Box_::into_raw(f),
5333            )
5334        }
5335    }
5336
5337    #[doc(alias = "valign")]
5338    fn connect_valign_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
5339        unsafe extern "C" fn notify_valign_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
5340            this: *mut ffi::GtkWidget,
5341            _param_spec: glib::ffi::gpointer,
5342            f: glib::ffi::gpointer,
5343        ) {
5344            let f: &F = &*(f as *const F);
5345            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
5346        }
5347        unsafe {
5348            let f: Box_<F> = Box_::new(f);
5349            connect_raw(
5350                self.as_ptr() as *mut _,
5351                b"notify::valign\0".as_ptr() as *const _,
5352                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5353                    notify_valign_trampoline::<Self, F> as *const (),
5354                )),
5355                Box_::into_raw(f),
5356            )
5357        }
5358    }
5359
5360    #[doc(alias = "vexpand")]
5361    fn connect_vexpand_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
5362        unsafe extern "C" fn notify_vexpand_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
5363            this: *mut ffi::GtkWidget,
5364            _param_spec: glib::ffi::gpointer,
5365            f: glib::ffi::gpointer,
5366        ) {
5367            let f: &F = &*(f as *const F);
5368            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
5369        }
5370        unsafe {
5371            let f: Box_<F> = Box_::new(f);
5372            connect_raw(
5373                self.as_ptr() as *mut _,
5374                b"notify::vexpand\0".as_ptr() as *const _,
5375                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5376                    notify_vexpand_trampoline::<Self, F> as *const (),
5377                )),
5378                Box_::into_raw(f),
5379            )
5380        }
5381    }
5382
5383    #[doc(alias = "vexpand-set")]
5384    fn connect_vexpand_set_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
5385        unsafe extern "C" fn notify_vexpand_set_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
5386            this: *mut ffi::GtkWidget,
5387            _param_spec: glib::ffi::gpointer,
5388            f: glib::ffi::gpointer,
5389        ) {
5390            let f: &F = &*(f as *const F);
5391            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
5392        }
5393        unsafe {
5394            let f: Box_<F> = Box_::new(f);
5395            connect_raw(
5396                self.as_ptr() as *mut _,
5397                b"notify::vexpand-set\0".as_ptr() as *const _,
5398                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5399                    notify_vexpand_set_trampoline::<Self, F> as *const (),
5400                )),
5401                Box_::into_raw(f),
5402            )
5403        }
5404    }
5405
5406    #[doc(alias = "visible")]
5407    fn connect_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
5408        unsafe extern "C" fn notify_visible_trampoline<P: IsA<Widget>, F: Fn(&P) + 'static>(
5409            this: *mut ffi::GtkWidget,
5410            _param_spec: glib::ffi::gpointer,
5411            f: glib::ffi::gpointer,
5412        ) {
5413            let f: &F = &*(f as *const F);
5414            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
5415        }
5416        unsafe {
5417            let f: Box_<F> = Box_::new(f);
5418            connect_raw(
5419                self.as_ptr() as *mut _,
5420                b"notify::visible\0".as_ptr() as *const _,
5421                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5422                    notify_visible_trampoline::<Self, F> as *const (),
5423                )),
5424                Box_::into_raw(f),
5425            )
5426        }
5427    }
5428
5429    #[doc(alias = "width-request")]
5430    fn connect_width_request_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
5431        unsafe extern "C" fn notify_width_request_trampoline<
5432            P: IsA<Widget>,
5433            F: Fn(&P) + 'static,
5434        >(
5435            this: *mut ffi::GtkWidget,
5436            _param_spec: glib::ffi::gpointer,
5437            f: glib::ffi::gpointer,
5438        ) {
5439            let f: &F = &*(f as *const F);
5440            f(Widget::from_glib_borrow(this).unsafe_cast_ref())
5441        }
5442        unsafe {
5443            let f: Box_<F> = Box_::new(f);
5444            connect_raw(
5445                self.as_ptr() as *mut _,
5446                b"notify::width-request\0".as_ptr() as *const _,
5447                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
5448                    notify_width_request_trampoline::<Self, F> as *const (),
5449                )),
5450                Box_::into_raw(f),
5451            )
5452        }
5453    }
5454}
5455
5456impl<O: IsA<Widget>> WidgetExt for O {}