Skip to main content

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