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