libadwaita/auto/window.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from
3// from gir-files (https://github.com/gtk-rs/gir-files.git)
4// DO NOT EDIT
5
6#[cfg(feature = "v1_4")]
7#[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
8use crate::Breakpoint;
9#[cfg(feature = "v1_5")]
10#[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
11use crate::Dialog;
12use crate::ffi;
13use glib::{
14 prelude::*,
15 signal::{SignalHandlerId, connect_raw},
16 translate::*,
17};
18use std::boxed::Box as Box_;
19
20glib::wrapper! {
21 /// A freeform window.
22 ///
23 /// <picture>
24 /// <source srcset="window-dark.png" media="(prefers-color-scheme: dark)">
25 /// <img src="window.png" alt="window">
26 /// </picture>
27 ///
28 /// The [`Window`][crate::Window] widget is a subclass of [`gtk::Window`][crate::gtk::Window] which has no
29 /// titlebar area. Instead, [`ToolbarView`][crate::ToolbarView] can be used together with
30 /// [`HeaderBar`][crate::HeaderBar] or [`gtk::HeaderBar`][crate::gtk::HeaderBar] as follows:
31 ///
32 /// ```xml
33 /// <object class="AdwWindow">
34 /// <property name="content">
35 /// <object class="AdwToolbarView">
36 /// <child type="top">
37 /// <object class="AdwHeaderBar"/>
38 /// </child>
39 /// <property name="content">
40 /// <!-- ... -->
41 /// </property>
42 /// </object>
43 /// </property>
44 /// </object>
45 /// ```
46 ///
47 /// Using [`titlebar`][struct@crate::gtk::Window#titlebar] or [`child`][struct@crate::gtk::Window#child]
48 /// is not supported and will result in a crash. Use [`content`][struct@crate::Window#content]
49 /// instead.
50 ///
51 /// ## Dialogs
52 ///
53 /// [`Window`][crate::Window] can contain [`Dialog`][crate::Dialog]. Use [`AdwDialogExt::present()`][crate::prelude::AdwDialogExt::present()] with the
54 /// window or a widget within a window to show a dialog.
55 ///
56 /// ## Breakpoints
57 ///
58 /// [`Window`][crate::Window] can be used with [`Breakpoint`][crate::Breakpoint] the same way as
59 /// [`BreakpointBin`][crate::BreakpointBin]. Refer to that widget's documentation for details.
60 ///
61 /// Example:
62 ///
63 /// ```xml
64 /// <object class="AdwWindow">
65 /// <property name="content">
66 /// <object class="AdwToolbarView">
67 /// <child type="top">
68 /// <object class="AdwHeaderBar"/>
69 /// </child>
70 /// <property name="content">
71 /// <!-- ... -->
72 /// </property>
73 /// <child type="bottom">
74 /// <object class="GtkActionBar" id="bottom_bar">
75 /// <property name="revealed">True</property>
76 /// <property name="visible">False</property>
77 /// </object>
78 /// </child>
79 /// </object>
80 /// </property>
81 /// <child>
82 /// <object class="AdwBreakpoint">
83 /// <condition>max-width: 500px</condition>
84 /// <setter object="bottom_bar" property="visible">True</setter>
85 /// </object>
86 /// </child>
87 /// </object>
88 /// ```
89 ///
90 /// When breakpoints are used, the minimum size must be larger than the smallest
91 /// UI state. [`Window`][crate::Window] defaults to the minimum size of 360×200 px. If that's
92 /// too small, set the [`width-request`][struct@crate::gtk::Widget#width-request] and
93 /// [`height-request`][struct@crate::gtk::Widget#height-request] properties manually.
94 ///
95 /// ## Adaptive Preview
96 ///
97 /// [`Window`][crate::Window] has a debug tool called adaptive preview. It can be opened from
98 /// GTK Inspector or by pressing <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>M</kbd>,
99 /// and controlled via the [`adaptive-preview`][struct@crate::Window#adaptive-preview] property.
100 ///
101 /// ## Properties
102 ///
103 ///
104 /// #### `adaptive-preview`
105 /// Whether adaptive preview is currently open.
106 ///
107 /// Adaptive preview is a debugging tool used for testing the window
108 /// contents at specific screen sizes, simulating mobile environment.
109 ///
110 /// Adaptive preview can always be accessed from inspector. This function
111 /// allows applications to open it manually.
112 ///
113 /// Most applications should not use this property.
114 ///
115 /// Readable | Writeable
116 ///
117 ///
118 /// #### `content`
119 /// The content widget.
120 ///
121 /// This property should always be used instead of [`child`][struct@crate::gtk::Window#child].
122 ///
123 /// Readable | Writeable
124 ///
125 ///
126 /// #### `current-breakpoint`
127 /// The current breakpoint.
128 ///
129 /// Readable
130 ///
131 ///
132 /// #### `dialogs`
133 /// The open dialogs.
134 ///
135 /// Readable
136 ///
137 ///
138 /// #### `visible-dialog`
139 /// The currently visible dialog
140 ///
141 /// Readable
142 /// <details><summary><h4>Window</h4></summary>
143 ///
144 ///
145 /// #### `application`
146 /// The [`gtk::Application`][crate::gtk::Application] associated with the window.
147 ///
148 /// The application will be kept alive for at least as long as it
149 /// has any windows associated with it (see g_application_hold()
150 /// for a way to keep it alive without windows).
151 ///
152 /// Normally, the connection between the application and the window
153 /// will remain until the window is destroyed, but you can explicitly
154 /// remove it by setting the this property to `NULL`.
155 ///
156 /// Readable | Writeable
157 ///
158 ///
159 /// #### `child`
160 /// The child widget.
161 ///
162 /// Readable | Writeable
163 ///
164 ///
165 /// #### `decorated`
166 /// Whether the window should have a frame (also known as *decorations*).
167 ///
168 /// Readable | Writeable
169 ///
170 ///
171 /// #### `default-height`
172 /// The default height of the window.
173 ///
174 /// Readable | Writeable
175 ///
176 ///
177 /// #### `default-widget`
178 /// The default widget.
179 ///
180 /// Readable | Writeable
181 ///
182 ///
183 /// #### `default-width`
184 /// The default width of the window.
185 ///
186 /// Readable | Writeable
187 ///
188 ///
189 /// #### `deletable`
190 /// Whether the window frame should have a close button.
191 ///
192 /// Readable | Writeable
193 ///
194 ///
195 /// #### `destroy-with-parent`
196 /// If this window should be destroyed when the parent is destroyed.
197 ///
198 /// Readable | Writeable
199 ///
200 ///
201 /// #### `display`
202 /// The display that will display this window.
203 ///
204 /// Readable | Writeable
205 ///
206 ///
207 /// #### `focus-visible`
208 /// Whether 'focus rectangles' are currently visible in this window.
209 ///
210 /// This property is maintained by GTK based on user input
211 /// and should not be set by applications.
212 ///
213 /// Readable | Writeable
214 ///
215 ///
216 /// #### `focus-widget`
217 /// The focus widget.
218 ///
219 /// Readable | Writeable
220 ///
221 ///
222 /// #### `fullscreened`
223 /// Whether the window is fullscreen.
224 ///
225 /// Setting this property is the equivalent of calling
226 /// [`GtkWindowExtManual::fullscreen()`][crate::gtk::prelude::GtkWindowExtManual::fullscreen()] or [`GtkWindowExtManual::unfullscreen()`][crate::gtk::prelude::GtkWindowExtManual::unfullscreen()];
227 /// either operation is asynchronous, which means you will need to
228 /// connect to the ::notify signal in order to know whether the
229 /// operation was successful.
230 ///
231 /// Readable | Writeable
232 ///
233 ///
234 /// #### `gravity`
235 /// The gravity to use when resizing the window programmatically.
236 ///
237 /// Gravity describes which point of the window we want to keep
238 /// fixed (meaning that the window will grow in the opposite direction).
239 /// For example, a gravity of `GTK_WINDOW_GRAVITY_TOP_RIGHT` means that we
240 /// want the to fix top right corner of the window.
241 ///
242 /// Readable | Writeable
243 ///
244 ///
245 /// #### `handle-menubar-accel`
246 /// Whether the window frame should handle <kbd>F10</kbd> for activating
247 /// menubars.
248 ///
249 /// Readable | Writeable
250 ///
251 ///
252 /// #### `hide-on-close`
253 /// If this window should be hidden instead of destroyed when the user clicks
254 /// the close button.
255 ///
256 /// Readable | Writeable
257 ///
258 ///
259 /// #### `icon-name`
260 /// Specifies the name of the themed icon to use as the window icon.
261 ///
262 /// See `Gtk::IconTheme` for more details.
263 ///
264 /// Readable | Writeable
265 ///
266 ///
267 /// #### `is-active`
268 /// Whether the toplevel is the currently active window.
269 ///
270 /// Readable
271 ///
272 ///
273 /// #### `maximized`
274 /// Whether the window is maximized.
275 ///
276 /// Setting this property is the equivalent of calling
277 /// [`GtkWindowExtManual::maximize()`][crate::gtk::prelude::GtkWindowExtManual::maximize()] or [`GtkWindowExtManual::unmaximize()`][crate::gtk::prelude::GtkWindowExtManual::unmaximize()];
278 /// either operation is asynchronous, which means you will need to
279 /// connect to the ::notify signal in order to know whether the
280 /// operation was successful.
281 ///
282 /// Readable | Writeable
283 ///
284 ///
285 /// #### `mnemonics-visible`
286 /// Whether mnemonics are currently visible in this window.
287 ///
288 /// This property is maintained by GTK based on user input,
289 /// and should not be set by applications.
290 ///
291 /// Readable | Writeable
292 ///
293 ///
294 /// #### `modal`
295 /// If true, the window is modal.
296 ///
297 /// Readable | Writeable
298 ///
299 ///
300 /// #### `resizable`
301 /// If true, users can resize the window.
302 ///
303 /// Readable | Writeable
304 ///
305 ///
306 /// #### `startup-id`
307 /// A write-only property for setting window's startup notification identifier.
308 ///
309 /// Writeable
310 ///
311 ///
312 /// #### `suspended`
313 /// Whether the window is suspended.
314 ///
315 /// See [`GtkWindowExtManual::is_suspended()`][crate::gtk::prelude::GtkWindowExtManual::is_suspended()] for details about what suspended means.
316 ///
317 /// Readable
318 ///
319 ///
320 /// #### `title`
321 /// The title of the window.
322 ///
323 /// Readable | Writeable
324 ///
325 ///
326 /// #### `titlebar`
327 /// The titlebar widget.
328 ///
329 /// Readable | Writeable
330 ///
331 ///
332 /// #### `transient-for`
333 /// The transient parent of the window.
334 ///
335 /// Readable | Writeable | Construct
336 /// </details>
337 /// <details><summary><h4>Widget</h4></summary>
338 ///
339 ///
340 /// #### `can-focus`
341 /// Whether the widget or any of its descendents can accept
342 /// the input focus.
343 ///
344 /// This property is meant to be set by widget implementations,
345 /// typically in their instance init function.
346 ///
347 /// Readable | Writeable
348 ///
349 ///
350 /// #### `can-target`
351 /// Whether the widget can receive pointer events.
352 ///
353 /// Readable | Writeable
354 ///
355 ///
356 /// #### `css-classes`
357 /// A list of css classes applied to this widget.
358 ///
359 /// Readable | Writeable
360 ///
361 ///
362 /// #### `css-name`
363 /// The name of this widget in the CSS tree.
364 ///
365 /// This property is meant to be set by widget implementations,
366 /// typically in their instance init function.
367 ///
368 /// Readable | Writeable | Construct Only
369 ///
370 ///
371 /// #### `cursor`
372 /// The cursor used by @widget.
373 ///
374 /// Readable | Writeable
375 ///
376 ///
377 /// #### `focus-on-click`
378 /// Whether the widget should grab focus when it is clicked with the mouse.
379 ///
380 /// This property is only relevant for widgets that can take focus.
381 ///
382 /// Readable | Writeable
383 ///
384 ///
385 /// #### `focusable`
386 /// Whether this widget itself will accept the input focus.
387 ///
388 /// Readable | Writeable
389 ///
390 ///
391 /// #### `halign`
392 /// How to distribute horizontal space if widget gets extra space.
393 ///
394 /// Readable | Writeable
395 ///
396 ///
397 /// #### `has-default`
398 /// Whether the widget is the default widget.
399 ///
400 /// Readable
401 ///
402 ///
403 /// #### `has-focus`
404 /// Whether the widget has the input focus.
405 ///
406 /// Readable
407 ///
408 ///
409 /// #### `has-tooltip`
410 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
411 /// signal on @widget.
412 ///
413 /// A true value indicates that @widget can have a tooltip, in this case
414 /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
415 /// determine whether it will provide a tooltip or not.
416 ///
417 /// Readable | Writeable
418 ///
419 ///
420 /// #### `height-request`
421 /// Overrides for height request of the widget.
422 ///
423 /// If this is -1, the natural request will be used.
424 ///
425 /// Readable | Writeable
426 ///
427 ///
428 /// #### `hexpand`
429 /// Whether to expand horizontally.
430 ///
431 /// Readable | Writeable
432 ///
433 ///
434 /// #### `hexpand-set`
435 /// Whether to use the `hexpand` property.
436 ///
437 /// Readable | Writeable
438 ///
439 ///
440 /// #### `layout-manager`
441 /// The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
442 /// the preferred size of the widget, and allocate its children.
443 ///
444 /// This property is meant to be set by widget implementations,
445 /// typically in their instance init function.
446 ///
447 /// Readable | Writeable
448 ///
449 ///
450 /// #### `limit-events`
451 /// Makes this widget act like a modal dialog, with respect to
452 /// event delivery.
453 ///
454 /// Global event controllers will not handle events with targets
455 /// inside the widget, unless they are set up to ignore propagation
456 /// limits. See `Gtk::EventController::set_propagation_limit()`.
457 ///
458 /// Readable | Writeable
459 ///
460 ///
461 /// #### `margin-bottom`
462 /// Margin on bottom side of widget.
463 ///
464 /// This property adds margin outside of the widget's normal size
465 /// request, the margin will be added in addition to the size from
466 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
467 ///
468 /// Readable | Writeable
469 ///
470 ///
471 /// #### `margin-end`
472 /// Margin on end of widget, horizontally.
473 ///
474 /// This property supports left-to-right and right-to-left text
475 /// directions.
476 ///
477 /// This property adds margin outside of the widget's normal size
478 /// request, the margin will be added in addition to the size from
479 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
480 ///
481 /// Readable | Writeable
482 ///
483 ///
484 /// #### `margin-start`
485 /// Margin on start of widget, horizontally.
486 ///
487 /// This property supports left-to-right and right-to-left text
488 /// directions.
489 ///
490 /// This property adds margin outside of the widget's normal size
491 /// request, the margin will be added in addition to the size from
492 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
493 ///
494 /// Readable | Writeable
495 ///
496 ///
497 /// #### `margin-top`
498 /// Margin on top side of widget.
499 ///
500 /// This property adds margin outside of the widget's normal size
501 /// request, the margin will be added in addition to the size from
502 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
503 ///
504 /// Readable | Writeable
505 ///
506 ///
507 /// #### `name`
508 /// The name of the widget.
509 ///
510 /// Readable | Writeable
511 ///
512 ///
513 /// #### `opacity`
514 /// The requested opacity of the widget.
515 ///
516 /// Readable | Writeable
517 ///
518 ///
519 /// #### `overflow`
520 /// How content outside the widget's content area is treated.
521 ///
522 /// This property is meant to be set by widget implementations,
523 /// typically in their instance init function.
524 ///
525 /// Readable | Writeable
526 ///
527 ///
528 /// #### `parent`
529 /// The parent widget of this widget.
530 ///
531 /// Readable
532 ///
533 ///
534 /// #### `receives-default`
535 /// Whether the widget will receive the default action when it is focused.
536 ///
537 /// Readable | Writeable
538 ///
539 ///
540 /// #### `root`
541 /// The [`gtk::Root`][crate::gtk::Root] widget of the widget tree containing this widget.
542 ///
543 /// This will be `NULL` if the widget is not contained in a root widget.
544 ///
545 /// Readable
546 ///
547 ///
548 /// #### `scale-factor`
549 /// The scale factor of the widget.
550 ///
551 /// Readable
552 ///
553 ///
554 /// #### `sensitive`
555 /// Whether the widget responds to input.
556 ///
557 /// Readable | Writeable
558 ///
559 ///
560 /// #### `tooltip-markup`
561 /// Sets the text of tooltip to be the given string, which is marked up
562 /// with Pango markup.
563 ///
564 /// Also see `Gtk::Tooltip::set_markup()`.
565 ///
566 /// This is a convenience property which will take care of getting the
567 /// tooltip shown if the given string is not `NULL`:
568 /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
569 /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
570 /// the default signal handler.
571 ///
572 /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
573 /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
574 ///
575 /// Readable | Writeable
576 ///
577 ///
578 /// #### `tooltip-text`
579 /// Sets the text of tooltip to be the given string.
580 ///
581 /// Also see `Gtk::Tooltip::set_text()`.
582 ///
583 /// This is a convenience property which will take care of getting the
584 /// tooltip shown if the given string is not `NULL`:
585 /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
586 /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
587 /// the default signal handler.
588 ///
589 /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
590 /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
591 ///
592 /// Readable | Writeable
593 ///
594 ///
595 /// #### `valign`
596 /// How to distribute vertical space if widget gets extra space.
597 ///
598 /// Readable | Writeable
599 ///
600 ///
601 /// #### `vexpand`
602 /// Whether to expand vertically.
603 ///
604 /// Readable | Writeable
605 ///
606 ///
607 /// #### `vexpand-set`
608 /// Whether to use the `vexpand` property.
609 ///
610 /// Readable | Writeable
611 ///
612 ///
613 /// #### `visible`
614 /// Whether the widget is visible.
615 ///
616 /// Readable | Writeable
617 ///
618 ///
619 /// #### `width-request`
620 /// Overrides for width request of the widget.
621 ///
622 /// If this is -1, the natural request will be used.
623 ///
624 /// Readable | Writeable
625 /// </details>
626 /// <details><summary><h4>Accessible</h4></summary>
627 ///
628 ///
629 /// #### `accessible-role`
630 /// The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
631 ///
632 /// The accessible role cannot be changed once set.
633 ///
634 /// Readable | Writeable
635 /// </details>
636 ///
637 /// # Implements
638 ///
639 /// [`AdwWindowExt`][trait@crate::prelude::AdwWindowExt], [`trait@gtk::prelude::GtkWindowExt`], [`trait@gtk::prelude::WidgetExt`], [`trait@glib::ObjectExt`], [`trait@gtk::prelude::AccessibleExt`], [`trait@gtk::prelude::BuildableExt`], [`trait@gtk::prelude::ConstraintTargetExt`], [`trait@gtk::prelude::NativeExt`], [`trait@gtk::prelude::RootExt`], [`trait@gtk::prelude::ShortcutManagerExt`]
640 #[doc(alias = "AdwWindow")]
641 pub struct Window(Object<ffi::AdwWindow, ffi::AdwWindowClass>) @extends gtk::Window, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Native, gtk::Root, gtk::ShortcutManager;
642
643 match fn {
644 type_ => || ffi::adw_window_get_type(),
645 }
646}
647
648impl Window {
649 pub const NONE: Option<&'static Window> = None;
650
651 /// Creates a new [`Window`][crate::Window].
652 ///
653 /// # Returns
654 ///
655 /// the newly created [`Window`][crate::Window]
656 #[doc(alias = "adw_window_new")]
657 pub fn new() -> Window {
658 assert_initialized_main_thread!();
659 unsafe { gtk::Widget::from_glib_none(ffi::adw_window_new()).unsafe_cast() }
660 }
661
662 // rustdoc-stripper-ignore-next
663 /// Creates a new builder-pattern struct instance to construct [`Window`] objects.
664 ///
665 /// This method returns an instance of [`WindowBuilder`](crate::builders::WindowBuilder) which can be used to create [`Window`] objects.
666 pub fn builder() -> WindowBuilder {
667 WindowBuilder::new()
668 }
669}
670
671impl Default for Window {
672 fn default() -> Self {
673 Self::new()
674 }
675}
676
677// rustdoc-stripper-ignore-next
678/// A [builder-pattern] type to construct [`Window`] objects.
679///
680/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
681#[must_use = "The builder must be built to be used"]
682pub struct WindowBuilder {
683 builder: glib::object::ObjectBuilder<'static, Window>,
684}
685
686impl WindowBuilder {
687 fn new() -> Self {
688 Self {
689 builder: glib::object::Object::builder(),
690 }
691 }
692
693 /// Whether adaptive preview is currently open.
694 ///
695 /// Adaptive preview is a debugging tool used for testing the window
696 /// contents at specific screen sizes, simulating mobile environment.
697 ///
698 /// Adaptive preview can always be accessed from inspector. This function
699 /// allows applications to open it manually.
700 ///
701 /// Most applications should not use this property.
702 #[cfg(feature = "v1_7")]
703 #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
704 pub fn adaptive_preview(self, adaptive_preview: bool) -> Self {
705 Self {
706 builder: self.builder.property("adaptive-preview", adaptive_preview),
707 }
708 }
709
710 /// The content widget.
711 ///
712 /// This property should always be used instead of [`child`][struct@crate::gtk::Window#child].
713 pub fn content(self, content: &impl IsA<gtk::Widget>) -> Self {
714 Self {
715 builder: self.builder.property("content", content.clone().upcast()),
716 }
717 }
718
719 /// The [`gtk::Application`][crate::gtk::Application] associated with the window.
720 ///
721 /// The application will be kept alive for at least as long as it
722 /// has any windows associated with it (see g_application_hold()
723 /// for a way to keep it alive without windows).
724 ///
725 /// Normally, the connection between the application and the window
726 /// will remain until the window is destroyed, but you can explicitly
727 /// remove it by setting the this property to `NULL`.
728 pub fn application(self, application: &impl IsA<gtk::Application>) -> Self {
729 Self {
730 builder: self
731 .builder
732 .property("application", application.clone().upcast()),
733 }
734 }
735
736 /// Whether the window should have a frame (also known as *decorations*).
737 pub fn decorated(self, decorated: bool) -> Self {
738 Self {
739 builder: self.builder.property("decorated", decorated),
740 }
741 }
742
743 /// The default height of the window.
744 pub fn default_height(self, default_height: i32) -> Self {
745 Self {
746 builder: self.builder.property("default-height", default_height),
747 }
748 }
749
750 /// The default widget.
751 pub fn default_widget(self, default_widget: &impl IsA<gtk::Widget>) -> Self {
752 Self {
753 builder: self
754 .builder
755 .property("default-widget", default_widget.clone().upcast()),
756 }
757 }
758
759 /// The default width of the window.
760 pub fn default_width(self, default_width: i32) -> Self {
761 Self {
762 builder: self.builder.property("default-width", default_width),
763 }
764 }
765
766 /// Whether the window frame should have a close button.
767 pub fn deletable(self, deletable: bool) -> Self {
768 Self {
769 builder: self.builder.property("deletable", deletable),
770 }
771 }
772
773 /// If this window should be destroyed when the parent is destroyed.
774 pub fn destroy_with_parent(self, destroy_with_parent: bool) -> Self {
775 Self {
776 builder: self
777 .builder
778 .property("destroy-with-parent", destroy_with_parent),
779 }
780 }
781
782 /// The display that will display this window.
783 pub fn display(self, display: &gdk::Display) -> Self {
784 Self {
785 builder: self.builder.property("display", display.clone()),
786 }
787 }
788
789 /// Whether 'focus rectangles' are currently visible in this window.
790 ///
791 /// This property is maintained by GTK based on user input
792 /// and should not be set by applications.
793 pub fn focus_visible(self, focus_visible: bool) -> Self {
794 Self {
795 builder: self.builder.property("focus-visible", focus_visible),
796 }
797 }
798
799 /// The focus widget.
800 pub fn focus_widget(self, focus_widget: &impl IsA<gtk::Widget>) -> Self {
801 Self {
802 builder: self
803 .builder
804 .property("focus-widget", focus_widget.clone().upcast()),
805 }
806 }
807
808 /// Whether the window is fullscreen.
809 ///
810 /// Setting this property is the equivalent of calling
811 /// [`GtkWindowExtManual::fullscreen()`][crate::gtk::prelude::GtkWindowExtManual::fullscreen()] or [`GtkWindowExtManual::unfullscreen()`][crate::gtk::prelude::GtkWindowExtManual::unfullscreen()];
812 /// either operation is asynchronous, which means you will need to
813 /// connect to the ::notify signal in order to know whether the
814 /// operation was successful.
815 pub fn fullscreened(self, fullscreened: bool) -> Self {
816 Self {
817 builder: self.builder.property("fullscreened", fullscreened),
818 }
819 }
820
821 /// The gravity to use when resizing the window programmatically.
822 ///
823 /// Gravity describes which point of the window we want to keep
824 /// fixed (meaning that the window will grow in the opposite direction).
825 /// For example, a gravity of `GTK_WINDOW_GRAVITY_TOP_RIGHT` means that we
826 /// want the to fix top right corner of the window.
827 #[cfg(feature = "gtk_v4_20")]
828 #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_20")))]
829 pub fn gravity(self, gravity: gtk::WindowGravity) -> Self {
830 Self {
831 builder: self.builder.property("gravity", gravity),
832 }
833 }
834
835 /// Whether the window frame should handle <kbd>F10</kbd> for activating
836 /// menubars.
837 #[cfg(feature = "gtk_v4_2")]
838 #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_2")))]
839 pub fn handle_menubar_accel(self, handle_menubar_accel: bool) -> Self {
840 Self {
841 builder: self
842 .builder
843 .property("handle-menubar-accel", handle_menubar_accel),
844 }
845 }
846
847 /// If this window should be hidden instead of destroyed when the user clicks
848 /// the close button.
849 pub fn hide_on_close(self, hide_on_close: bool) -> Self {
850 Self {
851 builder: self.builder.property("hide-on-close", hide_on_close),
852 }
853 }
854
855 /// Specifies the name of the themed icon to use as the window icon.
856 ///
857 /// See `Gtk::IconTheme` for more details.
858 pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
859 Self {
860 builder: self.builder.property("icon-name", icon_name.into()),
861 }
862 }
863
864 /// Whether the window is maximized.
865 ///
866 /// Setting this property is the equivalent of calling
867 /// [`GtkWindowExtManual::maximize()`][crate::gtk::prelude::GtkWindowExtManual::maximize()] or [`GtkWindowExtManual::unmaximize()`][crate::gtk::prelude::GtkWindowExtManual::unmaximize()];
868 /// either operation is asynchronous, which means you will need to
869 /// connect to the ::notify signal in order to know whether the
870 /// operation was successful.
871 pub fn maximized(self, maximized: bool) -> Self {
872 Self {
873 builder: self.builder.property("maximized", maximized),
874 }
875 }
876
877 /// Whether mnemonics are currently visible in this window.
878 ///
879 /// This property is maintained by GTK based on user input,
880 /// and should not be set by applications.
881 pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self {
882 Self {
883 builder: self
884 .builder
885 .property("mnemonics-visible", mnemonics_visible),
886 }
887 }
888
889 /// If true, the window is modal.
890 pub fn modal(self, modal: bool) -> Self {
891 Self {
892 builder: self.builder.property("modal", modal),
893 }
894 }
895
896 /// If true, users can resize the window.
897 pub fn resizable(self, resizable: bool) -> Self {
898 Self {
899 builder: self.builder.property("resizable", resizable),
900 }
901 }
902
903 /// A write-only property for setting window's startup notification identifier.
904 pub fn startup_id(self, startup_id: impl Into<glib::GString>) -> Self {
905 Self {
906 builder: self.builder.property("startup-id", startup_id.into()),
907 }
908 }
909
910 /// The title of the window.
911 pub fn title(self, title: impl Into<glib::GString>) -> Self {
912 Self {
913 builder: self.builder.property("title", title.into()),
914 }
915 }
916
917 /// The titlebar widget.
918 #[cfg(feature = "gtk_v4_6")]
919 #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_6")))]
920 pub fn titlebar(self, titlebar: &impl IsA<gtk::Widget>) -> Self {
921 Self {
922 builder: self.builder.property("titlebar", titlebar.clone().upcast()),
923 }
924 }
925
926 /// The transient parent of the window.
927 pub fn transient_for(self, transient_for: &impl IsA<gtk::Window>) -> Self {
928 Self {
929 builder: self
930 .builder
931 .property("transient-for", transient_for.clone().upcast()),
932 }
933 }
934
935 /// Whether the widget or any of its descendents can accept
936 /// the input focus.
937 ///
938 /// This property is meant to be set by widget implementations,
939 /// typically in their instance init function.
940 pub fn can_focus(self, can_focus: bool) -> Self {
941 Self {
942 builder: self.builder.property("can-focus", can_focus),
943 }
944 }
945
946 /// Whether the widget can receive pointer events.
947 pub fn can_target(self, can_target: bool) -> Self {
948 Self {
949 builder: self.builder.property("can-target", can_target),
950 }
951 }
952
953 /// A list of css classes applied to this widget.
954 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
955 Self {
956 builder: self.builder.property("css-classes", css_classes.into()),
957 }
958 }
959
960 /// The name of this widget in the CSS tree.
961 ///
962 /// This property is meant to be set by widget implementations,
963 /// typically in their instance init function.
964 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
965 Self {
966 builder: self.builder.property("css-name", css_name.into()),
967 }
968 }
969
970 /// The cursor used by @widget.
971 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
972 Self {
973 builder: self.builder.property("cursor", cursor.clone()),
974 }
975 }
976
977 /// Whether the widget should grab focus when it is clicked with the mouse.
978 ///
979 /// This property is only relevant for widgets that can take focus.
980 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
981 Self {
982 builder: self.builder.property("focus-on-click", focus_on_click),
983 }
984 }
985
986 /// Whether this widget itself will accept the input focus.
987 pub fn focusable(self, focusable: bool) -> Self {
988 Self {
989 builder: self.builder.property("focusable", focusable),
990 }
991 }
992
993 /// How to distribute horizontal space if widget gets extra space.
994 pub fn halign(self, halign: gtk::Align) -> Self {
995 Self {
996 builder: self.builder.property("halign", halign),
997 }
998 }
999
1000 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
1001 /// signal on @widget.
1002 ///
1003 /// A true value indicates that @widget can have a tooltip, in this case
1004 /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
1005 /// determine whether it will provide a tooltip or not.
1006 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1007 Self {
1008 builder: self.builder.property("has-tooltip", has_tooltip),
1009 }
1010 }
1011
1012 /// Overrides for height request of the widget.
1013 ///
1014 /// If this is -1, the natural request will be used.
1015 pub fn height_request(self, height_request: i32) -> Self {
1016 Self {
1017 builder: self.builder.property("height-request", height_request),
1018 }
1019 }
1020
1021 /// Whether to expand horizontally.
1022 pub fn hexpand(self, hexpand: bool) -> Self {
1023 Self {
1024 builder: self.builder.property("hexpand", hexpand),
1025 }
1026 }
1027
1028 /// Whether to use the `hexpand` property.
1029 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1030 Self {
1031 builder: self.builder.property("hexpand-set", hexpand_set),
1032 }
1033 }
1034
1035 /// The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
1036 /// the preferred size of the widget, and allocate its children.
1037 ///
1038 /// This property is meant to be set by widget implementations,
1039 /// typically in their instance init function.
1040 pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
1041 Self {
1042 builder: self
1043 .builder
1044 .property("layout-manager", layout_manager.clone().upcast()),
1045 }
1046 }
1047
1048 /// Makes this widget act like a modal dialog, with respect to
1049 /// event delivery.
1050 ///
1051 /// Global event controllers will not handle events with targets
1052 /// inside the widget, unless they are set up to ignore propagation
1053 /// limits. See `Gtk::EventController::set_propagation_limit()`.
1054 #[cfg(feature = "gtk_v4_18")]
1055 #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
1056 pub fn limit_events(self, limit_events: bool) -> Self {
1057 Self {
1058 builder: self.builder.property("limit-events", limit_events),
1059 }
1060 }
1061
1062 /// Margin on bottom side of widget.
1063 ///
1064 /// This property adds margin outside of the widget's normal size
1065 /// request, the margin will be added in addition to the size from
1066 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1067 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1068 Self {
1069 builder: self.builder.property("margin-bottom", margin_bottom),
1070 }
1071 }
1072
1073 /// Margin on end of widget, horizontally.
1074 ///
1075 /// This property supports left-to-right and right-to-left text
1076 /// directions.
1077 ///
1078 /// This property adds margin outside of the widget's normal size
1079 /// request, the margin will be added in addition to the size from
1080 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1081 pub fn margin_end(self, margin_end: i32) -> Self {
1082 Self {
1083 builder: self.builder.property("margin-end", margin_end),
1084 }
1085 }
1086
1087 /// Margin on start of widget, horizontally.
1088 ///
1089 /// This property supports left-to-right and right-to-left text
1090 /// directions.
1091 ///
1092 /// This property adds margin outside of the widget's normal size
1093 /// request, the margin will be added in addition to the size from
1094 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1095 pub fn margin_start(self, margin_start: i32) -> Self {
1096 Self {
1097 builder: self.builder.property("margin-start", margin_start),
1098 }
1099 }
1100
1101 /// Margin on top side of widget.
1102 ///
1103 /// This property adds margin outside of the widget's normal size
1104 /// request, the margin will be added in addition to the size from
1105 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1106 pub fn margin_top(self, margin_top: i32) -> Self {
1107 Self {
1108 builder: self.builder.property("margin-top", margin_top),
1109 }
1110 }
1111
1112 /// The name of the widget.
1113 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1114 Self {
1115 builder: self.builder.property("name", name.into()),
1116 }
1117 }
1118
1119 /// The requested opacity of the widget.
1120 pub fn opacity(self, opacity: f64) -> Self {
1121 Self {
1122 builder: self.builder.property("opacity", opacity),
1123 }
1124 }
1125
1126 /// How content outside the widget's content area is treated.
1127 ///
1128 /// This property is meant to be set by widget implementations,
1129 /// typically in their instance init function.
1130 pub fn overflow(self, overflow: gtk::Overflow) -> Self {
1131 Self {
1132 builder: self.builder.property("overflow", overflow),
1133 }
1134 }
1135
1136 /// Whether the widget will receive the default action when it is focused.
1137 pub fn receives_default(self, receives_default: bool) -> Self {
1138 Self {
1139 builder: self.builder.property("receives-default", receives_default),
1140 }
1141 }
1142
1143 /// Whether the widget responds to input.
1144 pub fn sensitive(self, sensitive: bool) -> Self {
1145 Self {
1146 builder: self.builder.property("sensitive", sensitive),
1147 }
1148 }
1149
1150 /// Sets the text of tooltip to be the given string, which is marked up
1151 /// with Pango markup.
1152 ///
1153 /// Also see `Gtk::Tooltip::set_markup()`.
1154 ///
1155 /// This is a convenience property which will take care of getting the
1156 /// tooltip shown if the given string is not `NULL`:
1157 /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
1158 /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
1159 /// the default signal handler.
1160 ///
1161 /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
1162 /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
1163 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1164 Self {
1165 builder: self
1166 .builder
1167 .property("tooltip-markup", tooltip_markup.into()),
1168 }
1169 }
1170
1171 /// Sets the text of tooltip to be the given string.
1172 ///
1173 /// Also see `Gtk::Tooltip::set_text()`.
1174 ///
1175 /// This is a convenience property which will take care of getting the
1176 /// tooltip shown if the given string is not `NULL`:
1177 /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
1178 /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
1179 /// the default signal handler.
1180 ///
1181 /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
1182 /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
1183 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1184 Self {
1185 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1186 }
1187 }
1188
1189 /// How to distribute vertical space if widget gets extra space.
1190 pub fn valign(self, valign: gtk::Align) -> Self {
1191 Self {
1192 builder: self.builder.property("valign", valign),
1193 }
1194 }
1195
1196 /// Whether to expand vertically.
1197 pub fn vexpand(self, vexpand: bool) -> Self {
1198 Self {
1199 builder: self.builder.property("vexpand", vexpand),
1200 }
1201 }
1202
1203 /// Whether to use the `vexpand` property.
1204 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1205 Self {
1206 builder: self.builder.property("vexpand-set", vexpand_set),
1207 }
1208 }
1209
1210 /// Whether the widget is visible.
1211 pub fn visible(self, visible: bool) -> Self {
1212 Self {
1213 builder: self.builder.property("visible", visible),
1214 }
1215 }
1216
1217 /// Overrides for width request of the widget.
1218 ///
1219 /// If this is -1, the natural request will be used.
1220 pub fn width_request(self, width_request: i32) -> Self {
1221 Self {
1222 builder: self.builder.property("width-request", width_request),
1223 }
1224 }
1225
1226 /// The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
1227 ///
1228 /// The accessible role cannot be changed once set.
1229 pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
1230 Self {
1231 builder: self.builder.property("accessible-role", accessible_role),
1232 }
1233 }
1234
1235 // rustdoc-stripper-ignore-next
1236 /// Build the [`Window`].
1237 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1238 pub fn build(self) -> Window {
1239 assert_initialized_main_thread!();
1240 self.builder.build()
1241 }
1242}
1243
1244/// Trait containing all [`struct@Window`] methods.
1245///
1246/// # Implementors
1247///
1248/// [`AboutWindow`][struct@crate::AboutWindow], [`PreferencesWindow`][struct@crate::PreferencesWindow], [`Window`][struct@crate::Window]
1249pub trait AdwWindowExt: IsA<Window> + 'static {
1250 /// Adds @breakpoint to @self.
1251 /// ## `breakpoint`
1252 /// the breakpoint to add
1253 #[cfg(feature = "v1_4")]
1254 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1255 #[doc(alias = "adw_window_add_breakpoint")]
1256 fn add_breakpoint(&self, breakpoint: Breakpoint) {
1257 unsafe {
1258 ffi::adw_window_add_breakpoint(
1259 self.as_ref().to_glib_none().0,
1260 breakpoint.into_glib_ptr(),
1261 );
1262 }
1263 }
1264
1265 /// Gets whether adaptive preview for @self is currently open.
1266 ///
1267 /// # Returns
1268 ///
1269 /// whether adaptive preview is open.
1270 #[cfg(feature = "v1_7")]
1271 #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
1272 #[doc(alias = "adw_window_get_adaptive_preview")]
1273 #[doc(alias = "get_adaptive_preview")]
1274 #[doc(alias = "adaptive-preview")]
1275 fn is_adaptive_preview(&self) -> bool {
1276 unsafe {
1277 from_glib(ffi::adw_window_get_adaptive_preview(
1278 self.as_ref().to_glib_none().0,
1279 ))
1280 }
1281 }
1282
1283 /// Gets the content widget of @self.
1284 ///
1285 /// This method should always be used instead of [`GtkWindowExtManual::child()`][crate::gtk::prelude::GtkWindowExtManual::child()].
1286 ///
1287 /// # Returns
1288 ///
1289 /// the content widget of @self
1290 #[doc(alias = "adw_window_get_content")]
1291 #[doc(alias = "get_content")]
1292 fn content(&self) -> Option<gtk::Widget> {
1293 unsafe { from_glib_none(ffi::adw_window_get_content(self.as_ref().to_glib_none().0)) }
1294 }
1295
1296 /// Gets the current breakpoint.
1297 ///
1298 /// # Returns
1299 ///
1300 /// the current breakpoint
1301 #[cfg(feature = "v1_4")]
1302 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1303 #[doc(alias = "adw_window_get_current_breakpoint")]
1304 #[doc(alias = "get_current_breakpoint")]
1305 #[doc(alias = "current-breakpoint")]
1306 fn current_breakpoint(&self) -> Option<Breakpoint> {
1307 unsafe {
1308 from_glib_none(ffi::adw_window_get_current_breakpoint(
1309 self.as_ref().to_glib_none().0,
1310 ))
1311 }
1312 }
1313
1314 /// Returns a [`gio::ListModel`][crate::gio::ListModel] that contains the open dialogs of @self.
1315 ///
1316 /// This can be used to keep an up-to-date view.
1317 ///
1318 /// # Returns
1319 ///
1320 /// a list model for the dialogs of @self
1321 #[cfg(feature = "v1_5")]
1322 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
1323 #[doc(alias = "adw_window_get_dialogs")]
1324 #[doc(alias = "get_dialogs")]
1325 fn dialogs(&self) -> gio::ListModel {
1326 unsafe { from_glib_full(ffi::adw_window_get_dialogs(self.as_ref().to_glib_none().0)) }
1327 }
1328
1329 /// Returns the currently visible dialog in @self, if there's one.
1330 ///
1331 /// # Returns
1332 ///
1333 /// the visible dialog
1334 #[cfg(feature = "v1_5")]
1335 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
1336 #[doc(alias = "adw_window_get_visible_dialog")]
1337 #[doc(alias = "get_visible_dialog")]
1338 #[doc(alias = "visible-dialog")]
1339 fn visible_dialog(&self) -> Option<Dialog> {
1340 unsafe {
1341 from_glib_none(ffi::adw_window_get_visible_dialog(
1342 self.as_ref().to_glib_none().0,
1343 ))
1344 }
1345 }
1346
1347 /// Sets whether adaptive preview for @self is currently open.
1348 ///
1349 /// Adaptive preview is a debugging tool used for testing the window
1350 /// contents at specific screen sizes, simulating mobile environment.
1351 ///
1352 /// Adaptive preview can always be accessed from inspector. This function
1353 /// allows applications to open it manually.
1354 ///
1355 /// Most applications should not use this function.
1356 /// ## `adaptive_preview`
1357 /// whether to open adaptive preview
1358 #[cfg(feature = "v1_7")]
1359 #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
1360 #[doc(alias = "adw_window_set_adaptive_preview")]
1361 #[doc(alias = "adaptive-preview")]
1362 fn set_adaptive_preview(&self, adaptive_preview: bool) {
1363 unsafe {
1364 ffi::adw_window_set_adaptive_preview(
1365 self.as_ref().to_glib_none().0,
1366 adaptive_preview.into_glib(),
1367 );
1368 }
1369 }
1370
1371 /// Sets the content widget of @self.
1372 ///
1373 /// This method should always be used instead of [`GtkWindowExtManual::set_child()`][crate::gtk::prelude::GtkWindowExtManual::set_child()].
1374 /// ## `content`
1375 /// the content widget
1376 #[doc(alias = "adw_window_set_content")]
1377 #[doc(alias = "content")]
1378 fn set_content(&self, content: Option<&impl IsA<gtk::Widget>>) {
1379 unsafe {
1380 ffi::adw_window_set_content(
1381 self.as_ref().to_glib_none().0,
1382 content.map(|p| p.as_ref()).to_glib_none().0,
1383 );
1384 }
1385 }
1386
1387 #[cfg(feature = "v1_7")]
1388 #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
1389 #[doc(alias = "adaptive-preview")]
1390 fn connect_adaptive_preview_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1391 unsafe extern "C" fn notify_adaptive_preview_trampoline<
1392 P: IsA<Window>,
1393 F: Fn(&P) + 'static,
1394 >(
1395 this: *mut ffi::AdwWindow,
1396 _param_spec: glib::ffi::gpointer,
1397 f: glib::ffi::gpointer,
1398 ) {
1399 unsafe {
1400 let f: &F = &*(f as *const F);
1401 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1402 }
1403 }
1404 unsafe {
1405 let f: Box_<F> = Box_::new(f);
1406 connect_raw(
1407 self.as_ptr() as *mut _,
1408 c"notify::adaptive-preview".as_ptr(),
1409 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1410 notify_adaptive_preview_trampoline::<Self, F> as *const (),
1411 )),
1412 Box_::into_raw(f),
1413 )
1414 }
1415 }
1416
1417 #[doc(alias = "content")]
1418 fn connect_content_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1419 unsafe extern "C" fn notify_content_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
1420 this: *mut ffi::AdwWindow,
1421 _param_spec: glib::ffi::gpointer,
1422 f: glib::ffi::gpointer,
1423 ) {
1424 unsafe {
1425 let f: &F = &*(f as *const F);
1426 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1427 }
1428 }
1429 unsafe {
1430 let f: Box_<F> = Box_::new(f);
1431 connect_raw(
1432 self.as_ptr() as *mut _,
1433 c"notify::content".as_ptr(),
1434 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1435 notify_content_trampoline::<Self, F> as *const (),
1436 )),
1437 Box_::into_raw(f),
1438 )
1439 }
1440 }
1441
1442 #[cfg(feature = "v1_4")]
1443 #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1444 #[doc(alias = "current-breakpoint")]
1445 fn connect_current_breakpoint_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1446 unsafe extern "C" fn notify_current_breakpoint_trampoline<
1447 P: IsA<Window>,
1448 F: Fn(&P) + 'static,
1449 >(
1450 this: *mut ffi::AdwWindow,
1451 _param_spec: glib::ffi::gpointer,
1452 f: glib::ffi::gpointer,
1453 ) {
1454 unsafe {
1455 let f: &F = &*(f as *const F);
1456 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1457 }
1458 }
1459 unsafe {
1460 let f: Box_<F> = Box_::new(f);
1461 connect_raw(
1462 self.as_ptr() as *mut _,
1463 c"notify::current-breakpoint".as_ptr(),
1464 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1465 notify_current_breakpoint_trampoline::<Self, F> as *const (),
1466 )),
1467 Box_::into_raw(f),
1468 )
1469 }
1470 }
1471
1472 #[cfg(feature = "v1_5")]
1473 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
1474 #[doc(alias = "dialogs")]
1475 fn connect_dialogs_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1476 unsafe extern "C" fn notify_dialogs_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
1477 this: *mut ffi::AdwWindow,
1478 _param_spec: glib::ffi::gpointer,
1479 f: glib::ffi::gpointer,
1480 ) {
1481 unsafe {
1482 let f: &F = &*(f as *const F);
1483 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1484 }
1485 }
1486 unsafe {
1487 let f: Box_<F> = Box_::new(f);
1488 connect_raw(
1489 self.as_ptr() as *mut _,
1490 c"notify::dialogs".as_ptr(),
1491 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1492 notify_dialogs_trampoline::<Self, F> as *const (),
1493 )),
1494 Box_::into_raw(f),
1495 )
1496 }
1497 }
1498
1499 #[cfg(feature = "v1_5")]
1500 #[cfg_attr(docsrs, doc(cfg(feature = "v1_5")))]
1501 #[doc(alias = "visible-dialog")]
1502 fn connect_visible_dialog_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1503 unsafe extern "C" fn notify_visible_dialog_trampoline<
1504 P: IsA<Window>,
1505 F: Fn(&P) + 'static,
1506 >(
1507 this: *mut ffi::AdwWindow,
1508 _param_spec: glib::ffi::gpointer,
1509 f: glib::ffi::gpointer,
1510 ) {
1511 unsafe {
1512 let f: &F = &*(f as *const F);
1513 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1514 }
1515 }
1516 unsafe {
1517 let f: Box_<F> = Box_::new(f);
1518 connect_raw(
1519 self.as_ptr() as *mut _,
1520 c"notify::visible-dialog".as_ptr(),
1521 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1522 notify_visible_dialog_trampoline::<Self, F> as *const (),
1523 )),
1524 Box_::into_raw(f),
1525 )
1526 }
1527 }
1528}
1529
1530impl<O: IsA<Window>> AdwWindowExt for O {}