1#![allow(deprecated)]
5
6#[cfg(feature = "v4_20")]
7#[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
8use crate::WindowGravity;
9use crate::{
10 ffi, Accessible, AccessibleRole, Align, Application, Buildable, ConstraintTarget,
11 LayoutManager, Native, Overflow, Root, ShortcutManager, Widget, WindowGroup,
12};
13use glib::{
14 object::ObjectType as _,
15 prelude::*,
16 signal::{connect_raw, SignalHandlerId},
17 translate::*,
18};
19use std::boxed::Box as Box_;
20
21glib::wrapper! {
22 #[doc(alias = "GtkWindow")]
23 pub struct Window(Object<ffi::GtkWindow, ffi::GtkWindowClass>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, Native, Root, ShortcutManager;
24
25 match fn {
26 type_ => || ffi::gtk_window_get_type(),
27 }
28}
29
30impl Window {
31 pub const NONE: Option<&'static Window> = None;
32
33 #[doc(alias = "gtk_window_new")]
34 pub fn new() -> Window {
35 assert_initialized_main_thread!();
36 unsafe { Widget::from_glib_none(ffi::gtk_window_new()).unsafe_cast() }
37 }
38
39 pub fn builder() -> WindowBuilder {
44 WindowBuilder::new()
45 }
46
47 #[doc(alias = "gtk_window_get_default_icon_name")]
48 #[doc(alias = "get_default_icon_name")]
49 pub fn default_icon_name() -> Option<glib::GString> {
50 assert_initialized_main_thread!();
51 unsafe { from_glib_none(ffi::gtk_window_get_default_icon_name()) }
52 }
53
54 #[doc(alias = "gtk_window_get_toplevels")]
55 #[doc(alias = "get_toplevels")]
56 pub fn toplevels() -> gio::ListModel {
57 assert_initialized_main_thread!();
58 unsafe { from_glib_none(ffi::gtk_window_get_toplevels()) }
59 }
60
61 #[doc(alias = "gtk_window_list_toplevels")]
62 pub fn list_toplevels() -> Vec<Widget> {
63 assert_initialized_main_thread!();
64 unsafe { FromGlibPtrContainer::from_glib_container(ffi::gtk_window_list_toplevels()) }
65 }
66
67 #[doc(alias = "gtk_window_set_auto_startup_notification")]
68 pub fn set_auto_startup_notification(setting: bool) {
69 assert_initialized_main_thread!();
70 unsafe {
71 ffi::gtk_window_set_auto_startup_notification(setting.into_glib());
72 }
73 }
74
75 #[doc(alias = "gtk_window_set_default_icon_name")]
76 pub fn set_default_icon_name(name: &str) {
77 assert_initialized_main_thread!();
78 unsafe {
79 ffi::gtk_window_set_default_icon_name(name.to_glib_none().0);
80 }
81 }
82
83 #[doc(alias = "gtk_window_set_interactive_debugging")]
84 pub fn set_interactive_debugging(enable: bool) {
85 assert_initialized_main_thread!();
86 unsafe {
87 ffi::gtk_window_set_interactive_debugging(enable.into_glib());
88 }
89 }
90}
91
92impl Default for Window {
93 fn default() -> Self {
94 Self::new()
95 }
96}
97
98#[must_use = "The builder must be built to be used"]
103pub struct WindowBuilder {
104 builder: glib::object::ObjectBuilder<'static, Window>,
105}
106
107impl WindowBuilder {
108 fn new() -> Self {
109 Self {
110 builder: glib::object::Object::builder(),
111 }
112 }
113
114 pub fn application(self, application: &impl IsA<Application>) -> Self {
115 Self {
116 builder: self
117 .builder
118 .property("application", application.clone().upcast()),
119 }
120 }
121
122 pub fn child(self, child: &impl IsA<Widget>) -> Self {
123 Self {
124 builder: self.builder.property("child", child.clone().upcast()),
125 }
126 }
127
128 pub fn decorated(self, decorated: bool) -> Self {
129 Self {
130 builder: self.builder.property("decorated", decorated),
131 }
132 }
133
134 pub fn default_height(self, default_height: i32) -> Self {
135 Self {
136 builder: self.builder.property("default-height", default_height),
137 }
138 }
139
140 pub fn default_widget(self, default_widget: &impl IsA<Widget>) -> Self {
141 Self {
142 builder: self
143 .builder
144 .property("default-widget", default_widget.clone().upcast()),
145 }
146 }
147
148 pub fn default_width(self, default_width: i32) -> Self {
149 Self {
150 builder: self.builder.property("default-width", default_width),
151 }
152 }
153
154 pub fn deletable(self, deletable: bool) -> Self {
155 Self {
156 builder: self.builder.property("deletable", deletable),
157 }
158 }
159
160 pub fn destroy_with_parent(self, destroy_with_parent: bool) -> Self {
161 Self {
162 builder: self
163 .builder
164 .property("destroy-with-parent", destroy_with_parent),
165 }
166 }
167
168 pub fn display(self, display: &impl IsA<gdk::Display>) -> Self {
169 Self {
170 builder: self.builder.property("display", display.clone().upcast()),
171 }
172 }
173
174 pub fn focus_visible(self, focus_visible: bool) -> Self {
175 Self {
176 builder: self.builder.property("focus-visible", focus_visible),
177 }
178 }
179
180 pub fn focus_widget(self, focus_widget: &impl IsA<Widget>) -> Self {
181 Self {
182 builder: self
183 .builder
184 .property("focus-widget", focus_widget.clone().upcast()),
185 }
186 }
187
188 pub fn fullscreened(self, fullscreened: bool) -> Self {
189 Self {
190 builder: self.builder.property("fullscreened", fullscreened),
191 }
192 }
193
194 #[cfg(feature = "v4_20")]
195 #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
196 pub fn gravity(self, gravity: WindowGravity) -> Self {
197 Self {
198 builder: self.builder.property("gravity", gravity),
199 }
200 }
201
202 #[cfg(feature = "v4_2")]
203 #[cfg_attr(docsrs, doc(cfg(feature = "v4_2")))]
204 pub fn handle_menubar_accel(self, handle_menubar_accel: bool) -> Self {
205 Self {
206 builder: self
207 .builder
208 .property("handle-menubar-accel", handle_menubar_accel),
209 }
210 }
211
212 pub fn hide_on_close(self, hide_on_close: bool) -> Self {
213 Self {
214 builder: self.builder.property("hide-on-close", hide_on_close),
215 }
216 }
217
218 pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
219 Self {
220 builder: self.builder.property("icon-name", icon_name.into()),
221 }
222 }
223
224 pub fn maximized(self, maximized: bool) -> Self {
225 Self {
226 builder: self.builder.property("maximized", maximized),
227 }
228 }
229
230 pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self {
231 Self {
232 builder: self
233 .builder
234 .property("mnemonics-visible", mnemonics_visible),
235 }
236 }
237
238 pub fn modal(self, modal: bool) -> Self {
239 Self {
240 builder: self.builder.property("modal", modal),
241 }
242 }
243
244 pub fn resizable(self, resizable: bool) -> Self {
245 Self {
246 builder: self.builder.property("resizable", resizable),
247 }
248 }
249
250 pub fn startup_id(self, startup_id: impl Into<glib::GString>) -> Self {
251 Self {
252 builder: self.builder.property("startup-id", startup_id.into()),
253 }
254 }
255
256 pub fn title(self, title: impl Into<glib::GString>) -> Self {
257 Self {
258 builder: self.builder.property("title", title.into()),
259 }
260 }
261
262 #[cfg(feature = "v4_6")]
263 #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
264 pub fn titlebar(self, titlebar: &impl IsA<Widget>) -> Self {
265 Self {
266 builder: self.builder.property("titlebar", titlebar.clone().upcast()),
267 }
268 }
269
270 pub fn transient_for(self, transient_for: &impl IsA<Window>) -> Self {
271 Self {
272 builder: self
273 .builder
274 .property("transient-for", transient_for.clone().upcast()),
275 }
276 }
277
278 pub fn can_focus(self, can_focus: bool) -> Self {
279 Self {
280 builder: self.builder.property("can-focus", can_focus),
281 }
282 }
283
284 pub fn can_target(self, can_target: bool) -> Self {
285 Self {
286 builder: self.builder.property("can-target", can_target),
287 }
288 }
289
290 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
291 Self {
292 builder: self.builder.property("css-classes", css_classes.into()),
293 }
294 }
295
296 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
297 Self {
298 builder: self.builder.property("css-name", css_name.into()),
299 }
300 }
301
302 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
303 Self {
304 builder: self.builder.property("cursor", cursor.clone()),
305 }
306 }
307
308 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
309 Self {
310 builder: self.builder.property("focus-on-click", focus_on_click),
311 }
312 }
313
314 pub fn focusable(self, focusable: bool) -> Self {
315 Self {
316 builder: self.builder.property("focusable", focusable),
317 }
318 }
319
320 pub fn halign(self, halign: Align) -> Self {
321 Self {
322 builder: self.builder.property("halign", halign),
323 }
324 }
325
326 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
327 Self {
328 builder: self.builder.property("has-tooltip", has_tooltip),
329 }
330 }
331
332 pub fn height_request(self, height_request: i32) -> Self {
333 Self {
334 builder: self.builder.property("height-request", height_request),
335 }
336 }
337
338 pub fn hexpand(self, hexpand: bool) -> Self {
339 Self {
340 builder: self.builder.property("hexpand", hexpand),
341 }
342 }
343
344 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
345 Self {
346 builder: self.builder.property("hexpand-set", hexpand_set),
347 }
348 }
349
350 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
351 Self {
352 builder: self
353 .builder
354 .property("layout-manager", layout_manager.clone().upcast()),
355 }
356 }
357
358 #[cfg(feature = "v4_18")]
359 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
360 pub fn limit_events(self, limit_events: bool) -> Self {
361 Self {
362 builder: self.builder.property("limit-events", limit_events),
363 }
364 }
365
366 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
367 Self {
368 builder: self.builder.property("margin-bottom", margin_bottom),
369 }
370 }
371
372 pub fn margin_end(self, margin_end: i32) -> Self {
373 Self {
374 builder: self.builder.property("margin-end", margin_end),
375 }
376 }
377
378 pub fn margin_start(self, margin_start: i32) -> Self {
379 Self {
380 builder: self.builder.property("margin-start", margin_start),
381 }
382 }
383
384 pub fn margin_top(self, margin_top: i32) -> Self {
385 Self {
386 builder: self.builder.property("margin-top", margin_top),
387 }
388 }
389
390 pub fn name(self, name: impl Into<glib::GString>) -> Self {
391 Self {
392 builder: self.builder.property("name", name.into()),
393 }
394 }
395
396 pub fn opacity(self, opacity: f64) -> Self {
397 Self {
398 builder: self.builder.property("opacity", opacity),
399 }
400 }
401
402 pub fn overflow(self, overflow: Overflow) -> Self {
403 Self {
404 builder: self.builder.property("overflow", overflow),
405 }
406 }
407
408 pub fn receives_default(self, receives_default: bool) -> Self {
409 Self {
410 builder: self.builder.property("receives-default", receives_default),
411 }
412 }
413
414 pub fn sensitive(self, sensitive: bool) -> Self {
415 Self {
416 builder: self.builder.property("sensitive", sensitive),
417 }
418 }
419
420 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
421 Self {
422 builder: self
423 .builder
424 .property("tooltip-markup", tooltip_markup.into()),
425 }
426 }
427
428 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
429 Self {
430 builder: self.builder.property("tooltip-text", tooltip_text.into()),
431 }
432 }
433
434 pub fn valign(self, valign: Align) -> Self {
435 Self {
436 builder: self.builder.property("valign", valign),
437 }
438 }
439
440 pub fn vexpand(self, vexpand: bool) -> Self {
441 Self {
442 builder: self.builder.property("vexpand", vexpand),
443 }
444 }
445
446 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
447 Self {
448 builder: self.builder.property("vexpand-set", vexpand_set),
449 }
450 }
451
452 pub fn visible(self, visible: bool) -> Self {
453 Self {
454 builder: self.builder.property("visible", visible),
455 }
456 }
457
458 pub fn width_request(self, width_request: i32) -> Self {
459 Self {
460 builder: self.builder.property("width-request", width_request),
461 }
462 }
463
464 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
465 Self {
466 builder: self.builder.property("accessible-role", accessible_role),
467 }
468 }
469
470 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
473 pub fn build(self) -> Window {
474 assert_initialized_main_thread!();
475 self.builder.build()
476 }
477}
478
479pub trait GtkWindowExt: IsA<Window> + 'static {
480 #[doc(alias = "gtk_window_close")]
481 fn close(&self) {
482 unsafe {
483 ffi::gtk_window_close(self.as_ref().to_glib_none().0);
484 }
485 }
486
487 #[doc(alias = "gtk_window_destroy")]
488 fn destroy(&self) {
489 unsafe {
490 ffi::gtk_window_destroy(self.as_ref().to_glib_none().0);
491 }
492 }
493
494 #[doc(alias = "gtk_window_fullscreen")]
495 fn fullscreen(&self) {
496 unsafe {
497 ffi::gtk_window_fullscreen(self.as_ref().to_glib_none().0);
498 }
499 }
500
501 #[doc(alias = "gtk_window_fullscreen_on_monitor")]
502 fn fullscreen_on_monitor(&self, monitor: &gdk::Monitor) {
503 unsafe {
504 ffi::gtk_window_fullscreen_on_monitor(
505 self.as_ref().to_glib_none().0,
506 monitor.to_glib_none().0,
507 );
508 }
509 }
510
511 #[doc(alias = "gtk_window_get_application")]
512 #[doc(alias = "get_application")]
513 fn application(&self) -> Option<Application> {
514 unsafe {
515 from_glib_none(ffi::gtk_window_get_application(
516 self.as_ref().to_glib_none().0,
517 ))
518 }
519 }
520
521 #[doc(alias = "gtk_window_get_child")]
522 #[doc(alias = "get_child")]
523 fn child(&self) -> Option<Widget> {
524 unsafe { from_glib_none(ffi::gtk_window_get_child(self.as_ref().to_glib_none().0)) }
525 }
526
527 #[doc(alias = "gtk_window_get_decorated")]
528 #[doc(alias = "get_decorated")]
529 #[doc(alias = "decorated")]
530 fn is_decorated(&self) -> bool {
531 unsafe {
532 from_glib(ffi::gtk_window_get_decorated(
533 self.as_ref().to_glib_none().0,
534 ))
535 }
536 }
537
538 #[doc(alias = "gtk_window_get_default_size")]
539 #[doc(alias = "get_default_size")]
540 fn default_size(&self) -> (i32, i32) {
541 unsafe {
542 let mut width = std::mem::MaybeUninit::uninit();
543 let mut height = std::mem::MaybeUninit::uninit();
544 ffi::gtk_window_get_default_size(
545 self.as_ref().to_glib_none().0,
546 width.as_mut_ptr(),
547 height.as_mut_ptr(),
548 );
549 (width.assume_init(), height.assume_init())
550 }
551 }
552
553 #[doc(alias = "gtk_window_get_default_widget")]
554 #[doc(alias = "get_default_widget")]
555 #[doc(alias = "default-widget")]
556 fn default_widget(&self) -> Option<Widget> {
557 unsafe {
558 from_glib_none(ffi::gtk_window_get_default_widget(
559 self.as_ref().to_glib_none().0,
560 ))
561 }
562 }
563
564 #[doc(alias = "gtk_window_get_deletable")]
565 #[doc(alias = "get_deletable")]
566 #[doc(alias = "deletable")]
567 fn is_deletable(&self) -> bool {
568 unsafe {
569 from_glib(ffi::gtk_window_get_deletable(
570 self.as_ref().to_glib_none().0,
571 ))
572 }
573 }
574
575 #[doc(alias = "gtk_window_get_destroy_with_parent")]
576 #[doc(alias = "get_destroy_with_parent")]
577 #[doc(alias = "destroy-with-parent")]
578 fn must_destroy_with_parent(&self) -> bool {
579 unsafe {
580 from_glib(ffi::gtk_window_get_destroy_with_parent(
581 self.as_ref().to_glib_none().0,
582 ))
583 }
584 }
585
586 #[doc(alias = "gtk_window_get_focus")]
587 #[doc(alias = "get_focus")]
588 #[doc(alias = "focus-widget")]
589 fn focus(&self) -> Option<Widget> {
590 unsafe { from_glib_none(ffi::gtk_window_get_focus(self.as_ref().to_glib_none().0)) }
591 }
592
593 #[doc(alias = "gtk_window_get_focus_visible")]
594 #[doc(alias = "get_focus_visible")]
595 #[doc(alias = "focus-visible")]
596 fn gets_focus_visible(&self) -> bool {
597 unsafe {
598 from_glib(ffi::gtk_window_get_focus_visible(
599 self.as_ref().to_glib_none().0,
600 ))
601 }
602 }
603
604 #[cfg(feature = "v4_20")]
605 #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
606 #[doc(alias = "gtk_window_get_gravity")]
607 #[doc(alias = "get_gravity")]
608 fn gravity(&self) -> WindowGravity {
609 unsafe { from_glib(ffi::gtk_window_get_gravity(self.as_ref().to_glib_none().0)) }
610 }
611
612 #[doc(alias = "gtk_window_get_group")]
613 #[doc(alias = "get_group")]
614 fn group(&self) -> WindowGroup {
615 unsafe { from_glib_none(ffi::gtk_window_get_group(self.as_ref().to_glib_none().0)) }
616 }
617
618 #[cfg(feature = "v4_2")]
619 #[cfg_attr(docsrs, doc(cfg(feature = "v4_2")))]
620 #[doc(alias = "gtk_window_get_handle_menubar_accel")]
621 #[doc(alias = "get_handle_menubar_accel")]
622 #[doc(alias = "handle-menubar-accel")]
623 fn is_handle_menubar_accel(&self) -> bool {
624 unsafe {
625 from_glib(ffi::gtk_window_get_handle_menubar_accel(
626 self.as_ref().to_glib_none().0,
627 ))
628 }
629 }
630
631 #[doc(alias = "gtk_window_get_hide_on_close")]
632 #[doc(alias = "get_hide_on_close")]
633 #[doc(alias = "hide-on-close")]
634 fn hides_on_close(&self) -> bool {
635 unsafe {
636 from_glib(ffi::gtk_window_get_hide_on_close(
637 self.as_ref().to_glib_none().0,
638 ))
639 }
640 }
641
642 #[doc(alias = "gtk_window_get_icon_name")]
643 #[doc(alias = "get_icon_name")]
644 #[doc(alias = "icon-name")]
645 fn icon_name(&self) -> Option<glib::GString> {
646 unsafe {
647 from_glib_none(ffi::gtk_window_get_icon_name(
648 self.as_ref().to_glib_none().0,
649 ))
650 }
651 }
652
653 #[doc(alias = "gtk_window_get_mnemonics_visible")]
654 #[doc(alias = "get_mnemonics_visible")]
655 #[doc(alias = "mnemonics-visible")]
656 fn is_mnemonics_visible(&self) -> bool {
657 unsafe {
658 from_glib(ffi::gtk_window_get_mnemonics_visible(
659 self.as_ref().to_glib_none().0,
660 ))
661 }
662 }
663
664 #[doc(alias = "gtk_window_get_modal")]
665 #[doc(alias = "get_modal")]
666 #[doc(alias = "modal")]
667 fn is_modal(&self) -> bool {
668 unsafe { from_glib(ffi::gtk_window_get_modal(self.as_ref().to_glib_none().0)) }
669 }
670
671 #[doc(alias = "gtk_window_get_resizable")]
672 #[doc(alias = "get_resizable")]
673 #[doc(alias = "resizable")]
674 fn is_resizable(&self) -> bool {
675 unsafe {
676 from_glib(ffi::gtk_window_get_resizable(
677 self.as_ref().to_glib_none().0,
678 ))
679 }
680 }
681
682 #[doc(alias = "gtk_window_get_title")]
683 #[doc(alias = "get_title")]
684 fn title(&self) -> Option<glib::GString> {
685 unsafe { from_glib_none(ffi::gtk_window_get_title(self.as_ref().to_glib_none().0)) }
686 }
687
688 #[doc(alias = "gtk_window_get_titlebar")]
689 #[doc(alias = "get_titlebar")]
690 fn titlebar(&self) -> Option<Widget> {
691 unsafe { from_glib_none(ffi::gtk_window_get_titlebar(self.as_ref().to_glib_none().0)) }
692 }
693
694 #[doc(alias = "gtk_window_get_transient_for")]
695 #[doc(alias = "get_transient_for")]
696 #[doc(alias = "transient-for")]
697 #[must_use]
698 fn transient_for(&self) -> Option<Window> {
699 unsafe {
700 from_glib_none(ffi::gtk_window_get_transient_for(
701 self.as_ref().to_glib_none().0,
702 ))
703 }
704 }
705
706 #[doc(alias = "gtk_window_has_group")]
707 fn has_group(&self) -> bool {
708 unsafe { from_glib(ffi::gtk_window_has_group(self.as_ref().to_glib_none().0)) }
709 }
710
711 #[doc(alias = "gtk_window_is_active")]
712 #[doc(alias = "is-active")]
713 fn is_active(&self) -> bool {
714 unsafe { from_glib(ffi::gtk_window_is_active(self.as_ref().to_glib_none().0)) }
715 }
716
717 #[doc(alias = "gtk_window_is_fullscreen")]
718 #[doc(alias = "fullscreened")]
719 fn is_fullscreen(&self) -> bool {
720 unsafe {
721 from_glib(ffi::gtk_window_is_fullscreen(
722 self.as_ref().to_glib_none().0,
723 ))
724 }
725 }
726
727 #[doc(alias = "gtk_window_is_maximized")]
728 #[doc(alias = "maximized")]
729 fn is_maximized(&self) -> bool {
730 unsafe { from_glib(ffi::gtk_window_is_maximized(self.as_ref().to_glib_none().0)) }
731 }
732
733 #[cfg(feature = "v4_12")]
734 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
735 #[doc(alias = "gtk_window_is_suspended")]
736 #[doc(alias = "suspended")]
737 fn is_suspended(&self) -> bool {
738 unsafe { from_glib(ffi::gtk_window_is_suspended(self.as_ref().to_glib_none().0)) }
739 }
740
741 #[doc(alias = "gtk_window_maximize")]
742 fn maximize(&self) {
743 unsafe {
744 ffi::gtk_window_maximize(self.as_ref().to_glib_none().0);
745 }
746 }
747
748 #[doc(alias = "gtk_window_minimize")]
749 fn minimize(&self) {
750 unsafe {
751 ffi::gtk_window_minimize(self.as_ref().to_glib_none().0);
752 }
753 }
754
755 #[doc(alias = "gtk_window_present")]
756 fn present(&self) {
757 unsafe {
758 ffi::gtk_window_present(self.as_ref().to_glib_none().0);
759 }
760 }
761
762 #[cfg_attr(feature = "v4_14", deprecated = "Since 4.14")]
763 #[allow(deprecated)]
764 #[doc(alias = "gtk_window_present_with_time")]
765 fn present_with_time(&self, timestamp: u32) {
766 unsafe {
767 ffi::gtk_window_present_with_time(self.as_ref().to_glib_none().0, timestamp);
768 }
769 }
770
771 #[doc(alias = "gtk_window_set_application")]
772 #[doc(alias = "application")]
773 fn set_application(&self, application: Option<&impl IsA<Application>>) {
774 unsafe {
775 ffi::gtk_window_set_application(
776 self.as_ref().to_glib_none().0,
777 application.map(|p| p.as_ref()).to_glib_none().0,
778 );
779 }
780 }
781
782 #[doc(alias = "gtk_window_set_child")]
783 #[doc(alias = "child")]
784 fn set_child(&self, child: Option<&impl IsA<Widget>>) {
785 unsafe {
786 ffi::gtk_window_set_child(
787 self.as_ref().to_glib_none().0,
788 child.map(|p| p.as_ref()).to_glib_none().0,
789 );
790 }
791 }
792
793 #[doc(alias = "gtk_window_set_decorated")]
794 #[doc(alias = "decorated")]
795 fn set_decorated(&self, setting: bool) {
796 unsafe {
797 ffi::gtk_window_set_decorated(self.as_ref().to_glib_none().0, setting.into_glib());
798 }
799 }
800
801 #[doc(alias = "gtk_window_set_default_size")]
802 fn set_default_size(&self, width: i32, height: i32) {
803 unsafe {
804 ffi::gtk_window_set_default_size(self.as_ref().to_glib_none().0, width, height);
805 }
806 }
807
808 #[doc(alias = "gtk_window_set_default_widget")]
809 #[doc(alias = "default-widget")]
810 fn set_default_widget(&self, default_widget: Option<&impl IsA<Widget>>) {
811 unsafe {
812 ffi::gtk_window_set_default_widget(
813 self.as_ref().to_glib_none().0,
814 default_widget.map(|p| p.as_ref()).to_glib_none().0,
815 );
816 }
817 }
818
819 #[doc(alias = "gtk_window_set_deletable")]
820 #[doc(alias = "deletable")]
821 fn set_deletable(&self, setting: bool) {
822 unsafe {
823 ffi::gtk_window_set_deletable(self.as_ref().to_glib_none().0, setting.into_glib());
824 }
825 }
826
827 #[doc(alias = "gtk_window_set_destroy_with_parent")]
828 #[doc(alias = "destroy-with-parent")]
829 fn set_destroy_with_parent(&self, setting: bool) {
830 unsafe {
831 ffi::gtk_window_set_destroy_with_parent(
832 self.as_ref().to_glib_none().0,
833 setting.into_glib(),
834 );
835 }
836 }
837
838 #[doc(alias = "gtk_window_set_display")]
839 #[doc(alias = "display")]
840 fn set_display(&self, display: &impl IsA<gdk::Display>) {
841 unsafe {
842 ffi::gtk_window_set_display(
843 self.as_ref().to_glib_none().0,
844 display.as_ref().to_glib_none().0,
845 );
846 }
847 }
848
849 #[doc(alias = "gtk_window_set_focus")]
850 #[doc(alias = "focus-widget")]
851 fn set_focus(&self, focus: Option<&impl IsA<Widget>>) {
852 unsafe {
853 ffi::gtk_window_set_focus(
854 self.as_ref().to_glib_none().0,
855 focus.map(|p| p.as_ref()).to_glib_none().0,
856 );
857 }
858 }
859
860 #[doc(alias = "gtk_window_set_focus_visible")]
861 #[doc(alias = "focus-visible")]
862 fn set_focus_visible(&self, setting: bool) {
863 unsafe {
864 ffi::gtk_window_set_focus_visible(self.as_ref().to_glib_none().0, setting.into_glib());
865 }
866 }
867
868 #[cfg(feature = "v4_20")]
869 #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
870 #[doc(alias = "gtk_window_set_gravity")]
871 #[doc(alias = "gravity")]
872 fn set_gravity(&self, gravity: WindowGravity) {
873 unsafe {
874 ffi::gtk_window_set_gravity(self.as_ref().to_glib_none().0, gravity.into_glib());
875 }
876 }
877
878 #[cfg(feature = "v4_2")]
879 #[cfg_attr(docsrs, doc(cfg(feature = "v4_2")))]
880 #[doc(alias = "gtk_window_set_handle_menubar_accel")]
881 #[doc(alias = "handle-menubar-accel")]
882 fn set_handle_menubar_accel(&self, handle_menubar_accel: bool) {
883 unsafe {
884 ffi::gtk_window_set_handle_menubar_accel(
885 self.as_ref().to_glib_none().0,
886 handle_menubar_accel.into_glib(),
887 );
888 }
889 }
890
891 #[doc(alias = "gtk_window_set_hide_on_close")]
892 #[doc(alias = "hide-on-close")]
893 fn set_hide_on_close(&self, setting: bool) {
894 unsafe {
895 ffi::gtk_window_set_hide_on_close(self.as_ref().to_glib_none().0, setting.into_glib());
896 }
897 }
898
899 #[doc(alias = "gtk_window_set_icon_name")]
900 #[doc(alias = "icon-name")]
901 fn set_icon_name(&self, name: Option<&str>) {
902 unsafe {
903 ffi::gtk_window_set_icon_name(self.as_ref().to_glib_none().0, name.to_glib_none().0);
904 }
905 }
906
907 #[doc(alias = "gtk_window_set_mnemonics_visible")]
908 #[doc(alias = "mnemonics-visible")]
909 fn set_mnemonics_visible(&self, setting: bool) {
910 unsafe {
911 ffi::gtk_window_set_mnemonics_visible(
912 self.as_ref().to_glib_none().0,
913 setting.into_glib(),
914 );
915 }
916 }
917
918 #[doc(alias = "gtk_window_set_modal")]
919 #[doc(alias = "modal")]
920 fn set_modal(&self, modal: bool) {
921 unsafe {
922 ffi::gtk_window_set_modal(self.as_ref().to_glib_none().0, modal.into_glib());
923 }
924 }
925
926 #[doc(alias = "gtk_window_set_resizable")]
927 #[doc(alias = "resizable")]
928 fn set_resizable(&self, resizable: bool) {
929 unsafe {
930 ffi::gtk_window_set_resizable(self.as_ref().to_glib_none().0, resizable.into_glib());
931 }
932 }
933
934 #[doc(alias = "gtk_window_set_startup_id")]
935 #[doc(alias = "startup-id")]
936 fn set_startup_id(&self, startup_id: &str) {
937 unsafe {
938 ffi::gtk_window_set_startup_id(
939 self.as_ref().to_glib_none().0,
940 startup_id.to_glib_none().0,
941 );
942 }
943 }
944
945 #[doc(alias = "gtk_window_set_title")]
946 #[doc(alias = "title")]
947 fn set_title(&self, title: Option<&str>) {
948 unsafe {
949 ffi::gtk_window_set_title(self.as_ref().to_glib_none().0, title.to_glib_none().0);
950 }
951 }
952
953 #[doc(alias = "gtk_window_set_titlebar")]
954 #[doc(alias = "titlebar")]
955 fn set_titlebar(&self, titlebar: Option<&impl IsA<Widget>>) {
956 unsafe {
957 ffi::gtk_window_set_titlebar(
958 self.as_ref().to_glib_none().0,
959 titlebar.map(|p| p.as_ref()).to_glib_none().0,
960 );
961 }
962 }
963
964 #[doc(alias = "gtk_window_set_transient_for")]
965 #[doc(alias = "transient-for")]
966 fn set_transient_for(&self, parent: Option<&impl IsA<Window>>) {
967 unsafe {
968 ffi::gtk_window_set_transient_for(
969 self.as_ref().to_glib_none().0,
970 parent.map(|p| p.as_ref()).to_glib_none().0,
971 );
972 }
973 }
974
975 #[doc(alias = "gtk_window_unfullscreen")]
976 fn unfullscreen(&self) {
977 unsafe {
978 ffi::gtk_window_unfullscreen(self.as_ref().to_glib_none().0);
979 }
980 }
981
982 #[doc(alias = "gtk_window_unmaximize")]
983 fn unmaximize(&self) {
984 unsafe {
985 ffi::gtk_window_unmaximize(self.as_ref().to_glib_none().0);
986 }
987 }
988
989 #[doc(alias = "gtk_window_unminimize")]
990 fn unminimize(&self) {
991 unsafe {
992 ffi::gtk_window_unminimize(self.as_ref().to_glib_none().0);
993 }
994 }
995
996 #[doc(alias = "default-height")]
997 fn default_height(&self) -> i32 {
998 ObjectExt::property(self.as_ref(), "default-height")
999 }
1000
1001 #[doc(alias = "default-height")]
1002 fn set_default_height(&self, default_height: i32) {
1003 ObjectExt::set_property(self.as_ref(), "default-height", default_height)
1004 }
1005
1006 #[doc(alias = "default-width")]
1007 fn default_width(&self) -> i32 {
1008 ObjectExt::property(self.as_ref(), "default-width")
1009 }
1010
1011 #[doc(alias = "default-width")]
1012 fn set_default_width(&self, default_width: i32) {
1013 ObjectExt::set_property(self.as_ref(), "default-width", default_width)
1014 }
1015
1016 fn set_fullscreened(&self, fullscreened: bool) {
1017 ObjectExt::set_property(self.as_ref(), "fullscreened", fullscreened)
1018 }
1019
1020 fn set_maximized(&self, maximized: bool) {
1021 ObjectExt::set_property(self.as_ref(), "maximized", maximized)
1022 }
1023
1024 #[doc(alias = "activate-default")]
1025 fn connect_activate_default<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1026 unsafe extern "C" fn activate_default_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
1027 this: *mut ffi::GtkWindow,
1028 f: glib::ffi::gpointer,
1029 ) {
1030 let f: &F = &*(f as *const F);
1031 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1032 }
1033 unsafe {
1034 let f: Box_<F> = Box_::new(f);
1035 connect_raw(
1036 self.as_ptr() as *mut _,
1037 c"activate-default".as_ptr() as *const _,
1038 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1039 activate_default_trampoline::<Self, F> as *const (),
1040 )),
1041 Box_::into_raw(f),
1042 )
1043 }
1044 }
1045
1046 fn emit_activate_default(&self) {
1047 self.emit_by_name::<()>("activate-default", &[]);
1048 }
1049
1050 #[doc(alias = "activate-focus")]
1051 fn connect_activate_focus<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1052 unsafe extern "C" fn activate_focus_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
1053 this: *mut ffi::GtkWindow,
1054 f: glib::ffi::gpointer,
1055 ) {
1056 let f: &F = &*(f as *const F);
1057 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1058 }
1059 unsafe {
1060 let f: Box_<F> = Box_::new(f);
1061 connect_raw(
1062 self.as_ptr() as *mut _,
1063 c"activate-focus".as_ptr() as *const _,
1064 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1065 activate_focus_trampoline::<Self, F> as *const (),
1066 )),
1067 Box_::into_raw(f),
1068 )
1069 }
1070 }
1071
1072 fn emit_activate_focus(&self) {
1073 self.emit_by_name::<()>("activate-focus", &[]);
1074 }
1075
1076 #[doc(alias = "close-request")]
1077 fn connect_close_request<F: Fn(&Self) -> glib::Propagation + 'static>(
1078 &self,
1079 f: F,
1080 ) -> SignalHandlerId {
1081 unsafe extern "C" fn close_request_trampoline<
1082 P: IsA<Window>,
1083 F: Fn(&P) -> glib::Propagation + 'static,
1084 >(
1085 this: *mut ffi::GtkWindow,
1086 f: glib::ffi::gpointer,
1087 ) -> glib::ffi::gboolean {
1088 let f: &F = &*(f as *const F);
1089 f(Window::from_glib_borrow(this).unsafe_cast_ref()).into_glib()
1090 }
1091 unsafe {
1092 let f: Box_<F> = Box_::new(f);
1093 connect_raw(
1094 self.as_ptr() as *mut _,
1095 c"close-request".as_ptr() as *const _,
1096 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1097 close_request_trampoline::<Self, F> as *const (),
1098 )),
1099 Box_::into_raw(f),
1100 )
1101 }
1102 }
1103
1104 #[doc(alias = "enable-debugging")]
1105 fn connect_enable_debugging<F: Fn(&Self, bool) -> bool + 'static>(
1106 &self,
1107 f: F,
1108 ) -> SignalHandlerId {
1109 unsafe extern "C" fn enable_debugging_trampoline<
1110 P: IsA<Window>,
1111 F: Fn(&P, bool) -> bool + 'static,
1112 >(
1113 this: *mut ffi::GtkWindow,
1114 toggle: glib::ffi::gboolean,
1115 f: glib::ffi::gpointer,
1116 ) -> glib::ffi::gboolean {
1117 let f: &F = &*(f as *const F);
1118 f(
1119 Window::from_glib_borrow(this).unsafe_cast_ref(),
1120 from_glib(toggle),
1121 )
1122 .into_glib()
1123 }
1124 unsafe {
1125 let f: Box_<F> = Box_::new(f);
1126 connect_raw(
1127 self.as_ptr() as *mut _,
1128 c"enable-debugging".as_ptr() as *const _,
1129 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1130 enable_debugging_trampoline::<Self, F> as *const (),
1131 )),
1132 Box_::into_raw(f),
1133 )
1134 }
1135 }
1136
1137 fn emit_enable_debugging(&self, toggle: bool) -> bool {
1138 self.emit_by_name("enable-debugging", &[&toggle])
1139 }
1140
1141 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1142 #[doc(alias = "keys-changed")]
1143 fn connect_keys_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1144 unsafe extern "C" fn keys_changed_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
1145 this: *mut ffi::GtkWindow,
1146 f: glib::ffi::gpointer,
1147 ) {
1148 let f: &F = &*(f as *const F);
1149 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1150 }
1151 unsafe {
1152 let f: Box_<F> = Box_::new(f);
1153 connect_raw(
1154 self.as_ptr() as *mut _,
1155 c"keys-changed".as_ptr() as *const _,
1156 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1157 keys_changed_trampoline::<Self, F> as *const (),
1158 )),
1159 Box_::into_raw(f),
1160 )
1161 }
1162 }
1163
1164 #[doc(alias = "application")]
1165 fn connect_application_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1166 unsafe extern "C" fn notify_application_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
1167 this: *mut ffi::GtkWindow,
1168 _param_spec: glib::ffi::gpointer,
1169 f: glib::ffi::gpointer,
1170 ) {
1171 let f: &F = &*(f as *const F);
1172 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1173 }
1174 unsafe {
1175 let f: Box_<F> = Box_::new(f);
1176 connect_raw(
1177 self.as_ptr() as *mut _,
1178 c"notify::application".as_ptr() as *const _,
1179 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1180 notify_application_trampoline::<Self, F> as *const (),
1181 )),
1182 Box_::into_raw(f),
1183 )
1184 }
1185 }
1186
1187 #[doc(alias = "child")]
1188 fn connect_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1189 unsafe extern "C" fn notify_child_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
1190 this: *mut ffi::GtkWindow,
1191 _param_spec: glib::ffi::gpointer,
1192 f: glib::ffi::gpointer,
1193 ) {
1194 let f: &F = &*(f as *const F);
1195 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1196 }
1197 unsafe {
1198 let f: Box_<F> = Box_::new(f);
1199 connect_raw(
1200 self.as_ptr() as *mut _,
1201 c"notify::child".as_ptr() as *const _,
1202 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1203 notify_child_trampoline::<Self, F> as *const (),
1204 )),
1205 Box_::into_raw(f),
1206 )
1207 }
1208 }
1209
1210 #[doc(alias = "decorated")]
1211 fn connect_decorated_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1212 unsafe extern "C" fn notify_decorated_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
1213 this: *mut ffi::GtkWindow,
1214 _param_spec: glib::ffi::gpointer,
1215 f: glib::ffi::gpointer,
1216 ) {
1217 let f: &F = &*(f as *const F);
1218 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1219 }
1220 unsafe {
1221 let f: Box_<F> = Box_::new(f);
1222 connect_raw(
1223 self.as_ptr() as *mut _,
1224 c"notify::decorated".as_ptr() as *const _,
1225 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1226 notify_decorated_trampoline::<Self, F> as *const (),
1227 )),
1228 Box_::into_raw(f),
1229 )
1230 }
1231 }
1232
1233 #[doc(alias = "default-height")]
1234 fn connect_default_height_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1235 unsafe extern "C" fn notify_default_height_trampoline<
1236 P: IsA<Window>,
1237 F: Fn(&P) + 'static,
1238 >(
1239 this: *mut ffi::GtkWindow,
1240 _param_spec: glib::ffi::gpointer,
1241 f: glib::ffi::gpointer,
1242 ) {
1243 let f: &F = &*(f as *const F);
1244 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1245 }
1246 unsafe {
1247 let f: Box_<F> = Box_::new(f);
1248 connect_raw(
1249 self.as_ptr() as *mut _,
1250 c"notify::default-height".as_ptr() as *const _,
1251 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1252 notify_default_height_trampoline::<Self, F> as *const (),
1253 )),
1254 Box_::into_raw(f),
1255 )
1256 }
1257 }
1258
1259 #[doc(alias = "default-widget")]
1260 fn connect_default_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1261 unsafe extern "C" fn notify_default_widget_trampoline<
1262 P: IsA<Window>,
1263 F: Fn(&P) + 'static,
1264 >(
1265 this: *mut ffi::GtkWindow,
1266 _param_spec: glib::ffi::gpointer,
1267 f: glib::ffi::gpointer,
1268 ) {
1269 let f: &F = &*(f as *const F);
1270 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1271 }
1272 unsafe {
1273 let f: Box_<F> = Box_::new(f);
1274 connect_raw(
1275 self.as_ptr() as *mut _,
1276 c"notify::default-widget".as_ptr() as *const _,
1277 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1278 notify_default_widget_trampoline::<Self, F> as *const (),
1279 )),
1280 Box_::into_raw(f),
1281 )
1282 }
1283 }
1284
1285 #[doc(alias = "default-width")]
1286 fn connect_default_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1287 unsafe extern "C" fn notify_default_width_trampoline<
1288 P: IsA<Window>,
1289 F: Fn(&P) + 'static,
1290 >(
1291 this: *mut ffi::GtkWindow,
1292 _param_spec: glib::ffi::gpointer,
1293 f: glib::ffi::gpointer,
1294 ) {
1295 let f: &F = &*(f as *const F);
1296 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1297 }
1298 unsafe {
1299 let f: Box_<F> = Box_::new(f);
1300 connect_raw(
1301 self.as_ptr() as *mut _,
1302 c"notify::default-width".as_ptr() as *const _,
1303 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1304 notify_default_width_trampoline::<Self, F> as *const (),
1305 )),
1306 Box_::into_raw(f),
1307 )
1308 }
1309 }
1310
1311 #[doc(alias = "deletable")]
1312 fn connect_deletable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1313 unsafe extern "C" fn notify_deletable_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
1314 this: *mut ffi::GtkWindow,
1315 _param_spec: glib::ffi::gpointer,
1316 f: glib::ffi::gpointer,
1317 ) {
1318 let f: &F = &*(f as *const F);
1319 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1320 }
1321 unsafe {
1322 let f: Box_<F> = Box_::new(f);
1323 connect_raw(
1324 self.as_ptr() as *mut _,
1325 c"notify::deletable".as_ptr() as *const _,
1326 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1327 notify_deletable_trampoline::<Self, F> as *const (),
1328 )),
1329 Box_::into_raw(f),
1330 )
1331 }
1332 }
1333
1334 #[doc(alias = "destroy-with-parent")]
1335 fn connect_destroy_with_parent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1336 unsafe extern "C" fn notify_destroy_with_parent_trampoline<
1337 P: IsA<Window>,
1338 F: Fn(&P) + 'static,
1339 >(
1340 this: *mut ffi::GtkWindow,
1341 _param_spec: glib::ffi::gpointer,
1342 f: glib::ffi::gpointer,
1343 ) {
1344 let f: &F = &*(f as *const F);
1345 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1346 }
1347 unsafe {
1348 let f: Box_<F> = Box_::new(f);
1349 connect_raw(
1350 self.as_ptr() as *mut _,
1351 c"notify::destroy-with-parent".as_ptr() as *const _,
1352 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1353 notify_destroy_with_parent_trampoline::<Self, F> as *const (),
1354 )),
1355 Box_::into_raw(f),
1356 )
1357 }
1358 }
1359
1360 #[doc(alias = "display")]
1361 fn connect_display_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1362 unsafe extern "C" fn notify_display_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
1363 this: *mut ffi::GtkWindow,
1364 _param_spec: glib::ffi::gpointer,
1365 f: glib::ffi::gpointer,
1366 ) {
1367 let f: &F = &*(f as *const F);
1368 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1369 }
1370 unsafe {
1371 let f: Box_<F> = Box_::new(f);
1372 connect_raw(
1373 self.as_ptr() as *mut _,
1374 c"notify::display".as_ptr() as *const _,
1375 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1376 notify_display_trampoline::<Self, F> as *const (),
1377 )),
1378 Box_::into_raw(f),
1379 )
1380 }
1381 }
1382
1383 #[doc(alias = "focus-visible")]
1384 fn connect_focus_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1385 unsafe extern "C" fn notify_focus_visible_trampoline<
1386 P: IsA<Window>,
1387 F: Fn(&P) + 'static,
1388 >(
1389 this: *mut ffi::GtkWindow,
1390 _param_spec: glib::ffi::gpointer,
1391 f: glib::ffi::gpointer,
1392 ) {
1393 let f: &F = &*(f as *const F);
1394 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1395 }
1396 unsafe {
1397 let f: Box_<F> = Box_::new(f);
1398 connect_raw(
1399 self.as_ptr() as *mut _,
1400 c"notify::focus-visible".as_ptr() as *const _,
1401 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1402 notify_focus_visible_trampoline::<Self, F> as *const (),
1403 )),
1404 Box_::into_raw(f),
1405 )
1406 }
1407 }
1408
1409 #[doc(alias = "focus-widget")]
1410 fn connect_focus_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1411 unsafe extern "C" fn notify_focus_widget_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
1412 this: *mut ffi::GtkWindow,
1413 _param_spec: glib::ffi::gpointer,
1414 f: glib::ffi::gpointer,
1415 ) {
1416 let f: &F = &*(f as *const F);
1417 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1418 }
1419 unsafe {
1420 let f: Box_<F> = Box_::new(f);
1421 connect_raw(
1422 self.as_ptr() as *mut _,
1423 c"notify::focus-widget".as_ptr() as *const _,
1424 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1425 notify_focus_widget_trampoline::<Self, F> as *const (),
1426 )),
1427 Box_::into_raw(f),
1428 )
1429 }
1430 }
1431
1432 #[doc(alias = "fullscreened")]
1433 fn connect_fullscreened_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1434 unsafe extern "C" fn notify_fullscreened_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
1435 this: *mut ffi::GtkWindow,
1436 _param_spec: glib::ffi::gpointer,
1437 f: glib::ffi::gpointer,
1438 ) {
1439 let f: &F = &*(f as *const F);
1440 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1441 }
1442 unsafe {
1443 let f: Box_<F> = Box_::new(f);
1444 connect_raw(
1445 self.as_ptr() as *mut _,
1446 c"notify::fullscreened".as_ptr() as *const _,
1447 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1448 notify_fullscreened_trampoline::<Self, F> as *const (),
1449 )),
1450 Box_::into_raw(f),
1451 )
1452 }
1453 }
1454
1455 #[cfg(feature = "v4_20")]
1456 #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
1457 #[doc(alias = "gravity")]
1458 fn connect_gravity_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1459 unsafe extern "C" fn notify_gravity_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
1460 this: *mut ffi::GtkWindow,
1461 _param_spec: glib::ffi::gpointer,
1462 f: glib::ffi::gpointer,
1463 ) {
1464 let f: &F = &*(f as *const F);
1465 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1466 }
1467 unsafe {
1468 let f: Box_<F> = Box_::new(f);
1469 connect_raw(
1470 self.as_ptr() as *mut _,
1471 c"notify::gravity".as_ptr() as *const _,
1472 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1473 notify_gravity_trampoline::<Self, F> as *const (),
1474 )),
1475 Box_::into_raw(f),
1476 )
1477 }
1478 }
1479
1480 #[cfg(feature = "v4_2")]
1481 #[cfg_attr(docsrs, doc(cfg(feature = "v4_2")))]
1482 #[doc(alias = "handle-menubar-accel")]
1483 fn connect_handle_menubar_accel_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1484 unsafe extern "C" fn notify_handle_menubar_accel_trampoline<
1485 P: IsA<Window>,
1486 F: Fn(&P) + 'static,
1487 >(
1488 this: *mut ffi::GtkWindow,
1489 _param_spec: glib::ffi::gpointer,
1490 f: glib::ffi::gpointer,
1491 ) {
1492 let f: &F = &*(f as *const F);
1493 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1494 }
1495 unsafe {
1496 let f: Box_<F> = Box_::new(f);
1497 connect_raw(
1498 self.as_ptr() as *mut _,
1499 c"notify::handle-menubar-accel".as_ptr() as *const _,
1500 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1501 notify_handle_menubar_accel_trampoline::<Self, F> as *const (),
1502 )),
1503 Box_::into_raw(f),
1504 )
1505 }
1506 }
1507
1508 #[doc(alias = "hide-on-close")]
1509 fn connect_hide_on_close_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1510 unsafe extern "C" fn notify_hide_on_close_trampoline<
1511 P: IsA<Window>,
1512 F: Fn(&P) + 'static,
1513 >(
1514 this: *mut ffi::GtkWindow,
1515 _param_spec: glib::ffi::gpointer,
1516 f: glib::ffi::gpointer,
1517 ) {
1518 let f: &F = &*(f as *const F);
1519 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1520 }
1521 unsafe {
1522 let f: Box_<F> = Box_::new(f);
1523 connect_raw(
1524 self.as_ptr() as *mut _,
1525 c"notify::hide-on-close".as_ptr() as *const _,
1526 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1527 notify_hide_on_close_trampoline::<Self, F> as *const (),
1528 )),
1529 Box_::into_raw(f),
1530 )
1531 }
1532 }
1533
1534 #[doc(alias = "icon-name")]
1535 fn connect_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1536 unsafe extern "C" fn notify_icon_name_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
1537 this: *mut ffi::GtkWindow,
1538 _param_spec: glib::ffi::gpointer,
1539 f: glib::ffi::gpointer,
1540 ) {
1541 let f: &F = &*(f as *const F);
1542 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1543 }
1544 unsafe {
1545 let f: Box_<F> = Box_::new(f);
1546 connect_raw(
1547 self.as_ptr() as *mut _,
1548 c"notify::icon-name".as_ptr() as *const _,
1549 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1550 notify_icon_name_trampoline::<Self, F> as *const (),
1551 )),
1552 Box_::into_raw(f),
1553 )
1554 }
1555 }
1556
1557 #[doc(alias = "is-active")]
1558 fn connect_is_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1559 unsafe extern "C" fn notify_is_active_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
1560 this: *mut ffi::GtkWindow,
1561 _param_spec: glib::ffi::gpointer,
1562 f: glib::ffi::gpointer,
1563 ) {
1564 let f: &F = &*(f as *const F);
1565 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1566 }
1567 unsafe {
1568 let f: Box_<F> = Box_::new(f);
1569 connect_raw(
1570 self.as_ptr() as *mut _,
1571 c"notify::is-active".as_ptr() as *const _,
1572 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1573 notify_is_active_trampoline::<Self, F> as *const (),
1574 )),
1575 Box_::into_raw(f),
1576 )
1577 }
1578 }
1579
1580 #[doc(alias = "maximized")]
1581 fn connect_maximized_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1582 unsafe extern "C" fn notify_maximized_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
1583 this: *mut ffi::GtkWindow,
1584 _param_spec: glib::ffi::gpointer,
1585 f: glib::ffi::gpointer,
1586 ) {
1587 let f: &F = &*(f as *const F);
1588 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1589 }
1590 unsafe {
1591 let f: Box_<F> = Box_::new(f);
1592 connect_raw(
1593 self.as_ptr() as *mut _,
1594 c"notify::maximized".as_ptr() as *const _,
1595 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1596 notify_maximized_trampoline::<Self, F> as *const (),
1597 )),
1598 Box_::into_raw(f),
1599 )
1600 }
1601 }
1602
1603 #[doc(alias = "mnemonics-visible")]
1604 fn connect_mnemonics_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1605 unsafe extern "C" fn notify_mnemonics_visible_trampoline<
1606 P: IsA<Window>,
1607 F: Fn(&P) + 'static,
1608 >(
1609 this: *mut ffi::GtkWindow,
1610 _param_spec: glib::ffi::gpointer,
1611 f: glib::ffi::gpointer,
1612 ) {
1613 let f: &F = &*(f as *const F);
1614 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1615 }
1616 unsafe {
1617 let f: Box_<F> = Box_::new(f);
1618 connect_raw(
1619 self.as_ptr() as *mut _,
1620 c"notify::mnemonics-visible".as_ptr() as *const _,
1621 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1622 notify_mnemonics_visible_trampoline::<Self, F> as *const (),
1623 )),
1624 Box_::into_raw(f),
1625 )
1626 }
1627 }
1628
1629 #[doc(alias = "modal")]
1630 fn connect_modal_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1631 unsafe extern "C" fn notify_modal_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
1632 this: *mut ffi::GtkWindow,
1633 _param_spec: glib::ffi::gpointer,
1634 f: glib::ffi::gpointer,
1635 ) {
1636 let f: &F = &*(f as *const F);
1637 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1638 }
1639 unsafe {
1640 let f: Box_<F> = Box_::new(f);
1641 connect_raw(
1642 self.as_ptr() as *mut _,
1643 c"notify::modal".as_ptr() as *const _,
1644 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1645 notify_modal_trampoline::<Self, F> as *const (),
1646 )),
1647 Box_::into_raw(f),
1648 )
1649 }
1650 }
1651
1652 #[doc(alias = "resizable")]
1653 fn connect_resizable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1654 unsafe extern "C" fn notify_resizable_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
1655 this: *mut ffi::GtkWindow,
1656 _param_spec: glib::ffi::gpointer,
1657 f: glib::ffi::gpointer,
1658 ) {
1659 let f: &F = &*(f as *const F);
1660 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1661 }
1662 unsafe {
1663 let f: Box_<F> = Box_::new(f);
1664 connect_raw(
1665 self.as_ptr() as *mut _,
1666 c"notify::resizable".as_ptr() as *const _,
1667 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1668 notify_resizable_trampoline::<Self, F> as *const (),
1669 )),
1670 Box_::into_raw(f),
1671 )
1672 }
1673 }
1674
1675 #[doc(alias = "startup-id")]
1676 fn connect_startup_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1677 unsafe extern "C" fn notify_startup_id_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
1678 this: *mut ffi::GtkWindow,
1679 _param_spec: glib::ffi::gpointer,
1680 f: glib::ffi::gpointer,
1681 ) {
1682 let f: &F = &*(f as *const F);
1683 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1684 }
1685 unsafe {
1686 let f: Box_<F> = Box_::new(f);
1687 connect_raw(
1688 self.as_ptr() as *mut _,
1689 c"notify::startup-id".as_ptr() as *const _,
1690 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1691 notify_startup_id_trampoline::<Self, F> as *const (),
1692 )),
1693 Box_::into_raw(f),
1694 )
1695 }
1696 }
1697
1698 #[cfg(feature = "v4_12")]
1699 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
1700 #[doc(alias = "suspended")]
1701 fn connect_suspended_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1702 unsafe extern "C" fn notify_suspended_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
1703 this: *mut ffi::GtkWindow,
1704 _param_spec: glib::ffi::gpointer,
1705 f: glib::ffi::gpointer,
1706 ) {
1707 let f: &F = &*(f as *const F);
1708 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1709 }
1710 unsafe {
1711 let f: Box_<F> = Box_::new(f);
1712 connect_raw(
1713 self.as_ptr() as *mut _,
1714 c"notify::suspended".as_ptr() as *const _,
1715 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1716 notify_suspended_trampoline::<Self, F> as *const (),
1717 )),
1718 Box_::into_raw(f),
1719 )
1720 }
1721 }
1722
1723 #[doc(alias = "title")]
1724 fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1725 unsafe extern "C" fn notify_title_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
1726 this: *mut ffi::GtkWindow,
1727 _param_spec: glib::ffi::gpointer,
1728 f: glib::ffi::gpointer,
1729 ) {
1730 let f: &F = &*(f as *const F);
1731 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1732 }
1733 unsafe {
1734 let f: Box_<F> = Box_::new(f);
1735 connect_raw(
1736 self.as_ptr() as *mut _,
1737 c"notify::title".as_ptr() as *const _,
1738 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1739 notify_title_trampoline::<Self, F> as *const (),
1740 )),
1741 Box_::into_raw(f),
1742 )
1743 }
1744 }
1745
1746 #[cfg(feature = "v4_6")]
1747 #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
1748 #[doc(alias = "titlebar")]
1749 fn connect_titlebar_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1750 unsafe extern "C" fn notify_titlebar_trampoline<P: IsA<Window>, F: Fn(&P) + 'static>(
1751 this: *mut ffi::GtkWindow,
1752 _param_spec: glib::ffi::gpointer,
1753 f: glib::ffi::gpointer,
1754 ) {
1755 let f: &F = &*(f as *const F);
1756 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1757 }
1758 unsafe {
1759 let f: Box_<F> = Box_::new(f);
1760 connect_raw(
1761 self.as_ptr() as *mut _,
1762 c"notify::titlebar".as_ptr() as *const _,
1763 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1764 notify_titlebar_trampoline::<Self, F> as *const (),
1765 )),
1766 Box_::into_raw(f),
1767 )
1768 }
1769 }
1770
1771 #[doc(alias = "transient-for")]
1772 fn connect_transient_for_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1773 unsafe extern "C" fn notify_transient_for_trampoline<
1774 P: IsA<Window>,
1775 F: Fn(&P) + 'static,
1776 >(
1777 this: *mut ffi::GtkWindow,
1778 _param_spec: glib::ffi::gpointer,
1779 f: glib::ffi::gpointer,
1780 ) {
1781 let f: &F = &*(f as *const F);
1782 f(Window::from_glib_borrow(this).unsafe_cast_ref())
1783 }
1784 unsafe {
1785 let f: Box_<F> = Box_::new(f);
1786 connect_raw(
1787 self.as_ptr() as *mut _,
1788 c"notify::transient-for".as_ptr() as *const _,
1789 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1790 notify_transient_for_trampoline::<Self, F> as *const (),
1791 )),
1792 Box_::into_raw(f),
1793 )
1794 }
1795 }
1796}
1797
1798impl<O: IsA<Window>> GtkWindowExt for O {}