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