Skip to main content

gtk/auto/
window.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{
6    AccelGroup, Align, Application, Bin, Buildable, Container, ResizeMode, Widget, WindowGroup,
7    WindowPosition, WindowType, ffi,
8};
9use glib::{
10    object::ObjectType as _,
11    prelude::*,
12    signal::{SignalHandlerId, connect_raw},
13    translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18    ///
19    /// ]|
20    ///
21    /// GtkWindow has a main CSS node with name window and style class .background,
22    /// and a subnode with name decoration.
23    ///
24    /// Style classes that are typically used with the main CSS node are .csd (when
25    /// client-side decorations are in use), .solid-csd (for client-side decorations
26    /// without invisible borders), .ssd (used by mutter when rendering server-side
27    /// decorations). GtkWindow also represents window states with the following
28    /// style classes on the main node: .tiled, .maximized, .fullscreen. Specialized
29    /// types of window often add their own discriminating style classes, such as
30    /// .popup or .tooltip.
31    ///
32    /// GtkWindow adds the .titlebar and .default-decoration style classes to the
33    /// widget that is added as a titlebar child.
34    ///
35    /// ## Properties
36    ///
37    ///
38    /// #### `accept-focus`
39    ///  Whether the window should receive the input focus.
40    ///
41    /// Readable | Writable
42    ///
43    ///
44    /// #### `application`
45    ///  The [`Application`][crate::Application] associated with the window.
46    ///
47    /// The application will be kept alive for at least as long as it
48    /// has any windows associated with it (see [`ApplicationExtManual::hold()`][crate::gio::prelude::ApplicationExtManual::hold()]
49    /// for a way to keep it alive without windows).
50    ///
51    /// Normally, the connection between the application and the window
52    /// will remain until the window is destroyed, but you can explicitly
53    /// remove it by setting the :application property to [`None`].
54    ///
55    /// Readable | Writable
56    ///
57    ///
58    /// #### `attached-to`
59    ///  The widget to which this window is attached.
60    /// See [`GtkWindowExt::set_attached_to()`][crate::prelude::GtkWindowExt::set_attached_to()].
61    ///
62    /// Examples of places where specifying this relation is useful are
63    /// for instance a [`Menu`][crate::Menu] created by a [`ComboBox`][crate::ComboBox], a completion
64    /// popup window created by [`Entry`][crate::Entry] or a typeahead search entry
65    /// created by [`TreeView`][crate::TreeView].
66    ///
67    /// Readable | Writable | Construct
68    ///
69    ///
70    /// #### `decorated`
71    ///  Whether the window should be decorated by the window manager.
72    ///
73    /// Readable | Writable
74    ///
75    ///
76    /// #### `default-height`
77    ///  Readable | Writable
78    ///
79    ///
80    /// #### `default-width`
81    ///  Readable | Writable
82    ///
83    ///
84    /// #### `deletable`
85    ///  Whether the window frame should have a close button.
86    ///
87    /// Readable | Writable
88    ///
89    ///
90    /// #### `destroy-with-parent`
91    ///  Readable | Writable
92    ///
93    ///
94    /// #### `focus-on-map`
95    ///  Whether the window should receive the input focus when mapped.
96    ///
97    /// Readable | Writable
98    ///
99    ///
100    /// #### `focus-visible`
101    ///  Whether 'focus rectangles' are currently visible in this window.
102    ///
103    /// This property is maintained by GTK+ based on user input
104    /// and should not be set by applications.
105    ///
106    /// Readable | Writable
107    ///
108    ///
109    /// #### `gravity`
110    ///  The window gravity of the window. See [`GtkWindowExt::move_()`][crate::prelude::GtkWindowExt::move_()] and [`gdk::Gravity`][crate::gdk::Gravity] for
111    /// more details about window gravity.
112    ///
113    /// Readable | Writable
114    ///
115    ///
116    /// #### `has-resize-grip`
117    ///  Whether the window has a corner resize grip.
118    ///
119    /// Note that the resize grip is only shown if the window is
120    /// actually resizable and not maximized. Use
121    /// [`resize-grip-visible`][struct@crate::Window#resize-grip-visible] to find out if the resize
122    /// grip is currently shown.
123    ///
124    /// Readable | Writable
125    ///
126    ///
127    /// #### `has-toplevel-focus`
128    ///  Readable
129    ///
130    ///
131    /// #### `hide-titlebar-when-maximized`
132    ///  Whether the titlebar should be hidden during maximization.
133    ///
134    /// Readable | Writable
135    ///
136    ///
137    /// #### `icon`
138    ///  Readable | Writable
139    ///
140    ///
141    /// #### `icon-name`
142    ///  The :icon-name property specifies the name of the themed icon to
143    /// use as the window icon. See [`IconTheme`][crate::IconTheme] for more details.
144    ///
145    /// Readable | Writable
146    ///
147    ///
148    /// #### `is-active`
149    ///  Readable
150    ///
151    ///
152    /// #### `is-maximized`
153    ///  Readable
154    ///
155    ///
156    /// #### `mnemonics-visible`
157    ///  Whether mnemonics are currently visible in this window.
158    ///
159    /// This property is maintained by GTK+ based on user input,
160    /// and should not be set by applications.
161    ///
162    /// Readable | Writable
163    ///
164    ///
165    /// #### `modal`
166    ///  Readable | Writable
167    ///
168    ///
169    /// #### `resizable`
170    ///  Readable | Writable
171    ///
172    ///
173    /// #### `resize-grip-visible`
174    ///  Whether a corner resize grip is currently shown.
175    ///
176    /// Readable
177    ///
178    ///
179    /// #### `role`
180    ///  Readable | Writable
181    ///
182    ///
183    /// #### `screen`
184    ///  Readable | Writable
185    ///
186    ///
187    /// #### `skip-pager-hint`
188    ///  Readable | Writable
189    ///
190    ///
191    /// #### `skip-taskbar-hint`
192    ///  Readable | Writable
193    ///
194    ///
195    /// #### `startup-id`
196    ///  The :startup-id is a write-only property for setting window's
197    /// startup notification identifier. See [`GtkWindowExt::set_startup_id()`][crate::prelude::GtkWindowExt::set_startup_id()]
198    /// for more details.
199    ///
200    /// Writable
201    ///
202    ///
203    /// #### `title`
204    ///  Readable | Writable
205    ///
206    ///
207    /// #### `transient-for`
208    ///  The transient parent of the window. See [`GtkWindowExt::set_transient_for()`][crate::prelude::GtkWindowExt::set_transient_for()] for
209    /// more details about transient windows.
210    ///
211    /// Readable | Writable | Construct
212    ///
213    ///
214    /// #### `type`
215    ///  Readable | Writable | Construct Only
216    ///
217    ///
218    /// #### `type-hint`
219    ///  Readable | Writable
220    ///
221    ///
222    /// #### `urgency-hint`
223    ///  Readable | Writable
224    ///
225    ///
226    /// #### `window-position`
227    ///  Readable | Writable
228    /// <details><summary><h4>Container</h4></summary>
229    ///
230    ///
231    /// #### `border-width`
232    ///  Readable | Writable
233    ///
234    ///
235    /// #### `child`
236    ///  Writable
237    ///
238    ///
239    /// #### `resize-mode`
240    ///  Readable | Writable
241    /// </details>
242    /// <details><summary><h4>Widget</h4></summary>
243    ///
244    ///
245    /// #### `app-paintable`
246    ///  Readable | Writable
247    ///
248    ///
249    /// #### `can-default`
250    ///  Readable | Writable
251    ///
252    ///
253    /// #### `can-focus`
254    ///  Readable | Writable
255    ///
256    ///
257    /// #### `composite-child`
258    ///  Readable
259    ///
260    ///
261    /// #### `double-buffered`
262    ///  Whether the widget is double buffered.
263    ///
264    /// Readable | Writable
265    ///
266    ///
267    /// #### `events`
268    ///  Readable | Writable
269    ///
270    ///
271    /// #### `expand`
272    ///  Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
273    ///
274    /// Readable | Writable
275    ///
276    ///
277    /// #### `focus-on-click`
278    ///  Whether the widget should grab focus when it is clicked with the mouse.
279    ///
280    /// This property is only relevant for widgets that can take focus.
281    ///
282    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
283    /// GtkComboBox) implemented this property individually.
284    ///
285    /// Readable | Writable
286    ///
287    ///
288    /// #### `halign`
289    ///  How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
290    ///
291    /// Readable | Writable
292    ///
293    ///
294    /// #### `has-default`
295    ///  Readable | Writable
296    ///
297    ///
298    /// #### `has-focus`
299    ///  Readable | Writable
300    ///
301    ///
302    /// #### `has-tooltip`
303    ///  Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
304    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
305    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
306    /// whether it will provide a tooltip or not.
307    ///
308    /// Note that setting this property to [`true`] for the first time will change
309    /// the event masks of the GdkWindows of this widget to include leave-notify
310    /// and motion-notify events. This cannot and will not be undone when the
311    /// property is set to [`false`] again.
312    ///
313    /// Readable | Writable
314    ///
315    ///
316    /// #### `height-request`
317    ///  Readable | Writable
318    ///
319    ///
320    /// #### `hexpand`
321    ///  Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
322    ///
323    /// Readable | Writable
324    ///
325    ///
326    /// #### `hexpand-set`
327    ///  Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
328    ///
329    /// Readable | Writable
330    ///
331    ///
332    /// #### `is-focus`
333    ///  Readable | Writable
334    ///
335    ///
336    /// #### `margin`
337    ///  Sets all four sides' margin at once. If read, returns max
338    /// margin on any side.
339    ///
340    /// Readable | Writable
341    ///
342    ///
343    /// #### `margin-bottom`
344    ///  Margin on bottom side of widget.
345    ///
346    /// This property adds margin outside of the widget's normal size
347    /// request, the margin will be added in addition to the size from
348    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
349    ///
350    /// Readable | Writable
351    ///
352    ///
353    /// #### `margin-end`
354    ///  Margin on end of widget, horizontally. This property supports
355    /// left-to-right and right-to-left text directions.
356    ///
357    /// This property adds margin outside of the widget's normal size
358    /// request, the margin will be added in addition to the size from
359    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
360    ///
361    /// Readable | Writable
362    ///
363    ///
364    /// #### `margin-left`
365    ///  Margin on left side of widget.
366    ///
367    /// This property adds margin outside of the widget's normal size
368    /// request, the margin will be added in addition to the size from
369    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
370    ///
371    /// Readable | Writable
372    ///
373    ///
374    /// #### `margin-right`
375    ///  Margin on right side of widget.
376    ///
377    /// This property adds margin outside of the widget's normal size
378    /// request, the margin will be added in addition to the size from
379    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
380    ///
381    /// Readable | Writable
382    ///
383    ///
384    /// #### `margin-start`
385    ///  Margin on start of widget, horizontally. This property supports
386    /// left-to-right and right-to-left text directions.
387    ///
388    /// This property adds margin outside of the widget's normal size
389    /// request, the margin will be added in addition to the size from
390    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
391    ///
392    /// Readable | Writable
393    ///
394    ///
395    /// #### `margin-top`
396    ///  Margin on top side of widget.
397    ///
398    /// This property adds margin outside of the widget's normal size
399    /// request, the margin will be added in addition to the size from
400    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
401    ///
402    /// Readable | Writable
403    ///
404    ///
405    /// #### `name`
406    ///  Readable | Writable
407    ///
408    ///
409    /// #### `no-show-all`
410    ///  Readable | Writable
411    ///
412    ///
413    /// #### `opacity`
414    ///  The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
415    /// more details about window opacity.
416    ///
417    /// Before 3.8 this was only available in GtkWindow
418    ///
419    /// Readable | Writable
420    ///
421    ///
422    /// #### `parent`
423    ///  Readable | Writable
424    ///
425    ///
426    /// #### `receives-default`
427    ///  Readable | Writable
428    ///
429    ///
430    /// #### `scale-factor`
431    ///  The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
432    /// more details about widget scaling.
433    ///
434    /// Readable
435    ///
436    ///
437    /// #### `sensitive`
438    ///  Readable | Writable
439    ///
440    ///
441    /// #### `style`
442    ///  The style of the widget, which contains information about how it will look (colors, etc).
443    ///
444    /// Readable | Writable
445    ///
446    ///
447    /// #### `tooltip-markup`
448    ///  Sets the text of tooltip to be the given string, which is marked up
449    /// with the [Pango text markup language][PangoMarkupFormat].
450    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
451    ///
452    /// This is a convenience property which will take care of getting the
453    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
454    /// will automatically be set to [`true`] and there will be taken care of
455    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
456    ///
457    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
458    /// are set, the last one wins.
459    ///
460    /// Readable | Writable
461    ///
462    ///
463    /// #### `tooltip-text`
464    ///  Sets the text of tooltip to be the given string.
465    ///
466    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
467    ///
468    /// This is a convenience property which will take care of getting the
469    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
470    /// will automatically be set to [`true`] and there will be taken care of
471    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
472    ///
473    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
474    /// are set, the last one wins.
475    ///
476    /// Readable | Writable
477    ///
478    ///
479    /// #### `valign`
480    ///  How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
481    ///
482    /// Readable | Writable
483    ///
484    ///
485    /// #### `vexpand`
486    ///  Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
487    ///
488    /// Readable | Writable
489    ///
490    ///
491    /// #### `vexpand-set`
492    ///  Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
493    ///
494    /// Readable | Writable
495    ///
496    ///
497    /// #### `visible`
498    ///  Readable | Writable
499    ///
500    ///
501    /// #### `width-request`
502    ///  Readable | Writable
503    ///
504    ///
505    /// #### `window`
506    ///  The widget's window if it is realized, [`None`] otherwise.
507    ///
508    /// Readable
509    /// </details>
510    ///
511    /// ## Signals
512    ///
513    ///
514    /// #### `activate-default`
515    ///  The ::activate-default signal is a
516    /// [keybinding signal][GtkBindingSignal]
517    /// which gets emitted when the user activates the default widget
518    /// of `window`.
519    ///
520    /// Action
521    ///
522    ///
523    /// #### `activate-focus`
524    ///  The ::activate-focus signal is a
525    /// [keybinding signal][GtkBindingSignal]
526    /// which gets emitted when the user activates the currently
527    /// focused widget of `window`.
528    ///
529    /// Action
530    ///
531    ///
532    /// #### `enable-debugging`
533    ///  The ::enable-debugging signal is a [keybinding signal][GtkBindingSignal]
534    /// which gets emitted when the user enables or disables interactive
535    /// debugging. When `toggle` is [`true`], interactive debugging is toggled
536    /// on or off, when it is [`false`], the debugger will be pointed at the
537    /// widget under the pointer.
538    ///
539    /// The default bindings for this signal are Ctrl-Shift-I
540    /// and Ctrl-Shift-D.
541    ///
542    /// Action
543    ///
544    ///
545    /// #### `keys-changed`
546    ///  The ::keys-changed signal gets emitted when the set of accelerators
547    /// or mnemonics that are associated with `window` changes.
548    ///
549    ///
550    ///
551    ///
552    /// #### `set-focus`
553    ///  This signal is emitted whenever the currently focused widget in
554    /// this window changes.
555    ///
556    ///
557    /// <details><summary><h4>Container</h4></summary>
558    ///
559    ///
560    /// #### `add`
561    ///
562    ///
563    ///
564    /// #### `check-resize`
565    ///
566    ///
567    ///
568    /// #### `remove`
569    ///
570    ///
571    ///
572    /// #### `set-focus-child`
573    ///
574    /// </details>
575    /// <details><summary><h4>Widget</h4></summary>
576    ///
577    ///
578    /// #### `accel-closures-changed`
579    ///
580    ///
581    ///
582    /// #### `button-press-event`
583    ///  The ::button-press-event signal will be emitted when a button
584    /// (typically from a mouse) is pressed.
585    ///
586    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
587    /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
588    ///
589    /// This signal will be sent to the grab widget if there is one.
590    ///
591    ///
592    ///
593    ///
594    /// #### `button-release-event`
595    ///  The ::button-release-event signal will be emitted when a button
596    /// (typically from a mouse) is released.
597    ///
598    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
599    /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
600    ///
601    /// This signal will be sent to the grab widget if there is one.
602    ///
603    ///
604    ///
605    ///
606    /// #### `can-activate-accel`
607    ///  Determines whether an accelerator that activates the signal
608    /// identified by `signal_id` can currently be activated.
609    /// This signal is present to allow applications and derived
610    /// widgets to override the default [`Widget`][crate::Widget] handling
611    /// for determining whether an accelerator can be activated.
612    ///
613    ///
614    ///
615    ///
616    /// #### `child-notify`
617    ///  The ::child-notify signal is emitted for each
618    /// [child property][child-properties] that has
619    /// changed on an object. The signal's detail holds the property name.
620    ///
621    /// Detailed
622    ///
623    ///
624    /// #### `composited-changed`
625    ///  The ::composited-changed signal is emitted when the composited
626    /// status of `widgets` screen changes.
627    /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
628    ///
629    /// Action
630    ///
631    ///
632    /// #### `configure-event`
633    ///  The ::configure-event signal will be emitted when the size, position or
634    /// stacking of the `widget`'s window has changed.
635    ///
636    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
637    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
638    /// automatically for all new windows.
639    ///
640    ///
641    ///
642    ///
643    /// #### `damage-event`
644    ///  Emitted when a redirected window belonging to `widget` gets drawn into.
645    /// The region/area members of the event shows what area of the redirected
646    /// drawable was drawn into.
647    ///
648    ///
649    ///
650    ///
651    /// #### `delete-event`
652    ///  The ::delete-event signal is emitted if a user requests that
653    /// a toplevel window is closed. The default handler for this signal
654    /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
655    /// this signal will cause the window to be hidden instead, so that
656    /// it can later be shown again without reconstructing it.
657    ///
658    ///
659    ///
660    ///
661    /// #### `destroy`
662    ///  Signals that all holders of a reference to the widget should release
663    /// the reference that they hold. May result in finalization of the widget
664    /// if all references are released.
665    ///
666    /// This signal is not suitable for saving widget state.
667    ///
668    ///
669    ///
670    ///
671    /// #### `destroy-event`
672    ///  The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
673    /// You rarely get this signal, because most widgets disconnect themselves
674    /// from their window before they destroy it, so no widget owns the
675    /// window at destroy time.
676    ///
677    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
678    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
679    /// automatically for all new windows.
680    ///
681    ///
682    ///
683    ///
684    /// #### `direction-changed`
685    ///  The ::direction-changed signal is emitted when the text direction
686    /// of a widget changes.
687    ///
688    ///
689    ///
690    ///
691    /// #### `drag-begin`
692    ///  The ::drag-begin signal is emitted on the drag source when a drag is
693    /// started. A typical reason to connect to this signal is to set up a
694    /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
695    ///
696    /// Note that some widgets set up a drag icon in the default handler of
697    /// this signal, so you may have to use `g_signal_connect_after()` to
698    /// override what the default handler did.
699    ///
700    ///
701    ///
702    ///
703    /// #### `drag-data-delete`
704    ///  The ::drag-data-delete signal is emitted on the drag source when a drag
705    /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
706    /// handler is responsible for deleting the data that has been dropped. What
707    /// "delete" means depends on the context of the drag operation.
708    ///
709    ///
710    ///
711    ///
712    /// #### `drag-data-get`
713    ///  The ::drag-data-get signal is emitted on the drag source when the drop
714    /// site requests the data which is dragged. It is the responsibility of
715    /// the signal handler to fill `data` with the data in the format which
716    /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
717    /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
718    ///
719    ///
720    ///
721    ///
722    /// #### `drag-data-received`
723    ///  format == 8))
724    ///  {
725    ///  GdkDragAction action;
726    ///
727    ///  // handle data here
728    ///
729    ///  action = gdk_drag_context_get_selected_action (context);
730    ///  if (action == GDK_ACTION_ASK)
731    ///  {
732    ///  GtkWidget *dialog;
733    ///  gint response;
734    ///
735    ///  dialog = gtk_message_dialog_new (NULL,
736    ///  GTK_DIALOG_MODAL |
737    ///  GTK_DIALOG_DESTROY_WITH_PARENT,
738    ///  GTK_MESSAGE_INFO,
739    ///  GTK_BUTTONS_YES_NO,
740    ///  "Move the data ?\n");
741    ///  response = gtk_dialog_run (GTK_DIALOG (dialog));
742    ///  gtk_widget_destroy (dialog);
743    ///
744    ///  if (response == GTK_RESPONSE_YES)
745    ///  action = GDK_ACTION_MOVE;
746    ///  else
747    ///  action = GDK_ACTION_COPY;
748    ///  }
749    ///
750    ///  gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
751    ///  }
752    ///  else
753    ///  gtk_drag_finish (context, FALSE, FALSE, time);
754    ///  }
755    /// ]|
756    ///
757    ///
758    ///
759    ///
760    /// #### `drag-drop`
761    ///  The ::drag-drop signal is emitted on the drop site when the user drops
762    /// the data onto the widget. The signal handler must determine whether
763    /// the cursor position is in a drop zone or not. If it is not in a drop
764    /// zone, it returns [`false`] and no further processing is necessary.
765    /// Otherwise, the handler returns [`true`]. In this case, the handler must
766    /// ensure that `gtk_drag_finish()` is called to let the source know that
767    /// the drop is done. The call to `gtk_drag_finish()` can be done either
768    /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
769    /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
770    /// or more of the supported targets.
771    ///
772    ///
773    ///
774    ///
775    /// #### `drag-end`
776    ///  The ::drag-end signal is emitted on the drag source when a drag is
777    /// finished. A typical reason to connect to this signal is to undo
778    /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
779    ///
780    ///
781    ///
782    ///
783    /// #### `drag-failed`
784    ///  The ::drag-failed signal is emitted on the drag source when a drag has
785    /// failed. The signal handler may hook custom code to handle a failed DnD
786    /// operation based on the type of error, it returns [`true`] is the failure has
787    /// been already handled (not showing the default "drag operation failed"
788    /// animation), otherwise it returns [`false`].
789    ///
790    ///
791    ///
792    ///
793    /// #### `drag-leave`
794    ///  The ::drag-leave signal is emitted on the drop site when the cursor
795    /// leaves the widget. A typical reason to connect to this signal is to
796    /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
797    /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
798    ///
799    ///
800    /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
801    /// ::drag-drop signal, for instance to allow cleaning up of a preview item
802    /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
803    ///
804    ///
805    ///
806    ///
807    /// #### `drag-motion`
808    ///  suggested_action,
809    ///  time);
810    ///  }
811    ///  else
812    ///  {
813    ///  // accept the drop
814    ///  }
815    /// }
816    /// ]|
817    ///
818    ///
819    ///
820    ///
821    /// #### `draw`
822    ///  This signal is emitted when a widget is supposed to render itself.
823    /// The `widget`'s top left corner must be painted at the origin of
824    /// the passed in context and be sized to the values returned by
825    /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
826    /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
827    ///
828    /// Signal handlers connected to this signal can modify the cairo
829    /// context passed as `cr` in any way they like and don't need to
830    /// restore it. The signal emission takes care of calling `cairo_save()`
831    /// before and `cairo_restore()` after invoking the handler.
832    ///
833    /// The signal handler will get a `cr` with a clip region already set to the
834    /// widget's dirty region, i.e. to the area that needs repainting. Complicated
835    /// widgets that want to avoid redrawing themselves completely can get the full
836    /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
837    /// get a finer-grained representation of the dirty region with
838    /// `cairo_copy_clip_rectangle_list()`.
839    ///
840    ///
841    ///
842    ///
843    /// #### `enter-notify-event`
844    ///  The ::enter-notify-event will be emitted when the pointer enters
845    /// the `widget`'s window.
846    ///
847    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
848    /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
849    ///
850    /// This signal will be sent to the grab widget if there is one.
851    ///
852    ///
853    ///
854    ///
855    /// #### `event`
856    ///  The GTK+ main loop will emit three signals for each GDK event delivered
857    /// to a widget: one generic ::event signal, another, more specific,
858    /// signal that matches the type of event delivered (e.g.
859    /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
860    /// [`event-after`][struct@crate::Widget#event-after] signal.
861    ///
862    ///
863    ///
864    ///
865    /// #### `event-after`
866    ///  After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
867    /// the second more specific signal, ::event-after will be emitted
868    /// regardless of the previous two signals handlers return values.
869    ///
870    ///
871    ///
872    ///
873    /// #### `focus`
874    ///
875    ///
876    ///
877    /// #### `focus-in-event`
878    ///  The ::focus-in-event signal will be emitted when the keyboard focus
879    /// enters the `widget`'s window.
880    ///
881    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
882    /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
883    ///
884    ///
885    ///
886    ///
887    /// #### `focus-out-event`
888    ///  The ::focus-out-event signal will be emitted when the keyboard focus
889    /// leaves the `widget`'s window.
890    ///
891    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
892    /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
893    ///
894    ///
895    ///
896    ///
897    /// #### `grab-broken-event`
898    ///  Emitted when a pointer or keyboard grab on a window belonging
899    /// to `widget` gets broken.
900    ///
901    /// On X11, this happens when the grab window becomes unviewable
902    /// (i.e. it or one of its ancestors is unmapped), or if the same
903    /// application grabs the pointer or keyboard again.
904    ///
905    ///
906    ///
907    ///
908    /// #### `grab-focus`
909    ///  Action
910    ///
911    ///
912    /// #### `grab-notify`
913    ///  The ::grab-notify signal is emitted when a widget becomes
914    /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
915    /// another widget, or when it becomes unshadowed due to a grab
916    /// being removed.
917    ///
918    /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
919    /// grab widget in the grab stack of its window group is not
920    /// its ancestor.
921    ///
922    ///
923    ///
924    ///
925    /// #### `hide`
926    ///  The ::hide signal is emitted when `widget` is hidden, for example with
927    /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
928    ///
929    ///
930    ///
931    ///
932    /// #### `hierarchy-changed`
933    ///  The ::hierarchy-changed signal is emitted when the
934    /// anchored state of a widget changes. A widget is
935    /// “anchored” when its toplevel
936    /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
937    /// a widget changes from un-anchored to anchored or vice-versa.
938    ///
939    ///
940    ///
941    ///
942    /// #### `key-press-event`
943    ///  The ::key-press-event signal is emitted when a key is pressed. The signal
944    /// emission will reoccur at the key-repeat rate when the key is kept pressed.
945    ///
946    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
947    /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
948    ///
949    /// This signal will be sent to the grab widget if there is one.
950    ///
951    ///
952    ///
953    ///
954    /// #### `key-release-event`
955    ///  The ::key-release-event signal is emitted when a key is released.
956    ///
957    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
958    /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
959    ///
960    /// This signal will be sent to the grab widget if there is one.
961    ///
962    ///
963    ///
964    ///
965    /// #### `keynav-failed`
966    ///  Gets emitted if keyboard navigation fails.
967    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
968    ///
969    ///
970    ///
971    ///
972    /// #### `leave-notify-event`
973    ///  The ::leave-notify-event will be emitted when the pointer leaves
974    /// the `widget`'s window.
975    ///
976    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
977    /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
978    ///
979    /// This signal will be sent to the grab widget if there is one.
980    ///
981    ///
982    ///
983    ///
984    /// #### `map`
985    ///  The ::map signal is emitted when `widget` is going to be mapped, that is
986    /// when the widget is visible (which is controlled with
987    /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
988    /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
989    /// be emitted.
990    ///
991    /// The ::map signal can be used to determine whether a widget will be drawn,
992    /// for instance it can resume an animation that was stopped during the
993    /// emission of [`unmap`][struct@crate::Widget#unmap].
994    ///
995    ///
996    ///
997    ///
998    /// #### `map-event`
999    ///  The ::map-event signal will be emitted when the `widget`'s window is
1000    /// mapped. A window is mapped when it becomes visible on the screen.
1001    ///
1002    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1003    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1004    /// automatically for all new windows.
1005    ///
1006    ///
1007    ///
1008    ///
1009    /// #### `mnemonic-activate`
1010    ///  The default handler for this signal activates `widget` if `group_cycling`
1011    /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
1012    ///
1013    ///
1014    ///
1015    ///
1016    /// #### `motion-notify-event`
1017    ///  The ::motion-notify-event signal is emitted when the pointer moves
1018    /// over the widget's [`gdk::Window`][crate::gdk::Window].
1019    ///
1020    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
1021    /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
1022    ///
1023    /// This signal will be sent to the grab widget if there is one.
1024    ///
1025    ///
1026    ///
1027    ///
1028    /// #### `move-focus`
1029    ///  Action
1030    ///
1031    ///
1032    /// #### `parent-set`
1033    ///  The ::parent-set signal is emitted when a new parent
1034    /// has been set on a widget.
1035    ///
1036    ///
1037    ///
1038    ///
1039    /// #### `popup-menu`
1040    ///  This signal gets emitted whenever a widget should pop up a context
1041    /// menu. This usually happens through the standard key binding mechanism;
1042    /// by pressing a certain key while a widget is focused, the user can cause
1043    /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
1044    /// a menu with clipboard commands. See the
1045    /// [Popup Menu Migration Checklist][checklist-popup-menu]
1046    /// for an example of how to use this signal.
1047    ///
1048    /// Action
1049    ///
1050    ///
1051    /// #### `property-notify-event`
1052    ///  The ::property-notify-event signal will be emitted when a property on
1053    /// the `widget`'s window has been changed or deleted.
1054    ///
1055    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1056    /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
1057    ///
1058    ///
1059    ///
1060    ///
1061    /// #### `proximity-in-event`
1062    ///  To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1063    /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
1064    ///
1065    /// This signal will be sent to the grab widget if there is one.
1066    ///
1067    ///
1068    ///
1069    ///
1070    /// #### `proximity-out-event`
1071    ///  To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1072    /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
1073    ///
1074    /// This signal will be sent to the grab widget if there is one.
1075    ///
1076    ///
1077    ///
1078    ///
1079    /// #### `query-tooltip`
1080    ///  Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
1081    /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
1082    /// focus in keyboard mode.
1083    ///
1084    /// Using the given coordinates, the signal handler should determine
1085    /// whether a tooltip should be shown for `widget`. If this is the case
1086    /// [`true`] should be returned, [`false`] otherwise. Note that if
1087    /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
1088    /// should not be used.
1089    ///
1090    /// The signal handler is free to manipulate `tooltip` with the therefore
1091    /// destined function calls.
1092    ///
1093    ///
1094    ///
1095    ///
1096    /// #### `realize`
1097    ///  The ::realize signal is emitted when `widget` is associated with a
1098    /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
1099    /// widget has been mapped (that is, it is going to be drawn).
1100    ///
1101    ///
1102    ///
1103    ///
1104    /// #### `screen-changed`
1105    ///  The ::screen-changed signal gets emitted when the
1106    /// screen of a widget has changed.
1107    ///
1108    ///
1109    ///
1110    ///
1111    /// #### `scroll-event`
1112    ///  The ::scroll-event signal is emitted when a button in the 4 to 7
1113    /// range is pressed. Wheel mice are usually configured to generate
1114    /// button press events for buttons 4 and 5 when the wheel is turned.
1115    ///
1116    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1117    /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1118    ///
1119    /// This signal will be sent to the grab widget if there is one.
1120    ///
1121    ///
1122    ///
1123    ///
1124    /// #### `selection-clear-event`
1125    ///  The ::selection-clear-event signal will be emitted when the
1126    /// the `widget`'s window has lost ownership of a selection.
1127    ///
1128    ///
1129    ///
1130    ///
1131    /// #### `selection-get`
1132    ///
1133    ///
1134    ///
1135    /// #### `selection-notify-event`
1136    ///
1137    ///
1138    ///
1139    /// #### `selection-received`
1140    ///
1141    ///
1142    ///
1143    /// #### `selection-request-event`
1144    ///  The ::selection-request-event signal will be emitted when
1145    /// another client requests ownership of the selection owned by
1146    /// the `widget`'s window.
1147    ///
1148    ///
1149    ///
1150    ///
1151    /// #### `show`
1152    ///  The ::show signal is emitted when `widget` is shown, for example with
1153    /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1154    ///
1155    ///
1156    ///
1157    ///
1158    /// #### `show-help`
1159    ///  Action
1160    ///
1161    ///
1162    /// #### `size-allocate`
1163    ///
1164    ///
1165    ///
1166    /// #### `state-changed`
1167    ///  The ::state-changed signal is emitted when the widget state changes.
1168    /// See `gtk_widget_get_state()`.
1169    ///
1170    ///
1171    ///
1172    ///
1173    /// #### `state-flags-changed`
1174    ///  The ::state-flags-changed signal is emitted when the widget state
1175    /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1176    ///
1177    ///
1178    ///
1179    ///
1180    /// #### `style-set`
1181    ///  The ::style-set signal is emitted when a new style has been set
1182    /// on a widget. Note that style-modifying functions like
1183    /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1184    ///
1185    /// Note that this signal is emitted for changes to the deprecated
1186    /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1187    /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1188    ///
1189    ///
1190    ///
1191    ///
1192    /// #### `style-updated`
1193    ///  The ::style-updated signal is a convenience signal that is emitted when the
1194    /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1195    /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1196    ///
1197    /// Note that style-modifying functions like `gtk_widget_override_color()` also
1198    /// cause this signal to be emitted.
1199    ///
1200    ///
1201    ///
1202    ///
1203    /// #### `touch-event`
1204    ///
1205    ///
1206    ///
1207    /// #### `unmap`
1208    ///  The ::unmap signal is emitted when `widget` is going to be unmapped, which
1209    /// means that either it or any of its parents up to the toplevel widget have
1210    /// been set as hidden.
1211    ///
1212    /// As ::unmap indicates that a widget will not be shown any longer, it can be
1213    /// used to, for example, stop an animation on the widget.
1214    ///
1215    ///
1216    ///
1217    ///
1218    /// #### `unmap-event`
1219    ///  The ::unmap-event signal will be emitted when the `widget`'s window is
1220    /// unmapped. A window is unmapped when it becomes invisible on the screen.
1221    ///
1222    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1223    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1224    /// automatically for all new windows.
1225    ///
1226    ///
1227    ///
1228    ///
1229    /// #### `unrealize`
1230    ///  The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1231    /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1232    /// called or the widget has been unmapped (that is, it is going to be
1233    /// hidden).
1234    ///
1235    ///
1236    ///
1237    ///
1238    /// #### `visibility-notify-event`
1239    ///  The ::visibility-notify-event will be emitted when the `widget`'s
1240    /// window is obscured or unobscured.
1241    ///
1242    /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1243    /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1244    ///
1245    ///
1246    ///
1247    ///
1248    /// #### `window-state-event`
1249    ///  The ::window-state-event will be emitted when the state of the
1250    /// toplevel window associated to the `widget` changes.
1251    ///
1252    /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1253    /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1254    /// this mask automatically for all new windows.
1255    ///
1256    ///
1257    /// </details>
1258    ///
1259    /// # Implements
1260    ///
1261    /// [`GtkWindowExt`][trait@crate::prelude::GtkWindowExt], [`BinExt`][trait@crate::prelude::BinExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`GtkWindowExtManual`][trait@crate::prelude::GtkWindowExtManual], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
1262    #[doc(alias = "GtkWindow")]
1263    pub struct Window(Object<ffi::GtkWindow, ffi::GtkWindowClass>) @extends Bin, Container, Widget, @implements Buildable;
1264
1265    match fn {
1266        type_ => || ffi::gtk_window_get_type(),
1267    }
1268}
1269
1270impl Window {
1271    pub const NONE: Option<&'static Window> = None;
1272
1273    /// Creates a new [`Window`][crate::Window], which is a toplevel window that can
1274    /// contain other widgets. Nearly always, the type of the window should
1275    /// be [`WindowType::Toplevel`][crate::WindowType::Toplevel]. If you’re implementing something like a
1276    /// popup menu from scratch (which is a bad idea, just use [`Menu`][crate::Menu]),
1277    /// you might use [`WindowType::Popup`][crate::WindowType::Popup]. [`WindowType::Popup`][crate::WindowType::Popup] is not for
1278    /// dialogs, though in some other toolkits dialogs are called “popups”.
1279    /// In GTK+, [`WindowType::Popup`][crate::WindowType::Popup] means a pop-up menu or pop-up tooltip.
1280    /// On X11, popup windows are not controlled by the
1281    /// [window manager][gtk-X11-arch].
1282    ///
1283    /// If you simply want an undecorated window (no window borders), use
1284    /// [`GtkWindowExt::set_decorated()`][crate::prelude::GtkWindowExt::set_decorated()], don’t use [`WindowType::Popup`][crate::WindowType::Popup].
1285    ///
1286    /// All top-level windows created by [`new()`][Self::new()] are stored in
1287    /// an internal top-level window list. This list can be obtained from
1288    /// [`list_toplevels()`][Self::list_toplevels()]. Due to Gtk+ keeping a reference to
1289    /// the window internally, [`new()`][Self::new()] does not return a reference
1290    /// to the caller.
1291    ///
1292    /// To delete a [`Window`][crate::Window], call `gtk_widget_destroy()`.
1293    /// ## `type_`
1294    /// type of window
1295    ///
1296    /// # Returns
1297    ///
1298    /// a new [`Window`][crate::Window].
1299    #[doc(alias = "gtk_window_new")]
1300    pub fn new(type_: WindowType) -> Window {
1301        assert_initialized_main_thread!();
1302        unsafe { Widget::from_glib_none(ffi::gtk_window_new(type_.into_glib())).unsafe_cast() }
1303    }
1304
1305    // rustdoc-stripper-ignore-next
1306    /// Creates a new builder-pattern struct instance to construct [`Window`] objects.
1307    ///
1308    /// This method returns an instance of [`WindowBuilder`](crate::builders::WindowBuilder) which can be used to create [`Window`] objects.
1309    pub fn builder() -> WindowBuilder {
1310        WindowBuilder::new()
1311    }
1312
1313    /// Gets the value set by [`set_default_icon_list()`][Self::set_default_icon_list()].
1314    /// The list is a copy and should be freed with `g_list_free()`,
1315    /// but the pixbufs in the list have not had their reference count
1316    /// incremented.
1317    ///
1318    /// # Returns
1319    ///
1320    /// copy of default icon list
1321    #[doc(alias = "gtk_window_get_default_icon_list")]
1322    #[doc(alias = "get_default_icon_list")]
1323    pub fn default_icon_list() -> Vec<gdk_pixbuf::Pixbuf> {
1324        assert_initialized_main_thread!();
1325        unsafe {
1326            FromGlibPtrContainer::from_glib_container(ffi::gtk_window_get_default_icon_list())
1327        }
1328    }
1329
1330    /// Returns the fallback icon name for windows that has been set
1331    /// with [`set_default_icon_name()`][Self::set_default_icon_name()]. The returned
1332    /// string is owned by GTK+ and should not be modified. It
1333    /// is only valid until the next call to
1334    /// [`set_default_icon_name()`][Self::set_default_icon_name()].
1335    ///
1336    /// # Returns
1337    ///
1338    /// the fallback icon name for windows
1339    #[doc(alias = "gtk_window_get_default_icon_name")]
1340    #[doc(alias = "get_default_icon_name")]
1341    pub fn default_icon_name() -> Option<glib::GString> {
1342        assert_initialized_main_thread!();
1343        unsafe { from_glib_none(ffi::gtk_window_get_default_icon_name()) }
1344    }
1345
1346    /// Returns a list of all existing toplevel windows. The widgets
1347    /// in the list are not individually referenced. If you want
1348    /// to iterate through the list and perform actions involving
1349    /// callbacks that might destroy the widgets, you must call
1350    /// `g_list_foreach (result, (GFunc)g_object_ref, NULL)` first, and
1351    /// then unref all the widgets afterwards.
1352    ///
1353    /// # Returns
1354    ///
1355    /// list of toplevel widgets
1356    #[doc(alias = "gtk_window_list_toplevels")]
1357    pub fn list_toplevels() -> Vec<Widget> {
1358        assert_initialized_main_thread!();
1359        unsafe { FromGlibPtrContainer::from_glib_container(ffi::gtk_window_list_toplevels()) }
1360    }
1361
1362    /// By default, after showing the first [`Window`][crate::Window], GTK+ calls
1363    /// `gdk_notify_startup_complete()`. Call this function to disable
1364    /// the automatic startup notification. You might do this if your
1365    /// first window is a splash screen, and you want to delay notification
1366    /// until after your real main window has been shown, for example.
1367    ///
1368    /// In that example, you would disable startup notification
1369    /// temporarily, show your splash screen, then re-enable it so that
1370    /// showing the main window would automatically result in notification.
1371    /// ## `setting`
1372    /// [`true`] to automatically do startup notification
1373    #[doc(alias = "gtk_window_set_auto_startup_notification")]
1374    pub fn set_auto_startup_notification(setting: bool) {
1375        assert_initialized_main_thread!();
1376        unsafe {
1377            ffi::gtk_window_set_auto_startup_notification(setting.into_glib());
1378        }
1379    }
1380
1381    /// Sets an icon to be used as fallback for windows that haven't
1382    /// had [`GtkWindowExt::set_icon()`][crate::prelude::GtkWindowExt::set_icon()] called on them from a pixbuf.
1383    /// ## `icon`
1384    /// the icon
1385    #[doc(alias = "gtk_window_set_default_icon")]
1386    pub fn set_default_icon(icon: &gdk_pixbuf::Pixbuf) {
1387        assert_initialized_main_thread!();
1388        unsafe {
1389            ffi::gtk_window_set_default_icon(icon.to_glib_none().0);
1390        }
1391    }
1392
1393    /// Sets an icon to be used as fallback for windows that haven't
1394    /// had [`GtkWindowExt::set_icon_list()`][crate::prelude::GtkWindowExt::set_icon_list()] called on them from a file
1395    /// on disk. Warns on failure if `err` is [`None`].
1396    /// ## `filename`
1397    /// location of icon file
1398    ///
1399    /// # Returns
1400    ///
1401    /// [`true`] if setting the icon succeeded.
1402    #[doc(alias = "gtk_window_set_default_icon_from_file")]
1403    pub fn set_default_icon_from_file(
1404        filename: impl AsRef<std::path::Path>,
1405    ) -> Result<(), glib::Error> {
1406        assert_initialized_main_thread!();
1407        unsafe {
1408            let mut error = std::ptr::null_mut();
1409            let is_ok = ffi::gtk_window_set_default_icon_from_file(
1410                filename.as_ref().to_glib_none().0,
1411                &mut error,
1412            );
1413            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
1414            if error.is_null() {
1415                Ok(())
1416            } else {
1417                Err(from_glib_full(error))
1418            }
1419        }
1420    }
1421
1422    /// Sets an icon list to be used as fallback for windows that haven't
1423    /// had [`GtkWindowExt::set_icon_list()`][crate::prelude::GtkWindowExt::set_icon_list()] called on them to set up a
1424    /// window-specific icon list. This function allows you to set up the
1425    /// icon for all windows in your app at once.
1426    ///
1427    /// See [`GtkWindowExt::set_icon_list()`][crate::prelude::GtkWindowExt::set_icon_list()] for more details.
1428    /// ## `list`
1429    /// a list of [`gdk_pixbuf::Pixbuf`][crate::gdk_pixbuf::Pixbuf]
1430    #[doc(alias = "gtk_window_set_default_icon_list")]
1431    pub fn set_default_icon_list(list: &[gdk_pixbuf::Pixbuf]) {
1432        assert_initialized_main_thread!();
1433        unsafe {
1434            ffi::gtk_window_set_default_icon_list(list.to_glib_container().0);
1435        }
1436    }
1437
1438    /// Sets an icon to be used as fallback for windows that haven't
1439    /// had [`GtkWindowExt::set_icon_list()`][crate::prelude::GtkWindowExt::set_icon_list()] called on them from a named
1440    /// themed icon, see [`GtkWindowExt::set_icon_name()`][crate::prelude::GtkWindowExt::set_icon_name()].
1441    /// ## `name`
1442    /// the name of the themed icon
1443    #[doc(alias = "gtk_window_set_default_icon_name")]
1444    pub fn set_default_icon_name(name: &str) {
1445        assert_initialized_main_thread!();
1446        unsafe {
1447            ffi::gtk_window_set_default_icon_name(name.to_glib_none().0);
1448        }
1449    }
1450
1451    /// Opens or closes the [interactive debugger][interactive-debugging],
1452    /// which offers access to the widget hierarchy of the application
1453    /// and to useful debugging tools.
1454    /// ## `enable`
1455    /// [`true`] to enable interactive debugging
1456    #[doc(alias = "gtk_window_set_interactive_debugging")]
1457    pub fn set_interactive_debugging(enable: bool) {
1458        assert_initialized_main_thread!();
1459        unsafe {
1460            ffi::gtk_window_set_interactive_debugging(enable.into_glib());
1461        }
1462    }
1463}
1464
1465impl Default for Window {
1466    fn default() -> Self {
1467        glib::object::Object::new::<Self>()
1468    }
1469}
1470
1471// rustdoc-stripper-ignore-next
1472/// A [builder-pattern] type to construct [`Window`] objects.
1473///
1474/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1475#[must_use = "The builder must be built to be used"]
1476pub struct WindowBuilder {
1477    builder: glib::object::ObjectBuilder<'static, Window>,
1478}
1479
1480impl WindowBuilder {
1481    fn new() -> Self {
1482        Self {
1483            builder: glib::object::Object::builder(),
1484        }
1485    }
1486
1487    /// Whether the window should receive the input focus.
1488    pub fn accept_focus(self, accept_focus: bool) -> Self {
1489        Self {
1490            builder: self.builder.property("accept-focus", accept_focus),
1491        }
1492    }
1493
1494    /// The [`Application`][crate::Application] associated with the window.
1495    ///
1496    /// The application will be kept alive for at least as long as it
1497    /// has any windows associated with it (see [`ApplicationExtManual::hold()`][crate::gio::prelude::ApplicationExtManual::hold()]
1498    /// for a way to keep it alive without windows).
1499    ///
1500    /// Normally, the connection between the application and the window
1501    /// will remain until the window is destroyed, but you can explicitly
1502    /// remove it by setting the :application property to [`None`].
1503    pub fn application(self, application: &impl IsA<Application>) -> Self {
1504        Self {
1505            builder: self
1506                .builder
1507                .property("application", application.clone().upcast()),
1508        }
1509    }
1510
1511    /// The widget to which this window is attached.
1512    /// See [`GtkWindowExt::set_attached_to()`][crate::prelude::GtkWindowExt::set_attached_to()].
1513    ///
1514    /// Examples of places where specifying this relation is useful are
1515    /// for instance a [`Menu`][crate::Menu] created by a [`ComboBox`][crate::ComboBox], a completion
1516    /// popup window created by [`Entry`][crate::Entry] or a typeahead search entry
1517    /// created by [`TreeView`][crate::TreeView].
1518    pub fn attached_to(self, attached_to: &impl IsA<Widget>) -> Self {
1519        Self {
1520            builder: self
1521                .builder
1522                .property("attached-to", attached_to.clone().upcast()),
1523        }
1524    }
1525
1526    /// Whether the window should be decorated by the window manager.
1527    pub fn decorated(self, decorated: bool) -> Self {
1528        Self {
1529            builder: self.builder.property("decorated", decorated),
1530        }
1531    }
1532
1533    pub fn default_height(self, default_height: i32) -> Self {
1534        Self {
1535            builder: self.builder.property("default-height", default_height),
1536        }
1537    }
1538
1539    pub fn default_width(self, default_width: i32) -> Self {
1540        Self {
1541            builder: self.builder.property("default-width", default_width),
1542        }
1543    }
1544
1545    /// Whether the window frame should have a close button.
1546    pub fn deletable(self, deletable: bool) -> Self {
1547        Self {
1548            builder: self.builder.property("deletable", deletable),
1549        }
1550    }
1551
1552    pub fn destroy_with_parent(self, destroy_with_parent: bool) -> Self {
1553        Self {
1554            builder: self
1555                .builder
1556                .property("destroy-with-parent", destroy_with_parent),
1557        }
1558    }
1559
1560    /// Whether the window should receive the input focus when mapped.
1561    pub fn focus_on_map(self, focus_on_map: bool) -> Self {
1562        Self {
1563            builder: self.builder.property("focus-on-map", focus_on_map),
1564        }
1565    }
1566
1567    /// Whether 'focus rectangles' are currently visible in this window.
1568    ///
1569    /// This property is maintained by GTK+ based on user input
1570    /// and should not be set by applications.
1571    pub fn focus_visible(self, focus_visible: bool) -> Self {
1572        Self {
1573            builder: self.builder.property("focus-visible", focus_visible),
1574        }
1575    }
1576
1577    /// The window gravity of the window. See [`GtkWindowExt::move_()`][crate::prelude::GtkWindowExt::move_()] and [`gdk::Gravity`][crate::gdk::Gravity] for
1578    /// more details about window gravity.
1579    pub fn gravity(self, gravity: gdk::Gravity) -> Self {
1580        Self {
1581            builder: self.builder.property("gravity", gravity),
1582        }
1583    }
1584
1585    /// Whether the titlebar should be hidden during maximization.
1586    pub fn hide_titlebar_when_maximized(self, hide_titlebar_when_maximized: bool) -> Self {
1587        Self {
1588            builder: self
1589                .builder
1590                .property("hide-titlebar-when-maximized", hide_titlebar_when_maximized),
1591        }
1592    }
1593
1594    pub fn icon(self, icon: &gdk_pixbuf::Pixbuf) -> Self {
1595        Self {
1596            builder: self.builder.property("icon", icon.clone()),
1597        }
1598    }
1599
1600    /// The :icon-name property specifies the name of the themed icon to
1601    /// use as the window icon. See [`IconTheme`][crate::IconTheme] for more details.
1602    pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
1603        Self {
1604            builder: self.builder.property("icon-name", icon_name.into()),
1605        }
1606    }
1607
1608    /// Whether mnemonics are currently visible in this window.
1609    ///
1610    /// This property is maintained by GTK+ based on user input,
1611    /// and should not be set by applications.
1612    pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self {
1613        Self {
1614            builder: self
1615                .builder
1616                .property("mnemonics-visible", mnemonics_visible),
1617        }
1618    }
1619
1620    pub fn modal(self, modal: bool) -> Self {
1621        Self {
1622            builder: self.builder.property("modal", modal),
1623        }
1624    }
1625
1626    pub fn resizable(self, resizable: bool) -> Self {
1627        Self {
1628            builder: self.builder.property("resizable", resizable),
1629        }
1630    }
1631
1632    pub fn role(self, role: impl Into<glib::GString>) -> Self {
1633        Self {
1634            builder: self.builder.property("role", role.into()),
1635        }
1636    }
1637
1638    pub fn screen(self, screen: &gdk::Screen) -> Self {
1639        Self {
1640            builder: self.builder.property("screen", screen.clone()),
1641        }
1642    }
1643
1644    pub fn skip_pager_hint(self, skip_pager_hint: bool) -> Self {
1645        Self {
1646            builder: self.builder.property("skip-pager-hint", skip_pager_hint),
1647        }
1648    }
1649
1650    pub fn skip_taskbar_hint(self, skip_taskbar_hint: bool) -> Self {
1651        Self {
1652            builder: self
1653                .builder
1654                .property("skip-taskbar-hint", skip_taskbar_hint),
1655        }
1656    }
1657
1658    /// The :startup-id is a write-only property for setting window's
1659    /// startup notification identifier. See [`GtkWindowExt::set_startup_id()`][crate::prelude::GtkWindowExt::set_startup_id()]
1660    /// for more details.
1661    pub fn startup_id(self, startup_id: impl Into<glib::GString>) -> Self {
1662        Self {
1663            builder: self.builder.property("startup-id", startup_id.into()),
1664        }
1665    }
1666
1667    pub fn title(self, title: impl Into<glib::GString>) -> Self {
1668        Self {
1669            builder: self.builder.property("title", title.into()),
1670        }
1671    }
1672
1673    /// The transient parent of the window. See [`GtkWindowExt::set_transient_for()`][crate::prelude::GtkWindowExt::set_transient_for()] for
1674    /// more details about transient windows.
1675    pub fn transient_for(self, transient_for: &impl IsA<Window>) -> Self {
1676        Self {
1677            builder: self
1678                .builder
1679                .property("transient-for", transient_for.clone().upcast()),
1680        }
1681    }
1682
1683    pub fn type_(self, type_: WindowType) -> Self {
1684        Self {
1685            builder: self.builder.property("type", type_),
1686        }
1687    }
1688
1689    pub fn type_hint(self, type_hint: gdk::WindowTypeHint) -> Self {
1690        Self {
1691            builder: self.builder.property("type-hint", type_hint),
1692        }
1693    }
1694
1695    pub fn urgency_hint(self, urgency_hint: bool) -> Self {
1696        Self {
1697            builder: self.builder.property("urgency-hint", urgency_hint),
1698        }
1699    }
1700
1701    pub fn window_position(self, window_position: WindowPosition) -> Self {
1702        Self {
1703            builder: self.builder.property("window-position", window_position),
1704        }
1705    }
1706
1707    pub fn border_width(self, border_width: u32) -> Self {
1708        Self {
1709            builder: self.builder.property("border-width", border_width),
1710        }
1711    }
1712
1713    pub fn child(self, child: &impl IsA<Widget>) -> Self {
1714        Self {
1715            builder: self.builder.property("child", child.clone().upcast()),
1716        }
1717    }
1718
1719    pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
1720        Self {
1721            builder: self.builder.property("resize-mode", resize_mode),
1722        }
1723    }
1724
1725    pub fn app_paintable(self, app_paintable: bool) -> Self {
1726        Self {
1727            builder: self.builder.property("app-paintable", app_paintable),
1728        }
1729    }
1730
1731    pub fn can_default(self, can_default: bool) -> Self {
1732        Self {
1733            builder: self.builder.property("can-default", can_default),
1734        }
1735    }
1736
1737    pub fn can_focus(self, can_focus: bool) -> Self {
1738        Self {
1739            builder: self.builder.property("can-focus", can_focus),
1740        }
1741    }
1742
1743    pub fn events(self, events: gdk::EventMask) -> Self {
1744        Self {
1745            builder: self.builder.property("events", events),
1746        }
1747    }
1748
1749    /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1750    pub fn expand(self, expand: bool) -> Self {
1751        Self {
1752            builder: self.builder.property("expand", expand),
1753        }
1754    }
1755
1756    /// Whether the widget should grab focus when it is clicked with the mouse.
1757    ///
1758    /// This property is only relevant for widgets that can take focus.
1759    ///
1760    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1761    /// GtkComboBox) implemented this property individually.
1762    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1763        Self {
1764            builder: self.builder.property("focus-on-click", focus_on_click),
1765        }
1766    }
1767
1768    /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1769    pub fn halign(self, halign: Align) -> Self {
1770        Self {
1771            builder: self.builder.property("halign", halign),
1772        }
1773    }
1774
1775    pub fn has_default(self, has_default: bool) -> Self {
1776        Self {
1777            builder: self.builder.property("has-default", has_default),
1778        }
1779    }
1780
1781    pub fn has_focus(self, has_focus: bool) -> Self {
1782        Self {
1783            builder: self.builder.property("has-focus", has_focus),
1784        }
1785    }
1786
1787    /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1788    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1789    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1790    /// whether it will provide a tooltip or not.
1791    ///
1792    /// Note that setting this property to [`true`] for the first time will change
1793    /// the event masks of the GdkWindows of this widget to include leave-notify
1794    /// and motion-notify events. This cannot and will not be undone when the
1795    /// property is set to [`false`] again.
1796    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1797        Self {
1798            builder: self.builder.property("has-tooltip", has_tooltip),
1799        }
1800    }
1801
1802    pub fn height_request(self, height_request: i32) -> Self {
1803        Self {
1804            builder: self.builder.property("height-request", height_request),
1805        }
1806    }
1807
1808    /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1809    pub fn hexpand(self, hexpand: bool) -> Self {
1810        Self {
1811            builder: self.builder.property("hexpand", hexpand),
1812        }
1813    }
1814
1815    /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1816    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1817        Self {
1818            builder: self.builder.property("hexpand-set", hexpand_set),
1819        }
1820    }
1821
1822    pub fn is_focus(self, is_focus: bool) -> Self {
1823        Self {
1824            builder: self.builder.property("is-focus", is_focus),
1825        }
1826    }
1827
1828    /// Sets all four sides' margin at once. If read, returns max
1829    /// margin on any side.
1830    pub fn margin(self, margin: i32) -> Self {
1831        Self {
1832            builder: self.builder.property("margin", margin),
1833        }
1834    }
1835
1836    /// Margin on bottom side of widget.
1837    ///
1838    /// This property adds margin outside of the widget's normal size
1839    /// request, the margin will be added in addition to the size from
1840    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1841    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1842        Self {
1843            builder: self.builder.property("margin-bottom", margin_bottom),
1844        }
1845    }
1846
1847    /// Margin on end of widget, horizontally. This property supports
1848    /// left-to-right and right-to-left text directions.
1849    ///
1850    /// This property adds margin outside of the widget's normal size
1851    /// request, the margin will be added in addition to the size from
1852    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1853    pub fn margin_end(self, margin_end: i32) -> Self {
1854        Self {
1855            builder: self.builder.property("margin-end", margin_end),
1856        }
1857    }
1858
1859    /// Margin on start of widget, horizontally. This property supports
1860    /// left-to-right and right-to-left text directions.
1861    ///
1862    /// This property adds margin outside of the widget's normal size
1863    /// request, the margin will be added in addition to the size from
1864    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1865    pub fn margin_start(self, margin_start: i32) -> Self {
1866        Self {
1867            builder: self.builder.property("margin-start", margin_start),
1868        }
1869    }
1870
1871    /// Margin on top side of widget.
1872    ///
1873    /// This property adds margin outside of the widget's normal size
1874    /// request, the margin will be added in addition to the size from
1875    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1876    pub fn margin_top(self, margin_top: i32) -> Self {
1877        Self {
1878            builder: self.builder.property("margin-top", margin_top),
1879        }
1880    }
1881
1882    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1883        Self {
1884            builder: self.builder.property("name", name.into()),
1885        }
1886    }
1887
1888    pub fn no_show_all(self, no_show_all: bool) -> Self {
1889        Self {
1890            builder: self.builder.property("no-show-all", no_show_all),
1891        }
1892    }
1893
1894    /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1895    /// more details about window opacity.
1896    ///
1897    /// Before 3.8 this was only available in GtkWindow
1898    pub fn opacity(self, opacity: f64) -> Self {
1899        Self {
1900            builder: self.builder.property("opacity", opacity),
1901        }
1902    }
1903
1904    pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1905        Self {
1906            builder: self.builder.property("parent", parent.clone().upcast()),
1907        }
1908    }
1909
1910    pub fn receives_default(self, receives_default: bool) -> Self {
1911        Self {
1912            builder: self.builder.property("receives-default", receives_default),
1913        }
1914    }
1915
1916    pub fn sensitive(self, sensitive: bool) -> Self {
1917        Self {
1918            builder: self.builder.property("sensitive", sensitive),
1919        }
1920    }
1921
1922    /// Sets the text of tooltip to be the given string, which is marked up
1923    /// with the [Pango text markup language][PangoMarkupFormat].
1924    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1925    ///
1926    /// This is a convenience property which will take care of getting the
1927    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1928    /// will automatically be set to [`true`] and there will be taken care of
1929    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1930    ///
1931    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1932    /// are set, the last one wins.
1933    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1934        Self {
1935            builder: self
1936                .builder
1937                .property("tooltip-markup", tooltip_markup.into()),
1938        }
1939    }
1940
1941    /// Sets the text of tooltip to be the given string.
1942    ///
1943    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1944    ///
1945    /// This is a convenience property which will take care of getting the
1946    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1947    /// will automatically be set to [`true`] and there will be taken care of
1948    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1949    ///
1950    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1951    /// are set, the last one wins.
1952    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1953        Self {
1954            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1955        }
1956    }
1957
1958    /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1959    pub fn valign(self, valign: Align) -> Self {
1960        Self {
1961            builder: self.builder.property("valign", valign),
1962        }
1963    }
1964
1965    /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1966    pub fn vexpand(self, vexpand: bool) -> Self {
1967        Self {
1968            builder: self.builder.property("vexpand", vexpand),
1969        }
1970    }
1971
1972    /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1973    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1974        Self {
1975            builder: self.builder.property("vexpand-set", vexpand_set),
1976        }
1977    }
1978
1979    pub fn visible(self, visible: bool) -> Self {
1980        Self {
1981            builder: self.builder.property("visible", visible),
1982        }
1983    }
1984
1985    pub fn width_request(self, width_request: i32) -> Self {
1986        Self {
1987            builder: self.builder.property("width-request", width_request),
1988        }
1989    }
1990
1991    // rustdoc-stripper-ignore-next
1992    /// Build the [`Window`].
1993    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1994    pub fn build(self) -> Window {
1995        assert_initialized_main_thread!();
1996        self.builder.build()
1997    }
1998}
1999
2000/// Trait containing all [`struct@Window`] methods.
2001///
2002/// # Implementors
2003///
2004/// [`ApplicationWindow`][struct@crate::ApplicationWindow], [`Assistant`][struct@crate::Assistant], [`Dialog`][struct@crate::Dialog], [`OffscreenWindow`][struct@crate::OffscreenWindow], [`Plug`][struct@crate::Plug], [`ShortcutsWindow`][struct@crate::ShortcutsWindow], [`Window`][struct@crate::Window]
2005pub trait GtkWindowExt: IsA<Window> + 'static {
2006    /// Activates the default widget for the window, unless the current
2007    /// focused widget has been configured to receive the default action
2008    /// (see [`WidgetExt::set_receives_default()`][crate::prelude::WidgetExt::set_receives_default()]), in which case the
2009    /// focused widget is activated.
2010    ///
2011    /// # Returns
2012    ///
2013    /// [`true`] if a widget got activated.
2014    #[doc(alias = "gtk_window_activate_default")]
2015    fn activate_default(&self) -> bool {
2016        unsafe {
2017            from_glib(ffi::gtk_window_activate_default(
2018                self.as_ref().to_glib_none().0,
2019            ))
2020        }
2021    }
2022
2023    /// Activates the current focused widget within the window.
2024    ///
2025    /// # Returns
2026    ///
2027    /// [`true`] if a widget got activated.
2028    #[doc(alias = "gtk_window_activate_focus")]
2029    fn activate_focus(&self) -> bool {
2030        unsafe {
2031            from_glib(ffi::gtk_window_activate_focus(
2032                self.as_ref().to_glib_none().0,
2033            ))
2034        }
2035    }
2036
2037    /// Activates mnemonics and accelerators for this [`Window`][crate::Window]. This is normally
2038    /// called by the default ::key_press_event handler for toplevel windows,
2039    /// however in some cases it may be useful to call this directly when
2040    /// overriding the standard key handling for a toplevel window.
2041    /// ## `event`
2042    /// a [`gdk::EventKey`][crate::gdk::EventKey]
2043    ///
2044    /// # Returns
2045    ///
2046    /// [`true`] if a mnemonic or accelerator was found and activated.
2047    #[doc(alias = "gtk_window_activate_key")]
2048    fn activate_key(&self, event: &gdk::EventKey) -> bool {
2049        unsafe {
2050            from_glib(ffi::gtk_window_activate_key(
2051                self.as_ref().to_glib_none().0,
2052                mut_override(event.to_glib_none().0),
2053            ))
2054        }
2055    }
2056
2057    /// Associate `accel_group` with `self`, such that calling
2058    /// [`accel_groups_activate()`][crate::accel_groups_activate()] on `self` will activate accelerators
2059    /// in `accel_group`.
2060    /// ## `accel_group`
2061    /// a [`AccelGroup`][crate::AccelGroup]
2062    #[doc(alias = "gtk_window_add_accel_group")]
2063    fn add_accel_group(&self, accel_group: &impl IsA<AccelGroup>) {
2064        unsafe {
2065            ffi::gtk_window_add_accel_group(
2066                self.as_ref().to_glib_none().0,
2067                accel_group.as_ref().to_glib_none().0,
2068            );
2069        }
2070    }
2071
2072    /// Adds a mnemonic to this window.
2073    /// ## `keyval`
2074    /// the mnemonic
2075    /// ## `target`
2076    /// the widget that gets activated by the mnemonic
2077    #[doc(alias = "gtk_window_add_mnemonic")]
2078    fn add_mnemonic(&self, keyval: u32, target: &impl IsA<Widget>) {
2079        unsafe {
2080            ffi::gtk_window_add_mnemonic(
2081                self.as_ref().to_glib_none().0,
2082                keyval,
2083                target.as_ref().to_glib_none().0,
2084            );
2085        }
2086    }
2087
2088    /// Starts moving a window. This function is used if an application has
2089    /// window movement grips. When GDK can support it, the window movement
2090    /// will be done using the standard mechanism for the
2091    /// [window manager][gtk-X11-arch] or windowing
2092    /// system. Otherwise, GDK will try to emulate window movement,
2093    /// potentially not all that well, depending on the windowing system.
2094    /// ## `button`
2095    /// mouse button that initiated the drag
2096    /// ## `root_x`
2097    /// X position where the user clicked to initiate the drag, in root window coordinates
2098    /// ## `root_y`
2099    /// Y position where the user clicked to initiate the drag
2100    /// ## `timestamp`
2101    /// timestamp from the click event that initiated the drag
2102    #[doc(alias = "gtk_window_begin_move_drag")]
2103    fn begin_move_drag(&self, button: i32, root_x: i32, root_y: i32, timestamp: u32) {
2104        unsafe {
2105            ffi::gtk_window_begin_move_drag(
2106                self.as_ref().to_glib_none().0,
2107                button,
2108                root_x,
2109                root_y,
2110                timestamp,
2111            );
2112        }
2113    }
2114
2115    /// Starts resizing a window. This function is used if an application
2116    /// has window resizing controls. When GDK can support it, the resize
2117    /// will be done using the standard mechanism for the
2118    /// [window manager][gtk-X11-arch] or windowing
2119    /// system. Otherwise, GDK will try to emulate window resizing,
2120    /// potentially not all that well, depending on the windowing system.
2121    /// ## `edge`
2122    /// position of the resize control
2123    /// ## `button`
2124    /// mouse button that initiated the drag
2125    /// ## `root_x`
2126    /// X position where the user clicked to initiate the drag, in root window coordinates
2127    /// ## `root_y`
2128    /// Y position where the user clicked to initiate the drag
2129    /// ## `timestamp`
2130    /// timestamp from the click event that initiated the drag
2131    #[doc(alias = "gtk_window_begin_resize_drag")]
2132    fn begin_resize_drag(
2133        &self,
2134        edge: gdk::WindowEdge,
2135        button: i32,
2136        root_x: i32,
2137        root_y: i32,
2138        timestamp: u32,
2139    ) {
2140        unsafe {
2141            ffi::gtk_window_begin_resize_drag(
2142                self.as_ref().to_glib_none().0,
2143                edge.into_glib(),
2144                button,
2145                root_x,
2146                root_y,
2147                timestamp,
2148            );
2149        }
2150    }
2151
2152    /// Requests that the window is closed, similar to what happens
2153    /// when a window manager close button is clicked.
2154    ///
2155    /// This function can be used with close buttons in custom
2156    /// titlebars.
2157    #[doc(alias = "gtk_window_close")]
2158    fn close(&self) {
2159        unsafe {
2160            ffi::gtk_window_close(self.as_ref().to_glib_none().0);
2161        }
2162    }
2163
2164    /// Asks to deiconify (i.e. unminimize) the specified `self`. Note
2165    /// that you shouldn’t assume the window is definitely deiconified
2166    /// afterward, because other entities (e.g. the user or
2167    /// [window manager][gtk-X11-arch])) could iconify it
2168    /// again before your code which assumes deiconification gets to run.
2169    ///
2170    /// You can track iconification via the “window-state-event” signal
2171    /// on [`Widget`][crate::Widget].
2172    #[doc(alias = "gtk_window_deiconify")]
2173    fn deiconify(&self) {
2174        unsafe {
2175            ffi::gtk_window_deiconify(self.as_ref().to_glib_none().0);
2176        }
2177    }
2178
2179    /// Asks to place `self` in the fullscreen state. Note that you
2180    /// shouldn’t assume the window is definitely full screen afterward,
2181    /// because other entities (e.g. the user or
2182    /// [window manager][gtk-X11-arch]) could unfullscreen it
2183    /// again, and not all window managers honor requests to fullscreen
2184    /// windows. But normally the window will end up fullscreen. Just
2185    /// don’t write code that crashes if not.
2186    ///
2187    /// You can track the fullscreen state via the “window-state-event” signal
2188    /// on [`Widget`][crate::Widget].
2189    #[doc(alias = "gtk_window_fullscreen")]
2190    fn fullscreen(&self) {
2191        unsafe {
2192            ffi::gtk_window_fullscreen(self.as_ref().to_glib_none().0);
2193        }
2194    }
2195
2196    /// Asks to place `self` in the fullscreen state. Note that you shouldn't assume
2197    /// the window is definitely full screen afterward.
2198    ///
2199    /// You can track the fullscreen state via the "window-state-event" signal
2200    /// on [`Widget`][crate::Widget].
2201    /// ## `screen`
2202    /// a [`gdk::Screen`][crate::gdk::Screen] to draw to
2203    /// ## `monitor`
2204    /// which monitor to go fullscreen on
2205    #[doc(alias = "gtk_window_fullscreen_on_monitor")]
2206    fn fullscreen_on_monitor(&self, screen: &gdk::Screen, monitor: i32) {
2207        unsafe {
2208            ffi::gtk_window_fullscreen_on_monitor(
2209                self.as_ref().to_glib_none().0,
2210                screen.to_glib_none().0,
2211                monitor,
2212            );
2213        }
2214    }
2215
2216    /// Gets the value set by [`set_accept_focus()`][Self::set_accept_focus()].
2217    ///
2218    /// # Returns
2219    ///
2220    /// [`true`] if window should receive the input focus
2221    #[doc(alias = "gtk_window_get_accept_focus")]
2222    #[doc(alias = "get_accept_focus")]
2223    #[doc(alias = "accept-focus")]
2224    fn accepts_focus(&self) -> bool {
2225        unsafe {
2226            from_glib(ffi::gtk_window_get_accept_focus(
2227                self.as_ref().to_glib_none().0,
2228            ))
2229        }
2230    }
2231
2232    /// Gets the [`Application`][crate::Application] associated with the window (if any).
2233    ///
2234    /// # Returns
2235    ///
2236    /// a [`Application`][crate::Application], or [`None`]
2237    #[doc(alias = "gtk_window_get_application")]
2238    #[doc(alias = "get_application")]
2239    fn application(&self) -> Option<Application> {
2240        unsafe {
2241            from_glib_none(ffi::gtk_window_get_application(
2242                self.as_ref().to_glib_none().0,
2243            ))
2244        }
2245    }
2246
2247    /// Fetches the attach widget for this window. See
2248    /// [`set_attached_to()`][Self::set_attached_to()].
2249    ///
2250    /// # Returns
2251    ///
2252    /// the widget where the window
2253    /// is attached, or [`None`] if the window is not attached to any widget.
2254    #[doc(alias = "gtk_window_get_attached_to")]
2255    #[doc(alias = "get_attached_to")]
2256    #[doc(alias = "attached-to")]
2257    fn attached_to(&self) -> Option<Widget> {
2258        unsafe {
2259            from_glib_none(ffi::gtk_window_get_attached_to(
2260                self.as_ref().to_glib_none().0,
2261            ))
2262        }
2263    }
2264
2265    /// Returns whether the window has been set to have decorations
2266    /// such as a title bar via [`set_decorated()`][Self::set_decorated()].
2267    ///
2268    /// # Returns
2269    ///
2270    /// [`true`] if the window has been set to have decorations
2271    #[doc(alias = "gtk_window_get_decorated")]
2272    #[doc(alias = "get_decorated")]
2273    #[doc(alias = "decorated")]
2274    fn is_decorated(&self) -> bool {
2275        unsafe {
2276            from_glib(ffi::gtk_window_get_decorated(
2277                self.as_ref().to_glib_none().0,
2278            ))
2279        }
2280    }
2281
2282    /// Gets the default size of the window. A value of -1 for the width or
2283    /// height indicates that a default size has not been explicitly set
2284    /// for that dimension, so the “natural” size of the window will be
2285    /// used.
2286    ///
2287    /// # Returns
2288    ///
2289    ///
2290    /// ## `width`
2291    /// location to store the default width, or [`None`]
2292    ///
2293    /// ## `height`
2294    /// location to store the default height, or [`None`]
2295    #[doc(alias = "gtk_window_get_default_size")]
2296    #[doc(alias = "get_default_size")]
2297    fn default_size(&self) -> (i32, i32) {
2298        unsafe {
2299            let mut width = std::mem::MaybeUninit::uninit();
2300            let mut height = std::mem::MaybeUninit::uninit();
2301            ffi::gtk_window_get_default_size(
2302                self.as_ref().to_glib_none().0,
2303                width.as_mut_ptr(),
2304                height.as_mut_ptr(),
2305            );
2306            (width.assume_init(), height.assume_init())
2307        }
2308    }
2309
2310    /// Returns the default widget for `self`. See
2311    /// [`set_default()`][Self::set_default()] for more details.
2312    ///
2313    /// # Returns
2314    ///
2315    /// the default widget, or [`None`]
2316    /// if there is none.
2317    #[doc(alias = "gtk_window_get_default_widget")]
2318    #[doc(alias = "get_default_widget")]
2319    fn default_widget(&self) -> Option<Widget> {
2320        unsafe {
2321            from_glib_none(ffi::gtk_window_get_default_widget(
2322                self.as_ref().to_glib_none().0,
2323            ))
2324        }
2325    }
2326
2327    /// Returns whether the window has been set to have a close button
2328    /// via [`set_deletable()`][Self::set_deletable()].
2329    ///
2330    /// # Returns
2331    ///
2332    /// [`true`] if the window has been set to have a close button
2333    #[doc(alias = "gtk_window_get_deletable")]
2334    #[doc(alias = "get_deletable")]
2335    #[doc(alias = "deletable")]
2336    fn is_deletable(&self) -> bool {
2337        unsafe {
2338            from_glib(ffi::gtk_window_get_deletable(
2339                self.as_ref().to_glib_none().0,
2340            ))
2341        }
2342    }
2343
2344    /// Returns whether the window will be destroyed with its transient parent. See
2345    /// gtk_window_set_destroy_with_parent ().
2346    ///
2347    /// # Returns
2348    ///
2349    /// [`true`] if the window will be destroyed with its transient parent.
2350    #[doc(alias = "gtk_window_get_destroy_with_parent")]
2351    #[doc(alias = "get_destroy_with_parent")]
2352    #[doc(alias = "destroy-with-parent")]
2353    fn must_destroy_with_parent(&self) -> bool {
2354        unsafe {
2355            from_glib(ffi::gtk_window_get_destroy_with_parent(
2356                self.as_ref().to_glib_none().0,
2357            ))
2358        }
2359    }
2360
2361    /// Retrieves the current focused widget within the window.
2362    /// Note that this is the widget that would have the focus
2363    /// if the toplevel window focused; if the toplevel window
2364    /// is not focused then `gtk_widget_has_focus (widget)` will
2365    /// not be [`true`] for the widget.
2366    ///
2367    /// # Returns
2368    ///
2369    /// the currently focused widget,
2370    /// or [`None`] if there is none.
2371    #[doc(alias = "gtk_window_get_focus")]
2372    #[doc(alias = "get_focus")]
2373    fn focused_widget(&self) -> Option<Widget> {
2374        unsafe { from_glib_none(ffi::gtk_window_get_focus(self.as_ref().to_glib_none().0)) }
2375    }
2376
2377    /// Gets the value set by [`set_focus_on_map()`][Self::set_focus_on_map()].
2378    ///
2379    /// # Returns
2380    ///
2381    /// [`true`] if window should receive the input focus when
2382    /// mapped.
2383    #[doc(alias = "gtk_window_get_focus_on_map")]
2384    #[doc(alias = "get_focus_on_map")]
2385    #[doc(alias = "focus-on-map")]
2386    fn gets_focus_on_map(&self) -> bool {
2387        unsafe {
2388            from_glib(ffi::gtk_window_get_focus_on_map(
2389                self.as_ref().to_glib_none().0,
2390            ))
2391        }
2392    }
2393
2394    /// Gets the value of the [`focus-visible`][struct@crate::Window#focus-visible] property.
2395    ///
2396    /// # Returns
2397    ///
2398    /// [`true`] if “focus rectangles” are supposed to be visible
2399    ///  in this window.
2400    #[doc(alias = "gtk_window_get_focus_visible")]
2401    #[doc(alias = "get_focus_visible")]
2402    #[doc(alias = "focus-visible")]
2403    fn gets_focus_visible(&self) -> bool {
2404        unsafe {
2405            from_glib(ffi::gtk_window_get_focus_visible(
2406                self.as_ref().to_glib_none().0,
2407            ))
2408        }
2409    }
2410
2411    /// Gets the value set by [`set_gravity()`][Self::set_gravity()].
2412    ///
2413    /// # Returns
2414    ///
2415    /// window gravity
2416    #[doc(alias = "gtk_window_get_gravity")]
2417    #[doc(alias = "get_gravity")]
2418    fn gravity(&self) -> gdk::Gravity {
2419        unsafe { from_glib(ffi::gtk_window_get_gravity(self.as_ref().to_glib_none().0)) }
2420    }
2421
2422    /// Returns the group for `self` or the default group, if
2423    /// `self` is [`None`] or if `self` does not have an explicit
2424    /// window group.
2425    ///
2426    /// # Returns
2427    ///
2428    /// the [`WindowGroup`][crate::WindowGroup] for a window or the default group
2429    #[doc(alias = "gtk_window_get_group")]
2430    #[doc(alias = "get_group")]
2431    fn group(&self) -> Option<WindowGroup> {
2432        unsafe { from_glib_none(ffi::gtk_window_get_group(self.as_ref().to_glib_none().0)) }
2433    }
2434
2435    /// Returns whether the window has requested to have its titlebar hidden
2436    /// when maximized. See gtk_window_set_hide_titlebar_when_maximized ().
2437    ///
2438    /// # Returns
2439    ///
2440    /// [`true`] if the window has requested to have its titlebar
2441    ///  hidden when maximized
2442    #[doc(alias = "gtk_window_get_hide_titlebar_when_maximized")]
2443    #[doc(alias = "get_hide_titlebar_when_maximized")]
2444    #[doc(alias = "hide-titlebar-when-maximized")]
2445    fn hides_titlebar_when_maximized(&self) -> bool {
2446        unsafe {
2447            from_glib(ffi::gtk_window_get_hide_titlebar_when_maximized(
2448                self.as_ref().to_glib_none().0,
2449            ))
2450        }
2451    }
2452
2453    /// Gets the value set by [`set_icon()`][Self::set_icon()] (or if you've
2454    /// called [`set_icon_list()`][Self::set_icon_list()], gets the first icon in
2455    /// the icon list).
2456    ///
2457    /// # Returns
2458    ///
2459    /// icon for window or [`None`] if none
2460    #[doc(alias = "gtk_window_get_icon")]
2461    #[doc(alias = "get_icon")]
2462    fn icon(&self) -> Option<gdk_pixbuf::Pixbuf> {
2463        unsafe { from_glib_none(ffi::gtk_window_get_icon(self.as_ref().to_glib_none().0)) }
2464    }
2465
2466    /// Retrieves the list of icons set by [`set_icon_list()`][Self::set_icon_list()].
2467    /// The list is copied, but the reference count on each
2468    /// member won’t be incremented.
2469    ///
2470    /// # Returns
2471    ///
2472    /// copy of window’s icon list
2473    #[doc(alias = "gtk_window_get_icon_list")]
2474    #[doc(alias = "get_icon_list")]
2475    fn icon_list(&self) -> Vec<gdk_pixbuf::Pixbuf> {
2476        unsafe {
2477            FromGlibPtrContainer::from_glib_container(ffi::gtk_window_get_icon_list(
2478                self.as_ref().to_glib_none().0,
2479            ))
2480        }
2481    }
2482
2483    /// Returns the name of the themed icon for the window,
2484    /// see [`set_icon_name()`][Self::set_icon_name()].
2485    ///
2486    /// # Returns
2487    ///
2488    /// the icon name or [`None`] if the window has
2489    /// no themed icon
2490    #[doc(alias = "gtk_window_get_icon_name")]
2491    #[doc(alias = "get_icon_name")]
2492    #[doc(alias = "icon-name")]
2493    fn icon_name(&self) -> Option<glib::GString> {
2494        unsafe {
2495            from_glib_none(ffi::gtk_window_get_icon_name(
2496                self.as_ref().to_glib_none().0,
2497            ))
2498        }
2499    }
2500
2501    /// Returns the mnemonic modifier for this window. See
2502    /// [`set_mnemonic_modifier()`][Self::set_mnemonic_modifier()].
2503    ///
2504    /// # Returns
2505    ///
2506    /// the modifier mask used to activate
2507    ///  mnemonics on this window.
2508    #[doc(alias = "gtk_window_get_mnemonic_modifier")]
2509    #[doc(alias = "get_mnemonic_modifier")]
2510    fn mnemonic_modifier(&self) -> gdk::ModifierType {
2511        unsafe {
2512            from_glib(ffi::gtk_window_get_mnemonic_modifier(
2513                self.as_ref().to_glib_none().0,
2514            ))
2515        }
2516    }
2517
2518    /// Gets the value of the [`mnemonics-visible`][struct@crate::Window#mnemonics-visible] property.
2519    ///
2520    /// # Returns
2521    ///
2522    /// [`true`] if mnemonics are supposed to be visible
2523    /// in this window.
2524    #[doc(alias = "gtk_window_get_mnemonics_visible")]
2525    #[doc(alias = "get_mnemonics_visible")]
2526    #[doc(alias = "mnemonics-visible")]
2527    fn is_mnemonics_visible(&self) -> bool {
2528        unsafe {
2529            from_glib(ffi::gtk_window_get_mnemonics_visible(
2530                self.as_ref().to_glib_none().0,
2531            ))
2532        }
2533    }
2534
2535    /// Returns whether the window is modal. See [`set_modal()`][Self::set_modal()].
2536    ///
2537    /// # Returns
2538    ///
2539    /// [`true`] if the window is set to be modal and
2540    ///  establishes a grab when shown
2541    #[doc(alias = "gtk_window_get_modal")]
2542    #[doc(alias = "get_modal")]
2543    #[doc(alias = "modal")]
2544    fn is_modal(&self) -> bool {
2545        unsafe { from_glib(ffi::gtk_window_get_modal(self.as_ref().to_glib_none().0)) }
2546    }
2547
2548    /// This function returns the position you need to pass to
2549    /// [`move_()`][Self::move_()] to keep `self` in its current position.
2550    /// This means that the meaning of the returned value varies with
2551    /// window gravity. See [`move_()`][Self::move_()] for more details.
2552    ///
2553    /// The reliability of this function depends on the windowing system
2554    /// currently in use. Some windowing systems, such as Wayland, do not
2555    /// support a global coordinate system, and thus the position of the
2556    /// window will always be (0, 0). Others, like X11, do not have a reliable
2557    /// way to obtain the geometry of the decorations of a window if they are
2558    /// provided by the window manager. Additionally, on X11, window manager
2559    /// have been known to mismanage window gravity, which result in windows
2560    /// moving even if you use the coordinates of the current position as
2561    /// returned by this function.
2562    ///
2563    /// If you haven’t changed the window gravity, its gravity will be
2564    /// [`gdk::Gravity::NorthWest`][crate::gdk::Gravity::NorthWest]. This means that [`position()`][Self::position()]
2565    /// gets the position of the top-left corner of the window manager
2566    /// frame for the window. [`move_()`][Self::move_()] sets the position of this
2567    /// same top-left corner.
2568    ///
2569    /// If a window has gravity [`gdk::Gravity::Static`][crate::gdk::Gravity::Static] the window manager
2570    /// frame is not relevant, and thus [`position()`][Self::position()] will
2571    /// always produce accurate results. However you can’t use static
2572    /// gravity to do things like place a window in a corner of the screen,
2573    /// because static gravity ignores the window manager decorations.
2574    ///
2575    /// Ideally, this function should return appropriate values if the
2576    /// window has client side decorations, assuming that the windowing
2577    /// system supports global coordinates.
2578    ///
2579    /// In practice, saving the window position should not be left to
2580    /// applications, as they lack enough knowledge of the windowing
2581    /// system and the window manager state to effectively do so. The
2582    /// appropriate way to implement saving the window position is to
2583    /// use a platform-specific protocol, wherever that is available.
2584    ///
2585    /// # Returns
2586    ///
2587    ///
2588    /// ## `root_x`
2589    /// return location for X coordinate of
2590    ///  gravity-determined reference point, or [`None`]
2591    ///
2592    /// ## `root_y`
2593    /// return location for Y coordinate of
2594    ///  gravity-determined reference point, or [`None`]
2595    #[doc(alias = "gtk_window_get_position")]
2596    #[doc(alias = "get_position")]
2597    fn position(&self) -> (i32, i32) {
2598        unsafe {
2599            let mut root_x = std::mem::MaybeUninit::uninit();
2600            let mut root_y = std::mem::MaybeUninit::uninit();
2601            ffi::gtk_window_get_position(
2602                self.as_ref().to_glib_none().0,
2603                root_x.as_mut_ptr(),
2604                root_y.as_mut_ptr(),
2605            );
2606            (root_x.assume_init(), root_y.assume_init())
2607        }
2608    }
2609
2610    /// Gets the value set by [`set_resizable()`][Self::set_resizable()].
2611    ///
2612    /// # Returns
2613    ///
2614    /// [`true`] if the user can resize the window
2615    #[doc(alias = "gtk_window_get_resizable")]
2616    #[doc(alias = "get_resizable")]
2617    #[doc(alias = "resizable")]
2618    fn is_resizable(&self) -> bool {
2619        unsafe {
2620            from_glib(ffi::gtk_window_get_resizable(
2621                self.as_ref().to_glib_none().0,
2622            ))
2623        }
2624    }
2625
2626    /// Returns the role of the window. See [`set_role()`][Self::set_role()] for
2627    /// further explanation.
2628    ///
2629    /// # Returns
2630    ///
2631    /// the role of the window if set, or [`None`]. The
2632    /// returned is owned by the widget and must not be modified or freed.
2633    #[doc(alias = "gtk_window_get_role")]
2634    #[doc(alias = "get_role")]
2635    fn role(&self) -> Option<glib::GString> {
2636        unsafe { from_glib_none(ffi::gtk_window_get_role(self.as_ref().to_glib_none().0)) }
2637    }
2638
2639    /// Returns the [`gdk::Screen`][crate::gdk::Screen] associated with `self`.
2640    ///
2641    /// # Returns
2642    ///
2643    /// a [`gdk::Screen`][crate::gdk::Screen].
2644    #[doc(alias = "gtk_window_get_screen")]
2645    #[doc(alias = "get_screen")]
2646    fn screen(&self) -> Option<gdk::Screen> {
2647        unsafe { from_glib_none(ffi::gtk_window_get_screen(self.as_ref().to_glib_none().0)) }
2648    }
2649
2650    /// new_height);
2651    ///
2652    ///  ...
2653    /// }
2654    /// ]|
2655    ///
2656    /// Note that, if you connect to the [`size-allocate`][struct@crate::Widget#size-allocate] signal,
2657    /// you should not use the dimensions of the `GtkAllocation` passed to
2658    /// the signal handler, as the allocation may contain client side
2659    /// decorations added by GTK+, depending on the windowing system in
2660    /// use.
2661    ///
2662    /// If you are getting a window size in order to position the window
2663    /// on the screen, you should, instead, simply set the window’s semantic
2664    /// type with [`set_type_hint()`][Self::set_type_hint()], which allows the window manager
2665    /// to e.g. center dialogs. Also, if you set the transient parent of
2666    /// dialogs with [`set_transient_for()`][Self::set_transient_for()] window managers will
2667    /// often center the dialog over its parent window. It's much preferred
2668    /// to let the window manager handle these cases rather than doing it
2669    /// yourself, because all apps will behave consistently and according to
2670    /// user or system preferences, if the window manager handles it. Also,
2671    /// the window manager can take into account the size of the window
2672    /// decorations and border that it may add, and of which GTK+ has no
2673    /// knowledge. Additionally, positioning windows in global screen coordinates
2674    /// may not be allowed by the windowing system. For more information,
2675    /// see: [`set_position()`][Self::set_position()].
2676    ///
2677    /// # Returns
2678    ///
2679    ///
2680    /// ## `width`
2681    /// return location for width, or [`None`]
2682    ///
2683    /// ## `height`
2684    /// return location for height, or [`None`]
2685    #[doc(alias = "gtk_window_get_size")]
2686    #[doc(alias = "get_size")]
2687    fn size(&self) -> (i32, i32) {
2688        unsafe {
2689            let mut width = std::mem::MaybeUninit::uninit();
2690            let mut height = std::mem::MaybeUninit::uninit();
2691            ffi::gtk_window_get_size(
2692                self.as_ref().to_glib_none().0,
2693                width.as_mut_ptr(),
2694                height.as_mut_ptr(),
2695            );
2696            (width.assume_init(), height.assume_init())
2697        }
2698    }
2699
2700    /// Gets the value set by [`set_skip_pager_hint()`][Self::set_skip_pager_hint()].
2701    ///
2702    /// # Returns
2703    ///
2704    /// [`true`] if window shouldn’t be in pager
2705    #[doc(alias = "gtk_window_get_skip_pager_hint")]
2706    #[doc(alias = "get_skip_pager_hint")]
2707    #[doc(alias = "skip-pager-hint")]
2708    fn skips_pager_hint(&self) -> bool {
2709        unsafe {
2710            from_glib(ffi::gtk_window_get_skip_pager_hint(
2711                self.as_ref().to_glib_none().0,
2712            ))
2713        }
2714    }
2715
2716    /// Gets the value set by [`set_skip_taskbar_hint()`][Self::set_skip_taskbar_hint()]
2717    ///
2718    /// # Returns
2719    ///
2720    /// [`true`] if window shouldn’t be in taskbar
2721    #[doc(alias = "gtk_window_get_skip_taskbar_hint")]
2722    #[doc(alias = "get_skip_taskbar_hint")]
2723    #[doc(alias = "skip-taskbar-hint")]
2724    fn skips_taskbar_hint(&self) -> bool {
2725        unsafe {
2726            from_glib(ffi::gtk_window_get_skip_taskbar_hint(
2727                self.as_ref().to_glib_none().0,
2728            ))
2729        }
2730    }
2731
2732    /// Retrieves the title of the window. See [`set_title()`][Self::set_title()].
2733    ///
2734    /// # Returns
2735    ///
2736    /// the title of the window, or [`None`] if none has
2737    /// been set explicitly. The returned string is owned by the widget
2738    /// and must not be modified or freed.
2739    #[doc(alias = "gtk_window_get_title")]
2740    #[doc(alias = "get_title")]
2741    fn title(&self) -> Option<glib::GString> {
2742        unsafe { from_glib_none(ffi::gtk_window_get_title(self.as_ref().to_glib_none().0)) }
2743    }
2744
2745    /// Returns the custom titlebar that has been set with
2746    /// [`set_titlebar()`][Self::set_titlebar()].
2747    ///
2748    /// # Returns
2749    ///
2750    /// the custom titlebar, or [`None`]
2751    #[doc(alias = "gtk_window_get_titlebar")]
2752    #[doc(alias = "get_titlebar")]
2753    fn titlebar(&self) -> Option<Widget> {
2754        unsafe { from_glib_none(ffi::gtk_window_get_titlebar(self.as_ref().to_glib_none().0)) }
2755    }
2756
2757    /// Fetches the transient parent for this window. See
2758    /// [`set_transient_for()`][Self::set_transient_for()].
2759    ///
2760    /// # Returns
2761    ///
2762    /// the transient parent for this
2763    /// window, or [`None`] if no transient parent has been set.
2764    #[doc(alias = "gtk_window_get_transient_for")]
2765    #[doc(alias = "get_transient_for")]
2766    #[doc(alias = "transient-for")]
2767    #[must_use]
2768    fn transient_for(&self) -> Option<Window> {
2769        unsafe {
2770            from_glib_none(ffi::gtk_window_get_transient_for(
2771                self.as_ref().to_glib_none().0,
2772            ))
2773        }
2774    }
2775
2776    /// Gets the type hint for this window. See [`set_type_hint()`][Self::set_type_hint()].
2777    ///
2778    /// # Returns
2779    ///
2780    /// the type hint for `self`.
2781    #[doc(alias = "gtk_window_get_type_hint")]
2782    #[doc(alias = "get_type_hint")]
2783    #[doc(alias = "type-hint")]
2784    fn type_hint(&self) -> gdk::WindowTypeHint {
2785        unsafe {
2786            from_glib(ffi::gtk_window_get_type_hint(
2787                self.as_ref().to_glib_none().0,
2788            ))
2789        }
2790    }
2791
2792    /// Gets the value set by [`set_urgency_hint()`][Self::set_urgency_hint()]
2793    ///
2794    /// # Returns
2795    ///
2796    /// [`true`] if window is urgent
2797    #[doc(alias = "gtk_window_get_urgency_hint")]
2798    #[doc(alias = "get_urgency_hint")]
2799    #[doc(alias = "urgency-hint")]
2800    fn is_urgency_hint(&self) -> bool {
2801        unsafe {
2802            from_glib(ffi::gtk_window_get_urgency_hint(
2803                self.as_ref().to_glib_none().0,
2804            ))
2805        }
2806    }
2807
2808    /// Gets the type of the window. See [`WindowType`][crate::WindowType].
2809    ///
2810    /// # Returns
2811    ///
2812    /// the type of the window
2813    #[doc(alias = "gtk_window_get_window_type")]
2814    #[doc(alias = "get_window_type")]
2815    fn window_type(&self) -> WindowType {
2816        unsafe {
2817            from_glib(ffi::gtk_window_get_window_type(
2818                self.as_ref().to_glib_none().0,
2819            ))
2820        }
2821    }
2822
2823    /// Returns whether `self` has an explicit window group.
2824    ///
2825    /// # Returns
2826    ///
2827    /// [`true`] if `self` has an explicit window group.
2828    ///
2829    /// Since 2.22
2830    #[doc(alias = "gtk_window_has_group")]
2831    fn has_group(&self) -> bool {
2832        unsafe { from_glib(ffi::gtk_window_has_group(self.as_ref().to_glib_none().0)) }
2833    }
2834
2835    /// Returns whether the input focus is within this GtkWindow.
2836    /// For real toplevel windows, this is identical to [`is_active()`][Self::is_active()],
2837    /// but for embedded windows, like [`Plug`][crate::Plug], the results will differ.
2838    ///
2839    /// # Returns
2840    ///
2841    /// [`true`] if the input focus is within this GtkWindow
2842    #[doc(alias = "gtk_window_has_toplevel_focus")]
2843    #[doc(alias = "has-toplevel-focus")]
2844    fn has_toplevel_focus(&self) -> bool {
2845        unsafe {
2846            from_glib(ffi::gtk_window_has_toplevel_focus(
2847                self.as_ref().to_glib_none().0,
2848            ))
2849        }
2850    }
2851
2852    /// Asks to iconify (i.e. minimize) the specified `self`. Note that
2853    /// you shouldn’t assume the window is definitely iconified afterward,
2854    /// because other entities (e.g. the user or
2855    /// [window manager][gtk-X11-arch]) could deiconify it
2856    /// again, or there may not be a window manager in which case
2857    /// iconification isn’t possible, etc. But normally the window will end
2858    /// up iconified. Just don’t write code that crashes if not.
2859    ///
2860    /// It’s permitted to call this function before showing a window,
2861    /// in which case the window will be iconified before it ever appears
2862    /// onscreen.
2863    ///
2864    /// You can track iconification via the “window-state-event” signal
2865    /// on [`Widget`][crate::Widget].
2866    #[doc(alias = "gtk_window_iconify")]
2867    fn iconify(&self) {
2868        unsafe {
2869            ffi::gtk_window_iconify(self.as_ref().to_glib_none().0);
2870        }
2871    }
2872
2873    /// Returns whether the window is part of the current active toplevel.
2874    /// (That is, the toplevel window receiving keystrokes.)
2875    /// The return value is [`true`] if the window is active toplevel
2876    /// itself, but also if it is, say, a [`Plug`][crate::Plug] embedded in the active toplevel.
2877    /// You might use this function if you wanted to draw a widget
2878    /// differently in an active window from a widget in an inactive window.
2879    /// See [`has_toplevel_focus()`][Self::has_toplevel_focus()]
2880    ///
2881    /// # Returns
2882    ///
2883    /// [`true`] if the window part of the current active window.
2884    #[doc(alias = "gtk_window_is_active")]
2885    #[doc(alias = "is-active")]
2886    fn is_active(&self) -> bool {
2887        unsafe { from_glib(ffi::gtk_window_is_active(self.as_ref().to_glib_none().0)) }
2888    }
2889
2890    /// Retrieves the current maximized state of `self`.
2891    ///
2892    /// Note that since maximization is ultimately handled by the window
2893    /// manager and happens asynchronously to an application request, you
2894    /// shouldn’t assume the return value of this function changing
2895    /// immediately (or at all), as an effect of calling
2896    /// [`maximize()`][Self::maximize()] or [`unmaximize()`][Self::unmaximize()].
2897    ///
2898    /// # Returns
2899    ///
2900    /// whether the window has a maximized state.
2901    #[doc(alias = "gtk_window_is_maximized")]
2902    #[doc(alias = "is-maximized")]
2903    fn is_maximized(&self) -> bool {
2904        unsafe { from_glib(ffi::gtk_window_is_maximized(self.as_ref().to_glib_none().0)) }
2905    }
2906
2907    /// Asks to maximize `self`, so that it becomes full-screen. Note that
2908    /// you shouldn’t assume the window is definitely maximized afterward,
2909    /// because other entities (e.g. the user or
2910    /// [window manager][gtk-X11-arch]) could unmaximize it
2911    /// again, and not all window managers support maximization. But
2912    /// normally the window will end up maximized. Just don’t write code
2913    /// that crashes if not.
2914    ///
2915    /// It’s permitted to call this function before showing a window,
2916    /// in which case the window will be maximized when it appears onscreen
2917    /// initially.
2918    ///
2919    /// You can track maximization via the “window-state-event” signal
2920    /// on [`Widget`][crate::Widget], or by listening to notifications on the
2921    /// [`is-maximized`][struct@crate::Window#is-maximized] property.
2922    #[doc(alias = "gtk_window_maximize")]
2923    fn maximize(&self) {
2924        unsafe {
2925            ffi::gtk_window_maximize(self.as_ref().to_glib_none().0);
2926        }
2927    }
2928
2929    /// Activates the targets associated with the mnemonic.
2930    /// ## `keyval`
2931    /// the mnemonic
2932    /// ## `modifier`
2933    /// the modifiers
2934    ///
2935    /// # Returns
2936    ///
2937    /// [`true`] if the activation is done.
2938    #[doc(alias = "gtk_window_mnemonic_activate")]
2939    fn mnemonic_activate(&self, keyval: u32, modifier: gdk::ModifierType) -> bool {
2940        unsafe {
2941            from_glib(ffi::gtk_window_mnemonic_activate(
2942                self.as_ref().to_glib_none().0,
2943                keyval,
2944                modifier.into_glib(),
2945            ))
2946        }
2947    }
2948
2949    /// Asks the [window manager][gtk-X11-arch] to move
2950    /// `self` to the given position. Window managers are free to ignore
2951    /// this; most window managers ignore requests for initial window
2952    /// positions (instead using a user-defined placement algorithm) and
2953    /// honor requests after the window has already been shown.
2954    ///
2955    /// Note: the position is the position of the gravity-determined
2956    /// reference point for the window. The gravity determines two things:
2957    /// first, the location of the reference point in root window
2958    /// coordinates; and second, which point on the window is positioned at
2959    /// the reference point.
2960    ///
2961    /// By default the gravity is [`gdk::Gravity::NorthWest`][crate::gdk::Gravity::NorthWest], so the reference
2962    /// point is simply the `x`, `y` supplied to [`move_()`][Self::move_()]. The
2963    /// top-left corner of the window decorations (aka window frame or
2964    /// border) will be placed at `x`, `y`. Therefore, to position a window
2965    /// at the top left of the screen, you want to use the default gravity
2966    /// (which is [`gdk::Gravity::NorthWest`][crate::gdk::Gravity::NorthWest]) and move the window to 0,0.
2967    ///
2968    /// To position a window at the bottom right corner of the screen, you
2969    /// would set [`gdk::Gravity::SouthEast`][crate::gdk::Gravity::SouthEast], which means that the reference
2970    /// point is at `x` + the window width and `y` + the window height, and
2971    /// the bottom-right corner of the window border will be placed at that
2972    /// reference point. So, to place a window in the bottom right corner
2973    /// you would first set gravity to south east, then write:
2974    /// `gtk_window_move (window, gdk_screen_width () - window_width,
2975    /// gdk_screen_height () - window_height)` (note that this
2976    /// example does not take multi-head scenarios into account).
2977    ///
2978    /// The [Extended Window Manager Hints Specification](http://www.freedesktop.org/Standards/wm-spec)
2979    /// has a nice table of gravities in the “implementation notes” section.
2980    ///
2981    /// The [`position()`][Self::position()] documentation may also be relevant.
2982    /// ## `x`
2983    /// X coordinate to move window to
2984    /// ## `y`
2985    /// Y coordinate to move window to
2986    #[doc(alias = "gtk_window_move")]
2987    #[doc(alias = "move")]
2988    fn move_(&self, x: i32, y: i32) {
2989        unsafe {
2990            ffi::gtk_window_move(self.as_ref().to_glib_none().0, x, y);
2991        }
2992    }
2993
2994    /// Presents a window to the user. This function should not be used
2995    /// as when it is called, it is too late to gather a valid timestamp
2996    /// to allow focus stealing prevention to work correctly.
2997    #[doc(alias = "gtk_window_present")]
2998    fn present(&self) {
2999        unsafe {
3000            ffi::gtk_window_present(self.as_ref().to_glib_none().0);
3001        }
3002    }
3003
3004    /// Presents a window to the user. This may mean raising the window
3005    /// in the stacking order, deiconifying it, moving it to the current
3006    /// desktop, and/or giving it the keyboard focus, possibly dependent
3007    /// on the user’s platform, window manager, and preferences.
3008    ///
3009    /// If `self` is hidden, this function calls [`WidgetExt::show()`][crate::prelude::WidgetExt::show()]
3010    /// as well.
3011    ///
3012    /// This function should be used when the user tries to open a window
3013    /// that’s already open. Say for example the preferences dialog is
3014    /// currently open, and the user chooses Preferences from the menu
3015    /// a second time; use [`present()`][Self::present()] to move the already-open dialog
3016    /// where the user can see it.
3017    ///
3018    /// Presents a window to the user in response to a user interaction. The
3019    /// timestamp should be gathered when the window was requested to be shown
3020    /// (when clicking a link for example), rather than once the window is
3021    /// ready to be shown.
3022    /// ## `timestamp`
3023    /// the timestamp of the user interaction (typically a
3024    ///  button or key press event) which triggered this call
3025    #[doc(alias = "gtk_window_present_with_time")]
3026    fn present_with_time(&self, timestamp: u32) {
3027        unsafe {
3028            ffi::gtk_window_present_with_time(self.as_ref().to_glib_none().0, timestamp);
3029        }
3030    }
3031
3032    /// Propagate a key press or release event to the focus widget and
3033    /// up the focus container chain until a widget handles `event`.
3034    /// This is normally called by the default ::key_press_event and
3035    /// ::key_release_event handlers for toplevel windows,
3036    /// however in some cases it may be useful to call this directly when
3037    /// overriding the standard key handling for a toplevel window.
3038    /// ## `event`
3039    /// a [`gdk::EventKey`][crate::gdk::EventKey]
3040    ///
3041    /// # Returns
3042    ///
3043    /// [`true`] if a widget in the focus chain handled the event.
3044    #[doc(alias = "gtk_window_propagate_key_event")]
3045    fn propagate_key_event(&self, event: &gdk::EventKey) -> bool {
3046        unsafe {
3047            from_glib(ffi::gtk_window_propagate_key_event(
3048                self.as_ref().to_glib_none().0,
3049                mut_override(event.to_glib_none().0),
3050            ))
3051        }
3052    }
3053
3054    /// Reverses the effects of [`add_accel_group()`][Self::add_accel_group()].
3055    /// ## `accel_group`
3056    /// a [`AccelGroup`][crate::AccelGroup]
3057    #[doc(alias = "gtk_window_remove_accel_group")]
3058    fn remove_accel_group(&self, accel_group: &impl IsA<AccelGroup>) {
3059        unsafe {
3060            ffi::gtk_window_remove_accel_group(
3061                self.as_ref().to_glib_none().0,
3062                accel_group.as_ref().to_glib_none().0,
3063            );
3064        }
3065    }
3066
3067    /// Removes a mnemonic from this window.
3068    /// ## `keyval`
3069    /// the mnemonic
3070    /// ## `target`
3071    /// the widget that gets activated by the mnemonic
3072    #[doc(alias = "gtk_window_remove_mnemonic")]
3073    fn remove_mnemonic(&self, keyval: u32, target: &impl IsA<Widget>) {
3074        unsafe {
3075            ffi::gtk_window_remove_mnemonic(
3076                self.as_ref().to_glib_none().0,
3077                keyval,
3078                target.as_ref().to_glib_none().0,
3079            );
3080        }
3081    }
3082
3083    /// Resizes the window as if the user had done so, obeying geometry
3084    /// constraints. The default geometry constraint is that windows may
3085    /// not be smaller than their size request; to override this
3086    /// constraint, call [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] to set the window's
3087    /// request to a smaller value.
3088    ///
3089    /// If [`resize()`][Self::resize()] is called before showing a window for the
3090    /// first time, it overrides any default size set with
3091    /// [`set_default_size()`][Self::set_default_size()].
3092    ///
3093    /// Windows may not be resized smaller than 1 by 1 pixels.
3094    ///
3095    /// When using client side decorations, GTK+ will do its best to adjust
3096    /// the given size so that the resulting window size matches the
3097    /// requested size without the title bar, borders and shadows added for
3098    /// the client side decorations, but there is no guarantee that the
3099    /// result will be totally accurate because these widgets added for
3100    /// client side decorations depend on the theme and may not be realized
3101    /// or visible at the time [`resize()`][Self::resize()] is issued.
3102    ///
3103    /// If the GtkWindow has a titlebar widget (see [`set_titlebar()`][Self::set_titlebar()]), then
3104    /// typically, [`resize()`][Self::resize()] will compensate for the height of the titlebar
3105    /// widget only if the height is known when the resulting GtkWindow configuration
3106    /// is issued.
3107    /// For example, if new widgets are added after the GtkWindow configuration
3108    /// and cause the titlebar widget to grow in height, this will result in a
3109    /// window content smaller that specified by [`resize()`][Self::resize()] and not
3110    /// a larger window.
3111    /// ## `width`
3112    /// width in pixels to resize the window to
3113    /// ## `height`
3114    /// height in pixels to resize the window to
3115    #[doc(alias = "gtk_window_resize")]
3116    fn resize(&self, width: i32, height: i32) {
3117        unsafe {
3118            ffi::gtk_window_resize(self.as_ref().to_glib_none().0, width, height);
3119        }
3120    }
3121
3122    /// Windows may set a hint asking the desktop environment not to receive
3123    /// the input focus. This function sets this hint.
3124    /// ## `setting`
3125    /// [`true`] to let this window receive input focus
3126    #[doc(alias = "gtk_window_set_accept_focus")]
3127    #[doc(alias = "accept-focus")]
3128    fn set_accept_focus(&self, setting: bool) {
3129        unsafe {
3130            ffi::gtk_window_set_accept_focus(self.as_ref().to_glib_none().0, setting.into_glib());
3131        }
3132    }
3133
3134    /// Sets or unsets the [`Application`][crate::Application] associated with the window.
3135    ///
3136    /// The application will be kept alive for at least as long as it has any windows
3137    /// associated with it (see [`ApplicationExtManual::hold()`][crate::gio::prelude::ApplicationExtManual::hold()] for a way to keep it alive
3138    /// without windows).
3139    ///
3140    /// Normally, the connection between the application and the window will remain
3141    /// until the window is destroyed, but you can explicitly remove it by setting
3142    /// the `application` to [`None`].
3143    ///
3144    /// This is equivalent to calling [`GtkApplicationExt::remove_window()`][crate::prelude::GtkApplicationExt::remove_window()] and/or
3145    /// [`GtkApplicationExt::add_window()`][crate::prelude::GtkApplicationExt::add_window()] on the old/new applications as relevant.
3146    /// ## `application`
3147    /// a [`Application`][crate::Application], or [`None`] to unset
3148    #[doc(alias = "gtk_window_set_application")]
3149    #[doc(alias = "application")]
3150    fn set_application(&self, application: Option<&impl IsA<Application>>) {
3151        unsafe {
3152            ffi::gtk_window_set_application(
3153                self.as_ref().to_glib_none().0,
3154                application.map(|p| p.as_ref()).to_glib_none().0,
3155            );
3156        }
3157    }
3158
3159    /// Marks `self` as attached to `attach_widget`. This creates a logical binding
3160    /// between the window and the widget it belongs to, which is used by GTK+ to
3161    /// propagate information such as styling or accessibility to `self` as if it
3162    /// was a children of `attach_widget`.
3163    ///
3164    /// Examples of places where specifying this relation is useful are for instance
3165    /// a [`Menu`][crate::Menu] created by a [`ComboBox`][crate::ComboBox], a completion popup window
3166    /// created by [`Entry`][crate::Entry] or a typeahead search entry created by [`TreeView`][crate::TreeView].
3167    ///
3168    /// Note that this function should not be confused with
3169    /// [`set_transient_for()`][Self::set_transient_for()], which specifies a window manager relation
3170    /// between two toplevels instead.
3171    ///
3172    /// Passing [`None`] for `attach_widget` detaches the window.
3173    /// ## `attach_widget`
3174    /// a [`Widget`][crate::Widget], or [`None`]
3175    #[doc(alias = "gtk_window_set_attached_to")]
3176    #[doc(alias = "attached-to")]
3177    fn set_attached_to(&self, attach_widget: Option<&impl IsA<Widget>>) {
3178        unsafe {
3179            ffi::gtk_window_set_attached_to(
3180                self.as_ref().to_glib_none().0,
3181                attach_widget.map(|p| p.as_ref()).to_glib_none().0,
3182            );
3183        }
3184    }
3185
3186    /// By default, windows are decorated with a title bar, resize
3187    /// controls, etc. Some [window managers][gtk-X11-arch]
3188    /// allow GTK+ to disable these decorations, creating a
3189    /// borderless window. If you set the decorated property to [`false`]
3190    /// using this function, GTK+ will do its best to convince the window
3191    /// manager not to decorate the window. Depending on the system, this
3192    /// function may not have any effect when called on a window that is
3193    /// already visible, so you should call it before calling [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
3194    ///
3195    /// On Windows, this function always works, since there’s no window manager
3196    /// policy involved.
3197    /// ## `setting`
3198    /// [`true`] to decorate the window
3199    #[doc(alias = "gtk_window_set_decorated")]
3200    #[doc(alias = "decorated")]
3201    fn set_decorated(&self, setting: bool) {
3202        unsafe {
3203            ffi::gtk_window_set_decorated(self.as_ref().to_glib_none().0, setting.into_glib());
3204        }
3205    }
3206
3207    /// The default widget is the widget that’s activated when the user
3208    /// presses Enter in a dialog (for example). This function sets or
3209    /// unsets the default widget for a [`Window`][crate::Window]. When setting (rather
3210    /// than unsetting) the default widget it’s generally easier to call
3211    /// [`WidgetExt::grab_default()`][crate::prelude::WidgetExt::grab_default()] on the widget. Before making a widget
3212    /// the default widget, you must call [`WidgetExt::set_can_default()`][crate::prelude::WidgetExt::set_can_default()] on
3213    /// the widget you’d like to make the default.
3214    /// ## `default_widget`
3215    /// widget to be the default, or [`None`]
3216    ///  to unset the default widget for the toplevel
3217    #[doc(alias = "gtk_window_set_default")]
3218    fn set_default(&self, default_widget: Option<&impl IsA<Widget>>) {
3219        unsafe {
3220            ffi::gtk_window_set_default(
3221                self.as_ref().to_glib_none().0,
3222                default_widget.map(|p| p.as_ref()).to_glib_none().0,
3223            );
3224        }
3225    }
3226
3227    /// Sets the default size of a window. If the window’s “natural” size
3228    /// (its size request) is larger than the default, the default will be
3229    /// ignored. More generally, if the default size does not obey the
3230    /// geometry hints for the window ([`set_geometry_hints()`][Self::set_geometry_hints()] can
3231    /// be used to set these explicitly), the default size will be clamped
3232    /// to the nearest permitted size.
3233    ///
3234    /// Unlike [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()], which sets a size request for
3235    /// a widget and thus would keep users from shrinking the window, this
3236    /// function only sets the initial size, just as if the user had
3237    /// resized the window themselves. Users can still shrink the window
3238    /// again as they normally would. Setting a default size of -1 means to
3239    /// use the “natural” default size (the size request of the window).
3240    ///
3241    /// For more control over a window’s initial size and how resizing works,
3242    /// investigate [`set_geometry_hints()`][Self::set_geometry_hints()].
3243    ///
3244    /// For some uses, [`resize()`][Self::resize()] is a more appropriate function.
3245    /// [`resize()`][Self::resize()] changes the current size of the window, rather
3246    /// than the size to be used on initial display. [`resize()`][Self::resize()] always
3247    /// affects the window itself, not the geometry widget.
3248    ///
3249    /// The default size of a window only affects the first time a window is
3250    /// shown; if a window is hidden and re-shown, it will remember the size
3251    /// it had prior to hiding, rather than using the default size.
3252    ///
3253    /// Windows can’t actually be 0x0 in size, they must be at least 1x1, but
3254    /// passing 0 for `width` and `height` is OK, resulting in a 1x1 default size.
3255    ///
3256    /// If you use this function to reestablish a previously saved window size,
3257    /// note that the appropriate size to save is the one returned by
3258    /// [`size()`][Self::size()]. Using the window allocation directly will not
3259    /// work in all circumstances and can lead to growing or shrinking windows.
3260    /// ## `width`
3261    /// width in pixels, or -1 to unset the default width
3262    /// ## `height`
3263    /// height in pixels, or -1 to unset the default height
3264    #[doc(alias = "gtk_window_set_default_size")]
3265    fn set_default_size(&self, width: i32, height: i32) {
3266        unsafe {
3267            ffi::gtk_window_set_default_size(self.as_ref().to_glib_none().0, width, height);
3268        }
3269    }
3270
3271    /// By default, windows have a close button in the window frame. Some
3272    /// [window managers][gtk-X11-arch] allow GTK+ to
3273    /// disable this button. If you set the deletable property to [`false`]
3274    /// using this function, GTK+ will do its best to convince the window
3275    /// manager not to show a close button. Depending on the system, this
3276    /// function may not have any effect when called on a window that is
3277    /// already visible, so you should call it before calling [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
3278    ///
3279    /// On Windows, this function always works, since there’s no window manager
3280    /// policy involved.
3281    /// ## `setting`
3282    /// [`true`] to decorate the window as deletable
3283    #[doc(alias = "gtk_window_set_deletable")]
3284    #[doc(alias = "deletable")]
3285    fn set_deletable(&self, setting: bool) {
3286        unsafe {
3287            ffi::gtk_window_set_deletable(self.as_ref().to_glib_none().0, setting.into_glib());
3288        }
3289    }
3290
3291    /// If `setting` is [`true`], then destroying the transient parent of `self`
3292    /// will also destroy `self` itself. This is useful for dialogs that
3293    /// shouldn’t persist beyond the lifetime of the main window they're
3294    /// associated with, for example.
3295    /// ## `setting`
3296    /// whether to destroy `self` with its transient parent
3297    #[doc(alias = "gtk_window_set_destroy_with_parent")]
3298    #[doc(alias = "destroy-with-parent")]
3299    fn set_destroy_with_parent(&self, setting: bool) {
3300        unsafe {
3301            ffi::gtk_window_set_destroy_with_parent(
3302                self.as_ref().to_glib_none().0,
3303                setting.into_glib(),
3304            );
3305        }
3306    }
3307
3308    /// If `focus` is not the current focus widget, and is focusable, sets
3309    /// it as the focus widget for the window. If `focus` is [`None`], unsets
3310    /// the focus widget for this window. To set the focus to a particular
3311    /// widget in the toplevel, it is usually more convenient to use
3312    /// [`WidgetExt::grab_focus()`][crate::prelude::WidgetExt::grab_focus()] instead of this function.
3313    /// ## `focus`
3314    /// widget to be the new focus widget, or [`None`] to unset
3315    ///  any focus widget for the toplevel window.
3316    #[doc(alias = "gtk_window_set_focus")]
3317    fn set_focus(&self, focus: Option<&impl IsA<Widget>>) {
3318        unsafe {
3319            ffi::gtk_window_set_focus(
3320                self.as_ref().to_glib_none().0,
3321                focus.map(|p| p.as_ref()).to_glib_none().0,
3322            );
3323        }
3324    }
3325
3326    /// Windows may set a hint asking the desktop environment not to receive
3327    /// the input focus when the window is mapped. This function sets this
3328    /// hint.
3329    /// ## `setting`
3330    /// [`true`] to let this window receive input focus on map
3331    #[doc(alias = "gtk_window_set_focus_on_map")]
3332    #[doc(alias = "focus-on-map")]
3333    fn set_focus_on_map(&self, setting: bool) {
3334        unsafe {
3335            ffi::gtk_window_set_focus_on_map(self.as_ref().to_glib_none().0, setting.into_glib());
3336        }
3337    }
3338
3339    /// Sets the [`focus-visible`][struct@crate::Window#focus-visible] property.
3340    /// ## `setting`
3341    /// the new value
3342    #[doc(alias = "gtk_window_set_focus_visible")]
3343    #[doc(alias = "focus-visible")]
3344    fn set_focus_visible(&self, setting: bool) {
3345        unsafe {
3346            ffi::gtk_window_set_focus_visible(self.as_ref().to_glib_none().0, setting.into_glib());
3347        }
3348    }
3349
3350    /// This function sets up hints about how a window can be resized by
3351    /// the user. You can set a minimum and maximum size; allowed resize
3352    /// increments (e.g. for xterm, you can only resize by the size of a
3353    /// character); aspect ratios; and more. See the [`gdk::Geometry`][crate::gdk::Geometry] struct.
3354    /// ## `geometry_widget`
3355    /// widget the geometry hints used to be applied to
3356    ///  or [`None`]. Since 3.20 this argument is ignored and GTK behaves as if [`None`] was
3357    ///  set.
3358    /// ## `geometry`
3359    /// struct containing geometry information or [`None`]
3360    /// ## `geom_mask`
3361    /// mask indicating which struct fields should be paid attention to
3362    #[doc(alias = "gtk_window_set_geometry_hints")]
3363    fn set_geometry_hints(
3364        &self,
3365        geometry_widget: Option<&impl IsA<Widget>>,
3366        geometry: Option<&gdk::Geometry>,
3367        geom_mask: gdk::WindowHints,
3368    ) {
3369        unsafe {
3370            ffi::gtk_window_set_geometry_hints(
3371                self.as_ref().to_glib_none().0,
3372                geometry_widget.map(|p| p.as_ref()).to_glib_none().0,
3373                mut_override(geometry.to_glib_none().0),
3374                geom_mask.into_glib(),
3375            );
3376        }
3377    }
3378
3379    /// Window gravity defines the meaning of coordinates passed to
3380    /// [`move_()`][Self::move_()]. See [`move_()`][Self::move_()] and [`gdk::Gravity`][crate::gdk::Gravity] for
3381    /// more details.
3382    ///
3383    /// The default window gravity is [`gdk::Gravity::NorthWest`][crate::gdk::Gravity::NorthWest] which will
3384    /// typically “do what you mean.”
3385    /// ## `gravity`
3386    /// window gravity
3387    #[doc(alias = "gtk_window_set_gravity")]
3388    #[doc(alias = "gravity")]
3389    fn set_gravity(&self, gravity: gdk::Gravity) {
3390        unsafe {
3391            ffi::gtk_window_set_gravity(self.as_ref().to_glib_none().0, gravity.into_glib());
3392        }
3393    }
3394
3395    /// Tells GTK+ whether to drop its extra reference to the window
3396    /// when `gtk_widget_destroy()` is called.
3397    ///
3398    /// This function is only exported for the benefit of language
3399    /// bindings which may need to keep the window alive until their
3400    /// wrapper object is garbage collected. There is no justification
3401    /// for ever calling this function in an application.
3402    /// ## `setting`
3403    /// the new value
3404    #[doc(alias = "gtk_window_set_has_user_ref_count")]
3405    fn set_has_user_ref_count(&self, setting: bool) {
3406        unsafe {
3407            ffi::gtk_window_set_has_user_ref_count(
3408                self.as_ref().to_glib_none().0,
3409                setting.into_glib(),
3410            );
3411        }
3412    }
3413
3414    /// If `setting` is [`true`], then `self` will request that it’s titlebar
3415    /// should be hidden when maximized.
3416    /// This is useful for windows that don’t convey any information other
3417    /// than the application name in the titlebar, to put the available
3418    /// screen space to better use. If the underlying window system does not
3419    /// support the request, the setting will not have any effect.
3420    ///
3421    /// Note that custom titlebars set with [`set_titlebar()`][Self::set_titlebar()] are
3422    /// not affected by this. The application is in full control of their
3423    /// content and visibility anyway.
3424    /// ## `setting`
3425    /// whether to hide the titlebar when `self` is maximized
3426    #[doc(alias = "gtk_window_set_hide_titlebar_when_maximized")]
3427    #[doc(alias = "hide-titlebar-when-maximized")]
3428    fn set_hide_titlebar_when_maximized(&self, setting: bool) {
3429        unsafe {
3430            ffi::gtk_window_set_hide_titlebar_when_maximized(
3431                self.as_ref().to_glib_none().0,
3432                setting.into_glib(),
3433            );
3434        }
3435    }
3436
3437    /// Sets up the icon representing a [`Window`][crate::Window]. This icon is used when
3438    /// the window is minimized (also known as iconified). Some window
3439    /// managers or desktop environments may also place it in the window
3440    /// frame, or display it in other contexts. On others, the icon is not
3441    /// used at all, so your mileage may vary.
3442    ///
3443    /// The icon should be provided in whatever size it was naturally
3444    /// drawn; that is, don’t scale the image before passing it to
3445    /// GTK+. Scaling is postponed until the last minute, when the desired
3446    /// final size is known, to allow best quality.
3447    ///
3448    /// If you have your icon hand-drawn in multiple sizes, use
3449    /// [`set_icon_list()`][Self::set_icon_list()]. Then the best size will be used.
3450    ///
3451    /// This function is equivalent to calling [`set_icon_list()`][Self::set_icon_list()]
3452    /// with a 1-element list.
3453    ///
3454    /// See also [`Window::set_default_icon_list()`][crate::Window::set_default_icon_list()] to set the icon
3455    /// for all windows in your application in one go.
3456    /// ## `icon`
3457    /// icon image, or [`None`]
3458    #[doc(alias = "gtk_window_set_icon")]
3459    #[doc(alias = "icon")]
3460    fn set_icon(&self, icon: Option<&gdk_pixbuf::Pixbuf>) {
3461        unsafe {
3462            ffi::gtk_window_set_icon(self.as_ref().to_glib_none().0, icon.to_glib_none().0);
3463        }
3464    }
3465
3466    /// Sets the icon for `self`.
3467    /// Warns on failure if `err` is [`None`].
3468    ///
3469    /// This function is equivalent to calling [`set_icon()`][Self::set_icon()]
3470    /// with a pixbuf created by loading the image from `filename`.
3471    /// ## `filename`
3472    /// location of icon file
3473    ///
3474    /// # Returns
3475    ///
3476    /// [`true`] if setting the icon succeeded.
3477    #[doc(alias = "gtk_window_set_icon_from_file")]
3478    fn set_icon_from_file(&self, filename: impl AsRef<std::path::Path>) -> Result<(), glib::Error> {
3479        unsafe {
3480            let mut error = std::ptr::null_mut();
3481            let is_ok = ffi::gtk_window_set_icon_from_file(
3482                self.as_ref().to_glib_none().0,
3483                filename.as_ref().to_glib_none().0,
3484                &mut error,
3485            );
3486            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
3487            if error.is_null() {
3488                Ok(())
3489            } else {
3490                Err(from_glib_full(error))
3491            }
3492        }
3493    }
3494
3495    /// Sets up the icon representing a [`Window`][crate::Window]. The icon is used when
3496    /// the window is minimized (also known as iconified). Some window
3497    /// managers or desktop environments may also place it in the window
3498    /// frame, or display it in other contexts. On others, the icon is not
3499    /// used at all, so your mileage may vary.
3500    ///
3501    /// [`set_icon_list()`][Self::set_icon_list()] allows you to pass in the same icon in
3502    /// several hand-drawn sizes. The list should contain the natural sizes
3503    /// your icon is available in; that is, don’t scale the image before
3504    /// passing it to GTK+. Scaling is postponed until the last minute,
3505    /// when the desired final size is known, to allow best quality.
3506    ///
3507    /// By passing several sizes, you may improve the final image quality
3508    /// of the icon, by reducing or eliminating automatic image scaling.
3509    ///
3510    /// Recommended sizes to provide: 16x16, 32x32, 48x48 at minimum, and
3511    /// larger images (64x64, 128x128) if you have them.
3512    ///
3513    /// See also [`Window::set_default_icon_list()`][crate::Window::set_default_icon_list()] to set the icon
3514    /// for all windows in your application in one go.
3515    ///
3516    /// Note that transient windows (those who have been set transient for another
3517    /// window using [`set_transient_for()`][Self::set_transient_for()]) will inherit their
3518    /// icon from their transient parent. So there’s no need to explicitly
3519    /// set the icon on transient windows.
3520    /// ## `list`
3521    /// list of [`gdk_pixbuf::Pixbuf`][crate::gdk_pixbuf::Pixbuf]
3522    #[doc(alias = "gtk_window_set_icon_list")]
3523    fn set_icon_list(&self, list: &[gdk_pixbuf::Pixbuf]) {
3524        unsafe {
3525            ffi::gtk_window_set_icon_list(self.as_ref().to_glib_none().0, list.to_glib_none().0);
3526        }
3527    }
3528
3529    /// Sets the icon for the window from a named themed icon.
3530    /// See the docs for [`IconTheme`][crate::IconTheme] for more details.
3531    /// On some platforms, the window icon is not used at all.
3532    ///
3533    /// Note that this has nothing to do with the WM_ICON_NAME
3534    /// property which is mentioned in the ICCCM.
3535    /// ## `name`
3536    /// the name of the themed icon
3537    #[doc(alias = "gtk_window_set_icon_name")]
3538    #[doc(alias = "icon-name")]
3539    fn set_icon_name(&self, name: Option<&str>) {
3540        unsafe {
3541            ffi::gtk_window_set_icon_name(self.as_ref().to_glib_none().0, name.to_glib_none().0);
3542        }
3543    }
3544
3545    /// Asks to keep `self` above, so that it stays on top. Note that
3546    /// you shouldn’t assume the window is definitely above afterward,
3547    /// because other entities (e.g. the user or
3548    /// [window manager][gtk-X11-arch]) could not keep it above,
3549    /// and not all window managers support keeping windows above. But
3550    /// normally the window will end kept above. Just don’t write code
3551    /// that crashes if not.
3552    ///
3553    /// It’s permitted to call this function before showing a window,
3554    /// in which case the window will be kept above when it appears onscreen
3555    /// initially.
3556    ///
3557    /// You can track the above state via the “window-state-event” signal
3558    /// on [`Widget`][crate::Widget].
3559    ///
3560    /// Note that, according to the
3561    /// [Extended Window Manager Hints Specification](http://www.freedesktop.org/Standards/wm-spec),
3562    /// the above state is mainly meant for user preferences and should not
3563    /// be used by applications e.g. for drawing attention to their
3564    /// dialogs.
3565    /// ## `setting`
3566    /// whether to keep `self` above other windows
3567    #[doc(alias = "gtk_window_set_keep_above")]
3568    fn set_keep_above(&self, setting: bool) {
3569        unsafe {
3570            ffi::gtk_window_set_keep_above(self.as_ref().to_glib_none().0, setting.into_glib());
3571        }
3572    }
3573
3574    /// Asks to keep `self` below, so that it stays in bottom. Note that
3575    /// you shouldn’t assume the window is definitely below afterward,
3576    /// because other entities (e.g. the user or
3577    /// [window manager][gtk-X11-arch]) could not keep it below,
3578    /// and not all window managers support putting windows below. But
3579    /// normally the window will be kept below. Just don’t write code
3580    /// that crashes if not.
3581    ///
3582    /// It’s permitted to call this function before showing a window,
3583    /// in which case the window will be kept below when it appears onscreen
3584    /// initially.
3585    ///
3586    /// You can track the below state via the “window-state-event” signal
3587    /// on [`Widget`][crate::Widget].
3588    ///
3589    /// Note that, according to the
3590    /// [Extended Window Manager Hints Specification](http://www.freedesktop.org/Standards/wm-spec),
3591    /// the above state is mainly meant for user preferences and should not
3592    /// be used by applications e.g. for drawing attention to their
3593    /// dialogs.
3594    /// ## `setting`
3595    /// whether to keep `self` below other windows
3596    #[doc(alias = "gtk_window_set_keep_below")]
3597    fn set_keep_below(&self, setting: bool) {
3598        unsafe {
3599            ffi::gtk_window_set_keep_below(self.as_ref().to_glib_none().0, setting.into_glib());
3600        }
3601    }
3602
3603    /// Sets the mnemonic modifier for this window.
3604    /// ## `modifier`
3605    /// the modifier mask used to activate
3606    ///  mnemonics on this window.
3607    #[doc(alias = "gtk_window_set_mnemonic_modifier")]
3608    fn set_mnemonic_modifier(&self, modifier: gdk::ModifierType) {
3609        unsafe {
3610            ffi::gtk_window_set_mnemonic_modifier(
3611                self.as_ref().to_glib_none().0,
3612                modifier.into_glib(),
3613            );
3614        }
3615    }
3616
3617    /// Sets the [`mnemonics-visible`][struct@crate::Window#mnemonics-visible] property.
3618    /// ## `setting`
3619    /// the new value
3620    #[doc(alias = "gtk_window_set_mnemonics_visible")]
3621    #[doc(alias = "mnemonics-visible")]
3622    fn set_mnemonics_visible(&self, setting: bool) {
3623        unsafe {
3624            ffi::gtk_window_set_mnemonics_visible(
3625                self.as_ref().to_glib_none().0,
3626                setting.into_glib(),
3627            );
3628        }
3629    }
3630
3631    /// Sets a window modal or non-modal. Modal windows prevent interaction
3632    /// with other windows in the same application. To keep modal dialogs
3633    /// on top of main application windows, use
3634    /// [`set_transient_for()`][Self::set_transient_for()] to make the dialog transient for the
3635    /// parent; most [window managers][gtk-X11-arch]
3636    /// will then disallow lowering the dialog below the parent.
3637    /// ## `modal`
3638    /// whether the window is modal
3639    #[doc(alias = "gtk_window_set_modal")]
3640    #[doc(alias = "modal")]
3641    fn set_modal(&self, modal: bool) {
3642        unsafe {
3643            ffi::gtk_window_set_modal(self.as_ref().to_glib_none().0, modal.into_glib());
3644        }
3645    }
3646
3647    /// Sets a position constraint for this window. If the old or new
3648    /// constraint is [`WindowPosition::CenterAlways`][crate::WindowPosition::CenterAlways], this will also cause
3649    /// the window to be repositioned to satisfy the new constraint.
3650    /// ## `position`
3651    /// a position constraint.
3652    #[doc(alias = "gtk_window_set_position")]
3653    fn set_position(&self, position: WindowPosition) {
3654        unsafe {
3655            ffi::gtk_window_set_position(self.as_ref().to_glib_none().0, position.into_glib());
3656        }
3657    }
3658
3659    /// Sets whether the user can resize a window. Windows are user resizable
3660    /// by default.
3661    /// ## `resizable`
3662    /// [`true`] if the user can resize this window
3663    #[doc(alias = "gtk_window_set_resizable")]
3664    #[doc(alias = "resizable")]
3665    fn set_resizable(&self, resizable: bool) {
3666        unsafe {
3667            ffi::gtk_window_set_resizable(self.as_ref().to_glib_none().0, resizable.into_glib());
3668        }
3669    }
3670
3671    /// This function is only useful on X11, not with other GTK+ targets.
3672    ///
3673    /// In combination with the window title, the window role allows a
3674    /// [window manager][gtk-X11-arch] to identify "the
3675    /// same" window when an application is restarted. So for example you
3676    /// might set the “toolbox” role on your app’s toolbox window, so that
3677    /// when the user restarts their session, the window manager can put
3678    /// the toolbox back in the same place.
3679    ///
3680    /// If a window already has a unique title, you don’t need to set the
3681    /// role, since the WM can use the title to identify the window when
3682    /// restoring the session.
3683    /// ## `role`
3684    /// unique identifier for the window to be used when restoring a session
3685    #[doc(alias = "gtk_window_set_role")]
3686    #[doc(alias = "role")]
3687    fn set_role(&self, role: &str) {
3688        unsafe {
3689            ffi::gtk_window_set_role(self.as_ref().to_glib_none().0, role.to_glib_none().0);
3690        }
3691    }
3692
3693    /// Sets the [`gdk::Screen`][crate::gdk::Screen] where the `self` is displayed; if
3694    /// the window is already mapped, it will be unmapped, and
3695    /// then remapped on the new screen.
3696    /// ## `screen`
3697    /// a [`gdk::Screen`][crate::gdk::Screen].
3698    #[doc(alias = "gtk_window_set_screen")]
3699    #[doc(alias = "screen")]
3700    fn set_screen(&self, screen: &gdk::Screen) {
3701        unsafe {
3702            ffi::gtk_window_set_screen(self.as_ref().to_glib_none().0, screen.to_glib_none().0);
3703        }
3704    }
3705
3706    /// Windows may set a hint asking the desktop environment not to display
3707    /// the window in the pager. This function sets this hint.
3708    /// (A "pager" is any desktop navigation tool such as a workspace
3709    /// switcher that displays a thumbnail representation of the windows
3710    /// on the screen.)
3711    /// ## `setting`
3712    /// [`true`] to keep this window from appearing in the pager
3713    #[doc(alias = "gtk_window_set_skip_pager_hint")]
3714    #[doc(alias = "skip-pager-hint")]
3715    fn set_skip_pager_hint(&self, setting: bool) {
3716        unsafe {
3717            ffi::gtk_window_set_skip_pager_hint(
3718                self.as_ref().to_glib_none().0,
3719                setting.into_glib(),
3720            );
3721        }
3722    }
3723
3724    /// Windows may set a hint asking the desktop environment not to display
3725    /// the window in the task bar. This function sets this hint.
3726    /// ## `setting`
3727    /// [`true`] to keep this window from appearing in the task bar
3728    #[doc(alias = "gtk_window_set_skip_taskbar_hint")]
3729    #[doc(alias = "skip-taskbar-hint")]
3730    fn set_skip_taskbar_hint(&self, setting: bool) {
3731        unsafe {
3732            ffi::gtk_window_set_skip_taskbar_hint(
3733                self.as_ref().to_glib_none().0,
3734                setting.into_glib(),
3735            );
3736        }
3737    }
3738
3739    /// Startup notification identifiers are used by desktop environment to
3740    /// track application startup, to provide user feedback and other
3741    /// features. This function changes the corresponding property on the
3742    /// underlying GdkWindow. Normally, startup identifier is managed
3743    /// automatically and you should only use this function in special cases
3744    /// like transferring focus from other processes. You should use this
3745    /// function before calling [`present()`][Self::present()] or any equivalent
3746    /// function generating a window map event.
3747    ///
3748    /// This function is only useful on X11, not with other GTK+ targets.
3749    /// ## `startup_id`
3750    /// a string with startup-notification identifier
3751    #[doc(alias = "gtk_window_set_startup_id")]
3752    #[doc(alias = "startup-id")]
3753    fn set_startup_id(&self, startup_id: &str) {
3754        unsafe {
3755            ffi::gtk_window_set_startup_id(
3756                self.as_ref().to_glib_none().0,
3757                startup_id.to_glib_none().0,
3758            );
3759        }
3760    }
3761
3762    /// Sets the title of the [`Window`][crate::Window]. The title of a window will be
3763    /// displayed in its title bar; on the X Window System, the title bar
3764    /// is rendered by the [window manager][gtk-X11-arch],
3765    /// so exactly how the title appears to users may vary
3766    /// according to a user’s exact configuration. The title should help a
3767    /// user distinguish this window from other windows they may have
3768    /// open. A good title might include the application name and current
3769    /// document filename, for example.
3770    /// ## `title`
3771    /// title of the window
3772    #[doc(alias = "gtk_window_set_title")]
3773    #[doc(alias = "title")]
3774    fn set_title(&self, title: &str) {
3775        unsafe {
3776            ffi::gtk_window_set_title(self.as_ref().to_glib_none().0, title.to_glib_none().0);
3777        }
3778    }
3779
3780    /// Sets a custom titlebar for `self`.
3781    ///
3782    /// A typical widget used here is [`HeaderBar`][crate::HeaderBar], as it provides various features
3783    /// expected of a titlebar while allowing the addition of child widgets to it.
3784    ///
3785    /// If you set a custom titlebar, GTK+ will do its best to convince
3786    /// the window manager not to put its own titlebar on the window.
3787    /// Depending on the system, this function may not work for a window
3788    /// that is already visible, so you set the titlebar before calling
3789    /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
3790    /// ## `titlebar`
3791    /// the widget to use as titlebar
3792    #[doc(alias = "gtk_window_set_titlebar")]
3793    fn set_titlebar(&self, titlebar: Option<&impl IsA<Widget>>) {
3794        unsafe {
3795            ffi::gtk_window_set_titlebar(
3796                self.as_ref().to_glib_none().0,
3797                titlebar.map(|p| p.as_ref()).to_glib_none().0,
3798            );
3799        }
3800    }
3801
3802    /// Dialog windows should be set transient for the main application
3803    /// window they were spawned from. This allows
3804    /// [window managers][gtk-X11-arch] to e.g. keep the
3805    /// dialog on top of the main window, or center the dialog over the
3806    /// main window. `gtk_dialog_new_with_buttons()` and other convenience
3807    /// functions in GTK+ will sometimes call
3808    /// [`set_transient_for()`][Self::set_transient_for()] on your behalf.
3809    ///
3810    /// Passing [`None`] for `parent` unsets the current transient window.
3811    ///
3812    /// On Wayland, this function can also be used to attach a new
3813    /// [`WindowType::Popup`][crate::WindowType::Popup] to a [`WindowType::Toplevel`][crate::WindowType::Toplevel] parent already mapped
3814    /// on screen so that the [`WindowType::Popup`][crate::WindowType::Popup] will be created as a
3815    /// subsurface-based window `GDK_WINDOW_SUBSURFACE` which can be
3816    /// positioned at will relatively to the [`WindowType::Toplevel`][crate::WindowType::Toplevel] surface.
3817    ///
3818    /// On Windows, this function puts the child window on top of the parent,
3819    /// much as the window manager would have done on X.
3820    /// ## `parent`
3821    /// parent window, or [`None`]
3822    #[doc(alias = "gtk_window_set_transient_for")]
3823    #[doc(alias = "transient-for")]
3824    fn set_transient_for(&self, parent: Option<&impl IsA<Window>>) {
3825        unsafe {
3826            ffi::gtk_window_set_transient_for(
3827                self.as_ref().to_glib_none().0,
3828                parent.map(|p| p.as_ref()).to_glib_none().0,
3829            );
3830        }
3831    }
3832
3833    /// By setting the type hint for the window, you allow the window
3834    /// manager to decorate and handle the window in a way which is
3835    /// suitable to the function of the window in your application.
3836    ///
3837    /// This function should be called before the window becomes visible.
3838    ///
3839    /// `gtk_dialog_new_with_buttons()` and other convenience functions in GTK+
3840    /// will sometimes call [`set_type_hint()`][Self::set_type_hint()] on your behalf.
3841    /// ## `hint`
3842    /// the window type
3843    #[doc(alias = "gtk_window_set_type_hint")]
3844    #[doc(alias = "type-hint")]
3845    fn set_type_hint(&self, hint: gdk::WindowTypeHint) {
3846        unsafe {
3847            ffi::gtk_window_set_type_hint(self.as_ref().to_glib_none().0, hint.into_glib());
3848        }
3849    }
3850
3851    /// Windows may set a hint asking the desktop environment to draw
3852    /// the users attention to the window. This function sets this hint.
3853    /// ## `setting`
3854    /// [`true`] to mark this window as urgent
3855    #[doc(alias = "gtk_window_set_urgency_hint")]
3856    #[doc(alias = "urgency-hint")]
3857    fn set_urgency_hint(&self, setting: bool) {
3858        unsafe {
3859            ffi::gtk_window_set_urgency_hint(self.as_ref().to_glib_none().0, setting.into_glib());
3860        }
3861    }
3862
3863    /// Asks to stick `self`, which means that it will appear on all user
3864    /// desktops. Note that you shouldn’t assume the window is definitely
3865    /// stuck afterward, because other entities (e.g. the user or
3866    /// [window manager][gtk-X11-arch] could unstick it
3867    /// again, and some window managers do not support sticking
3868    /// windows. But normally the window will end up stuck. Just don't
3869    /// write code that crashes if not.
3870    ///
3871    /// It’s permitted to call this function before showing a window.
3872    ///
3873    /// You can track stickiness via the “window-state-event” signal
3874    /// on [`Widget`][crate::Widget].
3875    #[doc(alias = "gtk_window_stick")]
3876    fn stick(&self) {
3877        unsafe {
3878            ffi::gtk_window_stick(self.as_ref().to_glib_none().0);
3879        }
3880    }
3881
3882    /// Asks to toggle off the fullscreen state for `self`. Note that you
3883    /// shouldn’t assume the window is definitely not full screen
3884    /// afterward, because other entities (e.g. the user or
3885    /// [window manager][gtk-X11-arch]) could fullscreen it
3886    /// again, and not all window managers honor requests to unfullscreen
3887    /// windows. But normally the window will end up restored to its normal
3888    /// state. Just don’t write code that crashes if not.
3889    ///
3890    /// You can track the fullscreen state via the “window-state-event” signal
3891    /// on [`Widget`][crate::Widget].
3892    #[doc(alias = "gtk_window_unfullscreen")]
3893    fn unfullscreen(&self) {
3894        unsafe {
3895            ffi::gtk_window_unfullscreen(self.as_ref().to_glib_none().0);
3896        }
3897    }
3898
3899    /// Asks to unmaximize `self`. Note that you shouldn’t assume the
3900    /// window is definitely unmaximized afterward, because other entities
3901    /// (e.g. the user or [window manager][gtk-X11-arch])
3902    /// could maximize it again, and not all window
3903    /// managers honor requests to unmaximize. But normally the window will
3904    /// end up unmaximized. Just don’t write code that crashes if not.
3905    ///
3906    /// You can track maximization via the “window-state-event” signal
3907    /// on [`Widget`][crate::Widget].
3908    #[doc(alias = "gtk_window_unmaximize")]
3909    fn unmaximize(&self) {
3910        unsafe {
3911            ffi::gtk_window_unmaximize(self.as_ref().to_glib_none().0);
3912        }
3913    }
3914
3915    /// Asks to unstick `self`, which means that it will appear on only
3916    /// one of the user’s desktops. Note that you shouldn’t assume the
3917    /// window is definitely unstuck afterward, because other entities
3918    /// (e.g. the user or [window manager][gtk-X11-arch]) could
3919    /// stick it again. But normally the window will
3920    /// end up unstuck. Just don’t write code that crashes if not.
3921    ///
3922    /// You can track stickiness via the “window-state-event” signal
3923    /// on [`Widget`][crate::Widget].
3924    #[doc(alias = "gtk_window_unstick")]
3925    fn unstick(&self) {
3926        unsafe {
3927            ffi::gtk_window_unstick(self.as_ref().to_glib_none().0);
3928        }
3929    }
3930
3931    #[doc(alias = "default-height")]
3932    fn default_height(&self) -> i32 {
3933        ObjectExt::property(self.as_ref(), "default-height")
3934    }
3935
3936    #[doc(alias = "default-height")]
3937    fn set_default_height(&self, default_height: i32) {
3938        ObjectExt::set_property(self.as_ref(), "default-height", default_height)
3939    }
3940
3941    #[doc(alias = "default-width")]
3942    fn default_width(&self) -> i32 {
3943        ObjectExt::property(self.as_ref(), "default-width")
3944    }
3945
3946    #[doc(alias = "default-width")]
3947    fn set_default_width(&self, default_width: i32) {
3948        ObjectExt::set_property(self.as_ref(), "default-width", default_width)
3949    }
3950
3951    #[doc(alias = "type")]
3952    fn type_(&self) -> WindowType {
3953        ObjectExt::property(self.as_ref(), "type")
3954    }
3955
3956    #[doc(alias = "window-position")]
3957    fn window_position(&self) -> WindowPosition {
3958        ObjectExt::property(self.as_ref(), "window-position")
3959    }
3960
3961    #[doc(alias = "window-position")]
3962    fn set_window_position(&self, window_position: WindowPosition) {
3963        ObjectExt::set_property(self.as_ref(), "window-position", window_position)
3964    }
3965
3966    /// The ::activate-default signal is a
3967    /// [keybinding signal][GtkBindingSignal]
3968    /// which gets emitted when the user activates the default widget
3969    /// of `window`.
3970    #[doc(alias = "activate-default")]
3971    fn connect_activate_default<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3972        unsafe extern "C" fn activate_default_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
3973            this: *mut ffi::GtkWindow,
3974            f: glib::ffi::gpointer,
3975        ) {
3976            unsafe {
3977                let f: &F = &*(f as *const F);
3978                f(Window::from_glib_borrow(this).unsafe_cast_ref())
3979            }
3980        }
3981        unsafe {
3982            let f: Box_<F> = Box_::new(f);
3983            connect_raw(
3984                self.as_ptr() as *mut _,
3985                c"activate-default".as_ptr(),
3986                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3987                    activate_default_trampoline::<Self, F> as *const (),
3988                )),
3989                Box_::into_raw(f),
3990            )
3991        }
3992    }
3993
3994    fn emit_activate_default(&self) {
3995        self.emit_by_name::<()>("activate-default", &[]);
3996    }
3997
3998    /// The ::activate-focus signal is a
3999    /// [keybinding signal][GtkBindingSignal]
4000    /// which gets emitted when the user activates the currently
4001    /// focused widget of `window`.
4002    #[doc(alias = "activate-focus")]
4003    fn connect_activate_focus<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4004        unsafe extern "C" fn activate_focus_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4005            this: *mut ffi::GtkWindow,
4006            f: glib::ffi::gpointer,
4007        ) {
4008            unsafe {
4009                let f: &F = &*(f as *const F);
4010                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4011            }
4012        }
4013        unsafe {
4014            let f: Box_<F> = Box_::new(f);
4015            connect_raw(
4016                self.as_ptr() as *mut _,
4017                c"activate-focus".as_ptr(),
4018                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4019                    activate_focus_trampoline::<Self, F> as *const (),
4020                )),
4021                Box_::into_raw(f),
4022            )
4023        }
4024    }
4025
4026    fn emit_activate_focus(&self) {
4027        self.emit_by_name::<()>("activate-focus", &[]);
4028    }
4029
4030    /// The ::enable-debugging signal is a [keybinding signal][GtkBindingSignal]
4031    /// which gets emitted when the user enables or disables interactive
4032    /// debugging. When `toggle` is [`true`], interactive debugging is toggled
4033    /// on or off, when it is [`false`], the debugger will be pointed at the
4034    /// widget under the pointer.
4035    ///
4036    /// The default bindings for this signal are Ctrl-Shift-I
4037    /// and Ctrl-Shift-D.
4038    /// ## `toggle`
4039    /// toggle the debugger
4040    ///
4041    /// # Returns
4042    ///
4043    /// [`true`] if the key binding was handled
4044    #[doc(alias = "enable-debugging")]
4045    fn connect_enable_debugging<F: Fn(&Self, bool) -> bool + 'static>(
4046        &self,
4047        f: F,
4048    ) -> SignalHandlerId {
4049        unsafe extern "C" fn enable_debugging_trampoline<
4050            P: IsA<Window>,
4051            F: Fn(&P, bool) -> bool + 'static,
4052        >(
4053            this: *mut ffi::GtkWindow,
4054            toggle: glib::ffi::gboolean,
4055            f: glib::ffi::gpointer,
4056        ) -> glib::ffi::gboolean {
4057            unsafe {
4058                let f: &F = &*(f as *const F);
4059                f(
4060                    Window::from_glib_borrow(this).unsafe_cast_ref(),
4061                    from_glib(toggle),
4062                )
4063                .into_glib()
4064            }
4065        }
4066        unsafe {
4067            let f: Box_<F> = Box_::new(f);
4068            connect_raw(
4069                self.as_ptr() as *mut _,
4070                c"enable-debugging".as_ptr(),
4071                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4072                    enable_debugging_trampoline::<Self, F> as *const (),
4073                )),
4074                Box_::into_raw(f),
4075            )
4076        }
4077    }
4078
4079    fn emit_enable_debugging(&self, toggle: bool) -> bool {
4080        self.emit_by_name("enable-debugging", &[&toggle])
4081    }
4082
4083    /// The ::keys-changed signal gets emitted when the set of accelerators
4084    /// or mnemonics that are associated with `window` changes.
4085    #[doc(alias = "keys-changed")]
4086    fn connect_keys_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4087        unsafe extern "C" fn keys_changed_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4088            this: *mut ffi::GtkWindow,
4089            f: glib::ffi::gpointer,
4090        ) {
4091            unsafe {
4092                let f: &F = &*(f as *const F);
4093                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4094            }
4095        }
4096        unsafe {
4097            let f: Box_<F> = Box_::new(f);
4098            connect_raw(
4099                self.as_ptr() as *mut _,
4100                c"keys-changed".as_ptr(),
4101                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4102                    keys_changed_trampoline::<Self, F> as *const (),
4103                )),
4104                Box_::into_raw(f),
4105            )
4106        }
4107    }
4108
4109    /// This signal is emitted whenever the currently focused widget in
4110    /// this window changes.
4111    /// ## `widget`
4112    /// the newly focused widget (or [`None`] for no focus)
4113    #[doc(alias = "set-focus")]
4114    fn connect_set_focus<F: Fn(&Self, Option<&Widget>) + 'static>(&self, f: F) -> SignalHandlerId {
4115        unsafe extern "C" fn set_focus_trampoline<
4116            P: IsA<Window>,
4117            F: Fn(&P, Option<&Widget>) + 'static,
4118        >(
4119            this: *mut ffi::GtkWindow,
4120            widget: *mut ffi::GtkWidget,
4121            f: glib::ffi::gpointer,
4122        ) {
4123            unsafe {
4124                let f: &F = &*(f as *const F);
4125                f(
4126                    Window::from_glib_borrow(this).unsafe_cast_ref(),
4127                    Option::<Widget>::from_glib_borrow(widget).as_ref().as_ref(),
4128                )
4129            }
4130        }
4131        unsafe {
4132            let f: Box_<F> = Box_::new(f);
4133            connect_raw(
4134                self.as_ptr() as *mut _,
4135                c"set-focus".as_ptr(),
4136                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4137                    set_focus_trampoline::<Self, F> as *const (),
4138                )),
4139                Box_::into_raw(f),
4140            )
4141        }
4142    }
4143
4144    #[doc(alias = "accept-focus")]
4145    fn connect_accept_focus_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4146        unsafe extern "C" fn notify_accept_focus_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4147            this: *mut ffi::GtkWindow,
4148            _param_spec: glib::ffi::gpointer,
4149            f: glib::ffi::gpointer,
4150        ) {
4151            unsafe {
4152                let f: &F = &*(f as *const F);
4153                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4154            }
4155        }
4156        unsafe {
4157            let f: Box_<F> = Box_::new(f);
4158            connect_raw(
4159                self.as_ptr() as *mut _,
4160                c"notify::accept-focus".as_ptr(),
4161                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4162                    notify_accept_focus_trampoline::<Self, F> as *const (),
4163                )),
4164                Box_::into_raw(f),
4165            )
4166        }
4167    }
4168
4169    #[doc(alias = "application")]
4170    fn connect_application_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4171        unsafe extern "C" fn notify_application_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4172            this: *mut ffi::GtkWindow,
4173            _param_spec: glib::ffi::gpointer,
4174            f: glib::ffi::gpointer,
4175        ) {
4176            unsafe {
4177                let f: &F = &*(f as *const F);
4178                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4179            }
4180        }
4181        unsafe {
4182            let f: Box_<F> = Box_::new(f);
4183            connect_raw(
4184                self.as_ptr() as *mut _,
4185                c"notify::application".as_ptr(),
4186                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4187                    notify_application_trampoline::<Self, F> as *const (),
4188                )),
4189                Box_::into_raw(f),
4190            )
4191        }
4192    }
4193
4194    #[doc(alias = "attached-to")]
4195    fn connect_attached_to_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4196        unsafe extern "C" fn notify_attached_to_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4197            this: *mut ffi::GtkWindow,
4198            _param_spec: glib::ffi::gpointer,
4199            f: glib::ffi::gpointer,
4200        ) {
4201            unsafe {
4202                let f: &F = &*(f as *const F);
4203                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4204            }
4205        }
4206        unsafe {
4207            let f: Box_<F> = Box_::new(f);
4208            connect_raw(
4209                self.as_ptr() as *mut _,
4210                c"notify::attached-to".as_ptr(),
4211                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4212                    notify_attached_to_trampoline::<Self, F> as *const (),
4213                )),
4214                Box_::into_raw(f),
4215            )
4216        }
4217    }
4218
4219    #[doc(alias = "decorated")]
4220    fn connect_decorated_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4221        unsafe extern "C" fn notify_decorated_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4222            this: *mut ffi::GtkWindow,
4223            _param_spec: glib::ffi::gpointer,
4224            f: glib::ffi::gpointer,
4225        ) {
4226            unsafe {
4227                let f: &F = &*(f as *const F);
4228                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4229            }
4230        }
4231        unsafe {
4232            let f: Box_<F> = Box_::new(f);
4233            connect_raw(
4234                self.as_ptr() as *mut _,
4235                c"notify::decorated".as_ptr(),
4236                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4237                    notify_decorated_trampoline::<Self, F> as *const (),
4238                )),
4239                Box_::into_raw(f),
4240            )
4241        }
4242    }
4243
4244    #[doc(alias = "default-height")]
4245    fn connect_default_height_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4246        unsafe extern "C" fn notify_default_height_trampoline<
4247            P: IsA<Window>,
4248            F: Fn(&P) + 'static,
4249        >(
4250            this: *mut ffi::GtkWindow,
4251            _param_spec: glib::ffi::gpointer,
4252            f: glib::ffi::gpointer,
4253        ) {
4254            unsafe {
4255                let f: &F = &*(f as *const F);
4256                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4257            }
4258        }
4259        unsafe {
4260            let f: Box_<F> = Box_::new(f);
4261            connect_raw(
4262                self.as_ptr() as *mut _,
4263                c"notify::default-height".as_ptr(),
4264                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4265                    notify_default_height_trampoline::<Self, F> as *const (),
4266                )),
4267                Box_::into_raw(f),
4268            )
4269        }
4270    }
4271
4272    #[doc(alias = "default-width")]
4273    fn connect_default_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4274        unsafe extern "C" fn notify_default_width_trampoline<
4275            P: IsA<Window>,
4276            F: Fn(&P) + 'static,
4277        >(
4278            this: *mut ffi::GtkWindow,
4279            _param_spec: glib::ffi::gpointer,
4280            f: glib::ffi::gpointer,
4281        ) {
4282            unsafe {
4283                let f: &F = &*(f as *const F);
4284                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4285            }
4286        }
4287        unsafe {
4288            let f: Box_<F> = Box_::new(f);
4289            connect_raw(
4290                self.as_ptr() as *mut _,
4291                c"notify::default-width".as_ptr(),
4292                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4293                    notify_default_width_trampoline::<Self, F> as *const (),
4294                )),
4295                Box_::into_raw(f),
4296            )
4297        }
4298    }
4299
4300    #[doc(alias = "deletable")]
4301    fn connect_deletable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4302        unsafe extern "C" fn notify_deletable_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4303            this: *mut ffi::GtkWindow,
4304            _param_spec: glib::ffi::gpointer,
4305            f: glib::ffi::gpointer,
4306        ) {
4307            unsafe {
4308                let f: &F = &*(f as *const F);
4309                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4310            }
4311        }
4312        unsafe {
4313            let f: Box_<F> = Box_::new(f);
4314            connect_raw(
4315                self.as_ptr() as *mut _,
4316                c"notify::deletable".as_ptr(),
4317                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4318                    notify_deletable_trampoline::<Self, F> as *const (),
4319                )),
4320                Box_::into_raw(f),
4321            )
4322        }
4323    }
4324
4325    #[doc(alias = "destroy-with-parent")]
4326    fn connect_destroy_with_parent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4327        unsafe extern "C" fn notify_destroy_with_parent_trampoline<
4328            P: IsA<Window>,
4329            F: Fn(&P) + 'static,
4330        >(
4331            this: *mut ffi::GtkWindow,
4332            _param_spec: glib::ffi::gpointer,
4333            f: glib::ffi::gpointer,
4334        ) {
4335            unsafe {
4336                let f: &F = &*(f as *const F);
4337                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4338            }
4339        }
4340        unsafe {
4341            let f: Box_<F> = Box_::new(f);
4342            connect_raw(
4343                self.as_ptr() as *mut _,
4344                c"notify::destroy-with-parent".as_ptr(),
4345                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4346                    notify_destroy_with_parent_trampoline::<Self, F> as *const (),
4347                )),
4348                Box_::into_raw(f),
4349            )
4350        }
4351    }
4352
4353    #[doc(alias = "focus-on-map")]
4354    fn connect_focus_on_map_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4355        unsafe extern "C" fn notify_focus_on_map_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4356            this: *mut ffi::GtkWindow,
4357            _param_spec: glib::ffi::gpointer,
4358            f: glib::ffi::gpointer,
4359        ) {
4360            unsafe {
4361                let f: &F = &*(f as *const F);
4362                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4363            }
4364        }
4365        unsafe {
4366            let f: Box_<F> = Box_::new(f);
4367            connect_raw(
4368                self.as_ptr() as *mut _,
4369                c"notify::focus-on-map".as_ptr(),
4370                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4371                    notify_focus_on_map_trampoline::<Self, F> as *const (),
4372                )),
4373                Box_::into_raw(f),
4374            )
4375        }
4376    }
4377
4378    #[doc(alias = "focus-visible")]
4379    fn connect_focus_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4380        unsafe extern "C" fn notify_focus_visible_trampoline<
4381            P: IsA<Window>,
4382            F: Fn(&P) + 'static,
4383        >(
4384            this: *mut ffi::GtkWindow,
4385            _param_spec: glib::ffi::gpointer,
4386            f: glib::ffi::gpointer,
4387        ) {
4388            unsafe {
4389                let f: &F = &*(f as *const F);
4390                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4391            }
4392        }
4393        unsafe {
4394            let f: Box_<F> = Box_::new(f);
4395            connect_raw(
4396                self.as_ptr() as *mut _,
4397                c"notify::focus-visible".as_ptr(),
4398                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4399                    notify_focus_visible_trampoline::<Self, F> as *const (),
4400                )),
4401                Box_::into_raw(f),
4402            )
4403        }
4404    }
4405
4406    #[doc(alias = "gravity")]
4407    fn connect_gravity_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4408        unsafe extern "C" fn notify_gravity_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4409            this: *mut ffi::GtkWindow,
4410            _param_spec: glib::ffi::gpointer,
4411            f: glib::ffi::gpointer,
4412        ) {
4413            unsafe {
4414                let f: &F = &*(f as *const F);
4415                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4416            }
4417        }
4418        unsafe {
4419            let f: Box_<F> = Box_::new(f);
4420            connect_raw(
4421                self.as_ptr() as *mut _,
4422                c"notify::gravity".as_ptr(),
4423                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4424                    notify_gravity_trampoline::<Self, F> as *const (),
4425                )),
4426                Box_::into_raw(f),
4427            )
4428        }
4429    }
4430
4431    #[doc(alias = "has-toplevel-focus")]
4432    fn connect_has_toplevel_focus_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4433        unsafe extern "C" fn notify_has_toplevel_focus_trampoline<
4434            P: IsA<Window>,
4435            F: Fn(&P) + 'static,
4436        >(
4437            this: *mut ffi::GtkWindow,
4438            _param_spec: glib::ffi::gpointer,
4439            f: glib::ffi::gpointer,
4440        ) {
4441            unsafe {
4442                let f: &F = &*(f as *const F);
4443                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4444            }
4445        }
4446        unsafe {
4447            let f: Box_<F> = Box_::new(f);
4448            connect_raw(
4449                self.as_ptr() as *mut _,
4450                c"notify::has-toplevel-focus".as_ptr(),
4451                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4452                    notify_has_toplevel_focus_trampoline::<Self, F> as *const (),
4453                )),
4454                Box_::into_raw(f),
4455            )
4456        }
4457    }
4458
4459    #[doc(alias = "hide-titlebar-when-maximized")]
4460    fn connect_hide_titlebar_when_maximized_notify<F: Fn(&Self) + 'static>(
4461        &self,
4462        f: F,
4463    ) -> SignalHandlerId {
4464        unsafe extern "C" fn notify_hide_titlebar_when_maximized_trampoline<
4465            P: IsA<Window>,
4466            F: Fn(&P) + 'static,
4467        >(
4468            this: *mut ffi::GtkWindow,
4469            _param_spec: glib::ffi::gpointer,
4470            f: glib::ffi::gpointer,
4471        ) {
4472            unsafe {
4473                let f: &F = &*(f as *const F);
4474                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4475            }
4476        }
4477        unsafe {
4478            let f: Box_<F> = Box_::new(f);
4479            connect_raw(
4480                self.as_ptr() as *mut _,
4481                c"notify::hide-titlebar-when-maximized".as_ptr(),
4482                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4483                    notify_hide_titlebar_when_maximized_trampoline::<Self, F> as *const (),
4484                )),
4485                Box_::into_raw(f),
4486            )
4487        }
4488    }
4489
4490    #[doc(alias = "icon")]
4491    fn connect_icon_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4492        unsafe extern "C" fn notify_icon_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4493            this: *mut ffi::GtkWindow,
4494            _param_spec: glib::ffi::gpointer,
4495            f: glib::ffi::gpointer,
4496        ) {
4497            unsafe {
4498                let f: &F = &*(f as *const F);
4499                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4500            }
4501        }
4502        unsafe {
4503            let f: Box_<F> = Box_::new(f);
4504            connect_raw(
4505                self.as_ptr() as *mut _,
4506                c"notify::icon".as_ptr(),
4507                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4508                    notify_icon_trampoline::<Self, F> as *const (),
4509                )),
4510                Box_::into_raw(f),
4511            )
4512        }
4513    }
4514
4515    #[doc(alias = "icon-name")]
4516    fn connect_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4517        unsafe extern "C" fn notify_icon_name_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4518            this: *mut ffi::GtkWindow,
4519            _param_spec: glib::ffi::gpointer,
4520            f: glib::ffi::gpointer,
4521        ) {
4522            unsafe {
4523                let f: &F = &*(f as *const F);
4524                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4525            }
4526        }
4527        unsafe {
4528            let f: Box_<F> = Box_::new(f);
4529            connect_raw(
4530                self.as_ptr() as *mut _,
4531                c"notify::icon-name".as_ptr(),
4532                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4533                    notify_icon_name_trampoline::<Self, F> as *const (),
4534                )),
4535                Box_::into_raw(f),
4536            )
4537        }
4538    }
4539
4540    #[doc(alias = "is-active")]
4541    fn connect_is_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4542        unsafe extern "C" fn notify_is_active_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4543            this: *mut ffi::GtkWindow,
4544            _param_spec: glib::ffi::gpointer,
4545            f: glib::ffi::gpointer,
4546        ) {
4547            unsafe {
4548                let f: &F = &*(f as *const F);
4549                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4550            }
4551        }
4552        unsafe {
4553            let f: Box_<F> = Box_::new(f);
4554            connect_raw(
4555                self.as_ptr() as *mut _,
4556                c"notify::is-active".as_ptr(),
4557                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4558                    notify_is_active_trampoline::<Self, F> as *const (),
4559                )),
4560                Box_::into_raw(f),
4561            )
4562        }
4563    }
4564
4565    #[doc(alias = "is-maximized")]
4566    fn connect_is_maximized_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4567        unsafe extern "C" fn notify_is_maximized_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4568            this: *mut ffi::GtkWindow,
4569            _param_spec: glib::ffi::gpointer,
4570            f: glib::ffi::gpointer,
4571        ) {
4572            unsafe {
4573                let f: &F = &*(f as *const F);
4574                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4575            }
4576        }
4577        unsafe {
4578            let f: Box_<F> = Box_::new(f);
4579            connect_raw(
4580                self.as_ptr() as *mut _,
4581                c"notify::is-maximized".as_ptr(),
4582                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4583                    notify_is_maximized_trampoline::<Self, F> as *const (),
4584                )),
4585                Box_::into_raw(f),
4586            )
4587        }
4588    }
4589
4590    #[doc(alias = "mnemonics-visible")]
4591    fn connect_mnemonics_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4592        unsafe extern "C" fn notify_mnemonics_visible_trampoline<
4593            P: IsA<Window>,
4594            F: Fn(&P) + 'static,
4595        >(
4596            this: *mut ffi::GtkWindow,
4597            _param_spec: glib::ffi::gpointer,
4598            f: glib::ffi::gpointer,
4599        ) {
4600            unsafe {
4601                let f: &F = &*(f as *const F);
4602                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4603            }
4604        }
4605        unsafe {
4606            let f: Box_<F> = Box_::new(f);
4607            connect_raw(
4608                self.as_ptr() as *mut _,
4609                c"notify::mnemonics-visible".as_ptr(),
4610                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4611                    notify_mnemonics_visible_trampoline::<Self, F> as *const (),
4612                )),
4613                Box_::into_raw(f),
4614            )
4615        }
4616    }
4617
4618    #[doc(alias = "modal")]
4619    fn connect_modal_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4620        unsafe extern "C" fn notify_modal_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4621            this: *mut ffi::GtkWindow,
4622            _param_spec: glib::ffi::gpointer,
4623            f: glib::ffi::gpointer,
4624        ) {
4625            unsafe {
4626                let f: &F = &*(f as *const F);
4627                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4628            }
4629        }
4630        unsafe {
4631            let f: Box_<F> = Box_::new(f);
4632            connect_raw(
4633                self.as_ptr() as *mut _,
4634                c"notify::modal".as_ptr(),
4635                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4636                    notify_modal_trampoline::<Self, F> as *const (),
4637                )),
4638                Box_::into_raw(f),
4639            )
4640        }
4641    }
4642
4643    #[doc(alias = "resizable")]
4644    fn connect_resizable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4645        unsafe extern "C" fn notify_resizable_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4646            this: *mut ffi::GtkWindow,
4647            _param_spec: glib::ffi::gpointer,
4648            f: glib::ffi::gpointer,
4649        ) {
4650            unsafe {
4651                let f: &F = &*(f as *const F);
4652                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4653            }
4654        }
4655        unsafe {
4656            let f: Box_<F> = Box_::new(f);
4657            connect_raw(
4658                self.as_ptr() as *mut _,
4659                c"notify::resizable".as_ptr(),
4660                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4661                    notify_resizable_trampoline::<Self, F> as *const (),
4662                )),
4663                Box_::into_raw(f),
4664            )
4665        }
4666    }
4667
4668    #[doc(alias = "role")]
4669    fn connect_role_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4670        unsafe extern "C" fn notify_role_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4671            this: *mut ffi::GtkWindow,
4672            _param_spec: glib::ffi::gpointer,
4673            f: glib::ffi::gpointer,
4674        ) {
4675            unsafe {
4676                let f: &F = &*(f as *const F);
4677                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4678            }
4679        }
4680        unsafe {
4681            let f: Box_<F> = Box_::new(f);
4682            connect_raw(
4683                self.as_ptr() as *mut _,
4684                c"notify::role".as_ptr(),
4685                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4686                    notify_role_trampoline::<Self, F> as *const (),
4687                )),
4688                Box_::into_raw(f),
4689            )
4690        }
4691    }
4692
4693    #[doc(alias = "screen")]
4694    fn connect_screen_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4695        unsafe extern "C" fn notify_screen_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4696            this: *mut ffi::GtkWindow,
4697            _param_spec: glib::ffi::gpointer,
4698            f: glib::ffi::gpointer,
4699        ) {
4700            unsafe {
4701                let f: &F = &*(f as *const F);
4702                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4703            }
4704        }
4705        unsafe {
4706            let f: Box_<F> = Box_::new(f);
4707            connect_raw(
4708                self.as_ptr() as *mut _,
4709                c"notify::screen".as_ptr(),
4710                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4711                    notify_screen_trampoline::<Self, F> as *const (),
4712                )),
4713                Box_::into_raw(f),
4714            )
4715        }
4716    }
4717
4718    #[doc(alias = "skip-pager-hint")]
4719    fn connect_skip_pager_hint_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4720        unsafe extern "C" fn notify_skip_pager_hint_trampoline<
4721            P: IsA<Window>,
4722            F: Fn(&P) + 'static,
4723        >(
4724            this: *mut ffi::GtkWindow,
4725            _param_spec: glib::ffi::gpointer,
4726            f: glib::ffi::gpointer,
4727        ) {
4728            unsafe {
4729                let f: &F = &*(f as *const F);
4730                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4731            }
4732        }
4733        unsafe {
4734            let f: Box_<F> = Box_::new(f);
4735            connect_raw(
4736                self.as_ptr() as *mut _,
4737                c"notify::skip-pager-hint".as_ptr(),
4738                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4739                    notify_skip_pager_hint_trampoline::<Self, F> as *const (),
4740                )),
4741                Box_::into_raw(f),
4742            )
4743        }
4744    }
4745
4746    #[doc(alias = "skip-taskbar-hint")]
4747    fn connect_skip_taskbar_hint_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4748        unsafe extern "C" fn notify_skip_taskbar_hint_trampoline<
4749            P: IsA<Window>,
4750            F: Fn(&P) + 'static,
4751        >(
4752            this: *mut ffi::GtkWindow,
4753            _param_spec: glib::ffi::gpointer,
4754            f: glib::ffi::gpointer,
4755        ) {
4756            unsafe {
4757                let f: &F = &*(f as *const F);
4758                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4759            }
4760        }
4761        unsafe {
4762            let f: Box_<F> = Box_::new(f);
4763            connect_raw(
4764                self.as_ptr() as *mut _,
4765                c"notify::skip-taskbar-hint".as_ptr(),
4766                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4767                    notify_skip_taskbar_hint_trampoline::<Self, F> as *const (),
4768                )),
4769                Box_::into_raw(f),
4770            )
4771        }
4772    }
4773
4774    #[doc(alias = "startup-id")]
4775    fn connect_startup_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4776        unsafe extern "C" fn notify_startup_id_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4777            this: *mut ffi::GtkWindow,
4778            _param_spec: glib::ffi::gpointer,
4779            f: glib::ffi::gpointer,
4780        ) {
4781            unsafe {
4782                let f: &F = &*(f as *const F);
4783                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4784            }
4785        }
4786        unsafe {
4787            let f: Box_<F> = Box_::new(f);
4788            connect_raw(
4789                self.as_ptr() as *mut _,
4790                c"notify::startup-id".as_ptr(),
4791                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4792                    notify_startup_id_trampoline::<Self, F> as *const (),
4793                )),
4794                Box_::into_raw(f),
4795            )
4796        }
4797    }
4798
4799    #[doc(alias = "title")]
4800    fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4801        unsafe extern "C" fn notify_title_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4802            this: *mut ffi::GtkWindow,
4803            _param_spec: glib::ffi::gpointer,
4804            f: glib::ffi::gpointer,
4805        ) {
4806            unsafe {
4807                let f: &F = &*(f as *const F);
4808                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4809            }
4810        }
4811        unsafe {
4812            let f: Box_<F> = Box_::new(f);
4813            connect_raw(
4814                self.as_ptr() as *mut _,
4815                c"notify::title".as_ptr(),
4816                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4817                    notify_title_trampoline::<Self, F> as *const (),
4818                )),
4819                Box_::into_raw(f),
4820            )
4821        }
4822    }
4823
4824    #[doc(alias = "transient-for")]
4825    fn connect_transient_for_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4826        unsafe extern "C" fn notify_transient_for_trampoline<
4827            P: IsA<Window>,
4828            F: Fn(&P) + 'static,
4829        >(
4830            this: *mut ffi::GtkWindow,
4831            _param_spec: glib::ffi::gpointer,
4832            f: glib::ffi::gpointer,
4833        ) {
4834            unsafe {
4835                let f: &F = &*(f as *const F);
4836                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4837            }
4838        }
4839        unsafe {
4840            let f: Box_<F> = Box_::new(f);
4841            connect_raw(
4842                self.as_ptr() as *mut _,
4843                c"notify::transient-for".as_ptr(),
4844                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4845                    notify_transient_for_trampoline::<Self, F> as *const (),
4846                )),
4847                Box_::into_raw(f),
4848            )
4849        }
4850    }
4851
4852    #[doc(alias = "type-hint")]
4853    fn connect_type_hint_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4854        unsafe extern "C" fn notify_type_hint_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4855            this: *mut ffi::GtkWindow,
4856            _param_spec: glib::ffi::gpointer,
4857            f: glib::ffi::gpointer,
4858        ) {
4859            unsafe {
4860                let f: &F = &*(f as *const F);
4861                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4862            }
4863        }
4864        unsafe {
4865            let f: Box_<F> = Box_::new(f);
4866            connect_raw(
4867                self.as_ptr() as *mut _,
4868                c"notify::type-hint".as_ptr(),
4869                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4870                    notify_type_hint_trampoline::<Self, F> as *const (),
4871                )),
4872                Box_::into_raw(f),
4873            )
4874        }
4875    }
4876
4877    #[doc(alias = "urgency-hint")]
4878    fn connect_urgency_hint_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4879        unsafe extern "C" fn notify_urgency_hint_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
4880            this: *mut ffi::GtkWindow,
4881            _param_spec: glib::ffi::gpointer,
4882            f: glib::ffi::gpointer,
4883        ) {
4884            unsafe {
4885                let f: &F = &*(f as *const F);
4886                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4887            }
4888        }
4889        unsafe {
4890            let f: Box_<F> = Box_::new(f);
4891            connect_raw(
4892                self.as_ptr() as *mut _,
4893                c"notify::urgency-hint".as_ptr(),
4894                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4895                    notify_urgency_hint_trampoline::<Self, F> as *const (),
4896                )),
4897                Box_::into_raw(f),
4898            )
4899        }
4900    }
4901
4902    #[doc(alias = "window-position")]
4903    fn connect_window_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4904        unsafe extern "C" fn notify_window_position_trampoline<
4905            P: IsA<Window>,
4906            F: Fn(&P) + 'static,
4907        >(
4908            this: *mut ffi::GtkWindow,
4909            _param_spec: glib::ffi::gpointer,
4910            f: glib::ffi::gpointer,
4911        ) {
4912            unsafe {
4913                let f: &F = &*(f as *const F);
4914                f(Window::from_glib_borrow(this).unsafe_cast_ref())
4915            }
4916        }
4917        unsafe {
4918            let f: Box_<F> = Box_::new(f);
4919            connect_raw(
4920                self.as_ptr() as *mut _,
4921                c"notify::window-position".as_ptr(),
4922                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4923                    notify_window_position_trampoline::<Self, F> as *const (),
4924                )),
4925                Box_::into_raw(f),
4926            )
4927        }
4928    }
4929}
4930
4931impl<O: IsA<Window>> GtkWindowExt for O {}