Skip to main content

gtk4/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#![allow(deprecated)]
5
6#[cfg(feature = "v4_20")]
7#[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
8use crate::WindowGravity;
9use crate::{
10    Accessible, AccessibleRole, Align, Application, Buildable, ConstraintTarget, LayoutManager,
11    Native, Overflow, Root, ShortcutManager, Widget, WindowGroup, ffi,
12};
13use glib::{
14    object::ObjectType as _,
15    prelude::*,
16    signal::{SignalHandlerId, connect_raw},
17    translate::*,
18};
19use std::boxed::Box as Box_;
20
21glib::wrapper! {
22    /// A toplevel window which can contain other widgets.
23    ///
24    /// <picture>
25    ///   <source srcset="window-dark.png" media="(prefers-color-scheme: dark)">
26    ///   <img alt="An example GtkWindow" src="window.png">
27    /// </picture>
28    ///
29    /// Windows normally have decorations that are under the control
30    /// of the windowing system and allow the user to manipulate the window
31    /// (resize it, move it, close it,...).
32    ///
33    /// # GtkWindow as GtkBuildable
34    ///
35    /// The [`Window`][crate::Window] implementation of the [`Buildable`][crate::Buildable] interface supports
36    /// setting a child as the titlebar by specifying “titlebar” as the “type”
37    /// attribute of a `<child>` element.
38    ///
39    /// # Shortcuts and Gestures
40    ///
41    /// [`Window`][crate::Window] supports the following keyboard shortcuts:
42    ///
43    /// - <kbd>F10</kbd> activates the menubar, if present.
44    /// - <kbd>Alt</kbd> makes the mnemonics visible while pressed.
45    ///
46    /// The following signals have default keybindings:
47    ///
48    /// - [`activate-default`][struct@crate::Window#activate-default]
49    /// - [`activate-focus`][struct@crate::Window#activate-focus]
50    /// - [`enable-debugging`][struct@crate::Window#enable-debugging]
51    ///
52    /// # Actions
53    ///
54    /// [`Window`][crate::Window] defines a set of built-in actions:
55    ///
56    /// - `default.activate` activates the default widget.
57    /// - `window.minimize` minimizes the window.
58    /// - `window.toggle-maximized` maximizes or restores the window.
59    /// - `window.close` closes the window.
60    ///
61    /// # CSS nodes
62    ///
63    /// ```text
64    /// window.background [.csd / .solid-csd / .ssd] [.maximized / .fullscreen / .tiled]
65    /// ├── <child>
66    /// ╰── <titlebar child>.titlebar [.default-decoration]
67    /// ```
68    ///
69    /// [`Window`][crate::Window] has a main CSS node with name window and style class .background.
70    ///
71    /// Style classes that are typically used with the main CSS node are .csd (when
72    /// client-side decorations are in use), .solid-csd (for client-side decorations
73    /// without invisible borders), .ssd (used by mutter when rendering server-side
74    /// decorations). GtkWindow also represents window states with the following
75    /// style classes on the main node: .maximized, .fullscreen, .tiled (when supported,
76    /// also .tiled-top, .tiled-left, .tiled-right, .tiled-bottom).
77    ///
78    /// [`Window`][crate::Window] subclasses often add their own discriminating style classes,
79    /// such as .dialog, .popup or .tooltip.
80    ///
81    /// Generally, some CSS properties don't make sense on the toplevel window node,
82    /// such as margins or padding. When client-side decorations without invisible
83    /// borders are in use (i.e. the .solid-csd style class is added to the
84    /// main window node), the CSS border of the toplevel window is used for
85    /// resize drags. In the .csd case, the shadow area outside of the window
86    /// can be used to resize it.
87    ///
88    /// [`Window`][crate::Window] adds the .titlebar and .default-decoration style classes to the
89    /// widget that is added as a titlebar child.
90    ///
91    /// # Accessibility
92    ///
93    /// [`Window`][crate::Window] uses the [enum@Gtk.AccessibleRole.window] role.
94    ///
95    /// From GTK 4.12 to 4.18, it used the [enum@Gtk.AccessibleRole.application] role.
96    ///
97    /// ## Properties
98    ///
99    ///
100    /// #### `application`
101    ///  The [`Application`][crate::Application] associated with the window.
102    ///
103    /// The application will be kept alive for at least as long as it
104    /// has any windows associated with it (see g_application_hold()
105    /// for a way to keep it alive without windows).
106    ///
107    /// Normally, the connection between the application and the window
108    /// will remain until the window is destroyed, but you can explicitly
109    /// remove it by setting the this property to `NULL`.
110    ///
111    /// Readable | Writeable
112    ///
113    ///
114    /// #### `child`
115    ///  The child widget.
116    ///
117    /// Readable | Writeable
118    ///
119    ///
120    /// #### `decorated`
121    ///  Whether the window should have a frame (also known as *decorations*).
122    ///
123    /// Readable | Writeable
124    ///
125    ///
126    /// #### `default-height`
127    ///  The default height of the window.
128    ///
129    /// Readable | Writeable
130    ///
131    ///
132    /// #### `default-widget`
133    ///  The default widget.
134    ///
135    /// Readable | Writeable
136    ///
137    ///
138    /// #### `default-width`
139    ///  The default width of the window.
140    ///
141    /// Readable | Writeable
142    ///
143    ///
144    /// #### `deletable`
145    ///  Whether the window frame should have a close button.
146    ///
147    /// Readable | Writeable
148    ///
149    ///
150    /// #### `destroy-with-parent`
151    ///  If this window should be destroyed when the parent is destroyed.
152    ///
153    /// Readable | Writeable
154    ///
155    ///
156    /// #### `display`
157    ///  The display that will display this window.
158    ///
159    /// Readable | Writeable
160    ///
161    ///
162    /// #### `focus-visible`
163    ///  Whether 'focus rectangles' are currently visible in this window.
164    ///
165    /// This property is maintained by GTK based on user input
166    /// and should not be set by applications.
167    ///
168    /// Readable | Writeable
169    ///
170    ///
171    /// #### `focus-widget`
172    ///  The focus widget.
173    ///
174    /// Readable | Writeable
175    ///
176    ///
177    /// #### `fullscreened`
178    ///  Whether the window is fullscreen.
179    ///
180    /// Setting this property is the equivalent of calling
181    /// [`GtkWindowExt::fullscreen()`][crate::prelude::GtkWindowExt::fullscreen()] or [`GtkWindowExt::unfullscreen()`][crate::prelude::GtkWindowExt::unfullscreen()];
182    /// either operation is asynchronous, which means you will need to
183    /// connect to the ::notify signal in order to know whether the
184    /// operation was successful.
185    ///
186    /// Readable | Writeable
187    ///
188    ///
189    /// #### `gravity`
190    ///  The gravity to use when resizing the window programmatically.
191    ///
192    /// Gravity describes which point of the window we want to keep
193    /// fixed (meaning that the window will grow in the opposite direction).
194    /// For example, a gravity of `GTK_WINDOW_GRAVITY_TOP_RIGHT` means that we
195    /// want the to fix top right corner of the window.
196    ///
197    /// Readable | Writeable
198    ///
199    ///
200    /// #### `handle-menubar-accel`
201    ///  Whether the window frame should handle <kbd>F10</kbd> for activating
202    /// menubars.
203    ///
204    /// Readable | Writeable
205    ///
206    ///
207    /// #### `hide-on-close`
208    ///  If this window should be hidden instead of destroyed when the user clicks
209    /// the close button.
210    ///
211    /// Readable | Writeable
212    ///
213    ///
214    /// #### `icon-name`
215    ///  Specifies the name of the themed icon to use as the window icon.
216    ///
217    /// See [`IconTheme`][crate::IconTheme] for more details.
218    ///
219    /// Readable | Writeable
220    ///
221    ///
222    /// #### `is-active`
223    ///  Whether the toplevel is the currently active window.
224    ///
225    /// Readable
226    ///
227    ///
228    /// #### `maximized`
229    ///  Whether the window is maximized.
230    ///
231    /// Setting this property is the equivalent of calling
232    /// [`GtkWindowExt::maximize()`][crate::prelude::GtkWindowExt::maximize()] or [`GtkWindowExt::unmaximize()`][crate::prelude::GtkWindowExt::unmaximize()];
233    /// either operation is asynchronous, which means you will need to
234    /// connect to the ::notify signal in order to know whether the
235    /// operation was successful.
236    ///
237    /// Readable | Writeable
238    ///
239    ///
240    /// #### `mnemonics-visible`
241    ///  Whether mnemonics are currently visible in this window.
242    ///
243    /// This property is maintained by GTK based on user input,
244    /// and should not be set by applications.
245    ///
246    /// Readable | Writeable
247    ///
248    ///
249    /// #### `modal`
250    ///  If true, the window is modal.
251    ///
252    /// Readable | Writeable
253    ///
254    ///
255    /// #### `resizable`
256    ///  If true, users can resize the window.
257    ///
258    /// Readable | Writeable
259    ///
260    ///
261    /// #### `startup-id`
262    ///  A write-only property for setting window's startup notification identifier.
263    ///
264    /// Writeable
265    ///
266    ///
267    /// #### `suspended`
268    ///  Whether the window is suspended.
269    ///
270    /// See [`GtkWindowExt::is_suspended()`][crate::prelude::GtkWindowExt::is_suspended()] for details about what suspended means.
271    ///
272    /// Readable
273    ///
274    ///
275    /// #### `title`
276    ///  The title of the window.
277    ///
278    /// Readable | Writeable
279    ///
280    ///
281    /// #### `titlebar`
282    ///  The titlebar widget.
283    ///
284    /// Readable | Writeable
285    ///
286    ///
287    /// #### `transient-for`
288    ///  The transient parent of the window.
289    ///
290    /// Readable | Writeable | Construct
291    /// <details><summary><h4>Widget</h4></summary>
292    ///
293    ///
294    /// #### `can-focus`
295    ///  Whether the widget or any of its descendents can accept
296    /// the input focus.
297    ///
298    /// This property is meant to be set by widget implementations,
299    /// typically in their instance init function.
300    ///
301    /// Readable | Writeable
302    ///
303    ///
304    /// #### `can-target`
305    ///  Whether the widget can receive pointer events.
306    ///
307    /// Readable | Writeable
308    ///
309    ///
310    /// #### `css-classes`
311    ///  A list of css classes applied to this widget.
312    ///
313    /// Readable | Writeable
314    ///
315    ///
316    /// #### `css-name`
317    ///  The name of this widget in the CSS tree.
318    ///
319    /// This property is meant to be set by widget implementations,
320    /// typically in their instance init function.
321    ///
322    /// Readable | Writeable | Construct Only
323    ///
324    ///
325    /// #### `cursor`
326    ///  The cursor used by @widget.
327    ///
328    /// Readable | Writeable
329    ///
330    ///
331    /// #### `focus-on-click`
332    ///  Whether the widget should grab focus when it is clicked with the mouse.
333    ///
334    /// This property is only relevant for widgets that can take focus.
335    ///
336    /// Readable | Writeable
337    ///
338    ///
339    /// #### `focusable`
340    ///  Whether this widget itself will accept the input focus.
341    ///
342    /// Readable | Writeable
343    ///
344    ///
345    /// #### `halign`
346    ///  How to distribute horizontal space if widget gets extra space.
347    ///
348    /// Readable | Writeable
349    ///
350    ///
351    /// #### `has-default`
352    ///  Whether the widget is the default widget.
353    ///
354    /// Readable
355    ///
356    ///
357    /// #### `has-focus`
358    ///  Whether the widget has the input focus.
359    ///
360    /// Readable
361    ///
362    ///
363    /// #### `has-tooltip`
364    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
365    /// signal on @widget.
366    ///
367    /// A true value indicates that @widget can have a tooltip, in this case
368    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
369    /// determine whether it will provide a tooltip or not.
370    ///
371    /// Readable | Writeable
372    ///
373    ///
374    /// #### `height-request`
375    ///  Overrides for height request of the widget.
376    ///
377    /// If this is -1, the natural request will be used.
378    ///
379    /// Readable | Writeable
380    ///
381    ///
382    /// #### `hexpand`
383    ///  Whether to expand horizontally.
384    ///
385    /// Readable | Writeable
386    ///
387    ///
388    /// #### `hexpand-set`
389    ///  Whether to use the `hexpand` property.
390    ///
391    /// Readable | Writeable
392    ///
393    ///
394    /// #### `layout-manager`
395    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
396    /// the preferred size of the widget, and allocate its children.
397    ///
398    /// This property is meant to be set by widget implementations,
399    /// typically in their instance init function.
400    ///
401    /// Readable | Writeable
402    ///
403    ///
404    /// #### `limit-events`
405    ///  Makes this widget act like a modal dialog, with respect to
406    /// event delivery.
407    ///
408    /// Global event controllers will not handle events with targets
409    /// inside the widget, unless they are set up to ignore propagation
410    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
411    ///
412    /// Readable | Writeable
413    ///
414    ///
415    /// #### `margin-bottom`
416    ///  Margin on bottom side of widget.
417    ///
418    /// This property adds margin outside of the widget's normal size
419    /// request, the margin will be added in addition to the size from
420    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
421    ///
422    /// Readable | Writeable
423    ///
424    ///
425    /// #### `margin-end`
426    ///  Margin on end of widget, horizontally.
427    ///
428    /// This property supports left-to-right and right-to-left text
429    /// directions.
430    ///
431    /// This property adds margin outside of the widget's normal size
432    /// request, the margin will be added in addition to the size from
433    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
434    ///
435    /// Readable | Writeable
436    ///
437    ///
438    /// #### `margin-start`
439    ///  Margin on start of widget, horizontally.
440    ///
441    /// This property supports left-to-right and right-to-left text
442    /// directions.
443    ///
444    /// This property adds margin outside of the widget's normal size
445    /// request, the margin will be added in addition to the size from
446    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
447    ///
448    /// Readable | Writeable
449    ///
450    ///
451    /// #### `margin-top`
452    ///  Margin on top side of widget.
453    ///
454    /// This property adds margin outside of the widget's normal size
455    /// request, the margin will be added in addition to the size from
456    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
457    ///
458    /// Readable | Writeable
459    ///
460    ///
461    /// #### `name`
462    ///  The name of the widget.
463    ///
464    /// Readable | Writeable
465    ///
466    ///
467    /// #### `opacity`
468    ///  The requested opacity of the widget.
469    ///
470    /// Readable | Writeable
471    ///
472    ///
473    /// #### `overflow`
474    ///  How content outside the widget's content area is treated.
475    ///
476    /// This property is meant to be set by widget implementations,
477    /// typically in their instance init function.
478    ///
479    /// Readable | Writeable
480    ///
481    ///
482    /// #### `parent`
483    ///  The parent widget of this widget.
484    ///
485    /// Readable
486    ///
487    ///
488    /// #### `receives-default`
489    ///  Whether the widget will receive the default action when it is focused.
490    ///
491    /// Readable | Writeable
492    ///
493    ///
494    /// #### `root`
495    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
496    ///
497    /// This will be `NULL` if the widget is not contained in a root widget.
498    ///
499    /// Readable
500    ///
501    ///
502    /// #### `scale-factor`
503    ///  The scale factor of the widget.
504    ///
505    /// Readable
506    ///
507    ///
508    /// #### `sensitive`
509    ///  Whether the widget responds to input.
510    ///
511    /// Readable | Writeable
512    ///
513    ///
514    /// #### `tooltip-markup`
515    ///  Sets the text of tooltip to be the given string, which is marked up
516    /// with Pango markup.
517    ///
518    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
519    ///
520    /// This is a convenience property which will take care of getting the
521    /// tooltip shown if the given string is not `NULL`:
522    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
523    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
524    /// the default signal handler.
525    ///
526    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
527    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
528    ///
529    /// Readable | Writeable
530    ///
531    ///
532    /// #### `tooltip-text`
533    ///  Sets the text of tooltip to be the given string.
534    ///
535    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
536    ///
537    /// This is a convenience property which will take care of getting the
538    /// tooltip shown if the given string is not `NULL`:
539    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
540    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
541    /// the default signal handler.
542    ///
543    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
544    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
545    ///
546    /// Readable | Writeable
547    ///
548    ///
549    /// #### `valign`
550    ///  How to distribute vertical space if widget gets extra space.
551    ///
552    /// Readable | Writeable
553    ///
554    ///
555    /// #### `vexpand`
556    ///  Whether to expand vertically.
557    ///
558    /// Readable | Writeable
559    ///
560    ///
561    /// #### `vexpand-set`
562    ///  Whether to use the `vexpand` property.
563    ///
564    /// Readable | Writeable
565    ///
566    ///
567    /// #### `visible`
568    ///  Whether the widget is visible.
569    ///
570    /// Readable | Writeable
571    ///
572    ///
573    /// #### `width-request`
574    ///  Overrides for width request of the widget.
575    ///
576    /// If this is -1, the natural request will be used.
577    ///
578    /// Readable | Writeable
579    /// </details>
580    /// <details><summary><h4>Accessible</h4></summary>
581    ///
582    ///
583    /// #### `accessible-role`
584    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
585    ///
586    /// The accessible role cannot be changed once set.
587    ///
588    /// Readable | Writeable
589    /// </details>
590    ///
591    /// ## Signals
592    ///
593    ///
594    /// #### `activate-default`
595    ///  Emitted when the user activates the default widget.
596    ///
597    /// This is a [keybinding signal](class.SignalAction.html).
598    ///
599    /// The keybindings for this signal are all forms of the <kbd>Enter</kbd> key.
600    ///
601    /// Action
602    ///
603    ///
604    /// #### `activate-focus`
605    ///  Emitted when the user activates the currently focused
606    /// widget of @window.
607    ///
608    /// This is a [keybinding signal](class.SignalAction.html).
609    ///
610    /// The default binding for this signal is <kbd>␣</kbd>.
611    ///
612    /// Action
613    ///
614    ///
615    /// #### `close-request`
616    ///  Emitted when the user clicks on the close button of the window.
617    ///
618    ///
619    ///
620    ///
621    /// #### `enable-debugging`
622    ///  Emitted when the user enables or disables interactive debugging.
623    ///
624    /// When @toggle is true, interactive debugging is toggled on or off,
625    /// when it is false, the debugger will be pointed at the widget
626    /// under the pointer.
627    ///
628    /// This is a [keybinding signal](class.SignalAction.html).
629    ///
630    /// The default bindings for this signal are
631    /// <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>I</kbd> and
632    /// <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>D</kbd>.
633    ///
634    /// Action
635    ///
636    ///
637    /// #### `force-close`
638    ///  Emitted when the compositor has decided to eliminate a window.
639    ///
640    /// @window *has* to be in a hidden state after this signal was handled.
641    ///
642    ///
643    ///
644    ///
645    /// #### `keys-changed`
646    ///  Emitted when the set of accelerators or mnemonics that
647    /// are associated with the window changes.
648    ///
649    ///
650    /// <details><summary><h4>Widget</h4></summary>
651    ///
652    ///
653    /// #### `destroy`
654    ///  Signals that all holders of a reference to the widget should release
655    /// the reference that they hold.
656    ///
657    /// May result in finalization of the widget if all references are released.
658    ///
659    /// This signal is not suitable for saving widget state.
660    ///
661    ///
662    ///
663    ///
664    /// #### `direction-changed`
665    ///  Emitted when the text direction of a widget changes.
666    ///
667    ///
668    ///
669    ///
670    /// #### `hide`
671    ///  Emitted when @widget is hidden.
672    ///
673    ///
674    ///
675    ///
676    /// #### `keynav-failed`
677    ///  Emitted if keyboard navigation fails.
678    ///
679    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
680    ///
681    ///
682    ///
683    ///
684    /// #### `map`
685    ///  Emitted when @widget is going to be mapped.
686    ///
687    /// A widget is mapped when the widget is visible (which is controlled with
688    /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
689    /// are also visible.
690    ///
691    /// The `::map` signal can be used to determine whether a widget will be drawn,
692    /// for instance it can resume an animation that was stopped during the
693    /// emission of [`unmap`][struct@crate::Widget#unmap].
694    ///
695    ///
696    ///
697    ///
698    /// #### `mnemonic-activate`
699    ///  Emitted when a widget is activated via a mnemonic.
700    ///
701    /// The default handler for this signal activates @widget if @group_cycling
702    /// is false, or just makes @widget grab focus if @group_cycling is true.
703    ///
704    ///
705    ///
706    ///
707    /// #### `move-focus`
708    ///  Emitted when the focus is moved.
709    ///
710    /// The `::move-focus` signal is a [keybinding signal](class.SignalAction.html).
711    ///
712    /// The default bindings for this signal are <kbd>Tab</kbd> to move forward,
713    /// and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move backward.
714    ///
715    /// Action
716    ///
717    ///
718    /// #### `query-tooltip`
719    ///  Emitted when the widget’s tooltip is about to be shown.
720    ///
721    /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
722    /// is true and the hover timeout has expired with the cursor hovering
723    /// above @widget; or emitted when @widget got focus in keyboard mode.
724    ///
725    /// Using the given coordinates, the signal handler should determine
726    /// whether a tooltip should be shown for @widget. If this is the case
727    /// true should be returned, false otherwise. Note that if @keyboard_mode
728    /// is true, the values of @x and @y are undefined and should not be used.
729    ///
730    /// The signal handler is free to manipulate @tooltip with the therefore
731    /// destined function calls.
732    ///
733    ///
734    ///
735    ///
736    /// #### `realize`
737    ///  Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
738    ///
739    /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
740    /// or the widget has been mapped (that is, it is going to be drawn).
741    ///
742    ///
743    ///
744    ///
745    /// #### `show`
746    ///  Emitted when @widget is shown.
747    ///
748    ///
749    ///
750    ///
751    /// #### `state-flags-changed`
752    ///  Emitted when the widget state changes.
753    ///
754    /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
755    ///
756    ///
757    ///
758    ///
759    /// #### `unmap`
760    ///  Emitted when @widget is going to be unmapped.
761    ///
762    /// A widget is unmapped when either it or any of its parents up to the
763    /// toplevel widget have been set as hidden.
764    ///
765    /// As `::unmap` indicates that a widget will not be shown any longer,
766    /// it can be used to, for example, stop an animation on the widget.
767    ///
768    ///
769    ///
770    ///
771    /// #### `unrealize`
772    ///  Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
773    ///
774    /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
775    /// or the widget has been unmapped (that is, it is going to be hidden).
776    ///
777    ///
778    /// </details>
779    ///
780    /// # Implements
781    ///
782    /// [`GtkWindowExt`][trait@crate::prelude::GtkWindowExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`NativeExt`][trait@crate::prelude::NativeExt], [`RootExt`][trait@crate::prelude::RootExt], [`ShortcutManagerExt`][trait@crate::prelude::ShortcutManagerExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
783    #[doc(alias = "GtkWindow")]
784    pub struct Window(Object<ffi::GtkWindow, ffi::GtkWindowClass>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, Native, Root, ShortcutManager;
785
786    match fn {
787        type_ => || ffi::gtk_window_get_type(),
788    }
789}
790
791impl Window {
792    pub const NONE: Option<&'static Window> = None;
793
794    /// Creates a new [`Window`][crate::Window].
795    ///
796    /// To get an undecorated window (without window borders),
797    /// use [`GtkWindowExt::set_decorated()`][crate::prelude::GtkWindowExt::set_decorated()].
798    ///
799    /// All top-level windows created by this function are stored
800    /// in an internal top-level window list. This list can be obtained
801    /// from [`list_toplevels()`][Self::list_toplevels()]. Due to GTK keeping a
802    /// reference to the window internally, this function does not
803    /// return a reference to the caller.
804    ///
805    /// To delete a [`Window`][crate::Window], call `Gtk::Window::destroy()`.
806    ///
807    /// # Returns
808    ///
809    /// a new [`Window`][crate::Window]
810    #[doc(alias = "gtk_window_new")]
811    pub fn new() -> Window {
812        assert_initialized_main_thread!();
813        unsafe { Widget::from_glib_none(ffi::gtk_window_new()).unsafe_cast() }
814    }
815
816    // rustdoc-stripper-ignore-next
817    /// Creates a new builder-pattern struct instance to construct [`Window`] objects.
818    ///
819    /// This method returns an instance of [`WindowBuilder`](crate::builders::WindowBuilder) which can be used to create [`Window`] objects.
820    pub fn builder() -> WindowBuilder {
821        WindowBuilder::new()
822    }
823
824    /// Returns the fallback icon name for windows.
825    ///
826    /// The returned string is owned by GTK and should not
827    /// be modified. It is only valid until the next call to
828    /// [`set_default_icon_name()`][Self::set_default_icon_name()].
829    ///
830    /// # Returns
831    ///
832    /// the fallback icon name for windows
833    #[doc(alias = "gtk_window_get_default_icon_name")]
834    #[doc(alias = "get_default_icon_name")]
835    pub fn default_icon_name() -> Option<glib::GString> {
836        assert_initialized_main_thread!();
837        unsafe { from_glib_none(ffi::gtk_window_get_default_icon_name()) }
838    }
839
840    /// Returns the list of all existing toplevel windows.
841    ///
842    /// If you want to iterate through the list and perform actions involving
843    /// callbacks that might destroy the widgets or add new ones, be aware that
844    /// the list of toplevels will change and emit the "items-changed" signal.
845    ///
846    /// # Returns
847    ///
848    /// the list
849    ///   of toplevel widgets
850    #[doc(alias = "gtk_window_get_toplevels")]
851    #[doc(alias = "get_toplevels")]
852    pub fn toplevels() -> gio::ListModel {
853        assert_initialized_main_thread!();
854        unsafe { from_glib_none(ffi::gtk_window_get_toplevels()) }
855    }
856
857    /// Returns the list of all existing toplevel windows.
858    ///
859    /// The widgets in the list are not individually referenced.
860    /// If you want to iterate through the list and perform actions
861    /// involving callbacks that might destroy the widgets, you must
862    /// call `g_list_foreach (result, (GFunc)g_object_ref, NULL)` first,
863    /// and then unref all the widgets afterwards.
864    ///
865    /// # Returns
866    ///
867    /// list of
868    ///   toplevel widgets
869    #[doc(alias = "gtk_window_list_toplevels")]
870    pub fn list_toplevels() -> Vec<Widget> {
871        assert_initialized_main_thread!();
872        unsafe { FromGlibPtrContainer::from_glib_container(ffi::gtk_window_list_toplevels()) }
873    }
874
875    /// Sets whether the window should request startup notification.
876    ///
877    /// By default, after showing the first window, GTK calls
878    /// `Gdk::Toplevel::set_startup_id()`. Call this function
879    /// to disable the automatic startup notification. You might do this
880    /// if your first window is a splash screen, and you want to delay
881    /// notification until after your real main window has been shown,
882    /// for example.
883    ///
884    /// In that example, you would disable startup notification
885    /// temporarily, show your splash screen, then re-enable it so that
886    /// showing the main window would automatically result in notification.
887    /// ## `setting`
888    /// true to automatically do startup notification
889    #[doc(alias = "gtk_window_set_auto_startup_notification")]
890    pub fn set_auto_startup_notification(setting: bool) {
891        assert_initialized_main_thread!();
892        unsafe {
893            ffi::gtk_window_set_auto_startup_notification(setting.into_glib());
894        }
895    }
896
897    /// Sets an icon to be used as fallback.
898    ///
899    /// The fallback icon is used for windows that
900    /// haven't had [`GtkWindowExt::set_icon_name()`][crate::prelude::GtkWindowExt::set_icon_name()]
901    /// called on them.
902    /// ## `name`
903    /// the name of the themed icon
904    #[doc(alias = "gtk_window_set_default_icon_name")]
905    pub fn set_default_icon_name(name: &str) {
906        assert_initialized_main_thread!();
907        unsafe {
908            ffi::gtk_window_set_default_icon_name(name.to_glib_none().0);
909        }
910    }
911
912    /// Opens or closes the [interactive debugger](running.html#interactive-debugging).
913    ///
914    /// The debugger offers access to the widget hierarchy of the application
915    /// and to useful debugging tools.
916    ///
917    /// This function allows applications that already use
918    /// <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>I</kbd>
919    /// (or <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>D</kbd>)
920    /// for their own key shortcuts to add a different shortcut to open the Inspector.
921    ///
922    /// If you are not overriding the default key shortcuts for the Inspector,
923    /// you should not use this function.
924    /// ## `enable`
925    /// true to enable interactive debugging
926    #[doc(alias = "gtk_window_set_interactive_debugging")]
927    pub fn set_interactive_debugging(enable: bool) {
928        assert_initialized_main_thread!();
929        unsafe {
930            ffi::gtk_window_set_interactive_debugging(enable.into_glib());
931        }
932    }
933}
934
935impl Default for Window {
936    fn default() -> Self {
937        Self::new()
938    }
939}
940
941// rustdoc-stripper-ignore-next
942/// A [builder-pattern] type to construct [`Window`] objects.
943///
944/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
945#[must_use = "The builder must be built to be used"]
946pub struct WindowBuilder {
947    builder: glib::object::ObjectBuilder<'static, Window>,
948}
949
950impl WindowBuilder {
951    fn new() -> Self {
952        Self {
953            builder: glib::object::Object::builder(),
954        }
955    }
956
957    /// The [`Application`][crate::Application] associated with the window.
958    ///
959    /// The application will be kept alive for at least as long as it
960    /// has any windows associated with it (see g_application_hold()
961    /// for a way to keep it alive without windows).
962    ///
963    /// Normally, the connection between the application and the window
964    /// will remain until the window is destroyed, but you can explicitly
965    /// remove it by setting the this property to `NULL`.
966    pub fn application(self, application: &impl IsA<Application>) -> Self {
967        Self {
968            builder: self
969                .builder
970                .property("application", application.clone().upcast()),
971        }
972    }
973
974    /// The child widget.
975    pub fn child(self, child: &impl IsA<Widget>) -> Self {
976        Self {
977            builder: self.builder.property("child", child.clone().upcast()),
978        }
979    }
980
981    /// Whether the window should have a frame (also known as *decorations*).
982    pub fn decorated(self, decorated: bool) -> Self {
983        Self {
984            builder: self.builder.property("decorated", decorated),
985        }
986    }
987
988    /// The default height of the window.
989    pub fn default_height(self, default_height: i32) -> Self {
990        Self {
991            builder: self.builder.property("default-height", default_height),
992        }
993    }
994
995    /// The default widget.
996    pub fn default_widget(self, default_widget: &impl IsA<Widget>) -> Self {
997        Self {
998            builder: self
999                .builder
1000                .property("default-widget", default_widget.clone().upcast()),
1001        }
1002    }
1003
1004    /// The default width of the window.
1005    pub fn default_width(self, default_width: i32) -> Self {
1006        Self {
1007            builder: self.builder.property("default-width", default_width),
1008        }
1009    }
1010
1011    /// Whether the window frame should have a close button.
1012    pub fn deletable(self, deletable: bool) -> Self {
1013        Self {
1014            builder: self.builder.property("deletable", deletable),
1015        }
1016    }
1017
1018    /// If this window should be destroyed when the parent is destroyed.
1019    pub fn destroy_with_parent(self, destroy_with_parent: bool) -> Self {
1020        Self {
1021            builder: self
1022                .builder
1023                .property("destroy-with-parent", destroy_with_parent),
1024        }
1025    }
1026
1027    /// The display that will display this window.
1028    pub fn display(self, display: &impl IsA<gdk::Display>) -> Self {
1029        Self {
1030            builder: self.builder.property("display", display.clone().upcast()),
1031        }
1032    }
1033
1034    /// Whether 'focus rectangles' are currently visible in this window.
1035    ///
1036    /// This property is maintained by GTK based on user input
1037    /// and should not be set by applications.
1038    pub fn focus_visible(self, focus_visible: bool) -> Self {
1039        Self {
1040            builder: self.builder.property("focus-visible", focus_visible),
1041        }
1042    }
1043
1044    /// The focus widget.
1045    pub fn focus_widget(self, focus_widget: &impl IsA<Widget>) -> Self {
1046        Self {
1047            builder: self
1048                .builder
1049                .property("focus-widget", focus_widget.clone().upcast()),
1050        }
1051    }
1052
1053    /// Whether the window is fullscreen.
1054    ///
1055    /// Setting this property is the equivalent of calling
1056    /// [`GtkWindowExt::fullscreen()`][crate::prelude::GtkWindowExt::fullscreen()] or [`GtkWindowExt::unfullscreen()`][crate::prelude::GtkWindowExt::unfullscreen()];
1057    /// either operation is asynchronous, which means you will need to
1058    /// connect to the ::notify signal in order to know whether the
1059    /// operation was successful.
1060    pub fn fullscreened(self, fullscreened: bool) -> Self {
1061        Self {
1062            builder: self.builder.property("fullscreened", fullscreened),
1063        }
1064    }
1065
1066    /// The gravity to use when resizing the window programmatically.
1067    ///
1068    /// Gravity describes which point of the window we want to keep
1069    /// fixed (meaning that the window will grow in the opposite direction).
1070    /// For example, a gravity of `GTK_WINDOW_GRAVITY_TOP_RIGHT` means that we
1071    /// want the to fix top right corner of the window.
1072    #[cfg(feature = "v4_20")]
1073    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
1074    pub fn gravity(self, gravity: WindowGravity) -> Self {
1075        Self {
1076            builder: self.builder.property("gravity", gravity),
1077        }
1078    }
1079
1080    /// Whether the window frame should handle <kbd>F10</kbd> for activating
1081    /// menubars.
1082    #[cfg(feature = "v4_2")]
1083    #[cfg_attr(docsrs, doc(cfg(feature = "v4_2")))]
1084    pub fn handle_menubar_accel(self, handle_menubar_accel: bool) -> Self {
1085        Self {
1086            builder: self
1087                .builder
1088                .property("handle-menubar-accel", handle_menubar_accel),
1089        }
1090    }
1091
1092    /// If this window should be hidden instead of destroyed when the user clicks
1093    /// the close button.
1094    pub fn hide_on_close(self, hide_on_close: bool) -> Self {
1095        Self {
1096            builder: self.builder.property("hide-on-close", hide_on_close),
1097        }
1098    }
1099
1100    /// Specifies the name of the themed icon to use as the window icon.
1101    ///
1102    /// See [`IconTheme`][crate::IconTheme] for more details.
1103    pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
1104        Self {
1105            builder: self.builder.property("icon-name", icon_name.into()),
1106        }
1107    }
1108
1109    /// Whether the window is maximized.
1110    ///
1111    /// Setting this property is the equivalent of calling
1112    /// [`GtkWindowExt::maximize()`][crate::prelude::GtkWindowExt::maximize()] or [`GtkWindowExt::unmaximize()`][crate::prelude::GtkWindowExt::unmaximize()];
1113    /// either operation is asynchronous, which means you will need to
1114    /// connect to the ::notify signal in order to know whether the
1115    /// operation was successful.
1116    pub fn maximized(self, maximized: bool) -> Self {
1117        Self {
1118            builder: self.builder.property("maximized", maximized),
1119        }
1120    }
1121
1122    /// Whether mnemonics are currently visible in this window.
1123    ///
1124    /// This property is maintained by GTK based on user input,
1125    /// and should not be set by applications.
1126    pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self {
1127        Self {
1128            builder: self
1129                .builder
1130                .property("mnemonics-visible", mnemonics_visible),
1131        }
1132    }
1133
1134    /// If true, the window is modal.
1135    pub fn modal(self, modal: bool) -> Self {
1136        Self {
1137            builder: self.builder.property("modal", modal),
1138        }
1139    }
1140
1141    /// If true, users can resize the window.
1142    pub fn resizable(self, resizable: bool) -> Self {
1143        Self {
1144            builder: self.builder.property("resizable", resizable),
1145        }
1146    }
1147
1148    /// A write-only property for setting window's startup notification identifier.
1149    pub fn startup_id(self, startup_id: impl Into<glib::GString>) -> Self {
1150        Self {
1151            builder: self.builder.property("startup-id", startup_id.into()),
1152        }
1153    }
1154
1155    /// The title of the window.
1156    pub fn title(self, title: impl Into<glib::GString>) -> Self {
1157        Self {
1158            builder: self.builder.property("title", title.into()),
1159        }
1160    }
1161
1162    /// The titlebar widget.
1163    #[cfg(feature = "v4_6")]
1164    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
1165    pub fn titlebar(self, titlebar: &impl IsA<Widget>) -> Self {
1166        Self {
1167            builder: self.builder.property("titlebar", titlebar.clone().upcast()),
1168        }
1169    }
1170
1171    /// The transient parent of the window.
1172    pub fn transient_for(self, transient_for: &impl IsA<Window>) -> Self {
1173        Self {
1174            builder: self
1175                .builder
1176                .property("transient-for", transient_for.clone().upcast()),
1177        }
1178    }
1179
1180    /// Whether the widget or any of its descendents can accept
1181    /// the input focus.
1182    ///
1183    /// This property is meant to be set by widget implementations,
1184    /// typically in their instance init function.
1185    pub fn can_focus(self, can_focus: bool) -> Self {
1186        Self {
1187            builder: self.builder.property("can-focus", can_focus),
1188        }
1189    }
1190
1191    /// Whether the widget can receive pointer events.
1192    pub fn can_target(self, can_target: bool) -> Self {
1193        Self {
1194            builder: self.builder.property("can-target", can_target),
1195        }
1196    }
1197
1198    /// A list of css classes applied to this widget.
1199    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1200        Self {
1201            builder: self.builder.property("css-classes", css_classes.into()),
1202        }
1203    }
1204
1205    /// The name of this widget in the CSS tree.
1206    ///
1207    /// This property is meant to be set by widget implementations,
1208    /// typically in their instance init function.
1209    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1210        Self {
1211            builder: self.builder.property("css-name", css_name.into()),
1212        }
1213    }
1214
1215    /// The cursor used by @widget.
1216    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1217        Self {
1218            builder: self.builder.property("cursor", cursor.clone()),
1219        }
1220    }
1221
1222    /// Whether the widget should grab focus when it is clicked with the mouse.
1223    ///
1224    /// This property is only relevant for widgets that can take focus.
1225    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1226        Self {
1227            builder: self.builder.property("focus-on-click", focus_on_click),
1228        }
1229    }
1230
1231    /// Whether this widget itself will accept the input focus.
1232    pub fn focusable(self, focusable: bool) -> Self {
1233        Self {
1234            builder: self.builder.property("focusable", focusable),
1235        }
1236    }
1237
1238    /// How to distribute horizontal space if widget gets extra space.
1239    pub fn halign(self, halign: Align) -> Self {
1240        Self {
1241            builder: self.builder.property("halign", halign),
1242        }
1243    }
1244
1245    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1246    /// signal on @widget.
1247    ///
1248    /// A true value indicates that @widget can have a tooltip, in this case
1249    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1250    /// determine whether it will provide a tooltip or not.
1251    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1252        Self {
1253            builder: self.builder.property("has-tooltip", has_tooltip),
1254        }
1255    }
1256
1257    /// Overrides for height request of the widget.
1258    ///
1259    /// If this is -1, the natural request will be used.
1260    pub fn height_request(self, height_request: i32) -> Self {
1261        Self {
1262            builder: self.builder.property("height-request", height_request),
1263        }
1264    }
1265
1266    /// Whether to expand horizontally.
1267    pub fn hexpand(self, hexpand: bool) -> Self {
1268        Self {
1269            builder: self.builder.property("hexpand", hexpand),
1270        }
1271    }
1272
1273    /// Whether to use the `hexpand` property.
1274    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1275        Self {
1276            builder: self.builder.property("hexpand-set", hexpand_set),
1277        }
1278    }
1279
1280    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1281    /// the preferred size of the widget, and allocate its children.
1282    ///
1283    /// This property is meant to be set by widget implementations,
1284    /// typically in their instance init function.
1285    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1286        Self {
1287            builder: self
1288                .builder
1289                .property("layout-manager", layout_manager.clone().upcast()),
1290        }
1291    }
1292
1293    /// Makes this widget act like a modal dialog, with respect to
1294    /// event delivery.
1295    ///
1296    /// Global event controllers will not handle events with targets
1297    /// inside the widget, unless they are set up to ignore propagation
1298    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1299    #[cfg(feature = "v4_18")]
1300    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1301    pub fn limit_events(self, limit_events: bool) -> Self {
1302        Self {
1303            builder: self.builder.property("limit-events", limit_events),
1304        }
1305    }
1306
1307    /// Margin on bottom side of widget.
1308    ///
1309    /// This property adds margin outside of the widget's normal size
1310    /// request, the margin will be added in addition to the size from
1311    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1312    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1313        Self {
1314            builder: self.builder.property("margin-bottom", margin_bottom),
1315        }
1316    }
1317
1318    /// Margin on end of widget, horizontally.
1319    ///
1320    /// This property supports left-to-right and right-to-left text
1321    /// directions.
1322    ///
1323    /// This property adds margin outside of the widget's normal size
1324    /// request, the margin will be added in addition to the size from
1325    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1326    pub fn margin_end(self, margin_end: i32) -> Self {
1327        Self {
1328            builder: self.builder.property("margin-end", margin_end),
1329        }
1330    }
1331
1332    /// Margin on start of widget, horizontally.
1333    ///
1334    /// This property supports left-to-right and right-to-left text
1335    /// directions.
1336    ///
1337    /// This property adds margin outside of the widget's normal size
1338    /// request, the margin will be added in addition to the size from
1339    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1340    pub fn margin_start(self, margin_start: i32) -> Self {
1341        Self {
1342            builder: self.builder.property("margin-start", margin_start),
1343        }
1344    }
1345
1346    /// Margin on top side of widget.
1347    ///
1348    /// This property adds margin outside of the widget's normal size
1349    /// request, the margin will be added in addition to the size from
1350    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1351    pub fn margin_top(self, margin_top: i32) -> Self {
1352        Self {
1353            builder: self.builder.property("margin-top", margin_top),
1354        }
1355    }
1356
1357    /// The name of the widget.
1358    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1359        Self {
1360            builder: self.builder.property("name", name.into()),
1361        }
1362    }
1363
1364    /// The requested opacity of the widget.
1365    pub fn opacity(self, opacity: f64) -> Self {
1366        Self {
1367            builder: self.builder.property("opacity", opacity),
1368        }
1369    }
1370
1371    /// How content outside the widget's content area is treated.
1372    ///
1373    /// This property is meant to be set by widget implementations,
1374    /// typically in their instance init function.
1375    pub fn overflow(self, overflow: Overflow) -> Self {
1376        Self {
1377            builder: self.builder.property("overflow", overflow),
1378        }
1379    }
1380
1381    /// Whether the widget will receive the default action when it is focused.
1382    pub fn receives_default(self, receives_default: bool) -> Self {
1383        Self {
1384            builder: self.builder.property("receives-default", receives_default),
1385        }
1386    }
1387
1388    /// Whether the widget responds to input.
1389    pub fn sensitive(self, sensitive: bool) -> Self {
1390        Self {
1391            builder: self.builder.property("sensitive", sensitive),
1392        }
1393    }
1394
1395    /// Sets the text of tooltip to be the given string, which is marked up
1396    /// with Pango markup.
1397    ///
1398    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1399    ///
1400    /// This is a convenience property which will take care of getting the
1401    /// tooltip shown if the given string is not `NULL`:
1402    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1403    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1404    /// the default signal handler.
1405    ///
1406    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1407    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1408    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1409        Self {
1410            builder: self
1411                .builder
1412                .property("tooltip-markup", tooltip_markup.into()),
1413        }
1414    }
1415
1416    /// Sets the text of tooltip to be the given string.
1417    ///
1418    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1419    ///
1420    /// This is a convenience property which will take care of getting the
1421    /// tooltip shown if the given string is not `NULL`:
1422    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1423    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1424    /// the default signal handler.
1425    ///
1426    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1427    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1428    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1429        Self {
1430            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1431        }
1432    }
1433
1434    /// How to distribute vertical space if widget gets extra space.
1435    pub fn valign(self, valign: Align) -> Self {
1436        Self {
1437            builder: self.builder.property("valign", valign),
1438        }
1439    }
1440
1441    /// Whether to expand vertically.
1442    pub fn vexpand(self, vexpand: bool) -> Self {
1443        Self {
1444            builder: self.builder.property("vexpand", vexpand),
1445        }
1446    }
1447
1448    /// Whether to use the `vexpand` property.
1449    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1450        Self {
1451            builder: self.builder.property("vexpand-set", vexpand_set),
1452        }
1453    }
1454
1455    /// Whether the widget is visible.
1456    pub fn visible(self, visible: bool) -> Self {
1457        Self {
1458            builder: self.builder.property("visible", visible),
1459        }
1460    }
1461
1462    /// Overrides for width request of the widget.
1463    ///
1464    /// If this is -1, the natural request will be used.
1465    pub fn width_request(self, width_request: i32) -> Self {
1466        Self {
1467            builder: self.builder.property("width-request", width_request),
1468        }
1469    }
1470
1471    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1472    ///
1473    /// The accessible role cannot be changed once set.
1474    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1475        Self {
1476            builder: self.builder.property("accessible-role", accessible_role),
1477        }
1478    }
1479
1480    // rustdoc-stripper-ignore-next
1481    /// Build the [`Window`].
1482    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1483    pub fn build(self) -> Window {
1484        assert_initialized_main_thread!();
1485        self.builder.build()
1486    }
1487}
1488
1489/// Trait containing all [`struct@Window`] methods.
1490///
1491/// # Implementors
1492///
1493/// [`AboutDialog`][struct@crate::AboutDialog], [`ApplicationWindow`][struct@crate::ApplicationWindow], [`Assistant`][struct@crate::Assistant], [`Dialog`][struct@crate::Dialog], [`ShortcutsWindow`][struct@crate::ShortcutsWindow], [`Window`][struct@crate::Window]
1494pub trait GtkWindowExt: IsA<Window> + 'static {
1495    /// Requests that the window is closed.
1496    ///
1497    /// This is similar to what happens when a window manager
1498    /// close button is clicked.
1499    ///
1500    /// This function can be used with close buttons in custom
1501    /// titlebars.
1502    #[doc(alias = "gtk_window_close")]
1503    fn close(&self) {
1504        unsafe {
1505            ffi::gtk_window_close(self.as_ref().to_glib_none().0);
1506        }
1507    }
1508
1509    #[doc(alias = "gtk_window_destroy")]
1510    fn destroy(&self) {
1511        unsafe {
1512            ffi::gtk_window_destroy(self.as_ref().to_glib_none().0);
1513        }
1514    }
1515
1516    /// Asks to place the window in the fullscreen state.
1517    ///
1518    /// Note that you shouldn’t assume the window is definitely fullscreen
1519    /// afterward, because other entities (e.g. the user or window manager)
1520    /// unfullscreen it again, and not all window managers honor requests
1521    /// to fullscreen windows.
1522    ///
1523    /// If a window is not explicitly fullscreened or unfullscreened before
1524    /// it is shown, the initial state is at the window managers discretion.
1525    ///
1526    /// You can track the result of this operation via the
1527    /// [`state`][struct@crate::Gdk::Toplevel#state] property, or by listening to
1528    /// notifications of the [`fullscreened`][struct@crate::Window#fullscreened] property.
1529    #[doc(alias = "gtk_window_fullscreen")]
1530    fn fullscreen(&self) {
1531        unsafe {
1532            ffi::gtk_window_fullscreen(self.as_ref().to_glib_none().0);
1533        }
1534    }
1535
1536    /// Asks to place the window in the fullscreen state on the given monitor.
1537    ///
1538    /// Note that you shouldn't assume the window is definitely fullscreen
1539    /// afterward, or that the windowing system allows fullscreen windows on
1540    /// any given monitor.
1541    ///
1542    /// You can track the result of this operation via the
1543    /// [`state`][struct@crate::Gdk::Toplevel#state] property, or by listening to
1544    /// notifications of the [`fullscreened`][struct@crate::Window#fullscreened] property.
1545    /// ## `monitor`
1546    /// which monitor to go fullscreen on
1547    #[doc(alias = "gtk_window_fullscreen_on_monitor")]
1548    fn fullscreen_on_monitor(&self, monitor: &gdk::Monitor) {
1549        unsafe {
1550            ffi::gtk_window_fullscreen_on_monitor(
1551                self.as_ref().to_glib_none().0,
1552                monitor.to_glib_none().0,
1553            );
1554        }
1555    }
1556
1557    /// Gets the application object associated with the window.
1558    ///
1559    /// # Returns
1560    ///
1561    /// the application
1562    #[doc(alias = "gtk_window_get_application")]
1563    #[doc(alias = "get_application")]
1564    fn application(&self) -> Option<Application> {
1565        unsafe {
1566            from_glib_none(ffi::gtk_window_get_application(
1567                self.as_ref().to_glib_none().0,
1568            ))
1569        }
1570    }
1571
1572    /// Gets the child widget of the window.
1573    ///
1574    /// # Returns
1575    ///
1576    /// the child widget of @self
1577    #[doc(alias = "gtk_window_get_child")]
1578    #[doc(alias = "get_child")]
1579    fn child(&self) -> Option<Widget> {
1580        unsafe { from_glib_none(ffi::gtk_window_get_child(self.as_ref().to_glib_none().0)) }
1581    }
1582
1583    /// Returns whether the window has been set to have decorations.
1584    ///
1585    /// # Returns
1586    ///
1587    /// true if the window has been set to have decorations
1588    #[doc(alias = "gtk_window_get_decorated")]
1589    #[doc(alias = "get_decorated")]
1590    #[doc(alias = "decorated")]
1591    fn is_decorated(&self) -> bool {
1592        unsafe {
1593            from_glib(ffi::gtk_window_get_decorated(
1594                self.as_ref().to_glib_none().0,
1595            ))
1596        }
1597    }
1598
1599    /// Gets the default size of the window.
1600    ///
1601    /// A value of 0 for the width or height indicates that a default
1602    /// size has not been explicitly set for that dimension, so the
1603    /// “natural” size of the window will be used.
1604    ///
1605    /// This function is the recommended way for [saving window state
1606    /// across restarts of applications](https://developer.gnome.org/documentation/tutorials/save-state.html).
1607    ///
1608    /// # Returns
1609    ///
1610    ///
1611    /// ## `width`
1612    /// location to store the default width
1613    ///
1614    /// ## `height`
1615    /// location to store the default height
1616    #[doc(alias = "gtk_window_get_default_size")]
1617    #[doc(alias = "get_default_size")]
1618    fn default_size(&self) -> (i32, i32) {
1619        unsafe {
1620            let mut width = std::mem::MaybeUninit::uninit();
1621            let mut height = std::mem::MaybeUninit::uninit();
1622            ffi::gtk_window_get_default_size(
1623                self.as_ref().to_glib_none().0,
1624                width.as_mut_ptr(),
1625                height.as_mut_ptr(),
1626            );
1627            (width.assume_init(), height.assume_init())
1628        }
1629    }
1630
1631    /// Returns the default widget for @self.
1632    ///
1633    /// # Returns
1634    ///
1635    /// the default widget
1636    #[doc(alias = "gtk_window_get_default_widget")]
1637    #[doc(alias = "get_default_widget")]
1638    #[doc(alias = "default-widget")]
1639    fn default_widget(&self) -> Option<Widget> {
1640        unsafe {
1641            from_glib_none(ffi::gtk_window_get_default_widget(
1642                self.as_ref().to_glib_none().0,
1643            ))
1644        }
1645    }
1646
1647    /// Returns whether the window has been set to have a close button.
1648    ///
1649    /// # Returns
1650    ///
1651    /// true if the window has been set to have a close button
1652    #[doc(alias = "gtk_window_get_deletable")]
1653    #[doc(alias = "get_deletable")]
1654    #[doc(alias = "deletable")]
1655    fn is_deletable(&self) -> bool {
1656        unsafe {
1657            from_glib(ffi::gtk_window_get_deletable(
1658                self.as_ref().to_glib_none().0,
1659            ))
1660        }
1661    }
1662
1663    /// Returns whether the window will be destroyed with its transient parent.
1664    ///
1665    /// # Returns
1666    ///
1667    /// true if the window will be destroyed with its transient parent
1668    #[doc(alias = "gtk_window_get_destroy_with_parent")]
1669    #[doc(alias = "get_destroy_with_parent")]
1670    #[doc(alias = "destroy-with-parent")]
1671    fn must_destroy_with_parent(&self) -> bool {
1672        unsafe {
1673            from_glib(ffi::gtk_window_get_destroy_with_parent(
1674                self.as_ref().to_glib_none().0,
1675            ))
1676        }
1677    }
1678
1679    /// Retrieves the current focused widget within the window.
1680    ///
1681    /// Note that this is the widget that would have the focus
1682    /// if the toplevel window focused; if the toplevel window
1683    /// is not focused then `gtk_widget_has_focus (widget)` will
1684    /// not be false for the widget.
1685    ///
1686    /// # Returns
1687    ///
1688    /// the currently focused widget
1689    #[doc(alias = "gtk_window_get_focus")]
1690    #[doc(alias = "get_focus")]
1691    #[doc(alias = "focus-widget")]
1692    fn focus(&self) -> Option<Widget> {
1693        unsafe { from_glib_none(ffi::gtk_window_get_focus(self.as_ref().to_glib_none().0)) }
1694    }
1695
1696    /// Gets whether “focus rectangles” are supposed to be visible.
1697    ///
1698    /// # Returns
1699    ///
1700    /// true if “focus rectangles” are supposed to be visible
1701    ///   in this window
1702    #[doc(alias = "gtk_window_get_focus_visible")]
1703    #[doc(alias = "get_focus_visible")]
1704    #[doc(alias = "focus-visible")]
1705    fn gets_focus_visible(&self) -> bool {
1706        unsafe {
1707            from_glib(ffi::gtk_window_get_focus_visible(
1708                self.as_ref().to_glib_none().0,
1709            ))
1710        }
1711    }
1712
1713    /// Returns the gravity that is used when changing the window size programmatically.
1714    ///
1715    /// # Returns
1716    ///
1717    /// the gravity
1718    #[cfg(feature = "v4_20")]
1719    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
1720    #[doc(alias = "gtk_window_get_gravity")]
1721    #[doc(alias = "get_gravity")]
1722    fn gravity(&self) -> WindowGravity {
1723        unsafe { from_glib(ffi::gtk_window_get_gravity(self.as_ref().to_glib_none().0)) }
1724    }
1725
1726    /// Returns the group for the window.
1727    ///
1728    /// If the window has no group, then the default group is returned.
1729    ///
1730    /// # Returns
1731    ///
1732    /// the window group for @self
1733    ///   or the default group
1734    #[doc(alias = "gtk_window_get_group")]
1735    #[doc(alias = "get_group")]
1736    fn group(&self) -> WindowGroup {
1737        unsafe { from_glib_none(ffi::gtk_window_get_group(self.as_ref().to_glib_none().0)) }
1738    }
1739
1740    /// Returns whether this window reacts to <kbd>F10</kbd>
1741    /// presses by activating a menubar it contains.
1742    ///
1743    /// # Returns
1744    ///
1745    /// true if the window handles <kbd>F10</kbd>
1746    #[cfg(feature = "v4_2")]
1747    #[cfg_attr(docsrs, doc(cfg(feature = "v4_2")))]
1748    #[doc(alias = "gtk_window_get_handle_menubar_accel")]
1749    #[doc(alias = "get_handle_menubar_accel")]
1750    #[doc(alias = "handle-menubar-accel")]
1751    fn is_handle_menubar_accel(&self) -> bool {
1752        unsafe {
1753            from_glib(ffi::gtk_window_get_handle_menubar_accel(
1754                self.as_ref().to_glib_none().0,
1755            ))
1756        }
1757    }
1758
1759    /// Returns whether the window will be hidden instead of destroyed when the close
1760    /// button is clicked.
1761    ///
1762    /// # Returns
1763    ///
1764    /// true if the window will be hidden
1765    #[doc(alias = "gtk_window_get_hide_on_close")]
1766    #[doc(alias = "get_hide_on_close")]
1767    #[doc(alias = "hide-on-close")]
1768    fn hides_on_close(&self) -> bool {
1769        unsafe {
1770            from_glib(ffi::gtk_window_get_hide_on_close(
1771                self.as_ref().to_glib_none().0,
1772            ))
1773        }
1774    }
1775
1776    /// Returns the name of the themed icon for the window.
1777    ///
1778    /// # Returns
1779    ///
1780    /// the icon name
1781    #[doc(alias = "gtk_window_get_icon_name")]
1782    #[doc(alias = "get_icon_name")]
1783    #[doc(alias = "icon-name")]
1784    fn icon_name(&self) -> Option<glib::GString> {
1785        unsafe {
1786            from_glib_none(ffi::gtk_window_get_icon_name(
1787                self.as_ref().to_glib_none().0,
1788            ))
1789        }
1790    }
1791
1792    /// Gets whether mnemonics are supposed to be visible.
1793    ///
1794    /// # Returns
1795    ///
1796    /// true if mnemonics are supposed to be visible
1797    ///   in this window
1798    #[doc(alias = "gtk_window_get_mnemonics_visible")]
1799    #[doc(alias = "get_mnemonics_visible")]
1800    #[doc(alias = "mnemonics-visible")]
1801    fn is_mnemonics_visible(&self) -> bool {
1802        unsafe {
1803            from_glib(ffi::gtk_window_get_mnemonics_visible(
1804                self.as_ref().to_glib_none().0,
1805            ))
1806        }
1807    }
1808
1809    /// Returns whether the window is modal.
1810    ///
1811    /// # Returns
1812    ///
1813    /// true if the window is set to be modal and
1814    ///   establishes a grab when shown
1815    #[doc(alias = "gtk_window_get_modal")]
1816    #[doc(alias = "get_modal")]
1817    #[doc(alias = "modal")]
1818    fn is_modal(&self) -> bool {
1819        unsafe { from_glib(ffi::gtk_window_get_modal(self.as_ref().to_glib_none().0)) }
1820    }
1821
1822    /// Gets whether the user can resize the window.
1823    ///
1824    /// # Returns
1825    ///
1826    /// true if the user can resize the window
1827    #[doc(alias = "gtk_window_get_resizable")]
1828    #[doc(alias = "get_resizable")]
1829    #[doc(alias = "resizable")]
1830    fn is_resizable(&self) -> bool {
1831        unsafe {
1832            from_glib(ffi::gtk_window_get_resizable(
1833                self.as_ref().to_glib_none().0,
1834            ))
1835        }
1836    }
1837
1838    /// Retrieves the title of the window.
1839    ///
1840    /// # Returns
1841    ///
1842    /// the title
1843    #[doc(alias = "gtk_window_get_title")]
1844    #[doc(alias = "get_title")]
1845    fn title(&self) -> Option<glib::GString> {
1846        unsafe { from_glib_none(ffi::gtk_window_get_title(self.as_ref().to_glib_none().0)) }
1847    }
1848
1849    /// Returns the titlebar that has been set with
1850    /// [`set_titlebar()`][Self::set_titlebar()].
1851    ///
1852    /// # Returns
1853    ///
1854    /// the titlebar
1855    #[doc(alias = "gtk_window_get_titlebar")]
1856    #[doc(alias = "get_titlebar")]
1857    fn titlebar(&self) -> Option<Widget> {
1858        unsafe { from_glib_none(ffi::gtk_window_get_titlebar(self.as_ref().to_glib_none().0)) }
1859    }
1860
1861    /// Fetches the transient parent for this window.
1862    ///
1863    /// # Returns
1864    ///
1865    /// the transient parent
1866    #[doc(alias = "gtk_window_get_transient_for")]
1867    #[doc(alias = "get_transient_for")]
1868    #[doc(alias = "transient-for")]
1869    #[must_use]
1870    fn transient_for(&self) -> Option<Window> {
1871        unsafe {
1872            from_glib_none(ffi::gtk_window_get_transient_for(
1873                self.as_ref().to_glib_none().0,
1874            ))
1875        }
1876    }
1877
1878    /// Returns whether the window has an explicit window group.
1879    ///
1880    /// # Returns
1881    ///
1882    /// true if @self has an explicit window group
1883    #[doc(alias = "gtk_window_has_group")]
1884    fn has_group(&self) -> bool {
1885        unsafe { from_glib(ffi::gtk_window_has_group(self.as_ref().to_glib_none().0)) }
1886    }
1887
1888    /// Returns whether the window is part of the current active toplevel.
1889    ///
1890    /// The active toplevel is the window receiving keystrokes.
1891    ///
1892    /// The return value is [`true`] if the window is active toplevel itself.
1893    /// You might use this function if you wanted to draw a widget
1894    /// differently in an active window from a widget in an inactive window.
1895    ///
1896    /// # Returns
1897    ///
1898    /// true if the window part of the current active window.
1899    #[doc(alias = "gtk_window_is_active")]
1900    #[doc(alias = "is-active")]
1901    fn is_active(&self) -> bool {
1902        unsafe { from_glib(ffi::gtk_window_is_active(self.as_ref().to_glib_none().0)) }
1903    }
1904
1905    /// Retrieves the current fullscreen state of the window.
1906    ///
1907    /// Note that since fullscreening is ultimately handled by the window
1908    /// manager and happens asynchronously to an application request, you
1909    /// shouldn’t assume the return value of this function changing
1910    /// immediately (or at all), as an effect of calling
1911    /// [`fullscreen()`][Self::fullscreen()] or [`unfullscreen()`][Self::unfullscreen()].
1912    ///
1913    /// If the window isn't yet mapped, the value returned will whether the
1914    /// initial requested state is fullscreen.
1915    ///
1916    /// # Returns
1917    ///
1918    /// whether the window is fullscreen
1919    #[doc(alias = "gtk_window_is_fullscreen")]
1920    #[doc(alias = "fullscreened")]
1921    fn is_fullscreen(&self) -> bool {
1922        unsafe {
1923            from_glib(ffi::gtk_window_is_fullscreen(
1924                self.as_ref().to_glib_none().0,
1925            ))
1926        }
1927    }
1928
1929    /// Retrieves the current maximized state of the window.
1930    ///
1931    /// Note that since maximization is ultimately handled by the window
1932    /// manager and happens asynchronously to an application request, you
1933    /// shouldn’t assume the return value of this function changing
1934    /// immediately (or at all), as an effect of calling
1935    /// [`maximize()`][Self::maximize()] or [`unmaximize()`][Self::unmaximize()].
1936    ///
1937    /// If the window isn't yet mapped, the value returned will whether the
1938    /// initial requested state is maximized.
1939    ///
1940    /// # Returns
1941    ///
1942    /// whether the window is maximized
1943    #[doc(alias = "gtk_window_is_maximized")]
1944    #[doc(alias = "maximized")]
1945    fn is_maximized(&self) -> bool {
1946        unsafe { from_glib(ffi::gtk_window_is_maximized(self.as_ref().to_glib_none().0)) }
1947    }
1948
1949    /// Retrieves the current suspended state of the window.
1950    ///
1951    /// A window being suspended means it's currently not visible
1952    /// to the user, for example by being on a inactive workspace,
1953    /// minimized, obstructed.
1954    ///
1955    /// # Returns
1956    ///
1957    /// whether the window is suspended
1958    #[cfg(feature = "v4_12")]
1959    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
1960    #[doc(alias = "gtk_window_is_suspended")]
1961    #[doc(alias = "suspended")]
1962    fn is_suspended(&self) -> bool {
1963        unsafe { from_glib(ffi::gtk_window_is_suspended(self.as_ref().to_glib_none().0)) }
1964    }
1965
1966    /// Asks to maximize the window, so that it fills the screen.
1967    ///
1968    /// Note that you shouldn’t assume the window is definitely maximized
1969    /// afterward, because other entities (e.g. the user or window manager)
1970    /// could unmaximize it again, and not all window managers support
1971    /// maximization.
1972    ///
1973    /// It’s permitted to call this function before showing a window,
1974    /// in which case the window will be maximized when it appears onscreen
1975    /// initially.
1976    ///
1977    /// If a window is not explicitly maximized or unmaximized before it is
1978    /// shown, the initial state is at the window managers discretion. For
1979    /// example, it might decide to maximize a window that almost fills the
1980    /// screen.
1981    ///
1982    /// You can track the result of this operation via the
1983    /// [`state`][struct@crate::Gdk::Toplevel#state] property, or by listening to
1984    /// notifications on the [`maximized`][struct@crate::Window#maximized]
1985    /// property.
1986    #[doc(alias = "gtk_window_maximize")]
1987    fn maximize(&self) {
1988        unsafe {
1989            ffi::gtk_window_maximize(self.as_ref().to_glib_none().0);
1990        }
1991    }
1992
1993    /// Asks to minimize the window.
1994    ///
1995    /// Note that you shouldn’t assume the window is definitely minimized
1996    /// afterward, because the windowing system might not support this
1997    /// functionality; other entities (e.g. the user or the window manager)
1998    /// could unminimize it again, or there may not be a window manager in
1999    /// which case minimization isn’t possible, etc.
2000    ///
2001    /// It’s permitted to call this function before showing a window,
2002    /// in which case the window will be minimized before it ever appears
2003    /// onscreen.
2004    ///
2005    /// You can track result of this operation via the
2006    /// [`state`][struct@crate::Gdk::Toplevel#state] property.
2007    #[doc(alias = "gtk_window_minimize")]
2008    fn minimize(&self) {
2009        unsafe {
2010            ffi::gtk_window_minimize(self.as_ref().to_glib_none().0);
2011        }
2012    }
2013
2014    /// Presents a window to the user.
2015    ///
2016    /// This may mean raising the window in the stacking order,
2017    /// unminimizing it, moving it to the current desktop and/or
2018    /// giving it the keyboard focus (possibly dependent on the user’s
2019    /// platform, window manager and preferences).
2020    ///
2021    /// If @self is hidden, this function also makes it visible.
2022    #[doc(alias = "gtk_window_present")]
2023    fn present(&self) {
2024        unsafe {
2025            ffi::gtk_window_present(self.as_ref().to_glib_none().0);
2026        }
2027    }
2028
2029    /// Presents a window to the user in response to an user interaction.
2030    ///
2031    /// See [`present()`][Self::present()] for more details.
2032    ///
2033    /// The timestamp should be gathered when the window was requested
2034    /// to be shown (when clicking a link for example), rather than once
2035    /// the window is ready to be shown.
2036    ///
2037    /// # Deprecated since 4.14
2038    ///
2039    /// Use [`present()`][Self::present()]
2040    /// ## `timestamp`
2041    /// the timestamp of the user interaction (typically a
2042    ///   button or key press event) which triggered this call
2043    #[cfg_attr(feature = "v4_14", deprecated = "Since 4.14")]
2044    #[allow(deprecated)]
2045    #[doc(alias = "gtk_window_present_with_time")]
2046    fn present_with_time(&self, timestamp: u32) {
2047        unsafe {
2048            ffi::gtk_window_present_with_time(self.as_ref().to_glib_none().0, timestamp);
2049        }
2050    }
2051
2052    /// Sets or unsets the application object associated with the window.
2053    ///
2054    /// The application will be kept alive for at least as long as it has
2055    /// any windows associated with it (see `Gio::Application::hold()`
2056    /// for a way to keep it alive without windows).
2057    ///
2058    /// Normally, the connection between the application and the window will
2059    /// remain until the window is destroyed, but you can explicitly remove
2060    /// it by setting the @application to [`None`].
2061    ///
2062    /// This is equivalent to calling [`GtkApplicationExt::remove_window()`][crate::prelude::GtkApplicationExt::remove_window()]
2063    /// and/or [`GtkApplicationExt::add_window()`][crate::prelude::GtkApplicationExt::add_window()] on the old/new applications
2064    /// as relevant.
2065    /// ## `application`
2066    /// a [`Application`][crate::Application]
2067    #[doc(alias = "gtk_window_set_application")]
2068    #[doc(alias = "application")]
2069    fn set_application(&self, application: Option<&impl IsA<Application>>) {
2070        unsafe {
2071            ffi::gtk_window_set_application(
2072                self.as_ref().to_glib_none().0,
2073                application.map(|p| p.as_ref()).to_glib_none().0,
2074            );
2075        }
2076    }
2077
2078    /// Sets the child widget of the window.
2079    /// ## `child`
2080    /// the child widget
2081    #[doc(alias = "gtk_window_set_child")]
2082    #[doc(alias = "child")]
2083    fn set_child(&self, child: Option<&impl IsA<Widget>>) {
2084        unsafe {
2085            ffi::gtk_window_set_child(
2086                self.as_ref().to_glib_none().0,
2087                child.map(|p| p.as_ref()).to_glib_none().0,
2088            );
2089        }
2090    }
2091
2092    /// Sets whether the window should be decorated.
2093    ///
2094    /// By default, windows are decorated with a title bar, resize
2095    /// controls, etc. Some window managers allow GTK to disable these
2096    /// decorations, creating a borderless window. If you set the decorated
2097    /// property to false using this function, GTK will do its best to
2098    /// convince the window manager not to decorate the window. Depending on
2099    /// the system, this function may not have any effect when called on a
2100    /// window that is already visible, so you should call it before calling
2101    /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
2102    ///
2103    /// On Windows, this function always works, since there’s no window manager
2104    /// policy involved.
2105    /// ## `setting`
2106    /// true to decorate the window
2107    #[doc(alias = "gtk_window_set_decorated")]
2108    #[doc(alias = "decorated")]
2109    fn set_decorated(&self, setting: bool) {
2110        unsafe {
2111            ffi::gtk_window_set_decorated(self.as_ref().to_glib_none().0, setting.into_glib());
2112        }
2113    }
2114
2115    /// Sets the default size of a window.
2116    ///
2117    /// The default size of a window is the size that will be used
2118    /// if no other constraints apply.
2119    ///
2120    /// The default size will be updated whenever the window is resized
2121    /// to reflect the new size, unless the window is forced to a size,
2122    /// like when it is maximized or fullscreened.
2123    ///
2124    /// If the window’s minimum size request is larger than
2125    /// the default, the default will be ignored.
2126    ///
2127    /// Setting the default size to a value <= 0 will cause it to be
2128    /// ignored and the natural size request will be used instead. It
2129    /// is possible to do this while the window is showing to "reset"
2130    /// it to its initial size.
2131    ///
2132    /// Unlike [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()], which sets a size
2133    /// request for a widget and thus would keep users from shrinking
2134    /// the window, this function only sets the initial size, just as
2135    /// if the user had resized the window themselves. Users can still
2136    /// shrink the window again as they normally would. Setting a default
2137    /// size of -1 means to use the “natural” default size (the size request
2138    /// of the window).
2139    ///
2140    /// If you use this function to reestablish a previously saved window size,
2141    /// note that the appropriate size to save is the one returned by
2142    /// [`default_size()`][Self::default_size()]. Using the window allocation
2143    /// directly will not work in all circumstances and can lead to growing
2144    /// or shrinking windows.
2145    /// ## `width`
2146    /// width in pixels, or -1 to unset the default width
2147    /// ## `height`
2148    /// height in pixels, or -1 to unset the default height
2149    #[doc(alias = "gtk_window_set_default_size")]
2150    fn set_default_size(&self, width: i32, height: i32) {
2151        unsafe {
2152            ffi::gtk_window_set_default_size(self.as_ref().to_glib_none().0, width, height);
2153        }
2154    }
2155
2156    /// Sets the default widget.
2157    ///
2158    /// The default widget is the widget that is activated
2159    /// when the user presses <kbd>Enter</kbd> in a dialog
2160    /// (for example).
2161    /// ## `default_widget`
2162    /// widget to be the default
2163    #[doc(alias = "gtk_window_set_default_widget")]
2164    #[doc(alias = "default-widget")]
2165    fn set_default_widget(&self, default_widget: Option<&impl IsA<Widget>>) {
2166        unsafe {
2167            ffi::gtk_window_set_default_widget(
2168                self.as_ref().to_glib_none().0,
2169                default_widget.map(|p| p.as_ref()).to_glib_none().0,
2170            );
2171        }
2172    }
2173
2174    /// Sets whether the window should be deletable.
2175    ///
2176    /// By default, windows have a close button in the window frame.
2177    /// Some  window managers allow GTK to disable this button. If you
2178    /// set the deletable property to false using this function, GTK
2179    /// will do its best to convince the window manager not to show a
2180    /// close button. Depending on the system, this function may not
2181    /// have any effect when called on a window that is already visible,
2182    /// so you should call it before calling [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
2183    ///
2184    /// On Windows, this function always works, since there’s no window
2185    /// manager policy involved.
2186    /// ## `setting`
2187    /// true to decorate the window as deletable
2188    #[doc(alias = "gtk_window_set_deletable")]
2189    #[doc(alias = "deletable")]
2190    fn set_deletable(&self, setting: bool) {
2191        unsafe {
2192            ffi::gtk_window_set_deletable(self.as_ref().to_glib_none().0, setting.into_glib());
2193        }
2194    }
2195
2196    /// Sets whether to destroy the window when the transient parent is destroyed.
2197    ///
2198    /// This is useful for dialogs that shouldn’t persist beyond the lifetime
2199    /// of the main window they are associated with, for example.
2200    /// ## `setting`
2201    /// whether to destroy the window with its transient parent
2202    #[doc(alias = "gtk_window_set_destroy_with_parent")]
2203    #[doc(alias = "destroy-with-parent")]
2204    fn set_destroy_with_parent(&self, setting: bool) {
2205        unsafe {
2206            ffi::gtk_window_set_destroy_with_parent(
2207                self.as_ref().to_glib_none().0,
2208                setting.into_glib(),
2209            );
2210        }
2211    }
2212
2213    /// Sets the display where the window is displayed.
2214    ///
2215    /// If the window is already mapped, it will be unmapped,
2216    /// and then remapped on the new display.
2217    /// ## `display`
2218    /// a display
2219    #[doc(alias = "gtk_window_set_display")]
2220    #[doc(alias = "display")]
2221    fn set_display(&self, display: &impl IsA<gdk::Display>) {
2222        unsafe {
2223            ffi::gtk_window_set_display(
2224                self.as_ref().to_glib_none().0,
2225                display.as_ref().to_glib_none().0,
2226            );
2227        }
2228    }
2229
2230    /// Sets the focus widget.
2231    ///
2232    /// If @focus is not the current focus widget, and is focusable,
2233    /// sets it as the focus widget for the window. If @focus is [`None`],
2234    /// unsets the focus widget for this window. To set the focus to a
2235    /// particular widget in the toplevel, it is usually more convenient
2236    /// to use [`WidgetExt::grab_focus()`][crate::prelude::WidgetExt::grab_focus()] instead of this function.
2237    /// ## `focus`
2238    /// the new focus widget
2239    #[doc(alias = "gtk_window_set_focus")]
2240    #[doc(alias = "focus-widget")]
2241    fn set_focus(&self, focus: Option<&impl IsA<Widget>>) {
2242        unsafe {
2243            ffi::gtk_window_set_focus(
2244                self.as_ref().to_glib_none().0,
2245                focus.map(|p| p.as_ref()).to_glib_none().0,
2246            );
2247        }
2248    }
2249
2250    /// Sets whether “focus rectangles” are supposed to be visible.
2251    ///
2252    /// This property is maintained by GTK based on user input,
2253    /// and should not be set by applications.
2254    /// ## `setting`
2255    /// the new value
2256    #[doc(alias = "gtk_window_set_focus_visible")]
2257    #[doc(alias = "focus-visible")]
2258    fn set_focus_visible(&self, setting: bool) {
2259        unsafe {
2260            ffi::gtk_window_set_focus_visible(self.as_ref().to_glib_none().0, setting.into_glib());
2261        }
2262    }
2263
2264    /// Sets the gravity that is used when changing the window size programmatically.
2265    /// ## `gravity`
2266    /// the new gravity
2267    #[cfg(feature = "v4_20")]
2268    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
2269    #[doc(alias = "gtk_window_set_gravity")]
2270    #[doc(alias = "gravity")]
2271    fn set_gravity(&self, gravity: WindowGravity) {
2272        unsafe {
2273            ffi::gtk_window_set_gravity(self.as_ref().to_glib_none().0, gravity.into_glib());
2274        }
2275    }
2276
2277    /// Sets whether this window should react to <kbd>F10</kbd>
2278    /// presses by activating a menubar it contains.
2279    /// ## `handle_menubar_accel`
2280    /// true to make @self handle <kbd>F10</kbd>
2281    #[cfg(feature = "v4_2")]
2282    #[cfg_attr(docsrs, doc(cfg(feature = "v4_2")))]
2283    #[doc(alias = "gtk_window_set_handle_menubar_accel")]
2284    #[doc(alias = "handle-menubar-accel")]
2285    fn set_handle_menubar_accel(&self, handle_menubar_accel: bool) {
2286        unsafe {
2287            ffi::gtk_window_set_handle_menubar_accel(
2288                self.as_ref().to_glib_none().0,
2289                handle_menubar_accel.into_glib(),
2290            );
2291        }
2292    }
2293
2294    /// Sets whether clicking the close button will hide the window instead
2295    /// of destroying it.
2296    /// ## `setting`
2297    /// whether to hide the window when it is closed
2298    #[doc(alias = "gtk_window_set_hide_on_close")]
2299    #[doc(alias = "hide-on-close")]
2300    fn set_hide_on_close(&self, setting: bool) {
2301        unsafe {
2302            ffi::gtk_window_set_hide_on_close(self.as_ref().to_glib_none().0, setting.into_glib());
2303        }
2304    }
2305
2306    /// Sets the icon for the window from a named themed icon.
2307    ///
2308    /// See the docs for [`IconTheme`][crate::IconTheme] for more details.
2309    /// On some platforms, the window icon is not used at all.
2310    ///
2311    /// Note that this has nothing to do with the WM_ICON_NAME
2312    /// property which is mentioned in the ICCCM.
2313    /// ## `name`
2314    /// the name of the themed icon
2315    #[doc(alias = "gtk_window_set_icon_name")]
2316    #[doc(alias = "icon-name")]
2317    fn set_icon_name(&self, name: Option<&str>) {
2318        unsafe {
2319            ffi::gtk_window_set_icon_name(self.as_ref().to_glib_none().0, name.to_glib_none().0);
2320        }
2321    }
2322
2323    /// Sets whether mnemonics are supposed to be visible.
2324    ///
2325    /// This property is maintained by GTK based on user input,
2326    /// and should not be set by applications.
2327    /// ## `setting`
2328    /// the new value
2329    #[doc(alias = "gtk_window_set_mnemonics_visible")]
2330    #[doc(alias = "mnemonics-visible")]
2331    fn set_mnemonics_visible(&self, setting: bool) {
2332        unsafe {
2333            ffi::gtk_window_set_mnemonics_visible(
2334                self.as_ref().to_glib_none().0,
2335                setting.into_glib(),
2336            );
2337        }
2338    }
2339
2340    /// Sets a window modal or non-modal.
2341    ///
2342    /// Modal windows prevent interaction with other windows in the same
2343    /// application. To keep modal dialogs on top of main application windows,
2344    /// use [`set_transient_for()`][Self::set_transient_for()] to make the dialog transient
2345    /// for the parent; most window managers will then disallow lowering the
2346    /// dialog below the parent.
2347    /// ## `modal`
2348    /// whether the window is modal
2349    #[doc(alias = "gtk_window_set_modal")]
2350    #[doc(alias = "modal")]
2351    fn set_modal(&self, modal: bool) {
2352        unsafe {
2353            ffi::gtk_window_set_modal(self.as_ref().to_glib_none().0, modal.into_glib());
2354        }
2355    }
2356
2357    /// Sets whether the user can resize a window.
2358    ///
2359    /// Windows are user resizable by default.
2360    /// ## `resizable`
2361    /// true if the user can resize this window
2362    #[doc(alias = "gtk_window_set_resizable")]
2363    #[doc(alias = "resizable")]
2364    fn set_resizable(&self, resizable: bool) {
2365        unsafe {
2366            ffi::gtk_window_set_resizable(self.as_ref().to_glib_none().0, resizable.into_glib());
2367        }
2368    }
2369
2370    /// Sets the startup notification ID.
2371    ///
2372    /// Startup notification identifiers are used by desktop environment
2373    /// to track application startup, to provide user feedback and other
2374    /// features. This function changes the corresponding property on the
2375    /// underlying [`gdk::Surface`][crate::gdk::Surface].
2376    ///
2377    /// Normally, startup identifier is managed automatically and you should
2378    /// only use this function in special cases like transferring focus from
2379    /// other processes. You should use this function before calling
2380    /// [`present()`][Self::present()] or any equivalent function generating
2381    /// a window map event.
2382    ///
2383    /// This function is only useful on Wayland or X11, not with other GDK
2384    /// backends.
2385    /// ## `startup_id`
2386    /// a string with startup-notification identifier
2387    #[doc(alias = "gtk_window_set_startup_id")]
2388    #[doc(alias = "startup-id")]
2389    fn set_startup_id(&self, startup_id: &str) {
2390        unsafe {
2391            ffi::gtk_window_set_startup_id(
2392                self.as_ref().to_glib_none().0,
2393                startup_id.to_glib_none().0,
2394            );
2395        }
2396    }
2397
2398    /// Sets the title of the window.
2399    ///
2400    /// The title of a window will be displayed in its title bar; on the
2401    /// X Window System, the title bar is rendered by the window manager
2402    /// so exactly how the title appears to users may vary according to a
2403    /// user’s exact configuration. The title should help a user distinguish
2404    /// this window from other windows they may have open. A good title might
2405    /// include the application name and current document filename, for example.
2406    ///
2407    /// Passing `NULL` does the same as setting the title to an empty string.
2408    /// ## `title`
2409    /// title of the window
2410    #[doc(alias = "gtk_window_set_title")]
2411    #[doc(alias = "title")]
2412    fn set_title(&self, title: Option<&str>) {
2413        unsafe {
2414            ffi::gtk_window_set_title(self.as_ref().to_glib_none().0, title.to_glib_none().0);
2415        }
2416    }
2417
2418    /// Sets a custom titlebar for the window.
2419    ///
2420    /// A typical widget used here is [`HeaderBar`][crate::HeaderBar], as it
2421    /// provides various features expected of a titlebar while allowing
2422    /// the addition of child widgets to it.
2423    ///
2424    /// If you set a custom titlebar, GTK will do its best to convince
2425    /// the window manager not to put its own titlebar on the window.
2426    /// Depending on the system, this function may not work for a window
2427    /// that is already visible, so you set the titlebar before calling
2428    /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
2429    /// ## `titlebar`
2430    /// the widget to use as titlebar
2431    #[doc(alias = "gtk_window_set_titlebar")]
2432    #[doc(alias = "titlebar")]
2433    fn set_titlebar(&self, titlebar: Option<&impl IsA<Widget>>) {
2434        unsafe {
2435            ffi::gtk_window_set_titlebar(
2436                self.as_ref().to_glib_none().0,
2437                titlebar.map(|p| p.as_ref()).to_glib_none().0,
2438            );
2439        }
2440    }
2441
2442    /// Sets a transient parent for the window.
2443    ///
2444    /// Dialog windows should be set transient for the main application
2445    /// window they were spawned from. This allows window managers to e.g.
2446    /// keep the dialog on top of the main window, or center the dialog
2447    /// over the main window. [`Dialog::with_buttons()`][crate::Dialog::with_buttons()] and other
2448    /// convenience functions in GTK will sometimes call this function on
2449    /// your behalf.
2450    ///
2451    /// Passing `NULL` for @parent unsets the current transient window.
2452    ///
2453    /// On Windows, this function puts the child window on top of the parent,
2454    /// much as the window manager would have done on X.
2455    /// ## `parent`
2456    /// parent window
2457    #[doc(alias = "gtk_window_set_transient_for")]
2458    #[doc(alias = "transient-for")]
2459    fn set_transient_for(&self, parent: Option<&impl IsA<Window>>) {
2460        unsafe {
2461            ffi::gtk_window_set_transient_for(
2462                self.as_ref().to_glib_none().0,
2463                parent.map(|p| p.as_ref()).to_glib_none().0,
2464            );
2465        }
2466    }
2467
2468    /// Asks to remove the fullscreen state for the window, and return to
2469    /// its previous state.
2470    ///
2471    /// Note that you shouldn’t assume the window is definitely not
2472    /// fullscreen afterward, because other entities (e.g. the user or
2473    /// window manager) could fullscreen it again, and not all window
2474    /// managers honor requests to unfullscreen windows; normally the
2475    /// window will end up restored to its normal state. Just don’t
2476    /// write code that crashes if not.
2477    ///
2478    /// If a window is not explicitly fullscreened or unfullscreened before
2479    /// it is shown, the initial state is at the window managers discretion.
2480    ///
2481    /// You can track the result of this operation via the
2482    /// [`state`][struct@crate::Gdk::Toplevel#state] property, or by listening to
2483    /// notifications of the [`fullscreened`][struct@crate::Window#fullscreened] property.
2484    #[doc(alias = "gtk_window_unfullscreen")]
2485    fn unfullscreen(&self) {
2486        unsafe {
2487            ffi::gtk_window_unfullscreen(self.as_ref().to_glib_none().0);
2488        }
2489    }
2490
2491    /// Asks to unmaximize the window.
2492    ///
2493    /// Note that you shouldn’t assume the window is definitely unmaximized
2494    /// afterward, because other entities (e.g. the user or window manager)
2495    /// maximize it again, and not all window managers honor requests to
2496    /// unmaximize.
2497    ///
2498    /// If a window is not explicitly maximized or unmaximized before it is
2499    /// shown, the initial state is at the window managers discretion. For
2500    /// example, it might decide to maximize a window that almost fills the
2501    /// screen.
2502    ///
2503    /// You can track the result of this operation via the
2504    /// [`state`][struct@crate::Gdk::Toplevel#state] property, or by listening to
2505    /// notifications on the [`maximized`][struct@crate::Window#maximized] property.
2506    #[doc(alias = "gtk_window_unmaximize")]
2507    fn unmaximize(&self) {
2508        unsafe {
2509            ffi::gtk_window_unmaximize(self.as_ref().to_glib_none().0);
2510        }
2511    }
2512
2513    /// Asks to unminimize the window.
2514    ///
2515    /// Note that you shouldn’t assume the window is definitely unminimized
2516    /// afterward, because the windowing system might not support this
2517    /// functionality; other entities (e.g. the user or the window manager)
2518    /// could minimize it again, or there may not be a window manager in
2519    /// which case minimization isn’t possible, etc.
2520    ///
2521    /// You can track result of this operation via the
2522    /// [`state`][struct@crate::Gdk::Toplevel#state] property.
2523    #[doc(alias = "gtk_window_unminimize")]
2524    fn unminimize(&self) {
2525        unsafe {
2526            ffi::gtk_window_unminimize(self.as_ref().to_glib_none().0);
2527        }
2528    }
2529
2530    /// The default height of the window.
2531    #[doc(alias = "default-height")]
2532    fn default_height(&self) -> i32 {
2533        ObjectExt::property(self.as_ref(), "default-height")
2534    }
2535
2536    /// The default height of the window.
2537    #[doc(alias = "default-height")]
2538    fn set_default_height(&self, default_height: i32) {
2539        ObjectExt::set_property(self.as_ref(), "default-height", default_height)
2540    }
2541
2542    /// The default width of the window.
2543    #[doc(alias = "default-width")]
2544    fn default_width(&self) -> i32 {
2545        ObjectExt::property(self.as_ref(), "default-width")
2546    }
2547
2548    /// The default width of the window.
2549    #[doc(alias = "default-width")]
2550    fn set_default_width(&self, default_width: i32) {
2551        ObjectExt::set_property(self.as_ref(), "default-width", default_width)
2552    }
2553
2554    /// Whether the window is fullscreen.
2555    ///
2556    /// Setting this property is the equivalent of calling
2557    /// [`fullscreen()`][Self::fullscreen()] or [`unfullscreen()`][Self::unfullscreen()];
2558    /// either operation is asynchronous, which means you will need to
2559    /// connect to the ::notify signal in order to know whether the
2560    /// operation was successful.
2561    fn set_fullscreened(&self, fullscreened: bool) {
2562        ObjectExt::set_property(self.as_ref(), "fullscreened", fullscreened)
2563    }
2564
2565    /// Whether the window is maximized.
2566    ///
2567    /// Setting this property is the equivalent of calling
2568    /// [`maximize()`][Self::maximize()] or [`unmaximize()`][Self::unmaximize()];
2569    /// either operation is asynchronous, which means you will need to
2570    /// connect to the ::notify signal in order to know whether the
2571    /// operation was successful.
2572    fn set_maximized(&self, maximized: bool) {
2573        ObjectExt::set_property(self.as_ref(), "maximized", maximized)
2574    }
2575
2576    /// Emitted when the user activates the default widget.
2577    ///
2578    /// This is a [keybinding signal](class.SignalAction.html).
2579    ///
2580    /// The keybindings for this signal are all forms of the <kbd>Enter</kbd> key.
2581    #[doc(alias = "activate-default")]
2582    fn connect_activate_default<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2583        unsafe extern "C" fn activate_default_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
2584            this: *mut ffi::GtkWindow,
2585            f: glib::ffi::gpointer,
2586        ) {
2587            unsafe {
2588                let f: &F = &*(f as *const F);
2589                f(Window::from_glib_borrow(this).unsafe_cast_ref())
2590            }
2591        }
2592        unsafe {
2593            let f: Box_<F> = Box_::new(f);
2594            connect_raw(
2595                self.as_ptr() as *mut _,
2596                c"activate-default".as_ptr(),
2597                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2598                    activate_default_trampoline::<Self, F> as *const (),
2599                )),
2600                Box_::into_raw(f),
2601            )
2602        }
2603    }
2604
2605    fn emit_activate_default(&self) {
2606        self.emit_by_name::<()>("activate-default", &[]);
2607    }
2608
2609    /// Emitted when the user activates the currently focused
2610    /// widget of @window.
2611    ///
2612    /// This is a [keybinding signal](class.SignalAction.html).
2613    ///
2614    /// The default binding for this signal is <kbd>␣</kbd>.
2615    #[doc(alias = "activate-focus")]
2616    fn connect_activate_focus<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2617        unsafe extern "C" fn activate_focus_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
2618            this: *mut ffi::GtkWindow,
2619            f: glib::ffi::gpointer,
2620        ) {
2621            unsafe {
2622                let f: &F = &*(f as *const F);
2623                f(Window::from_glib_borrow(this).unsafe_cast_ref())
2624            }
2625        }
2626        unsafe {
2627            let f: Box_<F> = Box_::new(f);
2628            connect_raw(
2629                self.as_ptr() as *mut _,
2630                c"activate-focus".as_ptr(),
2631                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2632                    activate_focus_trampoline::<Self, F> as *const (),
2633                )),
2634                Box_::into_raw(f),
2635            )
2636        }
2637    }
2638
2639    fn emit_activate_focus(&self) {
2640        self.emit_by_name::<()>("activate-focus", &[]);
2641    }
2642
2643    /// Emitted when the user clicks on the close button of the window.
2644    ///
2645    /// # Returns
2646    ///
2647    /// true to stop other handlers from being invoked for the signal
2648    #[doc(alias = "close-request")]
2649    fn connect_close_request<F: Fn(&Self) -> glib::Propagation + 'static>(
2650        &self,
2651        f: F,
2652    ) -> SignalHandlerId {
2653        unsafe extern "C" fn close_request_trampoline<
2654            P: IsA<Window>,
2655            F: Fn(&P) -> glib::Propagation + 'static,
2656        >(
2657            this: *mut ffi::GtkWindow,
2658            f: glib::ffi::gpointer,
2659        ) -> glib::ffi::gboolean {
2660            unsafe {
2661                let f: &F = &*(f as *const F);
2662                f(Window::from_glib_borrow(this).unsafe_cast_ref()).into_glib()
2663            }
2664        }
2665        unsafe {
2666            let f: Box_<F> = Box_::new(f);
2667            connect_raw(
2668                self.as_ptr() as *mut _,
2669                c"close-request".as_ptr(),
2670                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2671                    close_request_trampoline::<Self, F> as *const (),
2672                )),
2673                Box_::into_raw(f),
2674            )
2675        }
2676    }
2677
2678    /// Emitted when the user enables or disables interactive debugging.
2679    ///
2680    /// When @toggle is true, interactive debugging is toggled on or off,
2681    /// when it is false, the debugger will be pointed at the widget
2682    /// under the pointer.
2683    ///
2684    /// This is a [keybinding signal](class.SignalAction.html).
2685    ///
2686    /// The default bindings for this signal are
2687    /// <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>I</kbd> and
2688    /// <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>D</kbd>.
2689    /// ## `toggle`
2690    /// toggle the debugger
2691    ///
2692    /// # Returns
2693    ///
2694    /// true if the key binding was handled
2695    #[doc(alias = "enable-debugging")]
2696    fn connect_enable_debugging<F: Fn(&Self, bool) -> bool + 'static>(
2697        &self,
2698        f: F,
2699    ) -> SignalHandlerId {
2700        unsafe extern "C" fn enable_debugging_trampoline<
2701            P: IsA<Window>,
2702            F: Fn(&P, bool) -> bool + 'static,
2703        >(
2704            this: *mut ffi::GtkWindow,
2705            toggle: glib::ffi::gboolean,
2706            f: glib::ffi::gpointer,
2707        ) -> glib::ffi::gboolean {
2708            unsafe {
2709                let f: &F = &*(f as *const F);
2710                f(
2711                    Window::from_glib_borrow(this).unsafe_cast_ref(),
2712                    from_glib(toggle),
2713                )
2714                .into_glib()
2715            }
2716        }
2717        unsafe {
2718            let f: Box_<F> = Box_::new(f);
2719            connect_raw(
2720                self.as_ptr() as *mut _,
2721                c"enable-debugging".as_ptr(),
2722                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2723                    enable_debugging_trampoline::<Self, F> as *const (),
2724                )),
2725                Box_::into_raw(f),
2726            )
2727        }
2728    }
2729
2730    fn emit_enable_debugging(&self, toggle: bool) -> bool {
2731        self.emit_by_name("enable-debugging", &[&toggle])
2732    }
2733
2734    /// Emitted when the compositor has decided to eliminate a window.
2735    ///
2736    /// @window *has* to be in a hidden state after this signal was handled.
2737    #[cfg(feature = "v4_24")]
2738    #[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
2739    #[doc(alias = "force-close")]
2740    fn connect_force_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2741        unsafe extern "C" fn force_close_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
2742            this: *mut ffi::GtkWindow,
2743            f: glib::ffi::gpointer,
2744        ) {
2745            unsafe {
2746                let f: &F = &*(f as *const F);
2747                f(Window::from_glib_borrow(this).unsafe_cast_ref())
2748            }
2749        }
2750        unsafe {
2751            let f: Box_<F> = Box_::new(f);
2752            connect_raw(
2753                self.as_ptr() as *mut _,
2754                c"force-close".as_ptr(),
2755                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2756                    force_close_trampoline::<Self, F> as *const (),
2757                )),
2758                Box_::into_raw(f),
2759            )
2760        }
2761    }
2762
2763    /// Emitted when the set of accelerators or mnemonics that
2764    /// are associated with the window changes.
2765    ///
2766    /// # Deprecated since 4.10
2767    ///
2768    /// Use [`Shortcut`][crate::Shortcut] and [`EventController`][crate::EventController]
2769    ///   to implement keyboard shortcuts
2770    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2771    #[doc(alias = "keys-changed")]
2772    fn connect_keys_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2773        unsafe extern "C" fn keys_changed_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
2774            this: *mut ffi::GtkWindow,
2775            f: glib::ffi::gpointer,
2776        ) {
2777            unsafe {
2778                let f: &F = &*(f as *const F);
2779                f(Window::from_glib_borrow(this).unsafe_cast_ref())
2780            }
2781        }
2782        unsafe {
2783            let f: Box_<F> = Box_::new(f);
2784            connect_raw(
2785                self.as_ptr() as *mut _,
2786                c"keys-changed".as_ptr(),
2787                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2788                    keys_changed_trampoline::<Self, F> as *const (),
2789                )),
2790                Box_::into_raw(f),
2791            )
2792        }
2793    }
2794
2795    #[doc(alias = "application")]
2796    fn connect_application_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2797        unsafe extern "C" fn notify_application_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
2798            this: *mut ffi::GtkWindow,
2799            _param_spec: glib::ffi::gpointer,
2800            f: glib::ffi::gpointer,
2801        ) {
2802            unsafe {
2803                let f: &F = &*(f as *const F);
2804                f(Window::from_glib_borrow(this).unsafe_cast_ref())
2805            }
2806        }
2807        unsafe {
2808            let f: Box_<F> = Box_::new(f);
2809            connect_raw(
2810                self.as_ptr() as *mut _,
2811                c"notify::application".as_ptr(),
2812                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2813                    notify_application_trampoline::<Self, F> as *const (),
2814                )),
2815                Box_::into_raw(f),
2816            )
2817        }
2818    }
2819
2820    #[doc(alias = "child")]
2821    fn connect_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2822        unsafe extern "C" fn notify_child_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
2823            this: *mut ffi::GtkWindow,
2824            _param_spec: glib::ffi::gpointer,
2825            f: glib::ffi::gpointer,
2826        ) {
2827            unsafe {
2828                let f: &F = &*(f as *const F);
2829                f(Window::from_glib_borrow(this).unsafe_cast_ref())
2830            }
2831        }
2832        unsafe {
2833            let f: Box_<F> = Box_::new(f);
2834            connect_raw(
2835                self.as_ptr() as *mut _,
2836                c"notify::child".as_ptr(),
2837                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2838                    notify_child_trampoline::<Self, F> as *const (),
2839                )),
2840                Box_::into_raw(f),
2841            )
2842        }
2843    }
2844
2845    #[doc(alias = "decorated")]
2846    fn connect_decorated_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2847        unsafe extern "C" fn notify_decorated_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
2848            this: *mut ffi::GtkWindow,
2849            _param_spec: glib::ffi::gpointer,
2850            f: glib::ffi::gpointer,
2851        ) {
2852            unsafe {
2853                let f: &F = &*(f as *const F);
2854                f(Window::from_glib_borrow(this).unsafe_cast_ref())
2855            }
2856        }
2857        unsafe {
2858            let f: Box_<F> = Box_::new(f);
2859            connect_raw(
2860                self.as_ptr() as *mut _,
2861                c"notify::decorated".as_ptr(),
2862                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2863                    notify_decorated_trampoline::<Self, F> as *const (),
2864                )),
2865                Box_::into_raw(f),
2866            )
2867        }
2868    }
2869
2870    #[doc(alias = "default-height")]
2871    fn connect_default_height_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2872        unsafe extern "C" fn notify_default_height_trampoline<
2873            P: IsA<Window>,
2874            F: Fn(&P) + 'static,
2875        >(
2876            this: *mut ffi::GtkWindow,
2877            _param_spec: glib::ffi::gpointer,
2878            f: glib::ffi::gpointer,
2879        ) {
2880            unsafe {
2881                let f: &F = &*(f as *const F);
2882                f(Window::from_glib_borrow(this).unsafe_cast_ref())
2883            }
2884        }
2885        unsafe {
2886            let f: Box_<F> = Box_::new(f);
2887            connect_raw(
2888                self.as_ptr() as *mut _,
2889                c"notify::default-height".as_ptr(),
2890                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2891                    notify_default_height_trampoline::<Self, F> as *const (),
2892                )),
2893                Box_::into_raw(f),
2894            )
2895        }
2896    }
2897
2898    #[doc(alias = "default-widget")]
2899    fn connect_default_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2900        unsafe extern "C" fn notify_default_widget_trampoline<
2901            P: IsA<Window>,
2902            F: Fn(&P) + 'static,
2903        >(
2904            this: *mut ffi::GtkWindow,
2905            _param_spec: glib::ffi::gpointer,
2906            f: glib::ffi::gpointer,
2907        ) {
2908            unsafe {
2909                let f: &F = &*(f as *const F);
2910                f(Window::from_glib_borrow(this).unsafe_cast_ref())
2911            }
2912        }
2913        unsafe {
2914            let f: Box_<F> = Box_::new(f);
2915            connect_raw(
2916                self.as_ptr() as *mut _,
2917                c"notify::default-widget".as_ptr(),
2918                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2919                    notify_default_widget_trampoline::<Self, F> as *const (),
2920                )),
2921                Box_::into_raw(f),
2922            )
2923        }
2924    }
2925
2926    #[doc(alias = "default-width")]
2927    fn connect_default_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2928        unsafe extern "C" fn notify_default_width_trampoline<
2929            P: IsA<Window>,
2930            F: Fn(&P) + 'static,
2931        >(
2932            this: *mut ffi::GtkWindow,
2933            _param_spec: glib::ffi::gpointer,
2934            f: glib::ffi::gpointer,
2935        ) {
2936            unsafe {
2937                let f: &F = &*(f as *const F);
2938                f(Window::from_glib_borrow(this).unsafe_cast_ref())
2939            }
2940        }
2941        unsafe {
2942            let f: Box_<F> = Box_::new(f);
2943            connect_raw(
2944                self.as_ptr() as *mut _,
2945                c"notify::default-width".as_ptr(),
2946                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2947                    notify_default_width_trampoline::<Self, F> as *const (),
2948                )),
2949                Box_::into_raw(f),
2950            )
2951        }
2952    }
2953
2954    #[doc(alias = "deletable")]
2955    fn connect_deletable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2956        unsafe extern "C" fn notify_deletable_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
2957            this: *mut ffi::GtkWindow,
2958            _param_spec: glib::ffi::gpointer,
2959            f: glib::ffi::gpointer,
2960        ) {
2961            unsafe {
2962                let f: &F = &*(f as *const F);
2963                f(Window::from_glib_borrow(this).unsafe_cast_ref())
2964            }
2965        }
2966        unsafe {
2967            let f: Box_<F> = Box_::new(f);
2968            connect_raw(
2969                self.as_ptr() as *mut _,
2970                c"notify::deletable".as_ptr(),
2971                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2972                    notify_deletable_trampoline::<Self, F> as *const (),
2973                )),
2974                Box_::into_raw(f),
2975            )
2976        }
2977    }
2978
2979    #[doc(alias = "destroy-with-parent")]
2980    fn connect_destroy_with_parent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2981        unsafe extern "C" fn notify_destroy_with_parent_trampoline<
2982            P: IsA<Window>,
2983            F: Fn(&P) + 'static,
2984        >(
2985            this: *mut ffi::GtkWindow,
2986            _param_spec: glib::ffi::gpointer,
2987            f: glib::ffi::gpointer,
2988        ) {
2989            unsafe {
2990                let f: &F = &*(f as *const F);
2991                f(Window::from_glib_borrow(this).unsafe_cast_ref())
2992            }
2993        }
2994        unsafe {
2995            let f: Box_<F> = Box_::new(f);
2996            connect_raw(
2997                self.as_ptr() as *mut _,
2998                c"notify::destroy-with-parent".as_ptr(),
2999                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3000                    notify_destroy_with_parent_trampoline::<Self, F> as *const (),
3001                )),
3002                Box_::into_raw(f),
3003            )
3004        }
3005    }
3006
3007    #[doc(alias = "display")]
3008    fn connect_display_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3009        unsafe extern "C" fn notify_display_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
3010            this: *mut ffi::GtkWindow,
3011            _param_spec: glib::ffi::gpointer,
3012            f: glib::ffi::gpointer,
3013        ) {
3014            unsafe {
3015                let f: &F = &*(f as *const F);
3016                f(Window::from_glib_borrow(this).unsafe_cast_ref())
3017            }
3018        }
3019        unsafe {
3020            let f: Box_<F> = Box_::new(f);
3021            connect_raw(
3022                self.as_ptr() as *mut _,
3023                c"notify::display".as_ptr(),
3024                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3025                    notify_display_trampoline::<Self, F> as *const (),
3026                )),
3027                Box_::into_raw(f),
3028            )
3029        }
3030    }
3031
3032    #[doc(alias = "focus-visible")]
3033    fn connect_focus_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3034        unsafe extern "C" fn notify_focus_visible_trampoline<
3035            P: IsA<Window>,
3036            F: Fn(&P) + 'static,
3037        >(
3038            this: *mut ffi::GtkWindow,
3039            _param_spec: glib::ffi::gpointer,
3040            f: glib::ffi::gpointer,
3041        ) {
3042            unsafe {
3043                let f: &F = &*(f as *const F);
3044                f(Window::from_glib_borrow(this).unsafe_cast_ref())
3045            }
3046        }
3047        unsafe {
3048            let f: Box_<F> = Box_::new(f);
3049            connect_raw(
3050                self.as_ptr() as *mut _,
3051                c"notify::focus-visible".as_ptr(),
3052                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3053                    notify_focus_visible_trampoline::<Self, F> as *const (),
3054                )),
3055                Box_::into_raw(f),
3056            )
3057        }
3058    }
3059
3060    #[doc(alias = "focus-widget")]
3061    fn connect_focus_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3062        unsafe extern "C" fn notify_focus_widget_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
3063            this: *mut ffi::GtkWindow,
3064            _param_spec: glib::ffi::gpointer,
3065            f: glib::ffi::gpointer,
3066        ) {
3067            unsafe {
3068                let f: &F = &*(f as *const F);
3069                f(Window::from_glib_borrow(this).unsafe_cast_ref())
3070            }
3071        }
3072        unsafe {
3073            let f: Box_<F> = Box_::new(f);
3074            connect_raw(
3075                self.as_ptr() as *mut _,
3076                c"notify::focus-widget".as_ptr(),
3077                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3078                    notify_focus_widget_trampoline::<Self, F> as *const (),
3079                )),
3080                Box_::into_raw(f),
3081            )
3082        }
3083    }
3084
3085    #[doc(alias = "fullscreened")]
3086    fn connect_fullscreened_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3087        unsafe extern "C" fn notify_fullscreened_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
3088            this: *mut ffi::GtkWindow,
3089            _param_spec: glib::ffi::gpointer,
3090            f: glib::ffi::gpointer,
3091        ) {
3092            unsafe {
3093                let f: &F = &*(f as *const F);
3094                f(Window::from_glib_borrow(this).unsafe_cast_ref())
3095            }
3096        }
3097        unsafe {
3098            let f: Box_<F> = Box_::new(f);
3099            connect_raw(
3100                self.as_ptr() as *mut _,
3101                c"notify::fullscreened".as_ptr(),
3102                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3103                    notify_fullscreened_trampoline::<Self, F> as *const (),
3104                )),
3105                Box_::into_raw(f),
3106            )
3107        }
3108    }
3109
3110    #[cfg(feature = "v4_20")]
3111    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
3112    #[doc(alias = "gravity")]
3113    fn connect_gravity_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3114        unsafe extern "C" fn notify_gravity_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
3115            this: *mut ffi::GtkWindow,
3116            _param_spec: glib::ffi::gpointer,
3117            f: glib::ffi::gpointer,
3118        ) {
3119            unsafe {
3120                let f: &F = &*(f as *const F);
3121                f(Window::from_glib_borrow(this).unsafe_cast_ref())
3122            }
3123        }
3124        unsafe {
3125            let f: Box_<F> = Box_::new(f);
3126            connect_raw(
3127                self.as_ptr() as *mut _,
3128                c"notify::gravity".as_ptr(),
3129                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3130                    notify_gravity_trampoline::<Self, F> as *const (),
3131                )),
3132                Box_::into_raw(f),
3133            )
3134        }
3135    }
3136
3137    #[cfg(feature = "v4_2")]
3138    #[cfg_attr(docsrs, doc(cfg(feature = "v4_2")))]
3139    #[doc(alias = "handle-menubar-accel")]
3140    fn connect_handle_menubar_accel_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3141        unsafe extern "C" fn notify_handle_menubar_accel_trampoline<
3142            P: IsA<Window>,
3143            F: Fn(&P) + 'static,
3144        >(
3145            this: *mut ffi::GtkWindow,
3146            _param_spec: glib::ffi::gpointer,
3147            f: glib::ffi::gpointer,
3148        ) {
3149            unsafe {
3150                let f: &F = &*(f as *const F);
3151                f(Window::from_glib_borrow(this).unsafe_cast_ref())
3152            }
3153        }
3154        unsafe {
3155            let f: Box_<F> = Box_::new(f);
3156            connect_raw(
3157                self.as_ptr() as *mut _,
3158                c"notify::handle-menubar-accel".as_ptr(),
3159                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3160                    notify_handle_menubar_accel_trampoline::<Self, F> as *const (),
3161                )),
3162                Box_::into_raw(f),
3163            )
3164        }
3165    }
3166
3167    #[doc(alias = "hide-on-close")]
3168    fn connect_hide_on_close_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3169        unsafe extern "C" fn notify_hide_on_close_trampoline<
3170            P: IsA<Window>,
3171            F: Fn(&P) + 'static,
3172        >(
3173            this: *mut ffi::GtkWindow,
3174            _param_spec: glib::ffi::gpointer,
3175            f: glib::ffi::gpointer,
3176        ) {
3177            unsafe {
3178                let f: &F = &*(f as *const F);
3179                f(Window::from_glib_borrow(this).unsafe_cast_ref())
3180            }
3181        }
3182        unsafe {
3183            let f: Box_<F> = Box_::new(f);
3184            connect_raw(
3185                self.as_ptr() as *mut _,
3186                c"notify::hide-on-close".as_ptr(),
3187                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3188                    notify_hide_on_close_trampoline::<Self, F> as *const (),
3189                )),
3190                Box_::into_raw(f),
3191            )
3192        }
3193    }
3194
3195    #[doc(alias = "icon-name")]
3196    fn connect_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3197        unsafe extern "C" fn notify_icon_name_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
3198            this: *mut ffi::GtkWindow,
3199            _param_spec: glib::ffi::gpointer,
3200            f: glib::ffi::gpointer,
3201        ) {
3202            unsafe {
3203                let f: &F = &*(f as *const F);
3204                f(Window::from_glib_borrow(this).unsafe_cast_ref())
3205            }
3206        }
3207        unsafe {
3208            let f: Box_<F> = Box_::new(f);
3209            connect_raw(
3210                self.as_ptr() as *mut _,
3211                c"notify::icon-name".as_ptr(),
3212                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3213                    notify_icon_name_trampoline::<Self, F> as *const (),
3214                )),
3215                Box_::into_raw(f),
3216            )
3217        }
3218    }
3219
3220    #[doc(alias = "is-active")]
3221    fn connect_is_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3222        unsafe extern "C" fn notify_is_active_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
3223            this: *mut ffi::GtkWindow,
3224            _param_spec: glib::ffi::gpointer,
3225            f: glib::ffi::gpointer,
3226        ) {
3227            unsafe {
3228                let f: &F = &*(f as *const F);
3229                f(Window::from_glib_borrow(this).unsafe_cast_ref())
3230            }
3231        }
3232        unsafe {
3233            let f: Box_<F> = Box_::new(f);
3234            connect_raw(
3235                self.as_ptr() as *mut _,
3236                c"notify::is-active".as_ptr(),
3237                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3238                    notify_is_active_trampoline::<Self, F> as *const (),
3239                )),
3240                Box_::into_raw(f),
3241            )
3242        }
3243    }
3244
3245    #[doc(alias = "maximized")]
3246    fn connect_maximized_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3247        unsafe extern "C" fn notify_maximized_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
3248            this: *mut ffi::GtkWindow,
3249            _param_spec: glib::ffi::gpointer,
3250            f: glib::ffi::gpointer,
3251        ) {
3252            unsafe {
3253                let f: &F = &*(f as *const F);
3254                f(Window::from_glib_borrow(this).unsafe_cast_ref())
3255            }
3256        }
3257        unsafe {
3258            let f: Box_<F> = Box_::new(f);
3259            connect_raw(
3260                self.as_ptr() as *mut _,
3261                c"notify::maximized".as_ptr(),
3262                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3263                    notify_maximized_trampoline::<Self, F> as *const (),
3264                )),
3265                Box_::into_raw(f),
3266            )
3267        }
3268    }
3269
3270    #[doc(alias = "mnemonics-visible")]
3271    fn connect_mnemonics_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3272        unsafe extern "C" fn notify_mnemonics_visible_trampoline<
3273            P: IsA<Window>,
3274            F: Fn(&P) + 'static,
3275        >(
3276            this: *mut ffi::GtkWindow,
3277            _param_spec: glib::ffi::gpointer,
3278            f: glib::ffi::gpointer,
3279        ) {
3280            unsafe {
3281                let f: &F = &*(f as *const F);
3282                f(Window::from_glib_borrow(this).unsafe_cast_ref())
3283            }
3284        }
3285        unsafe {
3286            let f: Box_<F> = Box_::new(f);
3287            connect_raw(
3288                self.as_ptr() as *mut _,
3289                c"notify::mnemonics-visible".as_ptr(),
3290                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3291                    notify_mnemonics_visible_trampoline::<Self, F> as *const (),
3292                )),
3293                Box_::into_raw(f),
3294            )
3295        }
3296    }
3297
3298    #[doc(alias = "modal")]
3299    fn connect_modal_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3300        unsafe extern "C" fn notify_modal_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
3301            this: *mut ffi::GtkWindow,
3302            _param_spec: glib::ffi::gpointer,
3303            f: glib::ffi::gpointer,
3304        ) {
3305            unsafe {
3306                let f: &F = &*(f as *const F);
3307                f(Window::from_glib_borrow(this).unsafe_cast_ref())
3308            }
3309        }
3310        unsafe {
3311            let f: Box_<F> = Box_::new(f);
3312            connect_raw(
3313                self.as_ptr() as *mut _,
3314                c"notify::modal".as_ptr(),
3315                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3316                    notify_modal_trampoline::<Self, F> as *const (),
3317                )),
3318                Box_::into_raw(f),
3319            )
3320        }
3321    }
3322
3323    #[doc(alias = "resizable")]
3324    fn connect_resizable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3325        unsafe extern "C" fn notify_resizable_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
3326            this: *mut ffi::GtkWindow,
3327            _param_spec: glib::ffi::gpointer,
3328            f: glib::ffi::gpointer,
3329        ) {
3330            unsafe {
3331                let f: &F = &*(f as *const F);
3332                f(Window::from_glib_borrow(this).unsafe_cast_ref())
3333            }
3334        }
3335        unsafe {
3336            let f: Box_<F> = Box_::new(f);
3337            connect_raw(
3338                self.as_ptr() as *mut _,
3339                c"notify::resizable".as_ptr(),
3340                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3341                    notify_resizable_trampoline::<Self, F> as *const (),
3342                )),
3343                Box_::into_raw(f),
3344            )
3345        }
3346    }
3347
3348    #[doc(alias = "startup-id")]
3349    fn connect_startup_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3350        unsafe extern "C" fn notify_startup_id_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
3351            this: *mut ffi::GtkWindow,
3352            _param_spec: glib::ffi::gpointer,
3353            f: glib::ffi::gpointer,
3354        ) {
3355            unsafe {
3356                let f: &F = &*(f as *const F);
3357                f(Window::from_glib_borrow(this).unsafe_cast_ref())
3358            }
3359        }
3360        unsafe {
3361            let f: Box_<F> = Box_::new(f);
3362            connect_raw(
3363                self.as_ptr() as *mut _,
3364                c"notify::startup-id".as_ptr(),
3365                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3366                    notify_startup_id_trampoline::<Self, F> as *const (),
3367                )),
3368                Box_::into_raw(f),
3369            )
3370        }
3371    }
3372
3373    #[cfg(feature = "v4_12")]
3374    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
3375    #[doc(alias = "suspended")]
3376    fn connect_suspended_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3377        unsafe extern "C" fn notify_suspended_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
3378            this: *mut ffi::GtkWindow,
3379            _param_spec: glib::ffi::gpointer,
3380            f: glib::ffi::gpointer,
3381        ) {
3382            unsafe {
3383                let f: &F = &*(f as *const F);
3384                f(Window::from_glib_borrow(this).unsafe_cast_ref())
3385            }
3386        }
3387        unsafe {
3388            let f: Box_<F> = Box_::new(f);
3389            connect_raw(
3390                self.as_ptr() as *mut _,
3391                c"notify::suspended".as_ptr(),
3392                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3393                    notify_suspended_trampoline::<Self, F> as *const (),
3394                )),
3395                Box_::into_raw(f),
3396            )
3397        }
3398    }
3399
3400    #[doc(alias = "title")]
3401    fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3402        unsafe extern "C" fn notify_title_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
3403            this: *mut ffi::GtkWindow,
3404            _param_spec: glib::ffi::gpointer,
3405            f: glib::ffi::gpointer,
3406        ) {
3407            unsafe {
3408                let f: &F = &*(f as *const F);
3409                f(Window::from_glib_borrow(this).unsafe_cast_ref())
3410            }
3411        }
3412        unsafe {
3413            let f: Box_<F> = Box_::new(f);
3414            connect_raw(
3415                self.as_ptr() as *mut _,
3416                c"notify::title".as_ptr(),
3417                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3418                    notify_title_trampoline::<Self, F> as *const (),
3419                )),
3420                Box_::into_raw(f),
3421            )
3422        }
3423    }
3424
3425    #[cfg(feature = "v4_6")]
3426    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
3427    #[doc(alias = "titlebar")]
3428    fn connect_titlebar_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3429        unsafe extern "C" fn notify_titlebar_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
3430            this: *mut ffi::GtkWindow,
3431            _param_spec: glib::ffi::gpointer,
3432            f: glib::ffi::gpointer,
3433        ) {
3434            unsafe {
3435                let f: &F = &*(f as *const F);
3436                f(Window::from_glib_borrow(this).unsafe_cast_ref())
3437            }
3438        }
3439        unsafe {
3440            let f: Box_<F> = Box_::new(f);
3441            connect_raw(
3442                self.as_ptr() as *mut _,
3443                c"notify::titlebar".as_ptr(),
3444                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3445                    notify_titlebar_trampoline::<Self, F> as *const (),
3446                )),
3447                Box_::into_raw(f),
3448            )
3449        }
3450    }
3451
3452    #[doc(alias = "transient-for")]
3453    fn connect_transient_for_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3454        unsafe extern "C" fn notify_transient_for_trampoline<
3455            P: IsA<Window>,
3456            F: Fn(&P) + 'static,
3457        >(
3458            this: *mut ffi::GtkWindow,
3459            _param_spec: glib::ffi::gpointer,
3460            f: glib::ffi::gpointer,
3461        ) {
3462            unsafe {
3463                let f: &F = &*(f as *const F);
3464                f(Window::from_glib_borrow(this).unsafe_cast_ref())
3465            }
3466        }
3467        unsafe {
3468            let f: Box_<F> = Box_::new(f);
3469            connect_raw(
3470                self.as_ptr() as *mut _,
3471                c"notify::transient-for".as_ptr(),
3472                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3473                    notify_transient_for_trampoline::<Self, F> as *const (),
3474                )),
3475                Box_::into_raw(f),
3476            )
3477        }
3478    }
3479}
3480
3481impl<O: IsA<Window>> GtkWindowExt for O {}