1 // This file was generated by gir (https://github.com/gtk-rs/gir)
2 // from gir-files (https://github.com/gtk-rs/gir-files)
3 // DO NOT EDIT
4 
5 use crate::Align;
6 use crate::Application;
7 use crate::Bin;
8 use crate::Buildable;
9 use crate::Container;
10 use crate::ResizeMode;
11 #[cfg(any(feature = "v3_20", feature = "dox"))]
12 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
13 use crate::ShortcutsWindow;
14 use crate::Widget;
15 use crate::Window;
16 use crate::WindowPosition;
17 use crate::WindowType;
18 use glib::object::Cast;
19 use glib::object::IsA;
20 use glib::signal::connect_raw;
21 use glib::signal::SignalHandlerId;
22 use glib::translate::*;
23 use glib::StaticType;
24 use glib::ToValue;
25 use std::boxed::Box as Box_;
26 use std::fmt;
27 use std::mem::transmute;
28 
29 glib::wrapper! {
30     #[doc(alias = "GtkApplicationWindow")]
31     pub struct ApplicationWindow(Object<ffi::GtkApplicationWindow, ffi::GtkApplicationWindowClass>) @extends Window, Bin, Container, Widget, @implements Buildable, gio::ActionGroup, gio::ActionMap;
32 
33     match fn {
34         type_ => || ffi::gtk_application_window_get_type(),
35     }
36 }
37 
38 impl ApplicationWindow {
39     // rustdoc-stripper-ignore-next
40     /// Creates a new builder-pattern struct instance to construct [`ApplicationWindow`] objects.
41     ///
42     /// This method returns an instance of [`ApplicationWindowBuilder`] which can be used to create [`ApplicationWindow`] objects.
builder() -> ApplicationWindowBuilder43     pub fn builder() -> ApplicationWindowBuilder {
44         ApplicationWindowBuilder::default()
45     }
46 }
47 
48 #[derive(Clone, Default)]
49 // rustdoc-stripper-ignore-next
50 /// A [builder-pattern] type to construct [`ApplicationWindow`] objects.
51 ///
52 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
53 pub struct ApplicationWindowBuilder {
54     show_menubar: Option<bool>,
55     accept_focus: Option<bool>,
56     application: Option<Application>,
57     attached_to: Option<Widget>,
58     decorated: Option<bool>,
59     default_height: Option<i32>,
60     default_width: Option<i32>,
61     deletable: Option<bool>,
62     destroy_with_parent: Option<bool>,
63     focus_on_map: Option<bool>,
64     focus_visible: Option<bool>,
65     gravity: Option<gdk::Gravity>,
66     hide_titlebar_when_maximized: Option<bool>,
67     icon: Option<gdk_pixbuf::Pixbuf>,
68     icon_name: Option<String>,
69     mnemonics_visible: Option<bool>,
70     modal: Option<bool>,
71     resizable: Option<bool>,
72     role: Option<String>,
73     screen: Option<gdk::Screen>,
74     skip_pager_hint: Option<bool>,
75     skip_taskbar_hint: Option<bool>,
76     startup_id: Option<String>,
77     title: Option<String>,
78     transient_for: Option<Window>,
79     type_: Option<WindowType>,
80     type_hint: Option<gdk::WindowTypeHint>,
81     urgency_hint: Option<bool>,
82     window_position: Option<WindowPosition>,
83     border_width: Option<u32>,
84     child: Option<Widget>,
85     resize_mode: Option<ResizeMode>,
86     app_paintable: Option<bool>,
87     can_default: Option<bool>,
88     can_focus: Option<bool>,
89     events: Option<gdk::EventMask>,
90     expand: Option<bool>,
91     #[cfg(any(feature = "v3_20", feature = "dox"))]
92     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
93     focus_on_click: Option<bool>,
94     halign: Option<Align>,
95     has_default: Option<bool>,
96     has_focus: Option<bool>,
97     has_tooltip: Option<bool>,
98     height_request: Option<i32>,
99     hexpand: Option<bool>,
100     hexpand_set: Option<bool>,
101     is_focus: Option<bool>,
102     margin: Option<i32>,
103     margin_bottom: Option<i32>,
104     margin_end: Option<i32>,
105     margin_start: Option<i32>,
106     margin_top: Option<i32>,
107     name: Option<String>,
108     no_show_all: Option<bool>,
109     opacity: Option<f64>,
110     parent: Option<Container>,
111     receives_default: Option<bool>,
112     sensitive: Option<bool>,
113     tooltip_markup: Option<String>,
114     tooltip_text: Option<String>,
115     valign: Option<Align>,
116     vexpand: Option<bool>,
117     vexpand_set: Option<bool>,
118     visible: Option<bool>,
119     width_request: Option<i32>,
120 }
121 
122 impl ApplicationWindowBuilder {
123     // rustdoc-stripper-ignore-next
124     /// Create a new [`ApplicationWindowBuilder`].
new() -> Self125     pub fn new() -> Self {
126         Self::default()
127     }
128 
129     // rustdoc-stripper-ignore-next
130     /// Build the [`ApplicationWindow`].
build(self) -> ApplicationWindow131     pub fn build(self) -> ApplicationWindow {
132         let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
133         if let Some(ref show_menubar) = self.show_menubar {
134             properties.push(("show-menubar", show_menubar));
135         }
136         if let Some(ref accept_focus) = self.accept_focus {
137             properties.push(("accept-focus", accept_focus));
138         }
139         if let Some(ref application) = self.application {
140             properties.push(("application", application));
141         }
142         if let Some(ref attached_to) = self.attached_to {
143             properties.push(("attached-to", attached_to));
144         }
145         if let Some(ref decorated) = self.decorated {
146             properties.push(("decorated", decorated));
147         }
148         if let Some(ref default_height) = self.default_height {
149             properties.push(("default-height", default_height));
150         }
151         if let Some(ref default_width) = self.default_width {
152             properties.push(("default-width", default_width));
153         }
154         if let Some(ref deletable) = self.deletable {
155             properties.push(("deletable", deletable));
156         }
157         if let Some(ref destroy_with_parent) = self.destroy_with_parent {
158             properties.push(("destroy-with-parent", destroy_with_parent));
159         }
160         if let Some(ref focus_on_map) = self.focus_on_map {
161             properties.push(("focus-on-map", focus_on_map));
162         }
163         if let Some(ref focus_visible) = self.focus_visible {
164             properties.push(("focus-visible", focus_visible));
165         }
166         if let Some(ref gravity) = self.gravity {
167             properties.push(("gravity", gravity));
168         }
169         if let Some(ref hide_titlebar_when_maximized) = self.hide_titlebar_when_maximized {
170             properties.push(("hide-titlebar-when-maximized", hide_titlebar_when_maximized));
171         }
172         if let Some(ref icon) = self.icon {
173             properties.push(("icon", icon));
174         }
175         if let Some(ref icon_name) = self.icon_name {
176             properties.push(("icon-name", icon_name));
177         }
178         if let Some(ref mnemonics_visible) = self.mnemonics_visible {
179             properties.push(("mnemonics-visible", mnemonics_visible));
180         }
181         if let Some(ref modal) = self.modal {
182             properties.push(("modal", modal));
183         }
184         if let Some(ref resizable) = self.resizable {
185             properties.push(("resizable", resizable));
186         }
187         if let Some(ref role) = self.role {
188             properties.push(("role", role));
189         }
190         if let Some(ref screen) = self.screen {
191             properties.push(("screen", screen));
192         }
193         if let Some(ref skip_pager_hint) = self.skip_pager_hint {
194             properties.push(("skip-pager-hint", skip_pager_hint));
195         }
196         if let Some(ref skip_taskbar_hint) = self.skip_taskbar_hint {
197             properties.push(("skip-taskbar-hint", skip_taskbar_hint));
198         }
199         if let Some(ref startup_id) = self.startup_id {
200             properties.push(("startup-id", startup_id));
201         }
202         if let Some(ref title) = self.title {
203             properties.push(("title", title));
204         }
205         if let Some(ref transient_for) = self.transient_for {
206             properties.push(("transient-for", transient_for));
207         }
208         if let Some(ref type_) = self.type_ {
209             properties.push(("type", type_));
210         }
211         if let Some(ref type_hint) = self.type_hint {
212             properties.push(("type-hint", type_hint));
213         }
214         if let Some(ref urgency_hint) = self.urgency_hint {
215             properties.push(("urgency-hint", urgency_hint));
216         }
217         if let Some(ref window_position) = self.window_position {
218             properties.push(("window-position", window_position));
219         }
220         if let Some(ref border_width) = self.border_width {
221             properties.push(("border-width", border_width));
222         }
223         if let Some(ref child) = self.child {
224             properties.push(("child", child));
225         }
226         if let Some(ref resize_mode) = self.resize_mode {
227             properties.push(("resize-mode", resize_mode));
228         }
229         if let Some(ref app_paintable) = self.app_paintable {
230             properties.push(("app-paintable", app_paintable));
231         }
232         if let Some(ref can_default) = self.can_default {
233             properties.push(("can-default", can_default));
234         }
235         if let Some(ref can_focus) = self.can_focus {
236             properties.push(("can-focus", can_focus));
237         }
238         if let Some(ref events) = self.events {
239             properties.push(("events", events));
240         }
241         if let Some(ref expand) = self.expand {
242             properties.push(("expand", expand));
243         }
244         #[cfg(any(feature = "v3_20", feature = "dox"))]
245         if let Some(ref focus_on_click) = self.focus_on_click {
246             properties.push(("focus-on-click", focus_on_click));
247         }
248         if let Some(ref halign) = self.halign {
249             properties.push(("halign", halign));
250         }
251         if let Some(ref has_default) = self.has_default {
252             properties.push(("has-default", has_default));
253         }
254         if let Some(ref has_focus) = self.has_focus {
255             properties.push(("has-focus", has_focus));
256         }
257         if let Some(ref has_tooltip) = self.has_tooltip {
258             properties.push(("has-tooltip", has_tooltip));
259         }
260         if let Some(ref height_request) = self.height_request {
261             properties.push(("height-request", height_request));
262         }
263         if let Some(ref hexpand) = self.hexpand {
264             properties.push(("hexpand", hexpand));
265         }
266         if let Some(ref hexpand_set) = self.hexpand_set {
267             properties.push(("hexpand-set", hexpand_set));
268         }
269         if let Some(ref is_focus) = self.is_focus {
270             properties.push(("is-focus", is_focus));
271         }
272         if let Some(ref margin) = self.margin {
273             properties.push(("margin", margin));
274         }
275         if let Some(ref margin_bottom) = self.margin_bottom {
276             properties.push(("margin-bottom", margin_bottom));
277         }
278         if let Some(ref margin_end) = self.margin_end {
279             properties.push(("margin-end", margin_end));
280         }
281         if let Some(ref margin_start) = self.margin_start {
282             properties.push(("margin-start", margin_start));
283         }
284         if let Some(ref margin_top) = self.margin_top {
285             properties.push(("margin-top", margin_top));
286         }
287         if let Some(ref name) = self.name {
288             properties.push(("name", name));
289         }
290         if let Some(ref no_show_all) = self.no_show_all {
291             properties.push(("no-show-all", no_show_all));
292         }
293         if let Some(ref opacity) = self.opacity {
294             properties.push(("opacity", opacity));
295         }
296         if let Some(ref parent) = self.parent {
297             properties.push(("parent", parent));
298         }
299         if let Some(ref receives_default) = self.receives_default {
300             properties.push(("receives-default", receives_default));
301         }
302         if let Some(ref sensitive) = self.sensitive {
303             properties.push(("sensitive", sensitive));
304         }
305         if let Some(ref tooltip_markup) = self.tooltip_markup {
306             properties.push(("tooltip-markup", tooltip_markup));
307         }
308         if let Some(ref tooltip_text) = self.tooltip_text {
309             properties.push(("tooltip-text", tooltip_text));
310         }
311         if let Some(ref valign) = self.valign {
312             properties.push(("valign", valign));
313         }
314         if let Some(ref vexpand) = self.vexpand {
315             properties.push(("vexpand", vexpand));
316         }
317         if let Some(ref vexpand_set) = self.vexpand_set {
318             properties.push(("vexpand-set", vexpand_set));
319         }
320         if let Some(ref visible) = self.visible {
321             properties.push(("visible", visible));
322         }
323         if let Some(ref width_request) = self.width_request {
324             properties.push(("width-request", width_request));
325         }
326         glib::Object::new::<ApplicationWindow>(&properties)
327             .expect("Failed to create an instance of ApplicationWindow")
328     }
329 
show_menubar(mut self, show_menubar: bool) -> Self330     pub fn show_menubar(mut self, show_menubar: bool) -> Self {
331         self.show_menubar = Some(show_menubar);
332         self
333     }
334 
accept_focus(mut self, accept_focus: bool) -> Self335     pub fn accept_focus(mut self, accept_focus: bool) -> Self {
336         self.accept_focus = Some(accept_focus);
337         self
338     }
339 
application<P: IsA<Application>>(mut self, application: &P) -> Self340     pub fn application<P: IsA<Application>>(mut self, application: &P) -> Self {
341         self.application = Some(application.clone().upcast());
342         self
343     }
344 
attached_to<P: IsA<Widget>>(mut self, attached_to: &P) -> Self345     pub fn attached_to<P: IsA<Widget>>(mut self, attached_to: &P) -> Self {
346         self.attached_to = Some(attached_to.clone().upcast());
347         self
348     }
349 
decorated(mut self, decorated: bool) -> Self350     pub fn decorated(mut self, decorated: bool) -> Self {
351         self.decorated = Some(decorated);
352         self
353     }
354 
default_height(mut self, default_height: i32) -> Self355     pub fn default_height(mut self, default_height: i32) -> Self {
356         self.default_height = Some(default_height);
357         self
358     }
359 
default_width(mut self, default_width: i32) -> Self360     pub fn default_width(mut self, default_width: i32) -> Self {
361         self.default_width = Some(default_width);
362         self
363     }
364 
deletable(mut self, deletable: bool) -> Self365     pub fn deletable(mut self, deletable: bool) -> Self {
366         self.deletable = Some(deletable);
367         self
368     }
369 
destroy_with_parent(mut self, destroy_with_parent: bool) -> Self370     pub fn destroy_with_parent(mut self, destroy_with_parent: bool) -> Self {
371         self.destroy_with_parent = Some(destroy_with_parent);
372         self
373     }
374 
focus_on_map(mut self, focus_on_map: bool) -> Self375     pub fn focus_on_map(mut self, focus_on_map: bool) -> Self {
376         self.focus_on_map = Some(focus_on_map);
377         self
378     }
379 
focus_visible(mut self, focus_visible: bool) -> Self380     pub fn focus_visible(mut self, focus_visible: bool) -> Self {
381         self.focus_visible = Some(focus_visible);
382         self
383     }
384 
gravity(mut self, gravity: gdk::Gravity) -> Self385     pub fn gravity(mut self, gravity: gdk::Gravity) -> Self {
386         self.gravity = Some(gravity);
387         self
388     }
389 
hide_titlebar_when_maximized(mut self, hide_titlebar_when_maximized: bool) -> Self390     pub fn hide_titlebar_when_maximized(mut self, hide_titlebar_when_maximized: bool) -> Self {
391         self.hide_titlebar_when_maximized = Some(hide_titlebar_when_maximized);
392         self
393     }
394 
icon(mut self, icon: &gdk_pixbuf::Pixbuf) -> Self395     pub fn icon(mut self, icon: &gdk_pixbuf::Pixbuf) -> Self {
396         self.icon = Some(icon.clone());
397         self
398     }
399 
icon_name(mut self, icon_name: &str) -> Self400     pub fn icon_name(mut self, icon_name: &str) -> Self {
401         self.icon_name = Some(icon_name.to_string());
402         self
403     }
404 
mnemonics_visible(mut self, mnemonics_visible: bool) -> Self405     pub fn mnemonics_visible(mut self, mnemonics_visible: bool) -> Self {
406         self.mnemonics_visible = Some(mnemonics_visible);
407         self
408     }
409 
modal(mut self, modal: bool) -> Self410     pub fn modal(mut self, modal: bool) -> Self {
411         self.modal = Some(modal);
412         self
413     }
414 
resizable(mut self, resizable: bool) -> Self415     pub fn resizable(mut self, resizable: bool) -> Self {
416         self.resizable = Some(resizable);
417         self
418     }
419 
role(mut self, role: &str) -> Self420     pub fn role(mut self, role: &str) -> Self {
421         self.role = Some(role.to_string());
422         self
423     }
424 
screen(mut self, screen: &gdk::Screen) -> Self425     pub fn screen(mut self, screen: &gdk::Screen) -> Self {
426         self.screen = Some(screen.clone());
427         self
428     }
429 
skip_pager_hint(mut self, skip_pager_hint: bool) -> Self430     pub fn skip_pager_hint(mut self, skip_pager_hint: bool) -> Self {
431         self.skip_pager_hint = Some(skip_pager_hint);
432         self
433     }
434 
skip_taskbar_hint(mut self, skip_taskbar_hint: bool) -> Self435     pub fn skip_taskbar_hint(mut self, skip_taskbar_hint: bool) -> Self {
436         self.skip_taskbar_hint = Some(skip_taskbar_hint);
437         self
438     }
439 
startup_id(mut self, startup_id: &str) -> Self440     pub fn startup_id(mut self, startup_id: &str) -> Self {
441         self.startup_id = Some(startup_id.to_string());
442         self
443     }
444 
title(mut self, title: &str) -> Self445     pub fn title(mut self, title: &str) -> Self {
446         self.title = Some(title.to_string());
447         self
448     }
449 
transient_for<P: IsA<Window>>(mut self, transient_for: &P) -> Self450     pub fn transient_for<P: IsA<Window>>(mut self, transient_for: &P) -> Self {
451         self.transient_for = Some(transient_for.clone().upcast());
452         self
453     }
454 
type_(mut self, type_: WindowType) -> Self455     pub fn type_(mut self, type_: WindowType) -> Self {
456         self.type_ = Some(type_);
457         self
458     }
459 
type_hint(mut self, type_hint: gdk::WindowTypeHint) -> Self460     pub fn type_hint(mut self, type_hint: gdk::WindowTypeHint) -> Self {
461         self.type_hint = Some(type_hint);
462         self
463     }
464 
urgency_hint(mut self, urgency_hint: bool) -> Self465     pub fn urgency_hint(mut self, urgency_hint: bool) -> Self {
466         self.urgency_hint = Some(urgency_hint);
467         self
468     }
469 
window_position(mut self, window_position: WindowPosition) -> Self470     pub fn window_position(mut self, window_position: WindowPosition) -> Self {
471         self.window_position = Some(window_position);
472         self
473     }
474 
border_width(mut self, border_width: u32) -> Self475     pub fn border_width(mut self, border_width: u32) -> Self {
476         self.border_width = Some(border_width);
477         self
478     }
479 
child<P: IsA<Widget>>(mut self, child: &P) -> Self480     pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self {
481         self.child = Some(child.clone().upcast());
482         self
483     }
484 
resize_mode(mut self, resize_mode: ResizeMode) -> Self485     pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self {
486         self.resize_mode = Some(resize_mode);
487         self
488     }
489 
app_paintable(mut self, app_paintable: bool) -> Self490     pub fn app_paintable(mut self, app_paintable: bool) -> Self {
491         self.app_paintable = Some(app_paintable);
492         self
493     }
494 
can_default(mut self, can_default: bool) -> Self495     pub fn can_default(mut self, can_default: bool) -> Self {
496         self.can_default = Some(can_default);
497         self
498     }
499 
can_focus(mut self, can_focus: bool) -> Self500     pub fn can_focus(mut self, can_focus: bool) -> Self {
501         self.can_focus = Some(can_focus);
502         self
503     }
504 
events(mut self, events: gdk::EventMask) -> Self505     pub fn events(mut self, events: gdk::EventMask) -> Self {
506         self.events = Some(events);
507         self
508     }
509 
expand(mut self, expand: bool) -> Self510     pub fn expand(mut self, expand: bool) -> Self {
511         self.expand = Some(expand);
512         self
513     }
514 
515     #[cfg(any(feature = "v3_20", feature = "dox"))]
516     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
focus_on_click(mut self, focus_on_click: bool) -> Self517     pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
518         self.focus_on_click = Some(focus_on_click);
519         self
520     }
521 
halign(mut self, halign: Align) -> Self522     pub fn halign(mut self, halign: Align) -> Self {
523         self.halign = Some(halign);
524         self
525     }
526 
has_default(mut self, has_default: bool) -> Self527     pub fn has_default(mut self, has_default: bool) -> Self {
528         self.has_default = Some(has_default);
529         self
530     }
531 
has_focus(mut self, has_focus: bool) -> Self532     pub fn has_focus(mut self, has_focus: bool) -> Self {
533         self.has_focus = Some(has_focus);
534         self
535     }
536 
has_tooltip(mut self, has_tooltip: bool) -> Self537     pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
538         self.has_tooltip = Some(has_tooltip);
539         self
540     }
541 
height_request(mut self, height_request: i32) -> Self542     pub fn height_request(mut self, height_request: i32) -> Self {
543         self.height_request = Some(height_request);
544         self
545     }
546 
hexpand(mut self, hexpand: bool) -> Self547     pub fn hexpand(mut self, hexpand: bool) -> Self {
548         self.hexpand = Some(hexpand);
549         self
550     }
551 
hexpand_set(mut self, hexpand_set: bool) -> Self552     pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
553         self.hexpand_set = Some(hexpand_set);
554         self
555     }
556 
is_focus(mut self, is_focus: bool) -> Self557     pub fn is_focus(mut self, is_focus: bool) -> Self {
558         self.is_focus = Some(is_focus);
559         self
560     }
561 
margin(mut self, margin: i32) -> Self562     pub fn margin(mut self, margin: i32) -> Self {
563         self.margin = Some(margin);
564         self
565     }
566 
margin_bottom(mut self, margin_bottom: i32) -> Self567     pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
568         self.margin_bottom = Some(margin_bottom);
569         self
570     }
571 
margin_end(mut self, margin_end: i32) -> Self572     pub fn margin_end(mut self, margin_end: i32) -> Self {
573         self.margin_end = Some(margin_end);
574         self
575     }
576 
margin_start(mut self, margin_start: i32) -> Self577     pub fn margin_start(mut self, margin_start: i32) -> Self {
578         self.margin_start = Some(margin_start);
579         self
580     }
581 
margin_top(mut self, margin_top: i32) -> Self582     pub fn margin_top(mut self, margin_top: i32) -> Self {
583         self.margin_top = Some(margin_top);
584         self
585     }
586 
name(mut self, name: &str) -> Self587     pub fn name(mut self, name: &str) -> Self {
588         self.name = Some(name.to_string());
589         self
590     }
591 
no_show_all(mut self, no_show_all: bool) -> Self592     pub fn no_show_all(mut self, no_show_all: bool) -> Self {
593         self.no_show_all = Some(no_show_all);
594         self
595     }
596 
opacity(mut self, opacity: f64) -> Self597     pub fn opacity(mut self, opacity: f64) -> Self {
598         self.opacity = Some(opacity);
599         self
600     }
601 
parent<P: IsA<Container>>(mut self, parent: &P) -> Self602     pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self {
603         self.parent = Some(parent.clone().upcast());
604         self
605     }
606 
receives_default(mut self, receives_default: bool) -> Self607     pub fn receives_default(mut self, receives_default: bool) -> Self {
608         self.receives_default = Some(receives_default);
609         self
610     }
611 
sensitive(mut self, sensitive: bool) -> Self612     pub fn sensitive(mut self, sensitive: bool) -> Self {
613         self.sensitive = Some(sensitive);
614         self
615     }
616 
tooltip_markup(mut self, tooltip_markup: &str) -> Self617     pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
618         self.tooltip_markup = Some(tooltip_markup.to_string());
619         self
620     }
621 
tooltip_text(mut self, tooltip_text: &str) -> Self622     pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
623         self.tooltip_text = Some(tooltip_text.to_string());
624         self
625     }
626 
valign(mut self, valign: Align) -> Self627     pub fn valign(mut self, valign: Align) -> Self {
628         self.valign = Some(valign);
629         self
630     }
631 
vexpand(mut self, vexpand: bool) -> Self632     pub fn vexpand(mut self, vexpand: bool) -> Self {
633         self.vexpand = Some(vexpand);
634         self
635     }
636 
vexpand_set(mut self, vexpand_set: bool) -> Self637     pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
638         self.vexpand_set = Some(vexpand_set);
639         self
640     }
641 
visible(mut self, visible: bool) -> Self642     pub fn visible(mut self, visible: bool) -> Self {
643         self.visible = Some(visible);
644         self
645     }
646 
width_request(mut self, width_request: i32) -> Self647     pub fn width_request(mut self, width_request: i32) -> Self {
648         self.width_request = Some(width_request);
649         self
650     }
651 }
652 
653 pub const NONE_APPLICATION_WINDOW: Option<&ApplicationWindow> = None;
654 
655 pub trait ApplicationWindowExt: 'static {
656     #[cfg(any(feature = "v3_20", feature = "dox"))]
657     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
658     #[doc(alias = "gtk_application_window_get_help_overlay")]
659     #[doc(alias = "get_help_overlay")]
help_overlay(&self) -> Option<ShortcutsWindow>660     fn help_overlay(&self) -> Option<ShortcutsWindow>;
661 
662     #[doc(alias = "gtk_application_window_get_id")]
663     #[doc(alias = "get_id")]
id(&self) -> u32664     fn id(&self) -> u32;
665 
666     #[doc(alias = "gtk_application_window_get_show_menubar")]
667     #[doc(alias = "get_show_menubar")]
shows_menubar(&self) -> bool668     fn shows_menubar(&self) -> bool;
669 
670     #[cfg(any(feature = "v3_20", feature = "dox"))]
671     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
672     #[doc(alias = "gtk_application_window_set_help_overlay")]
set_help_overlay<P: IsA<ShortcutsWindow>>(&self, help_overlay: Option<&P>)673     fn set_help_overlay<P: IsA<ShortcutsWindow>>(&self, help_overlay: Option<&P>);
674 
675     #[doc(alias = "gtk_application_window_set_show_menubar")]
set_show_menubar(&self, show_menubar: bool)676     fn set_show_menubar(&self, show_menubar: bool);
677 
678     #[doc(alias = "show-menubar")]
connect_show_menubar_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId679     fn connect_show_menubar_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
680 }
681 
682 impl<O: IsA<ApplicationWindow>> ApplicationWindowExt for O {
683     #[cfg(any(feature = "v3_20", feature = "dox"))]
684     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
help_overlay(&self) -> Option<ShortcutsWindow>685     fn help_overlay(&self) -> Option<ShortcutsWindow> {
686         unsafe {
687             from_glib_none(ffi::gtk_application_window_get_help_overlay(
688                 self.as_ref().to_glib_none().0,
689             ))
690         }
691     }
692 
id(&self) -> u32693     fn id(&self) -> u32 {
694         unsafe { ffi::gtk_application_window_get_id(self.as_ref().to_glib_none().0) }
695     }
696 
shows_menubar(&self) -> bool697     fn shows_menubar(&self) -> bool {
698         unsafe {
699             from_glib(ffi::gtk_application_window_get_show_menubar(
700                 self.as_ref().to_glib_none().0,
701             ))
702         }
703     }
704 
705     #[cfg(any(feature = "v3_20", feature = "dox"))]
706     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
set_help_overlay<P: IsA<ShortcutsWindow>>(&self, help_overlay: Option<&P>)707     fn set_help_overlay<P: IsA<ShortcutsWindow>>(&self, help_overlay: Option<&P>) {
708         unsafe {
709             ffi::gtk_application_window_set_help_overlay(
710                 self.as_ref().to_glib_none().0,
711                 help_overlay.map(|p| p.as_ref()).to_glib_none().0,
712             );
713         }
714     }
715 
set_show_menubar(&self, show_menubar: bool)716     fn set_show_menubar(&self, show_menubar: bool) {
717         unsafe {
718             ffi::gtk_application_window_set_show_menubar(
719                 self.as_ref().to_glib_none().0,
720                 show_menubar.into_glib(),
721             );
722         }
723     }
724 
connect_show_menubar_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId725     fn connect_show_menubar_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
726         unsafe extern "C" fn notify_show_menubar_trampoline<
727             P: IsA<ApplicationWindow>,
728             F: Fn(&P) + 'static,
729         >(
730             this: *mut ffi::GtkApplicationWindow,
731             _param_spec: glib::ffi::gpointer,
732             f: glib::ffi::gpointer,
733         ) {
734             let f: &F = &*(f as *const F);
735             f(ApplicationWindow::from_glib_borrow(this).unsafe_cast_ref())
736         }
737         unsafe {
738             let f: Box_<F> = Box_::new(f);
739             connect_raw(
740                 self.as_ptr() as *mut _,
741                 b"notify::show-menubar\0".as_ptr() as *const _,
742                 Some(transmute::<_, unsafe extern "C" fn()>(
743                     notify_show_menubar_trampoline::<Self, F> as *const (),
744                 )),
745                 Box_::into_raw(f),
746             )
747         }
748     }
749 }
750 
751 impl fmt::Display for ApplicationWindow {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result752     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
753         f.write_str("ApplicationWindow")
754     }
755 }
756