libhandy/auto/
window.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from
3// from gir-files (https://github.com/gtk-rs/gir-files.git)
4// DO NOT EDIT
5
6use glib::{prelude::*, translate::*};
7use std::fmt;
8
9glib::wrapper! {
10    #[doc(alias = "HdyWindow")]
11    pub struct Window(Object<ffi::HdyWindow, ffi::HdyWindowClass>) @extends gtk::Window, gtk::Bin, gtk::Container, gtk::Widget, @implements gtk::Buildable;
12
13    match fn {
14        type_ => || ffi::hdy_window_get_type(),
15    }
16}
17
18impl Window {
19    pub const NONE: Option<&'static Window> = None;
20
21    #[doc(alias = "hdy_window_new")]
22    pub fn new() -> Window {
23        assert_initialized_main_thread!();
24        unsafe { gtk::Widget::from_glib_none(ffi::hdy_window_new()).unsafe_cast() }
25    }
26
27    // rustdoc-stripper-ignore-next
28    /// Creates a new builder-pattern struct instance to construct [`Window`] objects.
29    ///
30    /// This method returns an instance of [`WindowBuilder`](crate::builders::WindowBuilder) which can be used to create [`Window`] objects.
31    pub fn builder() -> WindowBuilder {
32        WindowBuilder::new()
33    }
34}
35
36impl Default for Window {
37    fn default() -> Self {
38        Self::new()
39    }
40}
41
42// rustdoc-stripper-ignore-next
43/// A [builder-pattern] type to construct [`Window`] objects.
44///
45/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
46#[must_use = "The builder must be built to be used"]
47pub struct WindowBuilder {
48    builder: glib::object::ObjectBuilder<'static, Window>,
49}
50
51impl WindowBuilder {
52    fn new() -> Self {
53        Self {
54            builder: glib::object::Object::builder(),
55        }
56    }
57
58    pub fn accept_focus(self, accept_focus: bool) -> Self {
59        Self {
60            builder: self.builder.property("accept-focus", accept_focus),
61        }
62    }
63
64    //pub fn application(self, application: &impl IsA</*Ignored*/gtk::Application>) -> Self {
65    //    Self { builder: self.builder.property("application", application.clone().upcast()), }
66    //}
67
68    pub fn attached_to(self, attached_to: &impl IsA<gtk::Widget>) -> Self {
69        Self {
70            builder: self
71                .builder
72                .property("attached-to", attached_to.clone().upcast()),
73        }
74    }
75
76    pub fn decorated(self, decorated: bool) -> Self {
77        Self {
78            builder: self.builder.property("decorated", decorated),
79        }
80    }
81
82    pub fn default_height(self, default_height: i32) -> Self {
83        Self {
84            builder: self.builder.property("default-height", default_height),
85        }
86    }
87
88    pub fn default_width(self, default_width: i32) -> Self {
89        Self {
90            builder: self.builder.property("default-width", default_width),
91        }
92    }
93
94    pub fn deletable(self, deletable: bool) -> Self {
95        Self {
96            builder: self.builder.property("deletable", deletable),
97        }
98    }
99
100    pub fn destroy_with_parent(self, destroy_with_parent: bool) -> Self {
101        Self {
102            builder: self
103                .builder
104                .property("destroy-with-parent", destroy_with_parent),
105        }
106    }
107
108    pub fn focus_on_map(self, focus_on_map: bool) -> Self {
109        Self {
110            builder: self.builder.property("focus-on-map", focus_on_map),
111        }
112    }
113
114    pub fn focus_visible(self, focus_visible: bool) -> Self {
115        Self {
116            builder: self.builder.property("focus-visible", focus_visible),
117        }
118    }
119
120    //pub fn gravity(self, gravity: /*Ignored*/gdk::Gravity) -> Self {
121    //    Self { builder: self.builder.property("gravity", gravity), }
122    //}
123
124    pub fn hide_titlebar_when_maximized(self, hide_titlebar_when_maximized: bool) -> Self {
125        Self {
126            builder: self
127                .builder
128                .property("hide-titlebar-when-maximized", hide_titlebar_when_maximized),
129        }
130    }
131
132    pub fn icon(self, icon: &gdk_pixbuf::Pixbuf) -> Self {
133        Self {
134            builder: self.builder.property("icon", icon.clone()),
135        }
136    }
137
138    pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
139        Self {
140            builder: self.builder.property("icon-name", icon_name.into()),
141        }
142    }
143
144    pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self {
145        Self {
146            builder: self
147                .builder
148                .property("mnemonics-visible", mnemonics_visible),
149        }
150    }
151
152    pub fn modal(self, modal: bool) -> Self {
153        Self {
154            builder: self.builder.property("modal", modal),
155        }
156    }
157
158    pub fn resizable(self, resizable: bool) -> Self {
159        Self {
160            builder: self.builder.property("resizable", resizable),
161        }
162    }
163
164    pub fn role(self, role: impl Into<glib::GString>) -> Self {
165        Self {
166            builder: self.builder.property("role", role.into()),
167        }
168    }
169
170    //pub fn screen(self, screen: /*Ignored*/&gdk::Screen) -> Self {
171    //    Self { builder: self.builder.property("screen", screen), }
172    //}
173
174    pub fn skip_pager_hint(self, skip_pager_hint: bool) -> Self {
175        Self {
176            builder: self.builder.property("skip-pager-hint", skip_pager_hint),
177        }
178    }
179
180    pub fn skip_taskbar_hint(self, skip_taskbar_hint: bool) -> Self {
181        Self {
182            builder: self
183                .builder
184                .property("skip-taskbar-hint", skip_taskbar_hint),
185        }
186    }
187
188    pub fn startup_id(self, startup_id: impl Into<glib::GString>) -> Self {
189        Self {
190            builder: self.builder.property("startup-id", startup_id.into()),
191        }
192    }
193
194    pub fn title(self, title: impl Into<glib::GString>) -> Self {
195        Self {
196            builder: self.builder.property("title", title.into()),
197        }
198    }
199
200    pub fn transient_for(self, transient_for: &impl IsA<gtk::Window>) -> Self {
201        Self {
202            builder: self
203                .builder
204                .property("transient-for", transient_for.clone().upcast()),
205        }
206    }
207
208    //pub fn type_(self, type_: /*Ignored*/gtk::WindowType) -> Self {
209    //    Self { builder: self.builder.property("type", type_), }
210    //}
211
212    //pub fn type_hint(self, type_hint: /*Ignored*/gdk::WindowTypeHint) -> Self {
213    //    Self { builder: self.builder.property("type-hint", type_hint), }
214    //}
215
216    pub fn urgency_hint(self, urgency_hint: bool) -> Self {
217        Self {
218            builder: self.builder.property("urgency-hint", urgency_hint),
219        }
220    }
221
222    //pub fn window_position(self, window_position: /*Ignored*/gtk::WindowPosition) -> Self {
223    //    Self { builder: self.builder.property("window-position", window_position), }
224    //}
225
226    pub fn border_width(self, border_width: u32) -> Self {
227        Self {
228            builder: self.builder.property("border-width", border_width),
229        }
230    }
231
232    pub fn child(self, child: &impl IsA<gtk::Widget>) -> Self {
233        Self {
234            builder: self.builder.property("child", child.clone().upcast()),
235        }
236    }
237
238    pub fn resize_mode(self, resize_mode: gtk::ResizeMode) -> Self {
239        Self {
240            builder: self.builder.property("resize-mode", resize_mode),
241        }
242    }
243
244    pub fn app_paintable(self, app_paintable: bool) -> Self {
245        Self {
246            builder: self.builder.property("app-paintable", app_paintable),
247        }
248    }
249
250    pub fn can_default(self, can_default: bool) -> Self {
251        Self {
252            builder: self.builder.property("can-default", can_default),
253        }
254    }
255
256    pub fn can_focus(self, can_focus: bool) -> Self {
257        Self {
258            builder: self.builder.property("can-focus", can_focus),
259        }
260    }
261
262    pub fn events(self, events: gdk::EventMask) -> Self {
263        Self {
264            builder: self.builder.property("events", events),
265        }
266    }
267
268    pub fn expand(self, expand: bool) -> Self {
269        Self {
270            builder: self.builder.property("expand", expand),
271        }
272    }
273
274    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
275        Self {
276            builder: self.builder.property("focus-on-click", focus_on_click),
277        }
278    }
279
280    pub fn halign(self, halign: gtk::Align) -> Self {
281        Self {
282            builder: self.builder.property("halign", halign),
283        }
284    }
285
286    pub fn has_default(self, has_default: bool) -> Self {
287        Self {
288            builder: self.builder.property("has-default", has_default),
289        }
290    }
291
292    pub fn has_focus(self, has_focus: bool) -> Self {
293        Self {
294            builder: self.builder.property("has-focus", has_focus),
295        }
296    }
297
298    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
299        Self {
300            builder: self.builder.property("has-tooltip", has_tooltip),
301        }
302    }
303
304    pub fn height_request(self, height_request: i32) -> Self {
305        Self {
306            builder: self.builder.property("height-request", height_request),
307        }
308    }
309
310    pub fn hexpand(self, hexpand: bool) -> Self {
311        Self {
312            builder: self.builder.property("hexpand", hexpand),
313        }
314    }
315
316    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
317        Self {
318            builder: self.builder.property("hexpand-set", hexpand_set),
319        }
320    }
321
322    pub fn is_focus(self, is_focus: bool) -> Self {
323        Self {
324            builder: self.builder.property("is-focus", is_focus),
325        }
326    }
327
328    pub fn margin(self, margin: i32) -> Self {
329        Self {
330            builder: self.builder.property("margin", margin),
331        }
332    }
333
334    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
335        Self {
336            builder: self.builder.property("margin-bottom", margin_bottom),
337        }
338    }
339
340    pub fn margin_end(self, margin_end: i32) -> Self {
341        Self {
342            builder: self.builder.property("margin-end", margin_end),
343        }
344    }
345
346    pub fn margin_start(self, margin_start: i32) -> Self {
347        Self {
348            builder: self.builder.property("margin-start", margin_start),
349        }
350    }
351
352    pub fn margin_top(self, margin_top: i32) -> Self {
353        Self {
354            builder: self.builder.property("margin-top", margin_top),
355        }
356    }
357
358    pub fn name(self, name: impl Into<glib::GString>) -> Self {
359        Self {
360            builder: self.builder.property("name", name.into()),
361        }
362    }
363
364    pub fn no_show_all(self, no_show_all: bool) -> Self {
365        Self {
366            builder: self.builder.property("no-show-all", no_show_all),
367        }
368    }
369
370    pub fn opacity(self, opacity: f64) -> Self {
371        Self {
372            builder: self.builder.property("opacity", opacity),
373        }
374    }
375
376    pub fn parent(self, parent: &impl IsA<gtk::Container>) -> Self {
377        Self {
378            builder: self.builder.property("parent", parent.clone().upcast()),
379        }
380    }
381
382    pub fn receives_default(self, receives_default: bool) -> Self {
383        Self {
384            builder: self.builder.property("receives-default", receives_default),
385        }
386    }
387
388    pub fn sensitive(self, sensitive: bool) -> Self {
389        Self {
390            builder: self.builder.property("sensitive", sensitive),
391        }
392    }
393
394    //pub fn style(self, style: &impl IsA</*Ignored*/gtk::Style>) -> Self {
395    //    Self { builder: self.builder.property("style", style.clone().upcast()), }
396    //}
397
398    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
399        Self {
400            builder: self
401                .builder
402                .property("tooltip-markup", tooltip_markup.into()),
403        }
404    }
405
406    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
407        Self {
408            builder: self.builder.property("tooltip-text", tooltip_text.into()),
409        }
410    }
411
412    pub fn valign(self, valign: gtk::Align) -> Self {
413        Self {
414            builder: self.builder.property("valign", valign),
415        }
416    }
417
418    pub fn vexpand(self, vexpand: bool) -> Self {
419        Self {
420            builder: self.builder.property("vexpand", vexpand),
421        }
422    }
423
424    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
425        Self {
426            builder: self.builder.property("vexpand-set", vexpand_set),
427        }
428    }
429
430    pub fn visible(self, visible: bool) -> Self {
431        Self {
432            builder: self.builder.property("visible", visible),
433        }
434    }
435
436    pub fn width_request(self, width_request: i32) -> Self {
437        Self {
438            builder: self.builder.property("width-request", width_request),
439        }
440    }
441
442    // rustdoc-stripper-ignore-next
443    /// Build the [`Window`].
444    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
445    pub fn build(self) -> Window {
446        self.builder.build()
447    }
448}
449
450impl fmt::Display for Window {
451    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
452        f.write_str("Window")
453    }
454}