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 gdk;
6 use glib::object::Cast;
7 use glib::object::IsA;
8 use glib::translate::*;
9 use glib::StaticType;
10 use glib::ToValue;
11 use gtk_sys;
12 use std::fmt;
13 use Align;
14 use BaselinePosition;
15 use Box;
16 use Buildable;
17 use Container;
18 use Orientable;
19 use Orientation;
20 use RecentChooser;
21 use RecentFilter;
22 use RecentManager;
23 use RecentSortType;
24 use ResizeMode;
25 use Widget;
26 
27 glib_wrapper! {
28     pub struct RecentChooserWidget(Object<gtk_sys::GtkRecentChooserWidget, gtk_sys::GtkRecentChooserWidgetClass, RecentChooserWidgetClass>) @extends Box, Container, Widget, @implements Buildable, Orientable, RecentChooser;
29 
30     match fn {
31         get_type => || gtk_sys::gtk_recent_chooser_widget_get_type(),
32     }
33 }
34 
35 impl RecentChooserWidget {
new() -> RecentChooserWidget36     pub fn new() -> RecentChooserWidget {
37         assert_initialized_main_thread!();
38         unsafe { Widget::from_glib_none(gtk_sys::gtk_recent_chooser_widget_new()).unsafe_cast() }
39     }
40 
new_for_manager<P: IsA<RecentManager>>(manager: &P) -> RecentChooserWidget41     pub fn new_for_manager<P: IsA<RecentManager>>(manager: &P) -> RecentChooserWidget {
42         skip_assert_initialized!();
43         unsafe {
44             Widget::from_glib_none(gtk_sys::gtk_recent_chooser_widget_new_for_manager(
45                 manager.as_ref().to_glib_none().0,
46             ))
47             .unsafe_cast()
48         }
49     }
50 }
51 
52 impl Default for RecentChooserWidget {
default() -> Self53     fn default() -> Self {
54         Self::new()
55     }
56 }
57 
58 #[derive(Clone, Default)]
59 pub struct RecentChooserWidgetBuilder {
60     baseline_position: Option<BaselinePosition>,
61     homogeneous: Option<bool>,
62     spacing: Option<i32>,
63     border_width: Option<u32>,
64     child: Option<Widget>,
65     resize_mode: Option<ResizeMode>,
66     app_paintable: Option<bool>,
67     can_default: Option<bool>,
68     can_focus: Option<bool>,
69     events: Option<gdk::EventMask>,
70     expand: Option<bool>,
71     #[cfg(any(feature = "v3_20", feature = "dox"))]
72     focus_on_click: Option<bool>,
73     halign: Option<Align>,
74     has_default: Option<bool>,
75     has_focus: Option<bool>,
76     has_tooltip: Option<bool>,
77     height_request: Option<i32>,
78     hexpand: Option<bool>,
79     hexpand_set: Option<bool>,
80     is_focus: Option<bool>,
81     margin: Option<i32>,
82     margin_bottom: Option<i32>,
83     margin_end: Option<i32>,
84     margin_start: Option<i32>,
85     margin_top: Option<i32>,
86     name: Option<String>,
87     no_show_all: Option<bool>,
88     opacity: Option<f64>,
89     parent: Option<Container>,
90     receives_default: Option<bool>,
91     sensitive: Option<bool>,
92     tooltip_markup: Option<String>,
93     tooltip_text: Option<String>,
94     valign: Option<Align>,
95     vexpand: Option<bool>,
96     vexpand_set: Option<bool>,
97     visible: Option<bool>,
98     width_request: Option<i32>,
99     orientation: Option<Orientation>,
100     filter: Option<RecentFilter>,
101     limit: Option<i32>,
102     local_only: Option<bool>,
103     recent_manager: Option<RecentManager>,
104     select_multiple: Option<bool>,
105     show_icons: Option<bool>,
106     show_not_found: Option<bool>,
107     show_private: Option<bool>,
108     show_tips: Option<bool>,
109     sort_type: Option<RecentSortType>,
110 }
111 
112 impl RecentChooserWidgetBuilder {
new() -> Self113     pub fn new() -> Self {
114         Self::default()
115     }
116 
build(self) -> RecentChooserWidget117     pub fn build(self) -> RecentChooserWidget {
118         let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
119         if let Some(ref baseline_position) = self.baseline_position {
120             properties.push(("baseline-position", baseline_position));
121         }
122         if let Some(ref homogeneous) = self.homogeneous {
123             properties.push(("homogeneous", homogeneous));
124         }
125         if let Some(ref spacing) = self.spacing {
126             properties.push(("spacing", spacing));
127         }
128         if let Some(ref border_width) = self.border_width {
129             properties.push(("border-width", border_width));
130         }
131         if let Some(ref child) = self.child {
132             properties.push(("child", child));
133         }
134         if let Some(ref resize_mode) = self.resize_mode {
135             properties.push(("resize-mode", resize_mode));
136         }
137         if let Some(ref app_paintable) = self.app_paintable {
138             properties.push(("app-paintable", app_paintable));
139         }
140         if let Some(ref can_default) = self.can_default {
141             properties.push(("can-default", can_default));
142         }
143         if let Some(ref can_focus) = self.can_focus {
144             properties.push(("can-focus", can_focus));
145         }
146         if let Some(ref events) = self.events {
147             properties.push(("events", events));
148         }
149         if let Some(ref expand) = self.expand {
150             properties.push(("expand", expand));
151         }
152         #[cfg(any(feature = "v3_20", feature = "dox"))]
153         {
154             if let Some(ref focus_on_click) = self.focus_on_click {
155                 properties.push(("focus-on-click", focus_on_click));
156             }
157         }
158         if let Some(ref halign) = self.halign {
159             properties.push(("halign", halign));
160         }
161         if let Some(ref has_default) = self.has_default {
162             properties.push(("has-default", has_default));
163         }
164         if let Some(ref has_focus) = self.has_focus {
165             properties.push(("has-focus", has_focus));
166         }
167         if let Some(ref has_tooltip) = self.has_tooltip {
168             properties.push(("has-tooltip", has_tooltip));
169         }
170         if let Some(ref height_request) = self.height_request {
171             properties.push(("height-request", height_request));
172         }
173         if let Some(ref hexpand) = self.hexpand {
174             properties.push(("hexpand", hexpand));
175         }
176         if let Some(ref hexpand_set) = self.hexpand_set {
177             properties.push(("hexpand-set", hexpand_set));
178         }
179         if let Some(ref is_focus) = self.is_focus {
180             properties.push(("is-focus", is_focus));
181         }
182         if let Some(ref margin) = self.margin {
183             properties.push(("margin", margin));
184         }
185         if let Some(ref margin_bottom) = self.margin_bottom {
186             properties.push(("margin-bottom", margin_bottom));
187         }
188         if let Some(ref margin_end) = self.margin_end {
189             properties.push(("margin-end", margin_end));
190         }
191         if let Some(ref margin_start) = self.margin_start {
192             properties.push(("margin-start", margin_start));
193         }
194         if let Some(ref margin_top) = self.margin_top {
195             properties.push(("margin-top", margin_top));
196         }
197         if let Some(ref name) = self.name {
198             properties.push(("name", name));
199         }
200         if let Some(ref no_show_all) = self.no_show_all {
201             properties.push(("no-show-all", no_show_all));
202         }
203         if let Some(ref opacity) = self.opacity {
204             properties.push(("opacity", opacity));
205         }
206         if let Some(ref parent) = self.parent {
207             properties.push(("parent", parent));
208         }
209         if let Some(ref receives_default) = self.receives_default {
210             properties.push(("receives-default", receives_default));
211         }
212         if let Some(ref sensitive) = self.sensitive {
213             properties.push(("sensitive", sensitive));
214         }
215         if let Some(ref tooltip_markup) = self.tooltip_markup {
216             properties.push(("tooltip-markup", tooltip_markup));
217         }
218         if let Some(ref tooltip_text) = self.tooltip_text {
219             properties.push(("tooltip-text", tooltip_text));
220         }
221         if let Some(ref valign) = self.valign {
222             properties.push(("valign", valign));
223         }
224         if let Some(ref vexpand) = self.vexpand {
225             properties.push(("vexpand", vexpand));
226         }
227         if let Some(ref vexpand_set) = self.vexpand_set {
228             properties.push(("vexpand-set", vexpand_set));
229         }
230         if let Some(ref visible) = self.visible {
231             properties.push(("visible", visible));
232         }
233         if let Some(ref width_request) = self.width_request {
234             properties.push(("width-request", width_request));
235         }
236         if let Some(ref orientation) = self.orientation {
237             properties.push(("orientation", orientation));
238         }
239         if let Some(ref filter) = self.filter {
240             properties.push(("filter", filter));
241         }
242         if let Some(ref limit) = self.limit {
243             properties.push(("limit", limit));
244         }
245         if let Some(ref local_only) = self.local_only {
246             properties.push(("local-only", local_only));
247         }
248         if let Some(ref recent_manager) = self.recent_manager {
249             properties.push(("recent-manager", recent_manager));
250         }
251         if let Some(ref select_multiple) = self.select_multiple {
252             properties.push(("select-multiple", select_multiple));
253         }
254         if let Some(ref show_icons) = self.show_icons {
255             properties.push(("show-icons", show_icons));
256         }
257         if let Some(ref show_not_found) = self.show_not_found {
258             properties.push(("show-not-found", show_not_found));
259         }
260         if let Some(ref show_private) = self.show_private {
261             properties.push(("show-private", show_private));
262         }
263         if let Some(ref show_tips) = self.show_tips {
264             properties.push(("show-tips", show_tips));
265         }
266         if let Some(ref sort_type) = self.sort_type {
267             properties.push(("sort-type", sort_type));
268         }
269         glib::Object::new(RecentChooserWidget::static_type(), &properties)
270             .expect("object new")
271             .downcast()
272             .expect("downcast")
273     }
274 
baseline_position(mut self, baseline_position: BaselinePosition) -> Self275     pub fn baseline_position(mut self, baseline_position: BaselinePosition) -> Self {
276         self.baseline_position = Some(baseline_position);
277         self
278     }
279 
homogeneous(mut self, homogeneous: bool) -> Self280     pub fn homogeneous(mut self, homogeneous: bool) -> Self {
281         self.homogeneous = Some(homogeneous);
282         self
283     }
284 
spacing(mut self, spacing: i32) -> Self285     pub fn spacing(mut self, spacing: i32) -> Self {
286         self.spacing = Some(spacing);
287         self
288     }
289 
border_width(mut self, border_width: u32) -> Self290     pub fn border_width(mut self, border_width: u32) -> Self {
291         self.border_width = Some(border_width);
292         self
293     }
294 
child<P: IsA<Widget>>(mut self, child: &P) -> Self295     pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self {
296         self.child = Some(child.clone().upcast());
297         self
298     }
299 
resize_mode(mut self, resize_mode: ResizeMode) -> Self300     pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self {
301         self.resize_mode = Some(resize_mode);
302         self
303     }
304 
app_paintable(mut self, app_paintable: bool) -> Self305     pub fn app_paintable(mut self, app_paintable: bool) -> Self {
306         self.app_paintable = Some(app_paintable);
307         self
308     }
309 
can_default(mut self, can_default: bool) -> Self310     pub fn can_default(mut self, can_default: bool) -> Self {
311         self.can_default = Some(can_default);
312         self
313     }
314 
can_focus(mut self, can_focus: bool) -> Self315     pub fn can_focus(mut self, can_focus: bool) -> Self {
316         self.can_focus = Some(can_focus);
317         self
318     }
319 
events(mut self, events: gdk::EventMask) -> Self320     pub fn events(mut self, events: gdk::EventMask) -> Self {
321         self.events = Some(events);
322         self
323     }
324 
expand(mut self, expand: bool) -> Self325     pub fn expand(mut self, expand: bool) -> Self {
326         self.expand = Some(expand);
327         self
328     }
329 
330     #[cfg(any(feature = "v3_20", feature = "dox"))]
focus_on_click(mut self, focus_on_click: bool) -> Self331     pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
332         self.focus_on_click = Some(focus_on_click);
333         self
334     }
335 
halign(mut self, halign: Align) -> Self336     pub fn halign(mut self, halign: Align) -> Self {
337         self.halign = Some(halign);
338         self
339     }
340 
has_default(mut self, has_default: bool) -> Self341     pub fn has_default(mut self, has_default: bool) -> Self {
342         self.has_default = Some(has_default);
343         self
344     }
345 
has_focus(mut self, has_focus: bool) -> Self346     pub fn has_focus(mut self, has_focus: bool) -> Self {
347         self.has_focus = Some(has_focus);
348         self
349     }
350 
has_tooltip(mut self, has_tooltip: bool) -> Self351     pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
352         self.has_tooltip = Some(has_tooltip);
353         self
354     }
355 
height_request(mut self, height_request: i32) -> Self356     pub fn height_request(mut self, height_request: i32) -> Self {
357         self.height_request = Some(height_request);
358         self
359     }
360 
hexpand(mut self, hexpand: bool) -> Self361     pub fn hexpand(mut self, hexpand: bool) -> Self {
362         self.hexpand = Some(hexpand);
363         self
364     }
365 
hexpand_set(mut self, hexpand_set: bool) -> Self366     pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
367         self.hexpand_set = Some(hexpand_set);
368         self
369     }
370 
is_focus(mut self, is_focus: bool) -> Self371     pub fn is_focus(mut self, is_focus: bool) -> Self {
372         self.is_focus = Some(is_focus);
373         self
374     }
375 
margin(mut self, margin: i32) -> Self376     pub fn margin(mut self, margin: i32) -> Self {
377         self.margin = Some(margin);
378         self
379     }
380 
margin_bottom(mut self, margin_bottom: i32) -> Self381     pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
382         self.margin_bottom = Some(margin_bottom);
383         self
384     }
385 
margin_end(mut self, margin_end: i32) -> Self386     pub fn margin_end(mut self, margin_end: i32) -> Self {
387         self.margin_end = Some(margin_end);
388         self
389     }
390 
margin_start(mut self, margin_start: i32) -> Self391     pub fn margin_start(mut self, margin_start: i32) -> Self {
392         self.margin_start = Some(margin_start);
393         self
394     }
395 
margin_top(mut self, margin_top: i32) -> Self396     pub fn margin_top(mut self, margin_top: i32) -> Self {
397         self.margin_top = Some(margin_top);
398         self
399     }
400 
name(mut self, name: &str) -> Self401     pub fn name(mut self, name: &str) -> Self {
402         self.name = Some(name.to_string());
403         self
404     }
405 
no_show_all(mut self, no_show_all: bool) -> Self406     pub fn no_show_all(mut self, no_show_all: bool) -> Self {
407         self.no_show_all = Some(no_show_all);
408         self
409     }
410 
opacity(mut self, opacity: f64) -> Self411     pub fn opacity(mut self, opacity: f64) -> Self {
412         self.opacity = Some(opacity);
413         self
414     }
415 
parent<P: IsA<Container>>(mut self, parent: &P) -> Self416     pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self {
417         self.parent = Some(parent.clone().upcast());
418         self
419     }
420 
receives_default(mut self, receives_default: bool) -> Self421     pub fn receives_default(mut self, receives_default: bool) -> Self {
422         self.receives_default = Some(receives_default);
423         self
424     }
425 
sensitive(mut self, sensitive: bool) -> Self426     pub fn sensitive(mut self, sensitive: bool) -> Self {
427         self.sensitive = Some(sensitive);
428         self
429     }
430 
tooltip_markup(mut self, tooltip_markup: &str) -> Self431     pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
432         self.tooltip_markup = Some(tooltip_markup.to_string());
433         self
434     }
435 
tooltip_text(mut self, tooltip_text: &str) -> Self436     pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
437         self.tooltip_text = Some(tooltip_text.to_string());
438         self
439     }
440 
valign(mut self, valign: Align) -> Self441     pub fn valign(mut self, valign: Align) -> Self {
442         self.valign = Some(valign);
443         self
444     }
445 
vexpand(mut self, vexpand: bool) -> Self446     pub fn vexpand(mut self, vexpand: bool) -> Self {
447         self.vexpand = Some(vexpand);
448         self
449     }
450 
vexpand_set(mut self, vexpand_set: bool) -> Self451     pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
452         self.vexpand_set = Some(vexpand_set);
453         self
454     }
455 
visible(mut self, visible: bool) -> Self456     pub fn visible(mut self, visible: bool) -> Self {
457         self.visible = Some(visible);
458         self
459     }
460 
width_request(mut self, width_request: i32) -> Self461     pub fn width_request(mut self, width_request: i32) -> Self {
462         self.width_request = Some(width_request);
463         self
464     }
465 
orientation(mut self, orientation: Orientation) -> Self466     pub fn orientation(mut self, orientation: Orientation) -> Self {
467         self.orientation = Some(orientation);
468         self
469     }
470 
filter(mut self, filter: &RecentFilter) -> Self471     pub fn filter(mut self, filter: &RecentFilter) -> Self {
472         self.filter = Some(filter.clone());
473         self
474     }
475 
limit(mut self, limit: i32) -> Self476     pub fn limit(mut self, limit: i32) -> Self {
477         self.limit = Some(limit);
478         self
479     }
480 
local_only(mut self, local_only: bool) -> Self481     pub fn local_only(mut self, local_only: bool) -> Self {
482         self.local_only = Some(local_only);
483         self
484     }
485 
recent_manager<P: IsA<RecentManager>>(mut self, recent_manager: &P) -> Self486     pub fn recent_manager<P: IsA<RecentManager>>(mut self, recent_manager: &P) -> Self {
487         self.recent_manager = Some(recent_manager.clone().upcast());
488         self
489     }
490 
select_multiple(mut self, select_multiple: bool) -> Self491     pub fn select_multiple(mut self, select_multiple: bool) -> Self {
492         self.select_multiple = Some(select_multiple);
493         self
494     }
495 
show_icons(mut self, show_icons: bool) -> Self496     pub fn show_icons(mut self, show_icons: bool) -> Self {
497         self.show_icons = Some(show_icons);
498         self
499     }
500 
show_not_found(mut self, show_not_found: bool) -> Self501     pub fn show_not_found(mut self, show_not_found: bool) -> Self {
502         self.show_not_found = Some(show_not_found);
503         self
504     }
505 
show_private(mut self, show_private: bool) -> Self506     pub fn show_private(mut self, show_private: bool) -> Self {
507         self.show_private = Some(show_private);
508         self
509     }
510 
show_tips(mut self, show_tips: bool) -> Self511     pub fn show_tips(mut self, show_tips: bool) -> Self {
512         self.show_tips = Some(show_tips);
513         self
514     }
515 
sort_type(mut self, sort_type: RecentSortType) -> Self516     pub fn sort_type(mut self, sort_type: RecentSortType) -> Self {
517         self.sort_type = Some(sort_type);
518         self
519     }
520 }
521 
522 pub const NONE_RECENT_CHOOSER_WIDGET: Option<&RecentChooserWidget> = None;
523 
524 impl fmt::Display for RecentChooserWidget {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result525     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
526         write!(f, "RecentChooserWidget")
527     }
528 }
529