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 use glib::object::Cast;
7 use glib::object::IsA;
8 use glib::translate::*;
9 use glib::StaticType;
10 use glib::ToValue;
11 use std::fmt;
12 
13 glib::wrapper! {
14     #[doc(alias = "HdyWindow")]
15     pub struct Window(Object<ffi::HdyWindow, ffi::HdyWindowClass>) @extends gtk::Window, gtk::Bin, gtk::Container, gtk::Widget, @implements gtk::Buildable;
16 
17     match fn {
18         type_ => || ffi::hdy_window_get_type(),
19     }
20 }
21 
22 impl Window {
23     #[doc(alias = "hdy_window_new")]
new() -> Window24     pub fn new() -> Window {
25         assert_initialized_main_thread!();
26         unsafe { gtk::Widget::from_glib_full(ffi::hdy_window_new()).unsafe_cast() }
27     }
28 
29     // rustdoc-stripper-ignore-next
30     /// Creates a new builder-pattern struct instance to construct [`Window`] objects.
31     ///
32     /// This method returns an instance of [`WindowBuilder`] which can be used to create [`Window`] objects.
builder() -> WindowBuilder33     pub fn builder() -> WindowBuilder {
34         WindowBuilder::default()
35     }
36 }
37 
38 impl Default for Window {
default() -> Self39     fn default() -> Self {
40         Self::new()
41     }
42 }
43 
44 #[derive(Clone, Default)]
45 // rustdoc-stripper-ignore-next
46 /// A [builder-pattern] type to construct [`Window`] objects.
47 ///
48 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
49 pub struct WindowBuilder {
50     accept_focus: Option<bool>,
51     //application: /*Unknown type*/,
52     attached_to: Option<gtk::Widget>,
53     decorated: Option<bool>,
54     default_height: Option<i32>,
55     default_width: Option<i32>,
56     deletable: Option<bool>,
57     destroy_with_parent: Option<bool>,
58     focus_on_map: Option<bool>,
59     focus_visible: Option<bool>,
60     //gravity: /*Unknown type*/,
61     has_resize_grip: Option<bool>,
62     hide_titlebar_when_maximized: Option<bool>,
63     icon: Option<gdk_pixbuf::Pixbuf>,
64     icon_name: Option<String>,
65     mnemonics_visible: Option<bool>,
66     modal: Option<bool>,
67     resizable: Option<bool>,
68     role: Option<String>,
69     //screen: /*Unknown type*/,
70     skip_pager_hint: Option<bool>,
71     skip_taskbar_hint: Option<bool>,
72     startup_id: Option<String>,
73     title: Option<String>,
74     transient_for: Option<gtk::Window>,
75     //type: /*Unknown type*/,
76     //type-hint: /*Unknown type*/,
77     urgency_hint: Option<bool>,
78     //window-position: /*Unknown type*/,
79     border_width: Option<u32>,
80     child: Option<gtk::Widget>,
81     resize_mode: Option<gtk::ResizeMode>,
82     app_paintable: Option<bool>,
83     can_default: Option<bool>,
84     can_focus: Option<bool>,
85     double_buffered: Option<bool>,
86     events: Option<gdk::EventMask>,
87     expand: Option<bool>,
88     focus_on_click: Option<bool>,
89     halign: Option<gtk::Align>,
90     has_default: Option<bool>,
91     has_focus: Option<bool>,
92     has_tooltip: Option<bool>,
93     height_request: Option<i32>,
94     hexpand: Option<bool>,
95     hexpand_set: Option<bool>,
96     is_focus: Option<bool>,
97     margin: Option<i32>,
98     margin_bottom: Option<i32>,
99     margin_end: Option<i32>,
100     margin_left: Option<i32>,
101     margin_right: Option<i32>,
102     margin_start: Option<i32>,
103     margin_top: Option<i32>,
104     name: Option<String>,
105     no_show_all: Option<bool>,
106     opacity: Option<f64>,
107     parent: Option<gtk::Container>,
108     receives_default: Option<bool>,
109     sensitive: Option<bool>,
110     //style: /*Unknown type*/,
111     tooltip_markup: Option<String>,
112     tooltip_text: Option<String>,
113     valign: Option<gtk::Align>,
114     vexpand: Option<bool>,
115     vexpand_set: Option<bool>,
116     visible: Option<bool>,
117     width_request: Option<i32>,
118 }
119 
120 impl WindowBuilder {
121     // rustdoc-stripper-ignore-next
122     /// Create a new [`WindowBuilder`].
new() -> Self123     pub fn new() -> Self {
124         Self::default()
125     }
126 
127     // rustdoc-stripper-ignore-next
128     /// Build the [`Window`].
build(self) -> Window129     pub fn build(self) -> Window {
130         let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
131         if let Some(ref accept_focus) = self.accept_focus {
132             properties.push(("accept-focus", accept_focus));
133         }
134         if let Some(ref attached_to) = self.attached_to {
135             properties.push(("attached-to", attached_to));
136         }
137         if let Some(ref decorated) = self.decorated {
138             properties.push(("decorated", decorated));
139         }
140         if let Some(ref default_height) = self.default_height {
141             properties.push(("default-height", default_height));
142         }
143         if let Some(ref default_width) = self.default_width {
144             properties.push(("default-width", default_width));
145         }
146         if let Some(ref deletable) = self.deletable {
147             properties.push(("deletable", deletable));
148         }
149         if let Some(ref destroy_with_parent) = self.destroy_with_parent {
150             properties.push(("destroy-with-parent", destroy_with_parent));
151         }
152         if let Some(ref focus_on_map) = self.focus_on_map {
153             properties.push(("focus-on-map", focus_on_map));
154         }
155         if let Some(ref focus_visible) = self.focus_visible {
156             properties.push(("focus-visible", focus_visible));
157         }
158         if let Some(ref has_resize_grip) = self.has_resize_grip {
159             properties.push(("has-resize-grip", has_resize_grip));
160         }
161         if let Some(ref hide_titlebar_when_maximized) = self.hide_titlebar_when_maximized {
162             properties.push(("hide-titlebar-when-maximized", hide_titlebar_when_maximized));
163         }
164         if let Some(ref icon) = self.icon {
165             properties.push(("icon", icon));
166         }
167         if let Some(ref icon_name) = self.icon_name {
168             properties.push(("icon-name", icon_name));
169         }
170         if let Some(ref mnemonics_visible) = self.mnemonics_visible {
171             properties.push(("mnemonics-visible", mnemonics_visible));
172         }
173         if let Some(ref modal) = self.modal {
174             properties.push(("modal", modal));
175         }
176         if let Some(ref resizable) = self.resizable {
177             properties.push(("resizable", resizable));
178         }
179         if let Some(ref role) = self.role {
180             properties.push(("role", role));
181         }
182         if let Some(ref skip_pager_hint) = self.skip_pager_hint {
183             properties.push(("skip-pager-hint", skip_pager_hint));
184         }
185         if let Some(ref skip_taskbar_hint) = self.skip_taskbar_hint {
186             properties.push(("skip-taskbar-hint", skip_taskbar_hint));
187         }
188         if let Some(ref startup_id) = self.startup_id {
189             properties.push(("startup-id", startup_id));
190         }
191         if let Some(ref title) = self.title {
192             properties.push(("title", title));
193         }
194         if let Some(ref transient_for) = self.transient_for {
195             properties.push(("transient-for", transient_for));
196         }
197         if let Some(ref urgency_hint) = self.urgency_hint {
198             properties.push(("urgency-hint", urgency_hint));
199         }
200         if let Some(ref border_width) = self.border_width {
201             properties.push(("border-width", border_width));
202         }
203         if let Some(ref child) = self.child {
204             properties.push(("child", child));
205         }
206         if let Some(ref resize_mode) = self.resize_mode {
207             properties.push(("resize-mode", resize_mode));
208         }
209         if let Some(ref app_paintable) = self.app_paintable {
210             properties.push(("app-paintable", app_paintable));
211         }
212         if let Some(ref can_default) = self.can_default {
213             properties.push(("can-default", can_default));
214         }
215         if let Some(ref can_focus) = self.can_focus {
216             properties.push(("can-focus", can_focus));
217         }
218         if let Some(ref double_buffered) = self.double_buffered {
219             properties.push(("double-buffered", double_buffered));
220         }
221         if let Some(ref events) = self.events {
222             properties.push(("events", events));
223         }
224         if let Some(ref expand) = self.expand {
225             properties.push(("expand", expand));
226         }
227         if let Some(ref focus_on_click) = self.focus_on_click {
228             properties.push(("focus-on-click", focus_on_click));
229         }
230         if let Some(ref halign) = self.halign {
231             properties.push(("halign", halign));
232         }
233         if let Some(ref has_default) = self.has_default {
234             properties.push(("has-default", has_default));
235         }
236         if let Some(ref has_focus) = self.has_focus {
237             properties.push(("has-focus", has_focus));
238         }
239         if let Some(ref has_tooltip) = self.has_tooltip {
240             properties.push(("has-tooltip", has_tooltip));
241         }
242         if let Some(ref height_request) = self.height_request {
243             properties.push(("height-request", height_request));
244         }
245         if let Some(ref hexpand) = self.hexpand {
246             properties.push(("hexpand", hexpand));
247         }
248         if let Some(ref hexpand_set) = self.hexpand_set {
249             properties.push(("hexpand-set", hexpand_set));
250         }
251         if let Some(ref is_focus) = self.is_focus {
252             properties.push(("is-focus", is_focus));
253         }
254         if let Some(ref margin) = self.margin {
255             properties.push(("margin", margin));
256         }
257         if let Some(ref margin_bottom) = self.margin_bottom {
258             properties.push(("margin-bottom", margin_bottom));
259         }
260         if let Some(ref margin_end) = self.margin_end {
261             properties.push(("margin-end", margin_end));
262         }
263         if let Some(ref margin_left) = self.margin_left {
264             properties.push(("margin-left", margin_left));
265         }
266         if let Some(ref margin_right) = self.margin_right {
267             properties.push(("margin-right", margin_right));
268         }
269         if let Some(ref margin_start) = self.margin_start {
270             properties.push(("margin-start", margin_start));
271         }
272         if let Some(ref margin_top) = self.margin_top {
273             properties.push(("margin-top", margin_top));
274         }
275         if let Some(ref name) = self.name {
276             properties.push(("name", name));
277         }
278         if let Some(ref no_show_all) = self.no_show_all {
279             properties.push(("no-show-all", no_show_all));
280         }
281         if let Some(ref opacity) = self.opacity {
282             properties.push(("opacity", opacity));
283         }
284         if let Some(ref parent) = self.parent {
285             properties.push(("parent", parent));
286         }
287         if let Some(ref receives_default) = self.receives_default {
288             properties.push(("receives-default", receives_default));
289         }
290         if let Some(ref sensitive) = self.sensitive {
291             properties.push(("sensitive", sensitive));
292         }
293         if let Some(ref tooltip_markup) = self.tooltip_markup {
294             properties.push(("tooltip-markup", tooltip_markup));
295         }
296         if let Some(ref tooltip_text) = self.tooltip_text {
297             properties.push(("tooltip-text", tooltip_text));
298         }
299         if let Some(ref valign) = self.valign {
300             properties.push(("valign", valign));
301         }
302         if let Some(ref vexpand) = self.vexpand {
303             properties.push(("vexpand", vexpand));
304         }
305         if let Some(ref vexpand_set) = self.vexpand_set {
306             properties.push(("vexpand-set", vexpand_set));
307         }
308         if let Some(ref visible) = self.visible {
309             properties.push(("visible", visible));
310         }
311         if let Some(ref width_request) = self.width_request {
312             properties.push(("width-request", width_request));
313         }
314         glib::Object::new::<Window>(&properties).expect("Failed to create an instance of Window")
315     }
316 
accept_focus(mut self, accept_focus: bool) -> Self317     pub fn accept_focus(mut self, accept_focus: bool) -> Self {
318         self.accept_focus = Some(accept_focus);
319         self
320     }
321 
attached_to<P: IsA<gtk::Widget>>(mut self, attached_to: &P) -> Self322     pub fn attached_to<P: IsA<gtk::Widget>>(mut self, attached_to: &P) -> Self {
323         self.attached_to = Some(attached_to.clone().upcast());
324         self
325     }
326 
decorated(mut self, decorated: bool) -> Self327     pub fn decorated(mut self, decorated: bool) -> Self {
328         self.decorated = Some(decorated);
329         self
330     }
331 
default_height(mut self, default_height: i32) -> Self332     pub fn default_height(mut self, default_height: i32) -> Self {
333         self.default_height = Some(default_height);
334         self
335     }
336 
default_width(mut self, default_width: i32) -> Self337     pub fn default_width(mut self, default_width: i32) -> Self {
338         self.default_width = Some(default_width);
339         self
340     }
341 
deletable(mut self, deletable: bool) -> Self342     pub fn deletable(mut self, deletable: bool) -> Self {
343         self.deletable = Some(deletable);
344         self
345     }
346 
destroy_with_parent(mut self, destroy_with_parent: bool) -> Self347     pub fn destroy_with_parent(mut self, destroy_with_parent: bool) -> Self {
348         self.destroy_with_parent = Some(destroy_with_parent);
349         self
350     }
351 
focus_on_map(mut self, focus_on_map: bool) -> Self352     pub fn focus_on_map(mut self, focus_on_map: bool) -> Self {
353         self.focus_on_map = Some(focus_on_map);
354         self
355     }
356 
focus_visible(mut self, focus_visible: bool) -> Self357     pub fn focus_visible(mut self, focus_visible: bool) -> Self {
358         self.focus_visible = Some(focus_visible);
359         self
360     }
361 
has_resize_grip(mut self, has_resize_grip: bool) -> Self362     pub fn has_resize_grip(mut self, has_resize_grip: bool) -> Self {
363         self.has_resize_grip = Some(has_resize_grip);
364         self
365     }
366 
hide_titlebar_when_maximized(mut self, hide_titlebar_when_maximized: bool) -> Self367     pub fn hide_titlebar_when_maximized(mut self, hide_titlebar_when_maximized: bool) -> Self {
368         self.hide_titlebar_when_maximized = Some(hide_titlebar_when_maximized);
369         self
370     }
371 
icon(mut self, icon: &gdk_pixbuf::Pixbuf) -> Self372     pub fn icon(mut self, icon: &gdk_pixbuf::Pixbuf) -> Self {
373         self.icon = Some(icon.clone());
374         self
375     }
376 
icon_name(mut self, icon_name: &str) -> Self377     pub fn icon_name(mut self, icon_name: &str) -> Self {
378         self.icon_name = Some(icon_name.to_string());
379         self
380     }
381 
mnemonics_visible(mut self, mnemonics_visible: bool) -> Self382     pub fn mnemonics_visible(mut self, mnemonics_visible: bool) -> Self {
383         self.mnemonics_visible = Some(mnemonics_visible);
384         self
385     }
386 
modal(mut self, modal: bool) -> Self387     pub fn modal(mut self, modal: bool) -> Self {
388         self.modal = Some(modal);
389         self
390     }
391 
resizable(mut self, resizable: bool) -> Self392     pub fn resizable(mut self, resizable: bool) -> Self {
393         self.resizable = Some(resizable);
394         self
395     }
396 
role(mut self, role: &str) -> Self397     pub fn role(mut self, role: &str) -> Self {
398         self.role = Some(role.to_string());
399         self
400     }
401 
skip_pager_hint(mut self, skip_pager_hint: bool) -> Self402     pub fn skip_pager_hint(mut self, skip_pager_hint: bool) -> Self {
403         self.skip_pager_hint = Some(skip_pager_hint);
404         self
405     }
406 
skip_taskbar_hint(mut self, skip_taskbar_hint: bool) -> Self407     pub fn skip_taskbar_hint(mut self, skip_taskbar_hint: bool) -> Self {
408         self.skip_taskbar_hint = Some(skip_taskbar_hint);
409         self
410     }
411 
startup_id(mut self, startup_id: &str) -> Self412     pub fn startup_id(mut self, startup_id: &str) -> Self {
413         self.startup_id = Some(startup_id.to_string());
414         self
415     }
416 
title(mut self, title: &str) -> Self417     pub fn title(mut self, title: &str) -> Self {
418         self.title = Some(title.to_string());
419         self
420     }
421 
transient_for<P: IsA<gtk::Window>>(mut self, transient_for: &P) -> Self422     pub fn transient_for<P: IsA<gtk::Window>>(mut self, transient_for: &P) -> Self {
423         self.transient_for = Some(transient_for.clone().upcast());
424         self
425     }
426 
urgency_hint(mut self, urgency_hint: bool) -> Self427     pub fn urgency_hint(mut self, urgency_hint: bool) -> Self {
428         self.urgency_hint = Some(urgency_hint);
429         self
430     }
431 
border_width(mut self, border_width: u32) -> Self432     pub fn border_width(mut self, border_width: u32) -> Self {
433         self.border_width = Some(border_width);
434         self
435     }
436 
child<P: IsA<gtk::Widget>>(mut self, child: &P) -> Self437     pub fn child<P: IsA<gtk::Widget>>(mut self, child: &P) -> Self {
438         self.child = Some(child.clone().upcast());
439         self
440     }
441 
resize_mode(mut self, resize_mode: gtk::ResizeMode) -> Self442     pub fn resize_mode(mut self, resize_mode: gtk::ResizeMode) -> Self {
443         self.resize_mode = Some(resize_mode);
444         self
445     }
446 
app_paintable(mut self, app_paintable: bool) -> Self447     pub fn app_paintable(mut self, app_paintable: bool) -> Self {
448         self.app_paintable = Some(app_paintable);
449         self
450     }
451 
can_default(mut self, can_default: bool) -> Self452     pub fn can_default(mut self, can_default: bool) -> Self {
453         self.can_default = Some(can_default);
454         self
455     }
456 
can_focus(mut self, can_focus: bool) -> Self457     pub fn can_focus(mut self, can_focus: bool) -> Self {
458         self.can_focus = Some(can_focus);
459         self
460     }
461 
double_buffered(mut self, double_buffered: bool) -> Self462     pub fn double_buffered(mut self, double_buffered: bool) -> Self {
463         self.double_buffered = Some(double_buffered);
464         self
465     }
466 
events(mut self, events: gdk::EventMask) -> Self467     pub fn events(mut self, events: gdk::EventMask) -> Self {
468         self.events = Some(events);
469         self
470     }
471 
expand(mut self, expand: bool) -> Self472     pub fn expand(mut self, expand: bool) -> Self {
473         self.expand = Some(expand);
474         self
475     }
476 
focus_on_click(mut self, focus_on_click: bool) -> Self477     pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
478         self.focus_on_click = Some(focus_on_click);
479         self
480     }
481 
halign(mut self, halign: gtk::Align) -> Self482     pub fn halign(mut self, halign: gtk::Align) -> Self {
483         self.halign = Some(halign);
484         self
485     }
486 
has_default(mut self, has_default: bool) -> Self487     pub fn has_default(mut self, has_default: bool) -> Self {
488         self.has_default = Some(has_default);
489         self
490     }
491 
has_focus(mut self, has_focus: bool) -> Self492     pub fn has_focus(mut self, has_focus: bool) -> Self {
493         self.has_focus = Some(has_focus);
494         self
495     }
496 
has_tooltip(mut self, has_tooltip: bool) -> Self497     pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
498         self.has_tooltip = Some(has_tooltip);
499         self
500     }
501 
height_request(mut self, height_request: i32) -> Self502     pub fn height_request(mut self, height_request: i32) -> Self {
503         self.height_request = Some(height_request);
504         self
505     }
506 
hexpand(mut self, hexpand: bool) -> Self507     pub fn hexpand(mut self, hexpand: bool) -> Self {
508         self.hexpand = Some(hexpand);
509         self
510     }
511 
hexpand_set(mut self, hexpand_set: bool) -> Self512     pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
513         self.hexpand_set = Some(hexpand_set);
514         self
515     }
516 
is_focus(mut self, is_focus: bool) -> Self517     pub fn is_focus(mut self, is_focus: bool) -> Self {
518         self.is_focus = Some(is_focus);
519         self
520     }
521 
margin(mut self, margin: i32) -> Self522     pub fn margin(mut self, margin: i32) -> Self {
523         self.margin = Some(margin);
524         self
525     }
526 
margin_bottom(mut self, margin_bottom: i32) -> Self527     pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
528         self.margin_bottom = Some(margin_bottom);
529         self
530     }
531 
margin_end(mut self, margin_end: i32) -> Self532     pub fn margin_end(mut self, margin_end: i32) -> Self {
533         self.margin_end = Some(margin_end);
534         self
535     }
536 
margin_left(mut self, margin_left: i32) -> Self537     pub fn margin_left(mut self, margin_left: i32) -> Self {
538         self.margin_left = Some(margin_left);
539         self
540     }
541 
margin_right(mut self, margin_right: i32) -> Self542     pub fn margin_right(mut self, margin_right: i32) -> Self {
543         self.margin_right = Some(margin_right);
544         self
545     }
546 
margin_start(mut self, margin_start: i32) -> Self547     pub fn margin_start(mut self, margin_start: i32) -> Self {
548         self.margin_start = Some(margin_start);
549         self
550     }
551 
margin_top(mut self, margin_top: i32) -> Self552     pub fn margin_top(mut self, margin_top: i32) -> Self {
553         self.margin_top = Some(margin_top);
554         self
555     }
556 
name(mut self, name: &str) -> Self557     pub fn name(mut self, name: &str) -> Self {
558         self.name = Some(name.to_string());
559         self
560     }
561 
no_show_all(mut self, no_show_all: bool) -> Self562     pub fn no_show_all(mut self, no_show_all: bool) -> Self {
563         self.no_show_all = Some(no_show_all);
564         self
565     }
566 
opacity(mut self, opacity: f64) -> Self567     pub fn opacity(mut self, opacity: f64) -> Self {
568         self.opacity = Some(opacity);
569         self
570     }
571 
parent<P: IsA<gtk::Container>>(mut self, parent: &P) -> Self572     pub fn parent<P: IsA<gtk::Container>>(mut self, parent: &P) -> Self {
573         self.parent = Some(parent.clone().upcast());
574         self
575     }
576 
receives_default(mut self, receives_default: bool) -> Self577     pub fn receives_default(mut self, receives_default: bool) -> Self {
578         self.receives_default = Some(receives_default);
579         self
580     }
581 
sensitive(mut self, sensitive: bool) -> Self582     pub fn sensitive(mut self, sensitive: bool) -> Self {
583         self.sensitive = Some(sensitive);
584         self
585     }
586 
tooltip_markup(mut self, tooltip_markup: &str) -> Self587     pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
588         self.tooltip_markup = Some(tooltip_markup.to_string());
589         self
590     }
591 
tooltip_text(mut self, tooltip_text: &str) -> Self592     pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
593         self.tooltip_text = Some(tooltip_text.to_string());
594         self
595     }
596 
valign(mut self, valign: gtk::Align) -> Self597     pub fn valign(mut self, valign: gtk::Align) -> Self {
598         self.valign = Some(valign);
599         self
600     }
601 
vexpand(mut self, vexpand: bool) -> Self602     pub fn vexpand(mut self, vexpand: bool) -> Self {
603         self.vexpand = Some(vexpand);
604         self
605     }
606 
vexpand_set(mut self, vexpand_set: bool) -> Self607     pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
608         self.vexpand_set = Some(vexpand_set);
609         self
610     }
611 
visible(mut self, visible: bool) -> Self612     pub fn visible(mut self, visible: bool) -> Self {
613         self.visible = Some(visible);
614         self
615     }
616 
width_request(mut self, width_request: i32) -> Self617     pub fn width_request(mut self, width_request: i32) -> Self {
618         self.width_request = Some(width_request);
619         self
620     }
621 }
622 
623 pub const NONE_WINDOW: Option<&Window> = None;
624 
625 impl fmt::Display for Window {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result626     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
627         f.write_str("Window")
628     }
629 }
630