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