gtk4/auto/
file_chooser_dialog.rs

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#![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, Dialog,
11    FileChooser, FileChooserAction, FileFilter, LayoutManager, Native, Overflow, Root,
12    ShortcutManager, Widget, Window,
13};
14use glib::prelude::*;
15
16glib::wrapper! {
17    #[doc(alias = "GtkFileChooserDialog")]
18    pub struct FileChooserDialog(Object<ffi::GtkFileChooserDialog>) @extends Dialog, Window, Widget, @implements Accessible, Buildable, ConstraintTarget, Native, Root, ShortcutManager, FileChooser;
19
20    match fn {
21        type_ => || ffi::gtk_file_chooser_dialog_get_type(),
22    }
23}
24
25impl FileChooserDialog {
26    // rustdoc-stripper-ignore-next
27    /// Creates a new builder-pattern struct instance to construct [`FileChooserDialog`] objects.
28    ///
29    /// This method returns an instance of [`FileChooserDialogBuilder`](crate::builders::FileChooserDialogBuilder) which can be used to create [`FileChooserDialog`] objects.
30    pub fn builder() -> FileChooserDialogBuilder {
31        FileChooserDialogBuilder::new()
32    }
33}
34
35// rustdoc-stripper-ignore-next
36/// A [builder-pattern] type to construct [`FileChooserDialog`] objects.
37///
38/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
39#[must_use = "The builder must be built to be used"]
40pub struct FileChooserDialogBuilder {
41    builder: glib::object::ObjectBuilder<'static, FileChooserDialog>,
42}
43
44impl FileChooserDialogBuilder {
45    fn new() -> Self {
46        Self {
47            builder: glib::object::Object::builder(),
48        }
49    }
50
51    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
52    pub fn use_header_bar(self, use_header_bar: i32) -> Self {
53        Self {
54            builder: self.builder.property("use-header-bar", use_header_bar),
55        }
56    }
57
58    pub fn application(self, application: &impl IsA<Application>) -> Self {
59        Self {
60            builder: self
61                .builder
62                .property("application", application.clone().upcast()),
63        }
64    }
65
66    pub fn child(self, child: &impl IsA<Widget>) -> Self {
67        Self {
68            builder: self.builder.property("child", child.clone().upcast()),
69        }
70    }
71
72    pub fn decorated(self, decorated: bool) -> Self {
73        Self {
74            builder: self.builder.property("decorated", decorated),
75        }
76    }
77
78    pub fn default_height(self, default_height: i32) -> Self {
79        Self {
80            builder: self.builder.property("default-height", default_height),
81        }
82    }
83
84    pub fn default_widget(self, default_widget: &impl IsA<Widget>) -> Self {
85        Self {
86            builder: self
87                .builder
88                .property("default-widget", default_widget.clone().upcast()),
89        }
90    }
91
92    pub fn default_width(self, default_width: i32) -> Self {
93        Self {
94            builder: self.builder.property("default-width", default_width),
95        }
96    }
97
98    pub fn deletable(self, deletable: bool) -> Self {
99        Self {
100            builder: self.builder.property("deletable", deletable),
101        }
102    }
103
104    pub fn destroy_with_parent(self, destroy_with_parent: bool) -> Self {
105        Self {
106            builder: self
107                .builder
108                .property("destroy-with-parent", destroy_with_parent),
109        }
110    }
111
112    pub fn display(self, display: &impl IsA<gdk::Display>) -> Self {
113        Self {
114            builder: self.builder.property("display", display.clone().upcast()),
115        }
116    }
117
118    pub fn focus_visible(self, focus_visible: bool) -> Self {
119        Self {
120            builder: self.builder.property("focus-visible", focus_visible),
121        }
122    }
123
124    pub fn focus_widget(self, focus_widget: &impl IsA<Widget>) -> Self {
125        Self {
126            builder: self
127                .builder
128                .property("focus-widget", focus_widget.clone().upcast()),
129        }
130    }
131
132    pub fn fullscreened(self, fullscreened: bool) -> Self {
133        Self {
134            builder: self.builder.property("fullscreened", fullscreened),
135        }
136    }
137
138    #[cfg(feature = "v4_20")]
139    #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
140    pub fn gravity(self, gravity: WindowGravity) -> Self {
141        Self {
142            builder: self.builder.property("gravity", gravity),
143        }
144    }
145
146    #[cfg(feature = "v4_2")]
147    #[cfg_attr(docsrs, doc(cfg(feature = "v4_2")))]
148    pub fn handle_menubar_accel(self, handle_menubar_accel: bool) -> Self {
149        Self {
150            builder: self
151                .builder
152                .property("handle-menubar-accel", handle_menubar_accel),
153        }
154    }
155
156    pub fn hide_on_close(self, hide_on_close: bool) -> Self {
157        Self {
158            builder: self.builder.property("hide-on-close", hide_on_close),
159        }
160    }
161
162    pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
163        Self {
164            builder: self.builder.property("icon-name", icon_name.into()),
165        }
166    }
167
168    pub fn maximized(self, maximized: bool) -> Self {
169        Self {
170            builder: self.builder.property("maximized", maximized),
171        }
172    }
173
174    pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self {
175        Self {
176            builder: self
177                .builder
178                .property("mnemonics-visible", mnemonics_visible),
179        }
180    }
181
182    pub fn modal(self, modal: bool) -> Self {
183        Self {
184            builder: self.builder.property("modal", modal),
185        }
186    }
187
188    pub fn resizable(self, resizable: bool) -> Self {
189        Self {
190            builder: self.builder.property("resizable", resizable),
191        }
192    }
193
194    pub fn startup_id(self, startup_id: impl Into<glib::GString>) -> Self {
195        Self {
196            builder: self.builder.property("startup-id", startup_id.into()),
197        }
198    }
199
200    pub fn title(self, title: impl Into<glib::GString>) -> Self {
201        Self {
202            builder: self.builder.property("title", title.into()),
203        }
204    }
205
206    #[cfg(feature = "v4_6")]
207    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
208    pub fn titlebar(self, titlebar: &impl IsA<Widget>) -> Self {
209        Self {
210            builder: self.builder.property("titlebar", titlebar.clone().upcast()),
211        }
212    }
213
214    pub fn transient_for(self, transient_for: &impl IsA<Window>) -> Self {
215        Self {
216            builder: self
217                .builder
218                .property("transient-for", transient_for.clone().upcast()),
219        }
220    }
221
222    pub fn can_focus(self, can_focus: bool) -> Self {
223        Self {
224            builder: self.builder.property("can-focus", can_focus),
225        }
226    }
227
228    pub fn can_target(self, can_target: bool) -> Self {
229        Self {
230            builder: self.builder.property("can-target", can_target),
231        }
232    }
233
234    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
235        Self {
236            builder: self.builder.property("css-classes", css_classes.into()),
237        }
238    }
239
240    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
241        Self {
242            builder: self.builder.property("css-name", css_name.into()),
243        }
244    }
245
246    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
247        Self {
248            builder: self.builder.property("cursor", cursor.clone()),
249        }
250    }
251
252    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
253        Self {
254            builder: self.builder.property("focus-on-click", focus_on_click),
255        }
256    }
257
258    pub fn focusable(self, focusable: bool) -> Self {
259        Self {
260            builder: self.builder.property("focusable", focusable),
261        }
262    }
263
264    pub fn halign(self, halign: Align) -> Self {
265        Self {
266            builder: self.builder.property("halign", halign),
267        }
268    }
269
270    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
271        Self {
272            builder: self.builder.property("has-tooltip", has_tooltip),
273        }
274    }
275
276    pub fn height_request(self, height_request: i32) -> Self {
277        Self {
278            builder: self.builder.property("height-request", height_request),
279        }
280    }
281
282    pub fn hexpand(self, hexpand: bool) -> Self {
283        Self {
284            builder: self.builder.property("hexpand", hexpand),
285        }
286    }
287
288    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
289        Self {
290            builder: self.builder.property("hexpand-set", hexpand_set),
291        }
292    }
293
294    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
295        Self {
296            builder: self
297                .builder
298                .property("layout-manager", layout_manager.clone().upcast()),
299        }
300    }
301
302    #[cfg(feature = "v4_18")]
303    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
304    pub fn limit_events(self, limit_events: bool) -> Self {
305        Self {
306            builder: self.builder.property("limit-events", limit_events),
307        }
308    }
309
310    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
311        Self {
312            builder: self.builder.property("margin-bottom", margin_bottom),
313        }
314    }
315
316    pub fn margin_end(self, margin_end: i32) -> Self {
317        Self {
318            builder: self.builder.property("margin-end", margin_end),
319        }
320    }
321
322    pub fn margin_start(self, margin_start: i32) -> Self {
323        Self {
324            builder: self.builder.property("margin-start", margin_start),
325        }
326    }
327
328    pub fn margin_top(self, margin_top: i32) -> Self {
329        Self {
330            builder: self.builder.property("margin-top", margin_top),
331        }
332    }
333
334    pub fn name(self, name: impl Into<glib::GString>) -> Self {
335        Self {
336            builder: self.builder.property("name", name.into()),
337        }
338    }
339
340    pub fn opacity(self, opacity: f64) -> Self {
341        Self {
342            builder: self.builder.property("opacity", opacity),
343        }
344    }
345
346    pub fn overflow(self, overflow: Overflow) -> Self {
347        Self {
348            builder: self.builder.property("overflow", overflow),
349        }
350    }
351
352    pub fn receives_default(self, receives_default: bool) -> Self {
353        Self {
354            builder: self.builder.property("receives-default", receives_default),
355        }
356    }
357
358    pub fn sensitive(self, sensitive: bool) -> Self {
359        Self {
360            builder: self.builder.property("sensitive", sensitive),
361        }
362    }
363
364    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
365        Self {
366            builder: self
367                .builder
368                .property("tooltip-markup", tooltip_markup.into()),
369        }
370    }
371
372    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
373        Self {
374            builder: self.builder.property("tooltip-text", tooltip_text.into()),
375        }
376    }
377
378    pub fn valign(self, valign: Align) -> Self {
379        Self {
380            builder: self.builder.property("valign", valign),
381        }
382    }
383
384    pub fn vexpand(self, vexpand: bool) -> Self {
385        Self {
386            builder: self.builder.property("vexpand", vexpand),
387        }
388    }
389
390    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
391        Self {
392            builder: self.builder.property("vexpand-set", vexpand_set),
393        }
394    }
395
396    pub fn visible(self, visible: bool) -> Self {
397        Self {
398            builder: self.builder.property("visible", visible),
399        }
400    }
401
402    pub fn width_request(self, width_request: i32) -> Self {
403        Self {
404            builder: self.builder.property("width-request", width_request),
405        }
406    }
407
408    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
409        Self {
410            builder: self.builder.property("accessible-role", accessible_role),
411        }
412    }
413
414    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
415    pub fn action(self, action: FileChooserAction) -> Self {
416        Self {
417            builder: self.builder.property("action", action),
418        }
419    }
420
421    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
422    pub fn create_folders(self, create_folders: bool) -> Self {
423        Self {
424            builder: self.builder.property("create-folders", create_folders),
425        }
426    }
427
428    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
429    pub fn filter(self, filter: &FileFilter) -> Self {
430        Self {
431            builder: self.builder.property("filter", filter.clone()),
432        }
433    }
434
435    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
436    pub fn select_multiple(self, select_multiple: bool) -> Self {
437        Self {
438            builder: self.builder.property("select-multiple", select_multiple),
439        }
440    }
441
442    // rustdoc-stripper-ignore-next
443    /// Build the [`FileChooserDialog`].
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) -> FileChooserDialog {
446        assert_initialized_main_thread!();
447        self.builder.build()
448    }
449}