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 crate::Align;
6 use crate::BaselinePosition;
7 use crate::Box;
8 use crate::Buildable;
9 use crate::Container;
10 use crate::Orientable;
11 use crate::Orientation;
12 use crate::RecentChooser;
13 use crate::RecentFilter;
14 use crate::RecentManager;
15 use crate::RecentSortType;
16 use crate::ResizeMode;
17 use crate::Widget;
18 use glib::object::Cast;
19 use glib::object::IsA;
20 use glib::translate::*;
21 use glib::StaticType;
22 use glib::ToValue;
23 use std::fmt;
24 
25 glib::wrapper! {
26     #[doc(alias = "GtkRecentChooserWidget")]
27     pub struct RecentChooserWidget(Object<ffi::GtkRecentChooserWidget, ffi::GtkRecentChooserWidgetClass>) @extends Box, Container, Widget, @implements Buildable, Orientable, RecentChooser;
28 
29     match fn {
30         type_ => || ffi::gtk_recent_chooser_widget_get_type(),
31     }
32 }
33 
34 impl RecentChooserWidget {
35     #[doc(alias = "gtk_recent_chooser_widget_new")]
new() -> RecentChooserWidget36     pub fn new() -> RecentChooserWidget {
37         assert_initialized_main_thread!();
38         unsafe { Widget::from_glib_none(ffi::gtk_recent_chooser_widget_new()).unsafe_cast() }
39     }
40 
41     #[doc(alias = "gtk_recent_chooser_widget_new_for_manager")]
42     #[doc(alias = "new_for_manager")]
for_manager<P: IsA<RecentManager>>(manager: &P) -> RecentChooserWidget43     pub fn for_manager<P: IsA<RecentManager>>(manager: &P) -> RecentChooserWidget {
44         skip_assert_initialized!();
45         unsafe {
46             Widget::from_glib_none(ffi::gtk_recent_chooser_widget_new_for_manager(
47                 manager.as_ref().to_glib_none().0,
48             ))
49             .unsafe_cast()
50         }
51     }
52 
53     // rustdoc-stripper-ignore-next
54     /// Creates a new builder-pattern struct instance to construct [`RecentChooserWidget`] objects.
55     ///
56     /// This method returns an instance of [`RecentChooserWidgetBuilder`] which can be used to create [`RecentChooserWidget`] objects.
builder() -> RecentChooserWidgetBuilder57     pub fn builder() -> RecentChooserWidgetBuilder {
58         RecentChooserWidgetBuilder::default()
59     }
60 }
61 
62 impl Default for RecentChooserWidget {
default() -> Self63     fn default() -> Self {
64         Self::new()
65     }
66 }
67 
68 #[derive(Clone, Default)]
69 // rustdoc-stripper-ignore-next
70 /// A [builder-pattern] type to construct [`RecentChooserWidget`] objects.
71 ///
72 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
73 pub struct RecentChooserWidgetBuilder {
74     baseline_position: Option<BaselinePosition>,
75     homogeneous: Option<bool>,
76     spacing: Option<i32>,
77     border_width: Option<u32>,
78     child: Option<Widget>,
79     resize_mode: Option<ResizeMode>,
80     app_paintable: Option<bool>,
81     can_default: Option<bool>,
82     can_focus: Option<bool>,
83     events: Option<gdk::EventMask>,
84     expand: Option<bool>,
85     #[cfg(any(feature = "v3_20", feature = "dox"))]
86     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
87     focus_on_click: Option<bool>,
88     halign: Option<Align>,
89     has_default: Option<bool>,
90     has_focus: Option<bool>,
91     has_tooltip: Option<bool>,
92     height_request: Option<i32>,
93     hexpand: Option<bool>,
94     hexpand_set: Option<bool>,
95     is_focus: Option<bool>,
96     margin: Option<i32>,
97     margin_bottom: Option<i32>,
98     margin_end: Option<i32>,
99     margin_start: Option<i32>,
100     margin_top: Option<i32>,
101     name: Option<String>,
102     no_show_all: Option<bool>,
103     opacity: Option<f64>,
104     parent: Option<Container>,
105     receives_default: Option<bool>,
106     sensitive: Option<bool>,
107     tooltip_markup: Option<String>,
108     tooltip_text: Option<String>,
109     valign: Option<Align>,
110     vexpand: Option<bool>,
111     vexpand_set: Option<bool>,
112     visible: Option<bool>,
113     width_request: Option<i32>,
114     orientation: Option<Orientation>,
115     filter: Option<RecentFilter>,
116     limit: Option<i32>,
117     local_only: Option<bool>,
118     recent_manager: Option<RecentManager>,
119     select_multiple: Option<bool>,
120     show_icons: Option<bool>,
121     show_not_found: Option<bool>,
122     show_private: Option<bool>,
123     show_tips: Option<bool>,
124     sort_type: Option<RecentSortType>,
125 }
126 
127 impl RecentChooserWidgetBuilder {
128     // rustdoc-stripper-ignore-next
129     /// Create a new [`RecentChooserWidgetBuilder`].
new() -> Self130     pub fn new() -> Self {
131         Self::default()
132     }
133 
134     // rustdoc-stripper-ignore-next
135     /// Build the [`RecentChooserWidget`].
build(self) -> RecentChooserWidget136     pub fn build(self) -> RecentChooserWidget {
137         let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
138         if let Some(ref baseline_position) = self.baseline_position {
139             properties.push(("baseline-position", baseline_position));
140         }
141         if let Some(ref homogeneous) = self.homogeneous {
142             properties.push(("homogeneous", homogeneous));
143         }
144         if let Some(ref spacing) = self.spacing {
145             properties.push(("spacing", spacing));
146         }
147         if let Some(ref border_width) = self.border_width {
148             properties.push(("border-width", border_width));
149         }
150         if let Some(ref child) = self.child {
151             properties.push(("child", child));
152         }
153         if let Some(ref resize_mode) = self.resize_mode {
154             properties.push(("resize-mode", resize_mode));
155         }
156         if let Some(ref app_paintable) = self.app_paintable {
157             properties.push(("app-paintable", app_paintable));
158         }
159         if let Some(ref can_default) = self.can_default {
160             properties.push(("can-default", can_default));
161         }
162         if let Some(ref can_focus) = self.can_focus {
163             properties.push(("can-focus", can_focus));
164         }
165         if let Some(ref events) = self.events {
166             properties.push(("events", events));
167         }
168         if let Some(ref expand) = self.expand {
169             properties.push(("expand", expand));
170         }
171         #[cfg(any(feature = "v3_20", feature = "dox"))]
172         if let Some(ref focus_on_click) = self.focus_on_click {
173             properties.push(("focus-on-click", focus_on_click));
174         }
175         if let Some(ref halign) = self.halign {
176             properties.push(("halign", halign));
177         }
178         if let Some(ref has_default) = self.has_default {
179             properties.push(("has-default", has_default));
180         }
181         if let Some(ref has_focus) = self.has_focus {
182             properties.push(("has-focus", has_focus));
183         }
184         if let Some(ref has_tooltip) = self.has_tooltip {
185             properties.push(("has-tooltip", has_tooltip));
186         }
187         if let Some(ref height_request) = self.height_request {
188             properties.push(("height-request", height_request));
189         }
190         if let Some(ref hexpand) = self.hexpand {
191             properties.push(("hexpand", hexpand));
192         }
193         if let Some(ref hexpand_set) = self.hexpand_set {
194             properties.push(("hexpand-set", hexpand_set));
195         }
196         if let Some(ref is_focus) = self.is_focus {
197             properties.push(("is-focus", is_focus));
198         }
199         if let Some(ref margin) = self.margin {
200             properties.push(("margin", margin));
201         }
202         if let Some(ref margin_bottom) = self.margin_bottom {
203             properties.push(("margin-bottom", margin_bottom));
204         }
205         if let Some(ref margin_end) = self.margin_end {
206             properties.push(("margin-end", margin_end));
207         }
208         if let Some(ref margin_start) = self.margin_start {
209             properties.push(("margin-start", margin_start));
210         }
211         if let Some(ref margin_top) = self.margin_top {
212             properties.push(("margin-top", margin_top));
213         }
214         if let Some(ref name) = self.name {
215             properties.push(("name", name));
216         }
217         if let Some(ref no_show_all) = self.no_show_all {
218             properties.push(("no-show-all", no_show_all));
219         }
220         if let Some(ref opacity) = self.opacity {
221             properties.push(("opacity", opacity));
222         }
223         if let Some(ref parent) = self.parent {
224             properties.push(("parent", parent));
225         }
226         if let Some(ref receives_default) = self.receives_default {
227             properties.push(("receives-default", receives_default));
228         }
229         if let Some(ref sensitive) = self.sensitive {
230             properties.push(("sensitive", sensitive));
231         }
232         if let Some(ref tooltip_markup) = self.tooltip_markup {
233             properties.push(("tooltip-markup", tooltip_markup));
234         }
235         if let Some(ref tooltip_text) = self.tooltip_text {
236             properties.push(("tooltip-text", tooltip_text));
237         }
238         if let Some(ref valign) = self.valign {
239             properties.push(("valign", valign));
240         }
241         if let Some(ref vexpand) = self.vexpand {
242             properties.push(("vexpand", vexpand));
243         }
244         if let Some(ref vexpand_set) = self.vexpand_set {
245             properties.push(("vexpand-set", vexpand_set));
246         }
247         if let Some(ref visible) = self.visible {
248             properties.push(("visible", visible));
249         }
250         if let Some(ref width_request) = self.width_request {
251             properties.push(("width-request", width_request));
252         }
253         if let Some(ref orientation) = self.orientation {
254             properties.push(("orientation", orientation));
255         }
256         if let Some(ref filter) = self.filter {
257             properties.push(("filter", filter));
258         }
259         if let Some(ref limit) = self.limit {
260             properties.push(("limit", limit));
261         }
262         if let Some(ref local_only) = self.local_only {
263             properties.push(("local-only", local_only));
264         }
265         if let Some(ref recent_manager) = self.recent_manager {
266             properties.push(("recent-manager", recent_manager));
267         }
268         if let Some(ref select_multiple) = self.select_multiple {
269             properties.push(("select-multiple", select_multiple));
270         }
271         if let Some(ref show_icons) = self.show_icons {
272             properties.push(("show-icons", show_icons));
273         }
274         if let Some(ref show_not_found) = self.show_not_found {
275             properties.push(("show-not-found", show_not_found));
276         }
277         if let Some(ref show_private) = self.show_private {
278             properties.push(("show-private", show_private));
279         }
280         if let Some(ref show_tips) = self.show_tips {
281             properties.push(("show-tips", show_tips));
282         }
283         if let Some(ref sort_type) = self.sort_type {
284             properties.push(("sort-type", sort_type));
285         }
286         glib::Object::new::<RecentChooserWidget>(&properties)
287             .expect("Failed to create an instance of RecentChooserWidget")
288     }
289 
baseline_position(mut self, baseline_position: BaselinePosition) -> Self290     pub fn baseline_position(mut self, baseline_position: BaselinePosition) -> Self {
291         self.baseline_position = Some(baseline_position);
292         self
293     }
294 
homogeneous(mut self, homogeneous: bool) -> Self295     pub fn homogeneous(mut self, homogeneous: bool) -> Self {
296         self.homogeneous = Some(homogeneous);
297         self
298     }
299 
spacing(mut self, spacing: i32) -> Self300     pub fn spacing(mut self, spacing: i32) -> Self {
301         self.spacing = Some(spacing);
302         self
303     }
304 
border_width(mut self, border_width: u32) -> Self305     pub fn border_width(mut self, border_width: u32) -> Self {
306         self.border_width = Some(border_width);
307         self
308     }
309 
child<P: IsA<Widget>>(mut self, child: &P) -> Self310     pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self {
311         self.child = Some(child.clone().upcast());
312         self
313     }
314 
resize_mode(mut self, resize_mode: ResizeMode) -> Self315     pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self {
316         self.resize_mode = Some(resize_mode);
317         self
318     }
319 
app_paintable(mut self, app_paintable: bool) -> Self320     pub fn app_paintable(mut self, app_paintable: bool) -> Self {
321         self.app_paintable = Some(app_paintable);
322         self
323     }
324 
can_default(mut self, can_default: bool) -> Self325     pub fn can_default(mut self, can_default: bool) -> Self {
326         self.can_default = Some(can_default);
327         self
328     }
329 
can_focus(mut self, can_focus: bool) -> Self330     pub fn can_focus(mut self, can_focus: bool) -> Self {
331         self.can_focus = Some(can_focus);
332         self
333     }
334 
events(mut self, events: gdk::EventMask) -> Self335     pub fn events(mut self, events: gdk::EventMask) -> Self {
336         self.events = Some(events);
337         self
338     }
339 
expand(mut self, expand: bool) -> Self340     pub fn expand(mut self, expand: bool) -> Self {
341         self.expand = Some(expand);
342         self
343     }
344 
345     #[cfg(any(feature = "v3_20", feature = "dox"))]
346     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
focus_on_click(mut self, focus_on_click: bool) -> Self347     pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
348         self.focus_on_click = Some(focus_on_click);
349         self
350     }
351 
halign(mut self, halign: Align) -> Self352     pub fn halign(mut self, halign: Align) -> Self {
353         self.halign = Some(halign);
354         self
355     }
356 
has_default(mut self, has_default: bool) -> Self357     pub fn has_default(mut self, has_default: bool) -> Self {
358         self.has_default = Some(has_default);
359         self
360     }
361 
has_focus(mut self, has_focus: bool) -> Self362     pub fn has_focus(mut self, has_focus: bool) -> Self {
363         self.has_focus = Some(has_focus);
364         self
365     }
366 
has_tooltip(mut self, has_tooltip: bool) -> Self367     pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
368         self.has_tooltip = Some(has_tooltip);
369         self
370     }
371 
height_request(mut self, height_request: i32) -> Self372     pub fn height_request(mut self, height_request: i32) -> Self {
373         self.height_request = Some(height_request);
374         self
375     }
376 
hexpand(mut self, hexpand: bool) -> Self377     pub fn hexpand(mut self, hexpand: bool) -> Self {
378         self.hexpand = Some(hexpand);
379         self
380     }
381 
hexpand_set(mut self, hexpand_set: bool) -> Self382     pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
383         self.hexpand_set = Some(hexpand_set);
384         self
385     }
386 
is_focus(mut self, is_focus: bool) -> Self387     pub fn is_focus(mut self, is_focus: bool) -> Self {
388         self.is_focus = Some(is_focus);
389         self
390     }
391 
margin(mut self, margin: i32) -> Self392     pub fn margin(mut self, margin: i32) -> Self {
393         self.margin = Some(margin);
394         self
395     }
396 
margin_bottom(mut self, margin_bottom: i32) -> Self397     pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
398         self.margin_bottom = Some(margin_bottom);
399         self
400     }
401 
margin_end(mut self, margin_end: i32) -> Self402     pub fn margin_end(mut self, margin_end: i32) -> Self {
403         self.margin_end = Some(margin_end);
404         self
405     }
406 
margin_start(mut self, margin_start: i32) -> Self407     pub fn margin_start(mut self, margin_start: i32) -> Self {
408         self.margin_start = Some(margin_start);
409         self
410     }
411 
margin_top(mut self, margin_top: i32) -> Self412     pub fn margin_top(mut self, margin_top: i32) -> Self {
413         self.margin_top = Some(margin_top);
414         self
415     }
416 
name(mut self, name: &str) -> Self417     pub fn name(mut self, name: &str) -> Self {
418         self.name = Some(name.to_string());
419         self
420     }
421 
no_show_all(mut self, no_show_all: bool) -> Self422     pub fn no_show_all(mut self, no_show_all: bool) -> Self {
423         self.no_show_all = Some(no_show_all);
424         self
425     }
426 
opacity(mut self, opacity: f64) -> Self427     pub fn opacity(mut self, opacity: f64) -> Self {
428         self.opacity = Some(opacity);
429         self
430     }
431 
parent<P: IsA<Container>>(mut self, parent: &P) -> Self432     pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self {
433         self.parent = Some(parent.clone().upcast());
434         self
435     }
436 
receives_default(mut self, receives_default: bool) -> Self437     pub fn receives_default(mut self, receives_default: bool) -> Self {
438         self.receives_default = Some(receives_default);
439         self
440     }
441 
sensitive(mut self, sensitive: bool) -> Self442     pub fn sensitive(mut self, sensitive: bool) -> Self {
443         self.sensitive = Some(sensitive);
444         self
445     }
446 
tooltip_markup(mut self, tooltip_markup: &str) -> Self447     pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
448         self.tooltip_markup = Some(tooltip_markup.to_string());
449         self
450     }
451 
tooltip_text(mut self, tooltip_text: &str) -> Self452     pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
453         self.tooltip_text = Some(tooltip_text.to_string());
454         self
455     }
456 
valign(mut self, valign: Align) -> Self457     pub fn valign(mut self, valign: Align) -> Self {
458         self.valign = Some(valign);
459         self
460     }
461 
vexpand(mut self, vexpand: bool) -> Self462     pub fn vexpand(mut self, vexpand: bool) -> Self {
463         self.vexpand = Some(vexpand);
464         self
465     }
466 
vexpand_set(mut self, vexpand_set: bool) -> Self467     pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
468         self.vexpand_set = Some(vexpand_set);
469         self
470     }
471 
visible(mut self, visible: bool) -> Self472     pub fn visible(mut self, visible: bool) -> Self {
473         self.visible = Some(visible);
474         self
475     }
476 
width_request(mut self, width_request: i32) -> Self477     pub fn width_request(mut self, width_request: i32) -> Self {
478         self.width_request = Some(width_request);
479         self
480     }
481 
orientation(mut self, orientation: Orientation) -> Self482     pub fn orientation(mut self, orientation: Orientation) -> Self {
483         self.orientation = Some(orientation);
484         self
485     }
486 
filter(mut self, filter: &RecentFilter) -> Self487     pub fn filter(mut self, filter: &RecentFilter) -> Self {
488         self.filter = Some(filter.clone());
489         self
490     }
491 
limit(mut self, limit: i32) -> Self492     pub fn limit(mut self, limit: i32) -> Self {
493         self.limit = Some(limit);
494         self
495     }
496 
local_only(mut self, local_only: bool) -> Self497     pub fn local_only(mut self, local_only: bool) -> Self {
498         self.local_only = Some(local_only);
499         self
500     }
501 
recent_manager<P: IsA<RecentManager>>(mut self, recent_manager: &P) -> Self502     pub fn recent_manager<P: IsA<RecentManager>>(mut self, recent_manager: &P) -> Self {
503         self.recent_manager = Some(recent_manager.clone().upcast());
504         self
505     }
506 
select_multiple(mut self, select_multiple: bool) -> Self507     pub fn select_multiple(mut self, select_multiple: bool) -> Self {
508         self.select_multiple = Some(select_multiple);
509         self
510     }
511 
show_icons(mut self, show_icons: bool) -> Self512     pub fn show_icons(mut self, show_icons: bool) -> Self {
513         self.show_icons = Some(show_icons);
514         self
515     }
516 
show_not_found(mut self, show_not_found: bool) -> Self517     pub fn show_not_found(mut self, show_not_found: bool) -> Self {
518         self.show_not_found = Some(show_not_found);
519         self
520     }
521 
show_private(mut self, show_private: bool) -> Self522     pub fn show_private(mut self, show_private: bool) -> Self {
523         self.show_private = Some(show_private);
524         self
525     }
526 
show_tips(mut self, show_tips: bool) -> Self527     pub fn show_tips(mut self, show_tips: bool) -> Self {
528         self.show_tips = Some(show_tips);
529         self
530     }
531 
sort_type(mut self, sort_type: RecentSortType) -> Self532     pub fn sort_type(mut self, sort_type: RecentSortType) -> Self {
533         self.sort_type = Some(sort_type);
534         self
535     }
536 }
537 
538 pub const NONE_RECENT_CHOOSER_WIDGET: Option<&RecentChooserWidget> = None;
539 
540 impl fmt::Display for RecentChooserWidget {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result541     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
542         f.write_str("RecentChooserWidget")
543     }
544 }
545