Skip to main content

gtk4/auto/
application_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, ShortcutsWindow, Widget, Window, ffi,
12};
13#[cfg(feature = "v4_24")]
14#[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
15use glib::object::ObjectType as _;
16use glib::{
17    prelude::*,
18    signal::{SignalHandlerId, connect_raw},
19    translate::*,
20};
21use std::boxed::Box as Box_;
22
23glib::wrapper! {
24    /// A [`Window`][crate::Window] subclass that integrates with [`Application`][crate::Application].
25    ///
26    /// Notably, [`ApplicationWindow`][crate::ApplicationWindow] can handle an application menubar.
27    ///
28    /// This class implements the [`gio::ActionGroup`][crate::gio::ActionGroup] and [`gio::ActionMap`][crate::gio::ActionMap]
29    /// interfaces, to let you add window-specific actions that will be exported
30    /// by the associated [`Application`][crate::Application], together with its application-wide
31    /// actions. Window-specific actions are prefixed with the “win.”
32    /// prefix and application-wide actions are prefixed with the “app.”
33    /// prefix. Actions must be addressed with the prefixed name when
34    /// referring to them from a menu model.
35    ///
36    /// Note that widgets that are placed inside a [`ApplicationWindow`][crate::ApplicationWindow]
37    /// can also activate these actions, if they implement the
38    /// [`Actionable`][crate::Actionable] interface.
39    ///
40    /// The settings [`gtk-shell-shows-app-menu`][struct@crate::Settings#gtk-shell-shows-app-menu] and
41    /// [`gtk-shell-shows-menubar`][struct@crate::Settings#gtk-shell-shows-menubar] tell GTK whether the
42    /// desktop environment is showing the application menu and menubar
43    /// models outside the application as part of the desktop shell.
44    /// For instance, on OS X, both menus will be displayed remotely;
45    /// on Windows neither will be.
46    ///
47    /// If the desktop environment does not display the menubar, it can be shown in
48    /// the [`ApplicationWindow`][crate::ApplicationWindow] by setting the
49    /// [`show-menubar`][struct@crate::ApplicationWindow#show-menubar] property to true. If the
50    /// desktop environment does not display the application menu, then it will
51    /// automatically be included in the menubar or in the window’s client-side
52    /// decorations.
53    ///
54    /// See [`PopoverMenu`][crate::PopoverMenu] for information about the XML language
55    /// used by [`Builder`][crate::Builder] for menu models.
56    ///
57    /// See also: [`GtkApplicationExt::set_menubar()`][crate::prelude::GtkApplicationExt::set_menubar()].
58    ///
59    /// ## A GtkApplicationWindow with a menubar
60    ///
61    /// The code sample below shows how to set up a [`ApplicationWindow`][crate::ApplicationWindow]
62    /// with a menu bar defined on the [`Application`][crate::Application]:
63    ///
64    /// **⚠️ The following code is in c ⚠️**
65    ///
66    /// ```c
67    /// GtkApplication *app = gtk_application_new ("org.gtk.test", 0);
68    ///
69    /// GtkBuilder *builder = gtk_builder_new_from_string (
70    ///     "<interface>"
71    ///     "  <menu id='menubar'>"
72    ///     "    <submenu>"
73    ///     "      <attribute name='label' translatable='yes'>_Edit</attribute>"
74    ///     "      <item>"
75    ///     "        <attribute name='label' translatable='yes'>_Copy</attribute>"
76    ///     "        <attribute name='action'>win.copy</attribute>"
77    ///     "      </item>"
78    ///     "      <item>"
79    ///     "        <attribute name='label' translatable='yes'>_Paste</attribute>"
80    ///     "        <attribute name='action'>win.paste</attribute>"
81    ///     "      </item>"
82    ///     "    </submenu>"
83    ///     "  </menu>"
84    ///     "</interface>",
85    ///     -1);
86    ///
87    /// GMenuModel *menubar = G_MENU_MODEL (gtk_builder_get_object (builder, "menubar"));
88    /// gtk_application_set_menubar (GTK_APPLICATION (app), menubar);
89    /// g_object_unref (builder);
90    ///
91    /// // ...
92    ///
93    /// GtkWidget *window = gtk_application_window_new (app);
94    /// ```
95    ///
96    /// ## Properties
97    ///
98    ///
99    /// #### `show-menubar`
100    ///  If this property is true, the window will display a menubar
101    /// unless it is shown by the desktop shell.
102    ///
103    /// See [`GtkApplicationExt::set_menubar()`][crate::prelude::GtkApplicationExt::set_menubar()].
104    ///
105    /// If false, the window will not display a menubar, regardless
106    /// of whether the desktop shell is showing it or not.
107    ///
108    /// Readable | Writeable | Construct
109    /// <details><summary><h4>Window</h4></summary>
110    ///
111    ///
112    /// #### `application`
113    ///  The [`Application`][crate::Application] associated with the window.
114    ///
115    /// The application will be kept alive for at least as long as it
116    /// has any windows associated with it (see g_application_hold()
117    /// for a way to keep it alive without windows).
118    ///
119    /// Normally, the connection between the application and the window
120    /// will remain until the window is destroyed, but you can explicitly
121    /// remove it by setting the this property to `NULL`.
122    ///
123    /// Readable | Writeable
124    ///
125    ///
126    /// #### `child`
127    ///  The child widget.
128    ///
129    /// Readable | Writeable
130    ///
131    ///
132    /// #### `decorated`
133    ///  Whether the window should have a frame (also known as *decorations*).
134    ///
135    /// Readable | Writeable
136    ///
137    ///
138    /// #### `default-height`
139    ///  The default height of the window.
140    ///
141    /// Readable | Writeable
142    ///
143    ///
144    /// #### `default-widget`
145    ///  The default widget.
146    ///
147    /// Readable | Writeable
148    ///
149    ///
150    /// #### `default-width`
151    ///  The default width of the window.
152    ///
153    /// Readable | Writeable
154    ///
155    ///
156    /// #### `deletable`
157    ///  Whether the window frame should have a close button.
158    ///
159    /// Readable | Writeable
160    ///
161    ///
162    /// #### `destroy-with-parent`
163    ///  If this window should be destroyed when the parent is destroyed.
164    ///
165    /// Readable | Writeable
166    ///
167    ///
168    /// #### `display`
169    ///  The display that will display this window.
170    ///
171    /// Readable | Writeable
172    ///
173    ///
174    /// #### `focus-visible`
175    ///  Whether 'focus rectangles' are currently visible in this window.
176    ///
177    /// This property is maintained by GTK based on user input
178    /// and should not be set by applications.
179    ///
180    /// Readable | Writeable
181    ///
182    ///
183    /// #### `focus-widget`
184    ///  The focus widget.
185    ///
186    /// Readable | Writeable
187    ///
188    ///
189    /// #### `fullscreened`
190    ///  Whether the window is fullscreen.
191    ///
192    /// Setting this property is the equivalent of calling
193    /// [`GtkWindowExt::fullscreen()`][crate::prelude::GtkWindowExt::fullscreen()] or [`GtkWindowExt::unfullscreen()`][crate::prelude::GtkWindowExt::unfullscreen()];
194    /// either operation is asynchronous, which means you will need to
195    /// connect to the ::notify signal in order to know whether the
196    /// operation was successful.
197    ///
198    /// Readable | Writeable
199    ///
200    ///
201    /// #### `gravity`
202    ///  The gravity to use when resizing the window programmatically.
203    ///
204    /// Gravity describes which point of the window we want to keep
205    /// fixed (meaning that the window will grow in the opposite direction).
206    /// For example, a gravity of `GTK_WINDOW_GRAVITY_TOP_RIGHT` means that we
207    /// want the to fix top right corner of the window.
208    ///
209    /// Readable | Writeable
210    ///
211    ///
212    /// #### `handle-menubar-accel`
213    ///  Whether the window frame should handle <kbd>F10</kbd> for activating
214    /// menubars.
215    ///
216    /// Readable | Writeable
217    ///
218    ///
219    /// #### `hide-on-close`
220    ///  If this window should be hidden instead of destroyed when the user clicks
221    /// the close button.
222    ///
223    /// Readable | Writeable
224    ///
225    ///
226    /// #### `icon-name`
227    ///  Specifies the name of the themed icon to use as the window icon.
228    ///
229    /// See [`IconTheme`][crate::IconTheme] for more details.
230    ///
231    /// Readable | Writeable
232    ///
233    ///
234    /// #### `is-active`
235    ///  Whether the toplevel is the currently active window.
236    ///
237    /// Readable
238    ///
239    ///
240    /// #### `maximized`
241    ///  Whether the window is maximized.
242    ///
243    /// Setting this property is the equivalent of calling
244    /// [`GtkWindowExt::maximize()`][crate::prelude::GtkWindowExt::maximize()] or [`GtkWindowExt::unmaximize()`][crate::prelude::GtkWindowExt::unmaximize()];
245    /// either operation is asynchronous, which means you will need to
246    /// connect to the ::notify signal in order to know whether the
247    /// operation was successful.
248    ///
249    /// Readable | Writeable
250    ///
251    ///
252    /// #### `mnemonics-visible`
253    ///  Whether mnemonics are currently visible in this window.
254    ///
255    /// This property is maintained by GTK based on user input,
256    /// and should not be set by applications.
257    ///
258    /// Readable | Writeable
259    ///
260    ///
261    /// #### `modal`
262    ///  If true, the window is modal.
263    ///
264    /// Readable | Writeable
265    ///
266    ///
267    /// #### `resizable`
268    ///  If true, users can resize the window.
269    ///
270    /// Readable | Writeable
271    ///
272    ///
273    /// #### `startup-id`
274    ///  A write-only property for setting window's startup notification identifier.
275    ///
276    /// Writeable
277    ///
278    ///
279    /// #### `suspended`
280    ///  Whether the window is suspended.
281    ///
282    /// See [`GtkWindowExt::is_suspended()`][crate::prelude::GtkWindowExt::is_suspended()] for details about what suspended means.
283    ///
284    /// Readable
285    ///
286    ///
287    /// #### `title`
288    ///  The title of the window.
289    ///
290    /// Readable | Writeable
291    ///
292    ///
293    /// #### `titlebar`
294    ///  The titlebar widget.
295    ///
296    /// Readable | Writeable
297    ///
298    ///
299    /// #### `transient-for`
300    ///  The transient parent of the window.
301    ///
302    /// Readable | Writeable | Construct
303    /// </details>
304    /// <details><summary><h4>Widget</h4></summary>
305    ///
306    ///
307    /// #### `can-focus`
308    ///  Whether the widget or any of its descendents can accept
309    /// the input focus.
310    ///
311    /// This property is meant to be set by widget implementations,
312    /// typically in their instance init function.
313    ///
314    /// Readable | Writeable
315    ///
316    ///
317    /// #### `can-target`
318    ///  Whether the widget can receive pointer events.
319    ///
320    /// Readable | Writeable
321    ///
322    ///
323    /// #### `css-classes`
324    ///  A list of css classes applied to this widget.
325    ///
326    /// Readable | Writeable
327    ///
328    ///
329    /// #### `css-name`
330    ///  The name of this widget in the CSS tree.
331    ///
332    /// This property is meant to be set by widget implementations,
333    /// typically in their instance init function.
334    ///
335    /// Readable | Writeable | Construct Only
336    ///
337    ///
338    /// #### `cursor`
339    ///  The cursor used by @widget.
340    ///
341    /// Readable | Writeable
342    ///
343    ///
344    /// #### `focus-on-click`
345    ///  Whether the widget should grab focus when it is clicked with the mouse.
346    ///
347    /// This property is only relevant for widgets that can take focus.
348    ///
349    /// Readable | Writeable
350    ///
351    ///
352    /// #### `focusable`
353    ///  Whether this widget itself will accept the input focus.
354    ///
355    /// Readable | Writeable
356    ///
357    ///
358    /// #### `halign`
359    ///  How to distribute horizontal space if widget gets extra space.
360    ///
361    /// Readable | Writeable
362    ///
363    ///
364    /// #### `has-default`
365    ///  Whether the widget is the default widget.
366    ///
367    /// Readable
368    ///
369    ///
370    /// #### `has-focus`
371    ///  Whether the widget has the input focus.
372    ///
373    /// Readable
374    ///
375    ///
376    /// #### `has-tooltip`
377    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
378    /// signal on @widget.
379    ///
380    /// A true value indicates that @widget can have a tooltip, in this case
381    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
382    /// determine whether it will provide a tooltip or not.
383    ///
384    /// Readable | Writeable
385    ///
386    ///
387    /// #### `height-request`
388    ///  Overrides for height request of the widget.
389    ///
390    /// If this is -1, the natural request will be used.
391    ///
392    /// Readable | Writeable
393    ///
394    ///
395    /// #### `hexpand`
396    ///  Whether to expand horizontally.
397    ///
398    /// Readable | Writeable
399    ///
400    ///
401    /// #### `hexpand-set`
402    ///  Whether to use the `hexpand` property.
403    ///
404    /// Readable | Writeable
405    ///
406    ///
407    /// #### `layout-manager`
408    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
409    /// the preferred size of the widget, and allocate its children.
410    ///
411    /// This property is meant to be set by widget implementations,
412    /// typically in their instance init function.
413    ///
414    /// Readable | Writeable
415    ///
416    ///
417    /// #### `limit-events`
418    ///  Makes this widget act like a modal dialog, with respect to
419    /// event delivery.
420    ///
421    /// Global event controllers will not handle events with targets
422    /// inside the widget, unless they are set up to ignore propagation
423    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
424    ///
425    /// Readable | Writeable
426    ///
427    ///
428    /// #### `margin-bottom`
429    ///  Margin on bottom side of widget.
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-end`
439    ///  Margin on end 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-start`
452    ///  Margin on start of widget, horizontally.
453    ///
454    /// This property supports left-to-right and right-to-left text
455    /// directions.
456    ///
457    /// This property adds margin outside of the widget's normal size
458    /// request, the margin will be added in addition to the size from
459    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
460    ///
461    /// Readable | Writeable
462    ///
463    ///
464    /// #### `margin-top`
465    ///  Margin on top side of widget.
466    ///
467    /// This property adds margin outside of the widget's normal size
468    /// request, the margin will be added in addition to the size from
469    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
470    ///
471    /// Readable | Writeable
472    ///
473    ///
474    /// #### `name`
475    ///  The name of the widget.
476    ///
477    /// Readable | Writeable
478    ///
479    ///
480    /// #### `opacity`
481    ///  The requested opacity of the widget.
482    ///
483    /// Readable | Writeable
484    ///
485    ///
486    /// #### `overflow`
487    ///  How content outside the widget's content area is treated.
488    ///
489    /// This property is meant to be set by widget implementations,
490    /// typically in their instance init function.
491    ///
492    /// Readable | Writeable
493    ///
494    ///
495    /// #### `parent`
496    ///  The parent widget of this widget.
497    ///
498    /// Readable
499    ///
500    ///
501    /// #### `receives-default`
502    ///  Whether the widget will receive the default action when it is focused.
503    ///
504    /// Readable | Writeable
505    ///
506    ///
507    /// #### `root`
508    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
509    ///
510    /// This will be `NULL` if the widget is not contained in a root widget.
511    ///
512    /// Readable
513    ///
514    ///
515    /// #### `scale-factor`
516    ///  The scale factor of the widget.
517    ///
518    /// Readable
519    ///
520    ///
521    /// #### `sensitive`
522    ///  Whether the widget responds to input.
523    ///
524    /// Readable | Writeable
525    ///
526    ///
527    /// #### `tooltip-markup`
528    ///  Sets the text of tooltip to be the given string, which is marked up
529    /// with Pango markup.
530    ///
531    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
532    ///
533    /// This is a convenience property which will take care of getting the
534    /// tooltip shown if the given string is not `NULL`:
535    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
536    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
537    /// the default signal handler.
538    ///
539    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
540    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
541    ///
542    /// Readable | Writeable
543    ///
544    ///
545    /// #### `tooltip-text`
546    ///  Sets the text of tooltip to be the given string.
547    ///
548    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
549    ///
550    /// This is a convenience property which will take care of getting the
551    /// tooltip shown if the given string is not `NULL`:
552    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
553    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
554    /// the default signal handler.
555    ///
556    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
557    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
558    ///
559    /// Readable | Writeable
560    ///
561    ///
562    /// #### `valign`
563    ///  How to distribute vertical space if widget gets extra space.
564    ///
565    /// Readable | Writeable
566    ///
567    ///
568    /// #### `vexpand`
569    ///  Whether to expand vertically.
570    ///
571    /// Readable | Writeable
572    ///
573    ///
574    /// #### `vexpand-set`
575    ///  Whether to use the `vexpand` property.
576    ///
577    /// Readable | Writeable
578    ///
579    ///
580    /// #### `visible`
581    ///  Whether the widget is visible.
582    ///
583    /// Readable | Writeable
584    ///
585    ///
586    /// #### `width-request`
587    ///  Overrides for width request of the widget.
588    ///
589    /// If this is -1, the natural request will be used.
590    ///
591    /// Readable | Writeable
592    /// </details>
593    /// <details><summary><h4>Accessible</h4></summary>
594    ///
595    ///
596    /// #### `accessible-role`
597    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
598    ///
599    /// The accessible role cannot be changed once set.
600    ///
601    /// Readable | Writeable
602    /// </details>
603    ///
604    /// ## Signals
605    ///
606    ///
607    /// #### `save-state`
608    ///  The handler for this signal should persist any application-specific
609    /// state of @window into @dict.
610    ///
611    /// Note that window management state such as maximized, fullscreen,
612    /// or window size should not be saved as part of this. They are handled
613    /// by GTK.
614    ///
615    /// See [`restore-window`][struct@crate::Application#restore-window].
616    ///
617    ///
618    /// <details><summary><h4>Window</h4></summary>
619    ///
620    ///
621    /// #### `activate-default`
622    ///  Emitted when the user activates the default widget.
623    ///
624    /// This is a [keybinding signal](class.SignalAction.html).
625    ///
626    /// The keybindings for this signal are all forms of the <kbd>Enter</kbd> key.
627    ///
628    /// Action
629    ///
630    ///
631    /// #### `activate-focus`
632    ///  Emitted when the user activates the currently focused
633    /// widget of @window.
634    ///
635    /// This is a [keybinding signal](class.SignalAction.html).
636    ///
637    /// The default binding for this signal is <kbd>␣</kbd>.
638    ///
639    /// Action
640    ///
641    ///
642    /// #### `close-request`
643    ///  Emitted when the user clicks on the close button of the window.
644    ///
645    ///
646    ///
647    ///
648    /// #### `enable-debugging`
649    ///  Emitted when the user enables or disables interactive debugging.
650    ///
651    /// When @toggle is true, interactive debugging is toggled on or off,
652    /// when it is false, the debugger will be pointed at the widget
653    /// under the pointer.
654    ///
655    /// This is a [keybinding signal](class.SignalAction.html).
656    ///
657    /// The default bindings for this signal are
658    /// <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>I</kbd> and
659    /// <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>D</kbd>.
660    ///
661    /// Action
662    ///
663    ///
664    /// #### `force-close`
665    ///  Emitted when the compositor has decided to eliminate a window.
666    ///
667    /// @window *has* to be in a hidden state after this signal was handled.
668    ///
669    ///
670    ///
671    ///
672    /// #### `keys-changed`
673    ///  Emitted when the set of accelerators or mnemonics that
674    /// are associated with the window changes.
675    ///
676    ///
677    /// </details>
678    /// <details><summary><h4>Widget</h4></summary>
679    ///
680    ///
681    /// #### `destroy`
682    ///  Signals that all holders of a reference to the widget should release
683    /// the reference that they hold.
684    ///
685    /// May result in finalization of the widget if all references are released.
686    ///
687    /// This signal is not suitable for saving widget state.
688    ///
689    ///
690    ///
691    ///
692    /// #### `direction-changed`
693    ///  Emitted when the text direction of a widget changes.
694    ///
695    ///
696    ///
697    ///
698    /// #### `hide`
699    ///  Emitted when @widget is hidden.
700    ///
701    ///
702    ///
703    ///
704    /// #### `keynav-failed`
705    ///  Emitted if keyboard navigation fails.
706    ///
707    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
708    ///
709    ///
710    ///
711    ///
712    /// #### `map`
713    ///  Emitted when @widget is going to be mapped.
714    ///
715    /// A widget is mapped when the widget is visible (which is controlled with
716    /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
717    /// are also visible.
718    ///
719    /// The `::map` signal can be used to determine whether a widget will be drawn,
720    /// for instance it can resume an animation that was stopped during the
721    /// emission of [`unmap`][struct@crate::Widget#unmap].
722    ///
723    ///
724    ///
725    ///
726    /// #### `mnemonic-activate`
727    ///  Emitted when a widget is activated via a mnemonic.
728    ///
729    /// The default handler for this signal activates @widget if @group_cycling
730    /// is false, or just makes @widget grab focus if @group_cycling is true.
731    ///
732    ///
733    ///
734    ///
735    /// #### `move-focus`
736    ///  Emitted when the focus is moved.
737    ///
738    /// The `::move-focus` signal is a [keybinding signal](class.SignalAction.html).
739    ///
740    /// The default bindings for this signal are <kbd>Tab</kbd> to move forward,
741    /// and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move backward.
742    ///
743    /// Action
744    ///
745    ///
746    /// #### `query-tooltip`
747    ///  Emitted when the widget’s tooltip is about to be shown.
748    ///
749    /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
750    /// is true and the hover timeout has expired with the cursor hovering
751    /// above @widget; or emitted when @widget got focus in keyboard mode.
752    ///
753    /// Using the given coordinates, the signal handler should determine
754    /// whether a tooltip should be shown for @widget. If this is the case
755    /// true should be returned, false otherwise. Note that if @keyboard_mode
756    /// is true, the values of @x and @y are undefined and should not be used.
757    ///
758    /// The signal handler is free to manipulate @tooltip with the therefore
759    /// destined function calls.
760    ///
761    ///
762    ///
763    ///
764    /// #### `realize`
765    ///  Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
766    ///
767    /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
768    /// or the widget has been mapped (that is, it is going to be drawn).
769    ///
770    ///
771    ///
772    ///
773    /// #### `show`
774    ///  Emitted when @widget is shown.
775    ///
776    ///
777    ///
778    ///
779    /// #### `state-flags-changed`
780    ///  Emitted when the widget state changes.
781    ///
782    /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
783    ///
784    ///
785    ///
786    ///
787    /// #### `unmap`
788    ///  Emitted when @widget is going to be unmapped.
789    ///
790    /// A widget is unmapped when either it or any of its parents up to the
791    /// toplevel widget have been set as hidden.
792    ///
793    /// As `::unmap` indicates that a widget will not be shown any longer,
794    /// it can be used to, for example, stop an animation on the widget.
795    ///
796    ///
797    ///
798    ///
799    /// #### `unrealize`
800    ///  Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
801    ///
802    /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
803    /// or the widget has been unmapped (that is, it is going to be hidden).
804    ///
805    ///
806    /// </details>
807    /// <details><summary><h4>ActionGroup</h4></summary>
808    ///
809    ///
810    /// #### `action-added`
811    ///  Signals that a new action was just added to the group.
812    ///
813    /// This signal is emitted after the action has been added
814    /// and is now visible.
815    ///
816    /// Detailed
817    ///
818    ///
819    /// #### `action-enabled-changed`
820    ///  Signals that the enabled status of the named action has changed.
821    ///
822    /// Detailed
823    ///
824    ///
825    /// #### `action-removed`
826    ///  Signals that an action is just about to be removed from the group.
827    ///
828    /// This signal is emitted before the action is removed, so the action
829    /// is still visible and can be queried from the signal handler.
830    ///
831    /// Detailed
832    ///
833    ///
834    /// #### `action-state-changed`
835    ///  Signals that the state of the named action has changed.
836    ///
837    /// Detailed
838    /// </details>
839    ///
840    /// # Implements
841    ///
842    /// [`ApplicationWindowExt`][trait@crate::prelude::ApplicationWindowExt], [`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], [`trait@gio::prelude::ActionGroupExt`], [`trait@gio::prelude::ActionMapExt`], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
843    #[doc(alias = "GtkApplicationWindow")]
844    pub struct ApplicationWindow(Object<ffi::GtkApplicationWindow, ffi::GtkApplicationWindowClass>) @extends Window, Widget, @implements Accessible, Buildable, ConstraintTarget, Native, Root, ShortcutManager, gio::ActionGroup, gio::ActionMap;
845
846    match fn {
847        type_ => || ffi::gtk_application_window_get_type(),
848    }
849}
850
851impl ApplicationWindow {
852    pub const NONE: Option<&'static ApplicationWindow> = None;
853
854    /// Creates a new [`ApplicationWindow`][crate::ApplicationWindow].
855    /// ## `application`
856    /// an application
857    ///
858    /// # Returns
859    ///
860    /// a newly created [`ApplicationWindow`][crate::ApplicationWindow]
861    #[doc(alias = "gtk_application_window_new")]
862    pub fn new(application: &impl IsA<Application>) -> ApplicationWindow {
863        skip_assert_initialized!();
864        unsafe {
865            Widget::from_glib_none(ffi::gtk_application_window_new(
866                application.as_ref().to_glib_none().0,
867            ))
868            .unsafe_cast()
869        }
870    }
871
872    // rustdoc-stripper-ignore-next
873    /// Creates a new builder-pattern struct instance to construct [`ApplicationWindow`] objects.
874    ///
875    /// This method returns an instance of [`ApplicationWindowBuilder`](crate::builders::ApplicationWindowBuilder) which can be used to create [`ApplicationWindow`] objects.
876    pub fn builder() -> ApplicationWindowBuilder {
877        ApplicationWindowBuilder::new()
878    }
879}
880
881impl Default for ApplicationWindow {
882    fn default() -> Self {
883        glib::object::Object::new::<Self>()
884    }
885}
886
887// rustdoc-stripper-ignore-next
888/// A [builder-pattern] type to construct [`ApplicationWindow`] objects.
889///
890/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
891#[must_use = "The builder must be built to be used"]
892pub struct ApplicationWindowBuilder {
893    builder: glib::object::ObjectBuilder<'static, ApplicationWindow>,
894}
895
896impl ApplicationWindowBuilder {
897    fn new() -> Self {
898        Self {
899            builder: glib::object::Object::builder(),
900        }
901    }
902
903    /// If this property is true, the window will display a menubar
904    /// unless it is shown by the desktop shell.
905    ///
906    /// See [`GtkApplicationExt::set_menubar()`][crate::prelude::GtkApplicationExt::set_menubar()].
907    ///
908    /// If false, the window will not display a menubar, regardless
909    /// of whether the desktop shell is showing it or not.
910    pub fn show_menubar(self, show_menubar: bool) -> Self {
911        Self {
912            builder: self.builder.property("show-menubar", show_menubar),
913        }
914    }
915
916    /// The [`Application`][crate::Application] associated with the window.
917    ///
918    /// The application will be kept alive for at least as long as it
919    /// has any windows associated with it (see g_application_hold()
920    /// for a way to keep it alive without windows).
921    ///
922    /// Normally, the connection between the application and the window
923    /// will remain until the window is destroyed, but you can explicitly
924    /// remove it by setting the this property to `NULL`.
925    pub fn application(self, application: &impl IsA<Application>) -> Self {
926        Self {
927            builder: self
928                .builder
929                .property("application", application.clone().upcast()),
930        }
931    }
932
933    /// The child widget.
934    pub fn child(self, child: &impl IsA<Widget>) -> Self {
935        Self {
936            builder: self.builder.property("child", child.clone().upcast()),
937        }
938    }
939
940    /// Whether the window should have a frame (also known as *decorations*).
941    pub fn decorated(self, decorated: bool) -> Self {
942        Self {
943            builder: self.builder.property("decorated", decorated),
944        }
945    }
946
947    /// The default height of the window.
948    pub fn default_height(self, default_height: i32) -> Self {
949        Self {
950            builder: self.builder.property("default-height", default_height),
951        }
952    }
953
954    /// The default widget.
955    pub fn default_widget(self, default_widget: &impl IsA<Widget>) -> Self {
956        Self {
957            builder: self
958                .builder
959                .property("default-widget", default_widget.clone().upcast()),
960        }
961    }
962
963    /// The default width of the window.
964    pub fn default_width(self, default_width: i32) -> Self {
965        Self {
966            builder: self.builder.property("default-width", default_width),
967        }
968    }
969
970    /// Whether the window frame should have a close button.
971    pub fn deletable(self, deletable: bool) -> Self {
972        Self {
973            builder: self.builder.property("deletable", deletable),
974        }
975    }
976
977    /// If this window should be destroyed when the parent is destroyed.
978    pub fn destroy_with_parent(self, destroy_with_parent: bool) -> Self {
979        Self {
980            builder: self
981                .builder
982                .property("destroy-with-parent", destroy_with_parent),
983        }
984    }
985
986    /// The display that will display this window.
987    pub fn display(self, display: &impl IsA<gdk::Display>) -> Self {
988        Self {
989            builder: self.builder.property("display", display.clone().upcast()),
990        }
991    }
992
993    /// Whether 'focus rectangles' are currently visible in this window.
994    ///
995    /// This property is maintained by GTK based on user input
996    /// and should not be set by applications.
997    pub fn focus_visible(self, focus_visible: bool) -> Self {
998        Self {
999            builder: self.builder.property("focus-visible", focus_visible),
1000        }
1001    }
1002
1003    /// The focus widget.
1004    pub fn focus_widget(self, focus_widget: &impl IsA<Widget>) -> Self {
1005        Self {
1006            builder: self
1007                .builder
1008                .property("focus-widget", focus_widget.clone().upcast()),
1009        }
1010    }
1011
1012    /// Whether the window is fullscreen.
1013    ///
1014    /// Setting this property is the equivalent of calling
1015    /// [`GtkWindowExt::fullscreen()`][crate::prelude::GtkWindowExt::fullscreen()] or [`GtkWindowExt::unfullscreen()`][crate::prelude::GtkWindowExt::unfullscreen()];
1016    /// either operation is asynchronous, which means you will need to
1017    /// connect to the ::notify signal in order to know whether the
1018    /// operation was successful.
1019    pub fn fullscreened(self, fullscreened: bool) -> Self {
1020        Self {
1021            builder: self.builder.property("fullscreened", fullscreened),
1022        }
1023    }
1024
1025    /// The gravity to use when resizing the window programmatically.
1026    ///
1027    /// Gravity describes which point of the window we want to keep
1028    /// fixed (meaning that the window will grow in the opposite direction).
1029    /// For example, a gravity of `GTK_WINDOW_GRAVITY_TOP_RIGHT` means that we
1030    /// want the to fix top right corner of the window.
1031    #[cfg(feature = "v4_20")]
1032    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
1033    pub fn gravity(self, gravity: WindowGravity) -> Self {
1034        Self {
1035            builder: self.builder.property("gravity", gravity),
1036        }
1037    }
1038
1039    /// Whether the window frame should handle <kbd>F10</kbd> for activating
1040    /// menubars.
1041    #[cfg(feature = "v4_2")]
1042    #[cfg_attr(docsrs, doc(cfg(feature = "v4_2")))]
1043    pub fn handle_menubar_accel(self, handle_menubar_accel: bool) -> Self {
1044        Self {
1045            builder: self
1046                .builder
1047                .property("handle-menubar-accel", handle_menubar_accel),
1048        }
1049    }
1050
1051    /// If this window should be hidden instead of destroyed when the user clicks
1052    /// the close button.
1053    pub fn hide_on_close(self, hide_on_close: bool) -> Self {
1054        Self {
1055            builder: self.builder.property("hide-on-close", hide_on_close),
1056        }
1057    }
1058
1059    /// Specifies the name of the themed icon to use as the window icon.
1060    ///
1061    /// See [`IconTheme`][crate::IconTheme] for more details.
1062    pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
1063        Self {
1064            builder: self.builder.property("icon-name", icon_name.into()),
1065        }
1066    }
1067
1068    /// Whether the window is maximized.
1069    ///
1070    /// Setting this property is the equivalent of calling
1071    /// [`GtkWindowExt::maximize()`][crate::prelude::GtkWindowExt::maximize()] or [`GtkWindowExt::unmaximize()`][crate::prelude::GtkWindowExt::unmaximize()];
1072    /// either operation is asynchronous, which means you will need to
1073    /// connect to the ::notify signal in order to know whether the
1074    /// operation was successful.
1075    pub fn maximized(self, maximized: bool) -> Self {
1076        Self {
1077            builder: self.builder.property("maximized", maximized),
1078        }
1079    }
1080
1081    /// Whether mnemonics are currently visible in this window.
1082    ///
1083    /// This property is maintained by GTK based on user input,
1084    /// and should not be set by applications.
1085    pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self {
1086        Self {
1087            builder: self
1088                .builder
1089                .property("mnemonics-visible", mnemonics_visible),
1090        }
1091    }
1092
1093    /// If true, the window is modal.
1094    pub fn modal(self, modal: bool) -> Self {
1095        Self {
1096            builder: self.builder.property("modal", modal),
1097        }
1098    }
1099
1100    /// If true, users can resize the window.
1101    pub fn resizable(self, resizable: bool) -> Self {
1102        Self {
1103            builder: self.builder.property("resizable", resizable),
1104        }
1105    }
1106
1107    /// A write-only property for setting window's startup notification identifier.
1108    pub fn startup_id(self, startup_id: impl Into<glib::GString>) -> Self {
1109        Self {
1110            builder: self.builder.property("startup-id", startup_id.into()),
1111        }
1112    }
1113
1114    /// The title of the window.
1115    pub fn title(self, title: impl Into<glib::GString>) -> Self {
1116        Self {
1117            builder: self.builder.property("title", title.into()),
1118        }
1119    }
1120
1121    /// The titlebar widget.
1122    #[cfg(feature = "v4_6")]
1123    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
1124    pub fn titlebar(self, titlebar: &impl IsA<Widget>) -> Self {
1125        Self {
1126            builder: self.builder.property("titlebar", titlebar.clone().upcast()),
1127        }
1128    }
1129
1130    /// The transient parent of the window.
1131    pub fn transient_for(self, transient_for: &impl IsA<Window>) -> Self {
1132        Self {
1133            builder: self
1134                .builder
1135                .property("transient-for", transient_for.clone().upcast()),
1136        }
1137    }
1138
1139    /// Whether the widget or any of its descendents can accept
1140    /// the input focus.
1141    ///
1142    /// This property is meant to be set by widget implementations,
1143    /// typically in their instance init function.
1144    pub fn can_focus(self, can_focus: bool) -> Self {
1145        Self {
1146            builder: self.builder.property("can-focus", can_focus),
1147        }
1148    }
1149
1150    /// Whether the widget can receive pointer events.
1151    pub fn can_target(self, can_target: bool) -> Self {
1152        Self {
1153            builder: self.builder.property("can-target", can_target),
1154        }
1155    }
1156
1157    /// A list of css classes applied to this widget.
1158    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1159        Self {
1160            builder: self.builder.property("css-classes", css_classes.into()),
1161        }
1162    }
1163
1164    /// The name of this widget in the CSS tree.
1165    ///
1166    /// This property is meant to be set by widget implementations,
1167    /// typically in their instance init function.
1168    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1169        Self {
1170            builder: self.builder.property("css-name", css_name.into()),
1171        }
1172    }
1173
1174    /// The cursor used by @widget.
1175    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1176        Self {
1177            builder: self.builder.property("cursor", cursor.clone()),
1178        }
1179    }
1180
1181    /// Whether the widget should grab focus when it is clicked with the mouse.
1182    ///
1183    /// This property is only relevant for widgets that can take focus.
1184    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1185        Self {
1186            builder: self.builder.property("focus-on-click", focus_on_click),
1187        }
1188    }
1189
1190    /// Whether this widget itself will accept the input focus.
1191    pub fn focusable(self, focusable: bool) -> Self {
1192        Self {
1193            builder: self.builder.property("focusable", focusable),
1194        }
1195    }
1196
1197    /// How to distribute horizontal space if widget gets extra space.
1198    pub fn halign(self, halign: Align) -> Self {
1199        Self {
1200            builder: self.builder.property("halign", halign),
1201        }
1202    }
1203
1204    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1205    /// signal on @widget.
1206    ///
1207    /// A true value indicates that @widget can have a tooltip, in this case
1208    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1209    /// determine whether it will provide a tooltip or not.
1210    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1211        Self {
1212            builder: self.builder.property("has-tooltip", has_tooltip),
1213        }
1214    }
1215
1216    /// Overrides for height request of the widget.
1217    ///
1218    /// If this is -1, the natural request will be used.
1219    pub fn height_request(self, height_request: i32) -> Self {
1220        Self {
1221            builder: self.builder.property("height-request", height_request),
1222        }
1223    }
1224
1225    /// Whether to expand horizontally.
1226    pub fn hexpand(self, hexpand: bool) -> Self {
1227        Self {
1228            builder: self.builder.property("hexpand", hexpand),
1229        }
1230    }
1231
1232    /// Whether to use the `hexpand` property.
1233    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1234        Self {
1235            builder: self.builder.property("hexpand-set", hexpand_set),
1236        }
1237    }
1238
1239    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1240    /// the preferred size of the widget, and allocate its children.
1241    ///
1242    /// This property is meant to be set by widget implementations,
1243    /// typically in their instance init function.
1244    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1245        Self {
1246            builder: self
1247                .builder
1248                .property("layout-manager", layout_manager.clone().upcast()),
1249        }
1250    }
1251
1252    /// Makes this widget act like a modal dialog, with respect to
1253    /// event delivery.
1254    ///
1255    /// Global event controllers will not handle events with targets
1256    /// inside the widget, unless they are set up to ignore propagation
1257    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1258    #[cfg(feature = "v4_18")]
1259    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1260    pub fn limit_events(self, limit_events: bool) -> Self {
1261        Self {
1262            builder: self.builder.property("limit-events", limit_events),
1263        }
1264    }
1265
1266    /// Margin on bottom side of widget.
1267    ///
1268    /// This property adds margin outside of the widget's normal size
1269    /// request, the margin will be added in addition to the size from
1270    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1271    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1272        Self {
1273            builder: self.builder.property("margin-bottom", margin_bottom),
1274        }
1275    }
1276
1277    /// Margin on end of widget, horizontally.
1278    ///
1279    /// This property supports left-to-right and right-to-left text
1280    /// directions.
1281    ///
1282    /// This property adds margin outside of the widget's normal size
1283    /// request, the margin will be added in addition to the size from
1284    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1285    pub fn margin_end(self, margin_end: i32) -> Self {
1286        Self {
1287            builder: self.builder.property("margin-end", margin_end),
1288        }
1289    }
1290
1291    /// Margin on start of widget, horizontally.
1292    ///
1293    /// This property supports left-to-right and right-to-left text
1294    /// directions.
1295    ///
1296    /// This property adds margin outside of the widget's normal size
1297    /// request, the margin will be added in addition to the size from
1298    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1299    pub fn margin_start(self, margin_start: i32) -> Self {
1300        Self {
1301            builder: self.builder.property("margin-start", margin_start),
1302        }
1303    }
1304
1305    /// Margin on top side of widget.
1306    ///
1307    /// This property adds margin outside of the widget's normal size
1308    /// request, the margin will be added in addition to the size from
1309    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1310    pub fn margin_top(self, margin_top: i32) -> Self {
1311        Self {
1312            builder: self.builder.property("margin-top", margin_top),
1313        }
1314    }
1315
1316    /// The name of the widget.
1317    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1318        Self {
1319            builder: self.builder.property("name", name.into()),
1320        }
1321    }
1322
1323    /// The requested opacity of the widget.
1324    pub fn opacity(self, opacity: f64) -> Self {
1325        Self {
1326            builder: self.builder.property("opacity", opacity),
1327        }
1328    }
1329
1330    /// How content outside the widget's content area is treated.
1331    ///
1332    /// This property is meant to be set by widget implementations,
1333    /// typically in their instance init function.
1334    pub fn overflow(self, overflow: Overflow) -> Self {
1335        Self {
1336            builder: self.builder.property("overflow", overflow),
1337        }
1338    }
1339
1340    /// Whether the widget will receive the default action when it is focused.
1341    pub fn receives_default(self, receives_default: bool) -> Self {
1342        Self {
1343            builder: self.builder.property("receives-default", receives_default),
1344        }
1345    }
1346
1347    /// Whether the widget responds to input.
1348    pub fn sensitive(self, sensitive: bool) -> Self {
1349        Self {
1350            builder: self.builder.property("sensitive", sensitive),
1351        }
1352    }
1353
1354    /// Sets the text of tooltip to be the given string, which is marked up
1355    /// with Pango markup.
1356    ///
1357    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1358    ///
1359    /// This is a convenience property which will take care of getting the
1360    /// tooltip shown if the given string is not `NULL`:
1361    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1362    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1363    /// the default signal handler.
1364    ///
1365    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1366    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1367    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1368        Self {
1369            builder: self
1370                .builder
1371                .property("tooltip-markup", tooltip_markup.into()),
1372        }
1373    }
1374
1375    /// Sets the text of tooltip to be the given string.
1376    ///
1377    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1378    ///
1379    /// This is a convenience property which will take care of getting the
1380    /// tooltip shown if the given string is not `NULL`:
1381    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1382    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1383    /// the default signal handler.
1384    ///
1385    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1386    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1387    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1388        Self {
1389            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1390        }
1391    }
1392
1393    /// How to distribute vertical space if widget gets extra space.
1394    pub fn valign(self, valign: Align) -> Self {
1395        Self {
1396            builder: self.builder.property("valign", valign),
1397        }
1398    }
1399
1400    /// Whether to expand vertically.
1401    pub fn vexpand(self, vexpand: bool) -> Self {
1402        Self {
1403            builder: self.builder.property("vexpand", vexpand),
1404        }
1405    }
1406
1407    /// Whether to use the `vexpand` property.
1408    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1409        Self {
1410            builder: self.builder.property("vexpand-set", vexpand_set),
1411        }
1412    }
1413
1414    /// Whether the widget is visible.
1415    pub fn visible(self, visible: bool) -> Self {
1416        Self {
1417            builder: self.builder.property("visible", visible),
1418        }
1419    }
1420
1421    /// Overrides for width request of the widget.
1422    ///
1423    /// If this is -1, the natural request will be used.
1424    pub fn width_request(self, width_request: i32) -> Self {
1425        Self {
1426            builder: self.builder.property("width-request", width_request),
1427        }
1428    }
1429
1430    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1431    ///
1432    /// The accessible role cannot be changed once set.
1433    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1434        Self {
1435            builder: self.builder.property("accessible-role", accessible_role),
1436        }
1437    }
1438
1439    // rustdoc-stripper-ignore-next
1440    /// Build the [`ApplicationWindow`].
1441    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1442    pub fn build(self) -> ApplicationWindow {
1443        assert_initialized_main_thread!();
1444        self.builder.build()
1445    }
1446}
1447
1448/// Trait containing all [`struct@ApplicationWindow`] methods.
1449///
1450/// # Implementors
1451///
1452/// [`ApplicationWindow`][struct@crate::ApplicationWindow]
1453pub trait ApplicationWindowExt: IsA<ApplicationWindow> + 'static {
1454    /// Gets the [`ShortcutsWindow`][crate::ShortcutsWindow] that is associated with @self.
1455    ///
1456    /// See [`set_help_overlay()`][Self::set_help_overlay()].
1457    ///
1458    /// # Deprecated since 4.18
1459    ///
1460    /// [`ShortcutsWindow`][crate::ShortcutsWindow] will be removed in GTK 5
1461    ///
1462    /// # Returns
1463    ///
1464    /// the help overlay associated
1465    ///   with the window
1466    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1467    #[allow(deprecated)]
1468    #[doc(alias = "gtk_application_window_get_help_overlay")]
1469    #[doc(alias = "get_help_overlay")]
1470    fn help_overlay(&self) -> Option<ShortcutsWindow> {
1471        unsafe {
1472            from_glib_none(ffi::gtk_application_window_get_help_overlay(
1473                self.as_ref().to_glib_none().0,
1474            ))
1475        }
1476    }
1477
1478    /// Returns the unique ID of the window.
1479    ///
1480    ///  If the window has not yet been added to a [`Application`][crate::Application], returns `0`.
1481    ///
1482    /// # Returns
1483    ///
1484    /// the unique ID for the window, or `0` if the window
1485    ///   has not yet been added to an application
1486    #[doc(alias = "gtk_application_window_get_id")]
1487    #[doc(alias = "get_id")]
1488    fn id(&self) -> u32 {
1489        unsafe { ffi::gtk_application_window_get_id(self.as_ref().to_glib_none().0) }
1490    }
1491
1492    /// Returns whether the window will display a menubar for the app menu
1493    /// and menubar as needed.
1494    ///
1495    /// # Returns
1496    ///
1497    /// True if the window will display a menubar when needed
1498    #[doc(alias = "gtk_application_window_get_show_menubar")]
1499    #[doc(alias = "get_show_menubar")]
1500    #[doc(alias = "show-menubar")]
1501    fn shows_menubar(&self) -> bool {
1502        unsafe {
1503            from_glib(ffi::gtk_application_window_get_show_menubar(
1504                self.as_ref().to_glib_none().0,
1505            ))
1506        }
1507    }
1508
1509    /// Associates a shortcuts window with the application window.
1510    ///
1511    /// Additionally, sets up an action with the name
1512    /// `win.show-help-overlay` to present it.
1513    ///
1514    /// The window takes responsibility for destroying the help overlay.
1515    ///
1516    /// # Deprecated since 4.18
1517    ///
1518    /// [`ShortcutsWindow`][crate::ShortcutsWindow] will be removed in GTK 5
1519    /// ## `help_overlay`
1520    /// a shortcuts window
1521    #[cfg_attr(feature = "v4_18", deprecated = "Since 4.18")]
1522    #[allow(deprecated)]
1523    #[doc(alias = "gtk_application_window_set_help_overlay")]
1524    fn set_help_overlay(&self, help_overlay: Option<&ShortcutsWindow>) {
1525        unsafe {
1526            ffi::gtk_application_window_set_help_overlay(
1527                self.as_ref().to_glib_none().0,
1528                help_overlay.to_glib_none().0,
1529            );
1530        }
1531    }
1532
1533    /// Sets whether the window will display a menubar for the app menu
1534    /// and menubar as needed.
1535    /// ## `show_menubar`
1536    /// whether to show a menubar when needed
1537    #[doc(alias = "gtk_application_window_set_show_menubar")]
1538    #[doc(alias = "show-menubar")]
1539    fn set_show_menubar(&self, show_menubar: bool) {
1540        unsafe {
1541            ffi::gtk_application_window_set_show_menubar(
1542                self.as_ref().to_glib_none().0,
1543                show_menubar.into_glib(),
1544            );
1545        }
1546    }
1547
1548    /// The handler for this signal should persist any application-specific
1549    /// state of @window into @dict.
1550    ///
1551    /// Note that window management state such as maximized, fullscreen,
1552    /// or window size should not be saved as part of this. They are handled
1553    /// by GTK.
1554    ///
1555    /// See [`restore-window`][struct@crate::Application#restore-window].
1556    /// ## `dict`
1557    /// a dictionary to populate with application window state
1558    ///
1559    /// # Returns
1560    ///
1561    /// true to stop stop further handlers from running
1562    #[cfg(feature = "v4_24")]
1563    #[cfg_attr(docsrs, doc(cfg(feature = "v4_24")))]
1564    #[doc(alias = "save-state")]
1565    fn connect_save_state<F: Fn(&Self, &glib::VariantDict) -> bool + 'static>(
1566        &self,
1567        f: F,
1568    ) -> SignalHandlerId {
1569        unsafe extern "C" fn save_state_trampoline<
1570            P: IsA<ApplicationWindow>,
1571            F: Fn(&P, &glib::VariantDict) -> bool + 'static,
1572        >(
1573            this: *mut ffi::GtkApplicationWindow,
1574            dict: *mut glib::ffi::GVariantDict,
1575            f: glib::ffi::gpointer,
1576        ) -> glib::ffi::gboolean {
1577            unsafe {
1578                let f: &F = &*(f as *const F);
1579                f(
1580                    ApplicationWindow::from_glib_borrow(this).unsafe_cast_ref(),
1581                    &from_glib_borrow(dict),
1582                )
1583                .into_glib()
1584            }
1585        }
1586        unsafe {
1587            let f: Box_<F> = Box_::new(f);
1588            connect_raw(
1589                self.as_ptr() as *mut _,
1590                c"save-state".as_ptr(),
1591                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1592                    save_state_trampoline::<Self, F> as *const (),
1593                )),
1594                Box_::into_raw(f),
1595            )
1596        }
1597    }
1598
1599    #[doc(alias = "show-menubar")]
1600    fn connect_show_menubar_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1601        unsafe extern "C" fn notify_show_menubar_trampoline<
1602            P: IsA<ApplicationWindow>,
1603            F: Fn(&P) + 'static,
1604        >(
1605            this: *mut ffi::GtkApplicationWindow,
1606            _param_spec: glib::ffi::gpointer,
1607            f: glib::ffi::gpointer,
1608        ) {
1609            unsafe {
1610                let f: &F = &*(f as *const F);
1611                f(ApplicationWindow::from_glib_borrow(this).unsafe_cast_ref())
1612            }
1613        }
1614        unsafe {
1615            let f: Box_<F> = Box_::new(f);
1616            connect_raw(
1617                self.as_ptr() as *mut _,
1618                c"notify::show-menubar".as_ptr(),
1619                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1620                    notify_show_menubar_trampoline::<Self, F> as *const (),
1621                )),
1622                Box_::into_raw(f),
1623            )
1624        }
1625    }
1626}
1627
1628impl<O: IsA<ApplicationWindow>> ApplicationWindowExt for O {}