gtk/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
5use gdk;
6use gdk_pixbuf;
7use glib::object::Cast;
8use glib::translate::*;
9use glib::StaticType;
10use glib::ToValue;
11use gtk_sys;
12use std::fmt;
13use Align;
14use Application;
15use Bin;
16use Buildable;
17use Container;
18use Dialog;
19use FileChooser;
20use ResizeMode;
21use Widget;
22use Window;
23use WindowPosition;
24use WindowType;
25
26glib_wrapper! {
27    pub struct FileChooserDialog(Object<gtk_sys::GtkFileChooserDialog, gtk_sys::GtkFileChooserDialogClass, FileChooserDialogClass>) @extends Dialog, Window, Bin, Container, Widget, @implements Buildable, FileChooser;
28
29    match fn {
30        get_type => || gtk_sys::gtk_file_chooser_dialog_get_type(),
31    }
32}
33
34impl FileChooserDialog {
35    //pub fn new<P: IsA<Window>>(title: Option<&str>, parent: Option<&P>, action: FileChooserAction, first_button_text: Option<&str>, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> FileChooserDialog {
36    //    unsafe { TODO: call gtk_sys:gtk_file_chooser_dialog_new() }
37    //}
38}
39
40pub struct FileChooserDialogBuilder {
41    use_header_bar: Option<i32>,
42    accept_focus: Option<bool>,
43    application: Option<Application>,
44    attached_to: Option<Widget>,
45    decorated: Option<bool>,
46    default_height: Option<i32>,
47    default_width: Option<i32>,
48    deletable: Option<bool>,
49    destroy_with_parent: Option<bool>,
50    focus_on_map: Option<bool>,
51    focus_visible: Option<bool>,
52    gravity: Option<gdk::Gravity>,
53    hide_titlebar_when_maximized: Option<bool>,
54    icon: Option<gdk_pixbuf::Pixbuf>,
55    icon_name: Option<String>,
56    mnemonics_visible: Option<bool>,
57    modal: Option<bool>,
58    resizable: Option<bool>,
59    role: Option<String>,
60    screen: Option<gdk::Screen>,
61    skip_pager_hint: Option<bool>,
62    skip_taskbar_hint: Option<bool>,
63    startup_id: Option<String>,
64    title: Option<String>,
65    transient_for: Option<Window>,
66    type_: Option<WindowType>,
67    type_hint: Option<gdk::WindowTypeHint>,
68    urgency_hint: Option<bool>,
69    window_position: Option<WindowPosition>,
70    border_width: Option<u32>,
71    child: Option<Widget>,
72    resize_mode: Option<ResizeMode>,
73    app_paintable: Option<bool>,
74    can_default: Option<bool>,
75    can_focus: Option<bool>,
76    events: Option<gdk::EventMask>,
77    expand: Option<bool>,
78    #[cfg(any(feature = "v3_20", feature = "dox"))]
79    focus_on_click: Option<bool>,
80    halign: Option<Align>,
81    has_default: Option<bool>,
82    has_focus: Option<bool>,
83    has_tooltip: Option<bool>,
84    height_request: Option<i32>,
85    hexpand: Option<bool>,
86    hexpand_set: Option<bool>,
87    is_focus: Option<bool>,
88    margin: Option<i32>,
89    margin_bottom: Option<i32>,
90    margin_end: Option<i32>,
91    margin_start: Option<i32>,
92    margin_top: Option<i32>,
93    name: Option<String>,
94    no_show_all: Option<bool>,
95    opacity: Option<f64>,
96    parent: Option<Container>,
97    receives_default: Option<bool>,
98    sensitive: Option<bool>,
99    //style: /*Unknown type*/,
100    tooltip_markup: Option<String>,
101    tooltip_text: Option<String>,
102    valign: Option<Align>,
103    vexpand: Option<bool>,
104    vexpand_set: Option<bool>,
105    visible: Option<bool>,
106    width_request: Option<i32>,
107}
108
109impl FileChooserDialogBuilder {
110    pub fn new() -> Self {
111        Self {
112            use_header_bar: None,
113            accept_focus: None,
114            application: None,
115            attached_to: None,
116            decorated: None,
117            default_height: None,
118            default_width: None,
119            deletable: None,
120            destroy_with_parent: None,
121            focus_on_map: None,
122            focus_visible: None,
123            gravity: None,
124            hide_titlebar_when_maximized: None,
125            icon: None,
126            icon_name: None,
127            mnemonics_visible: None,
128            modal: None,
129            resizable: None,
130            role: None,
131            screen: None,
132            skip_pager_hint: None,
133            skip_taskbar_hint: None,
134            startup_id: None,
135            title: None,
136            transient_for: None,
137            type_: None,
138            type_hint: None,
139            urgency_hint: None,
140            window_position: None,
141            border_width: None,
142            child: None,
143            resize_mode: None,
144            app_paintable: None,
145            can_default: None,
146            can_focus: None,
147            events: None,
148            expand: None,
149            #[cfg(any(feature = "v3_20", feature = "dox"))]
150            focus_on_click: None,
151            halign: None,
152            has_default: None,
153            has_focus: None,
154            has_tooltip: None,
155            height_request: None,
156            hexpand: None,
157            hexpand_set: None,
158            is_focus: None,
159            margin: None,
160            margin_bottom: None,
161            margin_end: None,
162            margin_start: None,
163            margin_top: None,
164            name: None,
165            no_show_all: None,
166            opacity: None,
167            parent: None,
168            receives_default: None,
169            sensitive: None,
170            tooltip_markup: None,
171            tooltip_text: None,
172            valign: None,
173            vexpand: None,
174            vexpand_set: None,
175            visible: None,
176            width_request: None,
177        }
178    }
179
180    pub fn build(self) -> FileChooserDialog {
181        let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
182        if let Some(ref use_header_bar) = self.use_header_bar {
183            properties.push(("use-header-bar", use_header_bar));
184        }
185        if let Some(ref accept_focus) = self.accept_focus {
186            properties.push(("accept-focus", accept_focus));
187        }
188        if let Some(ref application) = self.application {
189            properties.push(("application", application));
190        }
191        if let Some(ref attached_to) = self.attached_to {
192            properties.push(("attached-to", attached_to));
193        }
194        if let Some(ref decorated) = self.decorated {
195            properties.push(("decorated", decorated));
196        }
197        if let Some(ref default_height) = self.default_height {
198            properties.push(("default-height", default_height));
199        }
200        if let Some(ref default_width) = self.default_width {
201            properties.push(("default-width", default_width));
202        }
203        if let Some(ref deletable) = self.deletable {
204            properties.push(("deletable", deletable));
205        }
206        if let Some(ref destroy_with_parent) = self.destroy_with_parent {
207            properties.push(("destroy-with-parent", destroy_with_parent));
208        }
209        if let Some(ref focus_on_map) = self.focus_on_map {
210            properties.push(("focus-on-map", focus_on_map));
211        }
212        if let Some(ref focus_visible) = self.focus_visible {
213            properties.push(("focus-visible", focus_visible));
214        }
215        if let Some(ref gravity) = self.gravity {
216            properties.push(("gravity", gravity));
217        }
218        if let Some(ref hide_titlebar_when_maximized) = self.hide_titlebar_when_maximized {
219            properties.push(("hide-titlebar-when-maximized", hide_titlebar_when_maximized));
220        }
221        if let Some(ref icon) = self.icon {
222            properties.push(("icon", icon));
223        }
224        if let Some(ref icon_name) = self.icon_name {
225            properties.push(("icon-name", icon_name));
226        }
227        if let Some(ref mnemonics_visible) = self.mnemonics_visible {
228            properties.push(("mnemonics-visible", mnemonics_visible));
229        }
230        if let Some(ref modal) = self.modal {
231            properties.push(("modal", modal));
232        }
233        if let Some(ref resizable) = self.resizable {
234            properties.push(("resizable", resizable));
235        }
236        if let Some(ref role) = self.role {
237            properties.push(("role", role));
238        }
239        if let Some(ref screen) = self.screen {
240            properties.push(("screen", screen));
241        }
242        if let Some(ref skip_pager_hint) = self.skip_pager_hint {
243            properties.push(("skip-pager-hint", skip_pager_hint));
244        }
245        if let Some(ref skip_taskbar_hint) = self.skip_taskbar_hint {
246            properties.push(("skip-taskbar-hint", skip_taskbar_hint));
247        }
248        if let Some(ref startup_id) = self.startup_id {
249            properties.push(("startup-id", startup_id));
250        }
251        if let Some(ref title) = self.title {
252            properties.push(("title", title));
253        }
254        if let Some(ref transient_for) = self.transient_for {
255            properties.push(("transient-for", transient_for));
256        }
257        if let Some(ref type_) = self.type_ {
258            properties.push(("type", type_));
259        }
260        if let Some(ref type_hint) = self.type_hint {
261            properties.push(("type-hint", type_hint));
262        }
263        if let Some(ref urgency_hint) = self.urgency_hint {
264            properties.push(("urgency-hint", urgency_hint));
265        }
266        if let Some(ref window_position) = self.window_position {
267            properties.push(("window-position", window_position));
268        }
269        if let Some(ref border_width) = self.border_width {
270            properties.push(("border-width", border_width));
271        }
272        if let Some(ref child) = self.child {
273            properties.push(("child", child));
274        }
275        if let Some(ref resize_mode) = self.resize_mode {
276            properties.push(("resize-mode", resize_mode));
277        }
278        if let Some(ref app_paintable) = self.app_paintable {
279            properties.push(("app-paintable", app_paintable));
280        }
281        if let Some(ref can_default) = self.can_default {
282            properties.push(("can-default", can_default));
283        }
284        if let Some(ref can_focus) = self.can_focus {
285            properties.push(("can-focus", can_focus));
286        }
287        if let Some(ref events) = self.events {
288            properties.push(("events", events));
289        }
290        if let Some(ref expand) = self.expand {
291            properties.push(("expand", expand));
292        }
293        #[cfg(any(feature = "v3_20", feature = "dox"))]
294        {
295            if let Some(ref focus_on_click) = self.focus_on_click {
296                properties.push(("focus-on-click", focus_on_click));
297            }
298        }
299        if let Some(ref halign) = self.halign {
300            properties.push(("halign", halign));
301        }
302        if let Some(ref has_default) = self.has_default {
303            properties.push(("has-default", has_default));
304        }
305        if let Some(ref has_focus) = self.has_focus {
306            properties.push(("has-focus", has_focus));
307        }
308        if let Some(ref has_tooltip) = self.has_tooltip {
309            properties.push(("has-tooltip", has_tooltip));
310        }
311        if let Some(ref height_request) = self.height_request {
312            properties.push(("height-request", height_request));
313        }
314        if let Some(ref hexpand) = self.hexpand {
315            properties.push(("hexpand", hexpand));
316        }
317        if let Some(ref hexpand_set) = self.hexpand_set {
318            properties.push(("hexpand-set", hexpand_set));
319        }
320        if let Some(ref is_focus) = self.is_focus {
321            properties.push(("is-focus", is_focus));
322        }
323        if let Some(ref margin) = self.margin {
324            properties.push(("margin", margin));
325        }
326        if let Some(ref margin_bottom) = self.margin_bottom {
327            properties.push(("margin-bottom", margin_bottom));
328        }
329        if let Some(ref margin_end) = self.margin_end {
330            properties.push(("margin-end", margin_end));
331        }
332        if let Some(ref margin_start) = self.margin_start {
333            properties.push(("margin-start", margin_start));
334        }
335        if let Some(ref margin_top) = self.margin_top {
336            properties.push(("margin-top", margin_top));
337        }
338        if let Some(ref name) = self.name {
339            properties.push(("name", name));
340        }
341        if let Some(ref no_show_all) = self.no_show_all {
342            properties.push(("no-show-all", no_show_all));
343        }
344        if let Some(ref opacity) = self.opacity {
345            properties.push(("opacity", opacity));
346        }
347        if let Some(ref parent) = self.parent {
348            properties.push(("parent", parent));
349        }
350        if let Some(ref receives_default) = self.receives_default {
351            properties.push(("receives-default", receives_default));
352        }
353        if let Some(ref sensitive) = self.sensitive {
354            properties.push(("sensitive", sensitive));
355        }
356        if let Some(ref tooltip_markup) = self.tooltip_markup {
357            properties.push(("tooltip-markup", tooltip_markup));
358        }
359        if let Some(ref tooltip_text) = self.tooltip_text {
360            properties.push(("tooltip-text", tooltip_text));
361        }
362        if let Some(ref valign) = self.valign {
363            properties.push(("valign", valign));
364        }
365        if let Some(ref vexpand) = self.vexpand {
366            properties.push(("vexpand", vexpand));
367        }
368        if let Some(ref vexpand_set) = self.vexpand_set {
369            properties.push(("vexpand-set", vexpand_set));
370        }
371        if let Some(ref visible) = self.visible {
372            properties.push(("visible", visible));
373        }
374        if let Some(ref width_request) = self.width_request {
375            properties.push(("width-request", width_request));
376        }
377        glib::Object::new(FileChooserDialog::static_type(), &properties)
378            .expect("object new")
379            .downcast()
380            .expect("downcast")
381    }
382
383    pub fn use_header_bar(mut self, use_header_bar: i32) -> Self {
384        self.use_header_bar = Some(use_header_bar);
385        self
386    }
387
388    pub fn accept_focus(mut self, accept_focus: bool) -> Self {
389        self.accept_focus = Some(accept_focus);
390        self
391    }
392
393    pub fn application(mut self, application: &Application) -> Self {
394        self.application = Some(application.clone());
395        self
396    }
397
398    pub fn attached_to(mut self, attached_to: &Widget) -> Self {
399        self.attached_to = Some(attached_to.clone());
400        self
401    }
402
403    pub fn decorated(mut self, decorated: bool) -> Self {
404        self.decorated = Some(decorated);
405        self
406    }
407
408    pub fn default_height(mut self, default_height: i32) -> Self {
409        self.default_height = Some(default_height);
410        self
411    }
412
413    pub fn default_width(mut self, default_width: i32) -> Self {
414        self.default_width = Some(default_width);
415        self
416    }
417
418    pub fn deletable(mut self, deletable: bool) -> Self {
419        self.deletable = Some(deletable);
420        self
421    }
422
423    pub fn destroy_with_parent(mut self, destroy_with_parent: bool) -> Self {
424        self.destroy_with_parent = Some(destroy_with_parent);
425        self
426    }
427
428    pub fn focus_on_map(mut self, focus_on_map: bool) -> Self {
429        self.focus_on_map = Some(focus_on_map);
430        self
431    }
432
433    pub fn focus_visible(mut self, focus_visible: bool) -> Self {
434        self.focus_visible = Some(focus_visible);
435        self
436    }
437
438    pub fn gravity(mut self, gravity: gdk::Gravity) -> Self {
439        self.gravity = Some(gravity);
440        self
441    }
442
443    pub fn hide_titlebar_when_maximized(mut self, hide_titlebar_when_maximized: bool) -> Self {
444        self.hide_titlebar_when_maximized = Some(hide_titlebar_when_maximized);
445        self
446    }
447
448    pub fn icon(mut self, icon: &gdk_pixbuf::Pixbuf) -> Self {
449        self.icon = Some(icon.clone());
450        self
451    }
452
453    pub fn icon_name(mut self, icon_name: &str) -> Self {
454        self.icon_name = Some(icon_name.to_string());
455        self
456    }
457
458    pub fn mnemonics_visible(mut self, mnemonics_visible: bool) -> Self {
459        self.mnemonics_visible = Some(mnemonics_visible);
460        self
461    }
462
463    pub fn modal(mut self, modal: bool) -> Self {
464        self.modal = Some(modal);
465        self
466    }
467
468    pub fn resizable(mut self, resizable: bool) -> Self {
469        self.resizable = Some(resizable);
470        self
471    }
472
473    pub fn role(mut self, role: &str) -> Self {
474        self.role = Some(role.to_string());
475        self
476    }
477
478    pub fn screen(mut self, screen: &gdk::Screen) -> Self {
479        self.screen = Some(screen.clone());
480        self
481    }
482
483    pub fn skip_pager_hint(mut self, skip_pager_hint: bool) -> Self {
484        self.skip_pager_hint = Some(skip_pager_hint);
485        self
486    }
487
488    pub fn skip_taskbar_hint(mut self, skip_taskbar_hint: bool) -> Self {
489        self.skip_taskbar_hint = Some(skip_taskbar_hint);
490        self
491    }
492
493    pub fn startup_id(mut self, startup_id: &str) -> Self {
494        self.startup_id = Some(startup_id.to_string());
495        self
496    }
497
498    pub fn title(mut self, title: &str) -> Self {
499        self.title = Some(title.to_string());
500        self
501    }
502
503    pub fn transient_for(mut self, transient_for: &Window) -> Self {
504        self.transient_for = Some(transient_for.clone());
505        self
506    }
507
508    pub fn type_(mut self, type_: WindowType) -> Self {
509        self.type_ = Some(type_);
510        self
511    }
512
513    pub fn type_hint(mut self, type_hint: gdk::WindowTypeHint) -> Self {
514        self.type_hint = Some(type_hint);
515        self
516    }
517
518    pub fn urgency_hint(mut self, urgency_hint: bool) -> Self {
519        self.urgency_hint = Some(urgency_hint);
520        self
521    }
522
523    pub fn window_position(mut self, window_position: WindowPosition) -> Self {
524        self.window_position = Some(window_position);
525        self
526    }
527
528    pub fn border_width(mut self, border_width: u32) -> Self {
529        self.border_width = Some(border_width);
530        self
531    }
532
533    pub fn child(mut self, child: &Widget) -> Self {
534        self.child = Some(child.clone());
535        self
536    }
537
538    pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self {
539        self.resize_mode = Some(resize_mode);
540        self
541    }
542
543    pub fn app_paintable(mut self, app_paintable: bool) -> Self {
544        self.app_paintable = Some(app_paintable);
545        self
546    }
547
548    pub fn can_default(mut self, can_default: bool) -> Self {
549        self.can_default = Some(can_default);
550        self
551    }
552
553    pub fn can_focus(mut self, can_focus: bool) -> Self {
554        self.can_focus = Some(can_focus);
555        self
556    }
557
558    pub fn events(mut self, events: gdk::EventMask) -> Self {
559        self.events = Some(events);
560        self
561    }
562
563    pub fn expand(mut self, expand: bool) -> Self {
564        self.expand = Some(expand);
565        self
566    }
567
568    #[cfg(any(feature = "v3_20", feature = "dox"))]
569    pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
570        self.focus_on_click = Some(focus_on_click);
571        self
572    }
573
574    pub fn halign(mut self, halign: Align) -> Self {
575        self.halign = Some(halign);
576        self
577    }
578
579    pub fn has_default(mut self, has_default: bool) -> Self {
580        self.has_default = Some(has_default);
581        self
582    }
583
584    pub fn has_focus(mut self, has_focus: bool) -> Self {
585        self.has_focus = Some(has_focus);
586        self
587    }
588
589    pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
590        self.has_tooltip = Some(has_tooltip);
591        self
592    }
593
594    pub fn height_request(mut self, height_request: i32) -> Self {
595        self.height_request = Some(height_request);
596        self
597    }
598
599    pub fn hexpand(mut self, hexpand: bool) -> Self {
600        self.hexpand = Some(hexpand);
601        self
602    }
603
604    pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
605        self.hexpand_set = Some(hexpand_set);
606        self
607    }
608
609    pub fn is_focus(mut self, is_focus: bool) -> Self {
610        self.is_focus = Some(is_focus);
611        self
612    }
613
614    pub fn margin(mut self, margin: i32) -> Self {
615        self.margin = Some(margin);
616        self
617    }
618
619    pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
620        self.margin_bottom = Some(margin_bottom);
621        self
622    }
623
624    pub fn margin_end(mut self, margin_end: i32) -> Self {
625        self.margin_end = Some(margin_end);
626        self
627    }
628
629    pub fn margin_start(mut self, margin_start: i32) -> Self {
630        self.margin_start = Some(margin_start);
631        self
632    }
633
634    pub fn margin_top(mut self, margin_top: i32) -> Self {
635        self.margin_top = Some(margin_top);
636        self
637    }
638
639    pub fn name(mut self, name: &str) -> Self {
640        self.name = Some(name.to_string());
641        self
642    }
643
644    pub fn no_show_all(mut self, no_show_all: bool) -> Self {
645        self.no_show_all = Some(no_show_all);
646        self
647    }
648
649    pub fn opacity(mut self, opacity: f64) -> Self {
650        self.opacity = Some(opacity);
651        self
652    }
653
654    pub fn parent(mut self, parent: &Container) -> Self {
655        self.parent = Some(parent.clone());
656        self
657    }
658
659    pub fn receives_default(mut self, receives_default: bool) -> Self {
660        self.receives_default = Some(receives_default);
661        self
662    }
663
664    pub fn sensitive(mut self, sensitive: bool) -> Self {
665        self.sensitive = Some(sensitive);
666        self
667    }
668
669    pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
670        self.tooltip_markup = Some(tooltip_markup.to_string());
671        self
672    }
673
674    pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
675        self.tooltip_text = Some(tooltip_text.to_string());
676        self
677    }
678
679    pub fn valign(mut self, valign: Align) -> Self {
680        self.valign = Some(valign);
681        self
682    }
683
684    pub fn vexpand(mut self, vexpand: bool) -> Self {
685        self.vexpand = Some(vexpand);
686        self
687    }
688
689    pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
690        self.vexpand_set = Some(vexpand_set);
691        self
692    }
693
694    pub fn visible(mut self, visible: bool) -> Self {
695        self.visible = Some(visible);
696        self
697    }
698
699    pub fn width_request(mut self, width_request: i32) -> Self {
700        self.width_request = Some(width_request);
701        self
702    }
703}
704
705pub const NONE_FILE_CHOOSER_DIALOG: Option<&FileChooserDialog> = None;
706
707impl fmt::Display for FileChooserDialog {
708    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
709        write!(f, "FileChooserDialog")
710    }
711}