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 
6 use crate::Swipeable;
7 use glib::object::Cast;
8 use glib::object::IsA;
9 use glib::object::ObjectType as ObjectType_;
10 use glib::signal::connect_raw;
11 use glib::signal::SignalHandlerId;
12 use glib::translate::*;
13 use glib::StaticType;
14 use glib::ToValue;
15 use std::boxed::Box as Box_;
16 use std::fmt;
17 use std::mem::transmute;
18 
19 glib::wrapper! {
20     #[doc(alias = "HdyCarousel")]
21     pub struct Carousel(Object<ffi::HdyCarousel, ffi::HdyCarouselClass>) @extends gtk::EventBox, gtk::Bin, gtk::Container, gtk::Widget, @implements gtk::Buildable, gtk::Orientable, Swipeable;
22 
23     match fn {
24         type_ => || ffi::hdy_carousel_get_type(),
25     }
26 }
27 
28 impl Carousel {
29     #[doc(alias = "hdy_carousel_new")]
new() -> Carousel30     pub fn new() -> Carousel {
31         assert_initialized_main_thread!();
32         unsafe { gtk::Widget::from_glib_none(ffi::hdy_carousel_new()).unsafe_cast() }
33     }
34 
35     // rustdoc-stripper-ignore-next
36     /// Creates a new builder-pattern struct instance to construct [`Carousel`] objects.
37     ///
38     /// This method returns an instance of [`CarouselBuilder`] which can be used to create [`Carousel`] objects.
builder() -> CarouselBuilder39     pub fn builder() -> CarouselBuilder {
40         CarouselBuilder::default()
41     }
42 
43     #[cfg(any(feature = "v1_2", feature = "dox"))]
44     #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))]
45     #[doc(alias = "hdy_carousel_get_allow_long_swipes")]
46     #[doc(alias = "get_allow_long_swipes")]
allows_long_swipes(&self) -> bool47     pub fn allows_long_swipes(&self) -> bool {
48         unsafe {
49             from_glib(ffi::hdy_carousel_get_allow_long_swipes(
50                 self.to_glib_none().0,
51             ))
52         }
53     }
54 
55     #[doc(alias = "hdy_carousel_get_allow_mouse_drag")]
56     #[doc(alias = "get_allow_mouse_drag")]
allows_mouse_drag(&self) -> bool57     pub fn allows_mouse_drag(&self) -> bool {
58         unsafe {
59             from_glib(ffi::hdy_carousel_get_allow_mouse_drag(
60                 self.to_glib_none().0,
61             ))
62         }
63     }
64 
65     #[doc(alias = "hdy_carousel_get_animation_duration")]
66     #[doc(alias = "get_animation_duration")]
animation_duration(&self) -> u3267     pub fn animation_duration(&self) -> u32 {
68         unsafe { ffi::hdy_carousel_get_animation_duration(self.to_glib_none().0) }
69     }
70 
71     #[doc(alias = "hdy_carousel_get_interactive")]
72     #[doc(alias = "get_interactive")]
is_interactive(&self) -> bool73     pub fn is_interactive(&self) -> bool {
74         unsafe { from_glib(ffi::hdy_carousel_get_interactive(self.to_glib_none().0)) }
75     }
76 
77     #[doc(alias = "hdy_carousel_get_n_pages")]
78     #[doc(alias = "get_n_pages")]
n_pages(&self) -> u3279     pub fn n_pages(&self) -> u32 {
80         unsafe { ffi::hdy_carousel_get_n_pages(self.to_glib_none().0) }
81     }
82 
83     #[doc(alias = "hdy_carousel_get_position")]
84     #[doc(alias = "get_position")]
position(&self) -> f6485     pub fn position(&self) -> f64 {
86         unsafe { ffi::hdy_carousel_get_position(self.to_glib_none().0) }
87     }
88 
89     #[doc(alias = "hdy_carousel_get_reveal_duration")]
90     #[doc(alias = "get_reveal_duration")]
reveal_duration(&self) -> u3291     pub fn reveal_duration(&self) -> u32 {
92         unsafe { ffi::hdy_carousel_get_reveal_duration(self.to_glib_none().0) }
93     }
94 
95     #[doc(alias = "hdy_carousel_get_spacing")]
96     #[doc(alias = "get_spacing")]
spacing(&self) -> u3297     pub fn spacing(&self) -> u32 {
98         unsafe { ffi::hdy_carousel_get_spacing(self.to_glib_none().0) }
99     }
100 
101     #[doc(alias = "hdy_carousel_insert")]
insert<P: IsA<gtk::Widget>>(&self, child: &P, position: i32)102     pub fn insert<P: IsA<gtk::Widget>>(&self, child: &P, position: i32) {
103         unsafe {
104             ffi::hdy_carousel_insert(
105                 self.to_glib_none().0,
106                 child.as_ref().to_glib_none().0,
107                 position,
108             );
109         }
110     }
111 
112     #[doc(alias = "hdy_carousel_prepend")]
prepend<P: IsA<gtk::Widget>>(&self, child: &P)113     pub fn prepend<P: IsA<gtk::Widget>>(&self, child: &P) {
114         unsafe {
115             ffi::hdy_carousel_prepend(self.to_glib_none().0, child.as_ref().to_glib_none().0);
116         }
117     }
118 
119     #[doc(alias = "hdy_carousel_reorder")]
reorder<P: IsA<gtk::Widget>>(&self, child: &P, position: i32)120     pub fn reorder<P: IsA<gtk::Widget>>(&self, child: &P, position: i32) {
121         unsafe {
122             ffi::hdy_carousel_reorder(
123                 self.to_glib_none().0,
124                 child.as_ref().to_glib_none().0,
125                 position,
126             );
127         }
128     }
129 
130     #[doc(alias = "hdy_carousel_scroll_to")]
scroll_to<P: IsA<gtk::Widget>>(&self, widget: &P)131     pub fn scroll_to<P: IsA<gtk::Widget>>(&self, widget: &P) {
132         unsafe {
133             ffi::hdy_carousel_scroll_to(self.to_glib_none().0, widget.as_ref().to_glib_none().0);
134         }
135     }
136 
137     #[doc(alias = "hdy_carousel_scroll_to_full")]
scroll_to_full<P: IsA<gtk::Widget>>(&self, widget: &P, duration: i64)138     pub fn scroll_to_full<P: IsA<gtk::Widget>>(&self, widget: &P, duration: i64) {
139         unsafe {
140             ffi::hdy_carousel_scroll_to_full(
141                 self.to_glib_none().0,
142                 widget.as_ref().to_glib_none().0,
143                 duration,
144             );
145         }
146     }
147 
148     #[cfg(any(feature = "v1_2", feature = "dox"))]
149     #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))]
150     #[doc(alias = "hdy_carousel_set_allow_long_swipes")]
set_allow_long_swipes(&self, allow_long_swipes: bool)151     pub fn set_allow_long_swipes(&self, allow_long_swipes: bool) {
152         unsafe {
153             ffi::hdy_carousel_set_allow_long_swipes(
154                 self.to_glib_none().0,
155                 allow_long_swipes.into_glib(),
156             );
157         }
158     }
159 
160     #[doc(alias = "hdy_carousel_set_allow_mouse_drag")]
set_allow_mouse_drag(&self, allow_mouse_drag: bool)161     pub fn set_allow_mouse_drag(&self, allow_mouse_drag: bool) {
162         unsafe {
163             ffi::hdy_carousel_set_allow_mouse_drag(
164                 self.to_glib_none().0,
165                 allow_mouse_drag.into_glib(),
166             );
167         }
168     }
169 
170     #[doc(alias = "hdy_carousel_set_animation_duration")]
set_animation_duration(&self, duration: u32)171     pub fn set_animation_duration(&self, duration: u32) {
172         unsafe {
173             ffi::hdy_carousel_set_animation_duration(self.to_glib_none().0, duration);
174         }
175     }
176 
177     #[doc(alias = "hdy_carousel_set_interactive")]
set_interactive(&self, interactive: bool)178     pub fn set_interactive(&self, interactive: bool) {
179         unsafe {
180             ffi::hdy_carousel_set_interactive(self.to_glib_none().0, interactive.into_glib());
181         }
182     }
183 
184     #[doc(alias = "hdy_carousel_set_reveal_duration")]
set_reveal_duration(&self, reveal_duration: u32)185     pub fn set_reveal_duration(&self, reveal_duration: u32) {
186         unsafe {
187             ffi::hdy_carousel_set_reveal_duration(self.to_glib_none().0, reveal_duration);
188         }
189     }
190 
191     #[doc(alias = "hdy_carousel_set_spacing")]
set_spacing(&self, spacing: u32)192     pub fn set_spacing(&self, spacing: u32) {
193         unsafe {
194             ffi::hdy_carousel_set_spacing(self.to_glib_none().0, spacing);
195         }
196     }
197 
198     #[doc(alias = "page-changed")]
connect_page_changed<F: Fn(&Self, u32) + 'static>(&self, f: F) -> SignalHandlerId199     pub fn connect_page_changed<F: Fn(&Self, u32) + 'static>(&self, f: F) -> SignalHandlerId {
200         unsafe extern "C" fn page_changed_trampoline<F: Fn(&Carousel, u32) + 'static>(
201             this: *mut ffi::HdyCarousel,
202             index: libc::c_uint,
203             f: glib::ffi::gpointer,
204         ) {
205             let f: &F = &*(f as *const F);
206             f(&from_glib_borrow(this), index)
207         }
208         unsafe {
209             let f: Box_<F> = Box_::new(f);
210             connect_raw(
211                 self.as_ptr() as *mut _,
212                 b"page-changed\0".as_ptr() as *const _,
213                 Some(transmute::<_, unsafe extern "C" fn()>(
214                     page_changed_trampoline::<F> as *const (),
215                 )),
216                 Box_::into_raw(f),
217             )
218         }
219     }
220 
221     #[cfg(any(feature = "v1_2", feature = "dox"))]
222     #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))]
223     #[doc(alias = "allow-long-swipes")]
connect_allow_long_swipes_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId224     pub fn connect_allow_long_swipes_notify<F: Fn(&Self) + 'static>(
225         &self,
226         f: F,
227     ) -> SignalHandlerId {
228         unsafe extern "C" fn notify_allow_long_swipes_trampoline<F: Fn(&Carousel) + 'static>(
229             this: *mut ffi::HdyCarousel,
230             _param_spec: glib::ffi::gpointer,
231             f: glib::ffi::gpointer,
232         ) {
233             let f: &F = &*(f as *const F);
234             f(&from_glib_borrow(this))
235         }
236         unsafe {
237             let f: Box_<F> = Box_::new(f);
238             connect_raw(
239                 self.as_ptr() as *mut _,
240                 b"notify::allow-long-swipes\0".as_ptr() as *const _,
241                 Some(transmute::<_, unsafe extern "C" fn()>(
242                     notify_allow_long_swipes_trampoline::<F> as *const (),
243                 )),
244                 Box_::into_raw(f),
245             )
246         }
247     }
248 
249     #[doc(alias = "allow-mouse-drag")]
connect_allow_mouse_drag_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId250     pub fn connect_allow_mouse_drag_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
251         unsafe extern "C" fn notify_allow_mouse_drag_trampoline<F: Fn(&Carousel) + 'static>(
252             this: *mut ffi::HdyCarousel,
253             _param_spec: glib::ffi::gpointer,
254             f: glib::ffi::gpointer,
255         ) {
256             let f: &F = &*(f as *const F);
257             f(&from_glib_borrow(this))
258         }
259         unsafe {
260             let f: Box_<F> = Box_::new(f);
261             connect_raw(
262                 self.as_ptr() as *mut _,
263                 b"notify::allow-mouse-drag\0".as_ptr() as *const _,
264                 Some(transmute::<_, unsafe extern "C" fn()>(
265                     notify_allow_mouse_drag_trampoline::<F> as *const (),
266                 )),
267                 Box_::into_raw(f),
268             )
269         }
270     }
271 
272     #[doc(alias = "animation-duration")]
connect_animation_duration_notify<F: Fn(&Self) + 'static>( &self, f: F, ) -> SignalHandlerId273     pub fn connect_animation_duration_notify<F: Fn(&Self) + 'static>(
274         &self,
275         f: F,
276     ) -> SignalHandlerId {
277         unsafe extern "C" fn notify_animation_duration_trampoline<F: Fn(&Carousel) + 'static>(
278             this: *mut ffi::HdyCarousel,
279             _param_spec: glib::ffi::gpointer,
280             f: glib::ffi::gpointer,
281         ) {
282             let f: &F = &*(f as *const F);
283             f(&from_glib_borrow(this))
284         }
285         unsafe {
286             let f: Box_<F> = Box_::new(f);
287             connect_raw(
288                 self.as_ptr() as *mut _,
289                 b"notify::animation-duration\0".as_ptr() as *const _,
290                 Some(transmute::<_, unsafe extern "C" fn()>(
291                     notify_animation_duration_trampoline::<F> as *const (),
292                 )),
293                 Box_::into_raw(f),
294             )
295         }
296     }
297 
298     #[doc(alias = "interactive")]
connect_interactive_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId299     pub fn connect_interactive_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
300         unsafe extern "C" fn notify_interactive_trampoline<F: Fn(&Carousel) + 'static>(
301             this: *mut ffi::HdyCarousel,
302             _param_spec: glib::ffi::gpointer,
303             f: glib::ffi::gpointer,
304         ) {
305             let f: &F = &*(f as *const F);
306             f(&from_glib_borrow(this))
307         }
308         unsafe {
309             let f: Box_<F> = Box_::new(f);
310             connect_raw(
311                 self.as_ptr() as *mut _,
312                 b"notify::interactive\0".as_ptr() as *const _,
313                 Some(transmute::<_, unsafe extern "C" fn()>(
314                     notify_interactive_trampoline::<F> as *const (),
315                 )),
316                 Box_::into_raw(f),
317             )
318         }
319     }
320 
321     #[doc(alias = "n-pages")]
connect_n_pages_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId322     pub fn connect_n_pages_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
323         unsafe extern "C" fn notify_n_pages_trampoline<F: Fn(&Carousel) + 'static>(
324             this: *mut ffi::HdyCarousel,
325             _param_spec: glib::ffi::gpointer,
326             f: glib::ffi::gpointer,
327         ) {
328             let f: &F = &*(f as *const F);
329             f(&from_glib_borrow(this))
330         }
331         unsafe {
332             let f: Box_<F> = Box_::new(f);
333             connect_raw(
334                 self.as_ptr() as *mut _,
335                 b"notify::n-pages\0".as_ptr() as *const _,
336                 Some(transmute::<_, unsafe extern "C" fn()>(
337                     notify_n_pages_trampoline::<F> as *const (),
338                 )),
339                 Box_::into_raw(f),
340             )
341         }
342     }
343 
344     #[doc(alias = "position")]
connect_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId345     pub fn connect_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
346         unsafe extern "C" fn notify_position_trampoline<F: Fn(&Carousel) + 'static>(
347             this: *mut ffi::HdyCarousel,
348             _param_spec: glib::ffi::gpointer,
349             f: glib::ffi::gpointer,
350         ) {
351             let f: &F = &*(f as *const F);
352             f(&from_glib_borrow(this))
353         }
354         unsafe {
355             let f: Box_<F> = Box_::new(f);
356             connect_raw(
357                 self.as_ptr() as *mut _,
358                 b"notify::position\0".as_ptr() as *const _,
359                 Some(transmute::<_, unsafe extern "C" fn()>(
360                     notify_position_trampoline::<F> as *const (),
361                 )),
362                 Box_::into_raw(f),
363             )
364         }
365     }
366 
367     #[doc(alias = "reveal-duration")]
connect_reveal_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId368     pub fn connect_reveal_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
369         unsafe extern "C" fn notify_reveal_duration_trampoline<F: Fn(&Carousel) + 'static>(
370             this: *mut ffi::HdyCarousel,
371             _param_spec: glib::ffi::gpointer,
372             f: glib::ffi::gpointer,
373         ) {
374             let f: &F = &*(f as *const F);
375             f(&from_glib_borrow(this))
376         }
377         unsafe {
378             let f: Box_<F> = Box_::new(f);
379             connect_raw(
380                 self.as_ptr() as *mut _,
381                 b"notify::reveal-duration\0".as_ptr() as *const _,
382                 Some(transmute::<_, unsafe extern "C" fn()>(
383                     notify_reveal_duration_trampoline::<F> as *const (),
384                 )),
385                 Box_::into_raw(f),
386             )
387         }
388     }
389 
390     #[doc(alias = "spacing")]
connect_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId391     pub fn connect_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
392         unsafe extern "C" fn notify_spacing_trampoline<F: Fn(&Carousel) + 'static>(
393             this: *mut ffi::HdyCarousel,
394             _param_spec: glib::ffi::gpointer,
395             f: glib::ffi::gpointer,
396         ) {
397             let f: &F = &*(f as *const F);
398             f(&from_glib_borrow(this))
399         }
400         unsafe {
401             let f: Box_<F> = Box_::new(f);
402             connect_raw(
403                 self.as_ptr() as *mut _,
404                 b"notify::spacing\0".as_ptr() as *const _,
405                 Some(transmute::<_, unsafe extern "C" fn()>(
406                     notify_spacing_trampoline::<F> as *const (),
407                 )),
408                 Box_::into_raw(f),
409             )
410         }
411     }
412 }
413 
414 impl Default for Carousel {
default() -> Self415     fn default() -> Self {
416         Self::new()
417     }
418 }
419 
420 #[derive(Clone, Default)]
421 // rustdoc-stripper-ignore-next
422 /// A [builder-pattern] type to construct [`Carousel`] objects.
423 ///
424 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
425 pub struct CarouselBuilder {
426     #[cfg(any(feature = "v1_2", feature = "dox"))]
427     #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))]
428     allow_long_swipes: Option<bool>,
429     allow_mouse_drag: Option<bool>,
430     animation_duration: Option<u32>,
431     interactive: Option<bool>,
432     reveal_duration: Option<u32>,
433     spacing: Option<u32>,
434     above_child: Option<bool>,
435     visible_window: Option<bool>,
436     border_width: Option<u32>,
437     child: Option<gtk::Widget>,
438     resize_mode: Option<gtk::ResizeMode>,
439     app_paintable: Option<bool>,
440     can_default: Option<bool>,
441     can_focus: Option<bool>,
442     double_buffered: Option<bool>,
443     events: Option<gdk::EventMask>,
444     expand: Option<bool>,
445     focus_on_click: Option<bool>,
446     halign: Option<gtk::Align>,
447     has_default: Option<bool>,
448     has_focus: Option<bool>,
449     has_tooltip: Option<bool>,
450     height_request: Option<i32>,
451     hexpand: Option<bool>,
452     hexpand_set: Option<bool>,
453     is_focus: Option<bool>,
454     margin: Option<i32>,
455     margin_bottom: Option<i32>,
456     margin_end: Option<i32>,
457     margin_left: Option<i32>,
458     margin_right: Option<i32>,
459     margin_start: Option<i32>,
460     margin_top: Option<i32>,
461     name: Option<String>,
462     no_show_all: Option<bool>,
463     opacity: Option<f64>,
464     parent: Option<gtk::Container>,
465     receives_default: Option<bool>,
466     sensitive: Option<bool>,
467     //style: /*Unknown type*/,
468     tooltip_markup: Option<String>,
469     tooltip_text: Option<String>,
470     valign: Option<gtk::Align>,
471     vexpand: Option<bool>,
472     vexpand_set: Option<bool>,
473     visible: Option<bool>,
474     width_request: Option<i32>,
475     orientation: Option<gtk::Orientation>,
476 }
477 
478 impl CarouselBuilder {
479     // rustdoc-stripper-ignore-next
480     /// Create a new [`CarouselBuilder`].
new() -> Self481     pub fn new() -> Self {
482         Self::default()
483     }
484 
485     // rustdoc-stripper-ignore-next
486     /// Build the [`Carousel`].
build(self) -> Carousel487     pub fn build(self) -> Carousel {
488         let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
489         #[cfg(any(feature = "v1_2", feature = "dox"))]
490         if let Some(ref allow_long_swipes) = self.allow_long_swipes {
491             properties.push(("allow-long-swipes", allow_long_swipes));
492         }
493         if let Some(ref allow_mouse_drag) = self.allow_mouse_drag {
494             properties.push(("allow-mouse-drag", allow_mouse_drag));
495         }
496         if let Some(ref animation_duration) = self.animation_duration {
497             properties.push(("animation-duration", animation_duration));
498         }
499         if let Some(ref interactive) = self.interactive {
500             properties.push(("interactive", interactive));
501         }
502         if let Some(ref reveal_duration) = self.reveal_duration {
503             properties.push(("reveal-duration", reveal_duration));
504         }
505         if let Some(ref spacing) = self.spacing {
506             properties.push(("spacing", spacing));
507         }
508         if let Some(ref above_child) = self.above_child {
509             properties.push(("above-child", above_child));
510         }
511         if let Some(ref visible_window) = self.visible_window {
512             properties.push(("visible-window", visible_window));
513         }
514         if let Some(ref border_width) = self.border_width {
515             properties.push(("border-width", border_width));
516         }
517         if let Some(ref child) = self.child {
518             properties.push(("child", child));
519         }
520         if let Some(ref resize_mode) = self.resize_mode {
521             properties.push(("resize-mode", resize_mode));
522         }
523         if let Some(ref app_paintable) = self.app_paintable {
524             properties.push(("app-paintable", app_paintable));
525         }
526         if let Some(ref can_default) = self.can_default {
527             properties.push(("can-default", can_default));
528         }
529         if let Some(ref can_focus) = self.can_focus {
530             properties.push(("can-focus", can_focus));
531         }
532         if let Some(ref double_buffered) = self.double_buffered {
533             properties.push(("double-buffered", double_buffered));
534         }
535         if let Some(ref events) = self.events {
536             properties.push(("events", events));
537         }
538         if let Some(ref expand) = self.expand {
539             properties.push(("expand", expand));
540         }
541         if let Some(ref focus_on_click) = self.focus_on_click {
542             properties.push(("focus-on-click", focus_on_click));
543         }
544         if let Some(ref halign) = self.halign {
545             properties.push(("halign", halign));
546         }
547         if let Some(ref has_default) = self.has_default {
548             properties.push(("has-default", has_default));
549         }
550         if let Some(ref has_focus) = self.has_focus {
551             properties.push(("has-focus", has_focus));
552         }
553         if let Some(ref has_tooltip) = self.has_tooltip {
554             properties.push(("has-tooltip", has_tooltip));
555         }
556         if let Some(ref height_request) = self.height_request {
557             properties.push(("height-request", height_request));
558         }
559         if let Some(ref hexpand) = self.hexpand {
560             properties.push(("hexpand", hexpand));
561         }
562         if let Some(ref hexpand_set) = self.hexpand_set {
563             properties.push(("hexpand-set", hexpand_set));
564         }
565         if let Some(ref is_focus) = self.is_focus {
566             properties.push(("is-focus", is_focus));
567         }
568         if let Some(ref margin) = self.margin {
569             properties.push(("margin", margin));
570         }
571         if let Some(ref margin_bottom) = self.margin_bottom {
572             properties.push(("margin-bottom", margin_bottom));
573         }
574         if let Some(ref margin_end) = self.margin_end {
575             properties.push(("margin-end", margin_end));
576         }
577         if let Some(ref margin_left) = self.margin_left {
578             properties.push(("margin-left", margin_left));
579         }
580         if let Some(ref margin_right) = self.margin_right {
581             properties.push(("margin-right", margin_right));
582         }
583         if let Some(ref margin_start) = self.margin_start {
584             properties.push(("margin-start", margin_start));
585         }
586         if let Some(ref margin_top) = self.margin_top {
587             properties.push(("margin-top", margin_top));
588         }
589         if let Some(ref name) = self.name {
590             properties.push(("name", name));
591         }
592         if let Some(ref no_show_all) = self.no_show_all {
593             properties.push(("no-show-all", no_show_all));
594         }
595         if let Some(ref opacity) = self.opacity {
596             properties.push(("opacity", opacity));
597         }
598         if let Some(ref parent) = self.parent {
599             properties.push(("parent", parent));
600         }
601         if let Some(ref receives_default) = self.receives_default {
602             properties.push(("receives-default", receives_default));
603         }
604         if let Some(ref sensitive) = self.sensitive {
605             properties.push(("sensitive", sensitive));
606         }
607         if let Some(ref tooltip_markup) = self.tooltip_markup {
608             properties.push(("tooltip-markup", tooltip_markup));
609         }
610         if let Some(ref tooltip_text) = self.tooltip_text {
611             properties.push(("tooltip-text", tooltip_text));
612         }
613         if let Some(ref valign) = self.valign {
614             properties.push(("valign", valign));
615         }
616         if let Some(ref vexpand) = self.vexpand {
617             properties.push(("vexpand", vexpand));
618         }
619         if let Some(ref vexpand_set) = self.vexpand_set {
620             properties.push(("vexpand-set", vexpand_set));
621         }
622         if let Some(ref visible) = self.visible {
623             properties.push(("visible", visible));
624         }
625         if let Some(ref width_request) = self.width_request {
626             properties.push(("width-request", width_request));
627         }
628         if let Some(ref orientation) = self.orientation {
629             properties.push(("orientation", orientation));
630         }
631         glib::Object::new::<Carousel>(&properties)
632             .expect("Failed to create an instance of Carousel")
633     }
634 
635     #[cfg(any(feature = "v1_2", feature = "dox"))]
636     #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_2")))]
allow_long_swipes(mut self, allow_long_swipes: bool) -> Self637     pub fn allow_long_swipes(mut self, allow_long_swipes: bool) -> Self {
638         self.allow_long_swipes = Some(allow_long_swipes);
639         self
640     }
641 
allow_mouse_drag(mut self, allow_mouse_drag: bool) -> Self642     pub fn allow_mouse_drag(mut self, allow_mouse_drag: bool) -> Self {
643         self.allow_mouse_drag = Some(allow_mouse_drag);
644         self
645     }
646 
animation_duration(mut self, animation_duration: u32) -> Self647     pub fn animation_duration(mut self, animation_duration: u32) -> Self {
648         self.animation_duration = Some(animation_duration);
649         self
650     }
651 
interactive(mut self, interactive: bool) -> Self652     pub fn interactive(mut self, interactive: bool) -> Self {
653         self.interactive = Some(interactive);
654         self
655     }
656 
reveal_duration(mut self, reveal_duration: u32) -> Self657     pub fn reveal_duration(mut self, reveal_duration: u32) -> Self {
658         self.reveal_duration = Some(reveal_duration);
659         self
660     }
661 
spacing(mut self, spacing: u32) -> Self662     pub fn spacing(mut self, spacing: u32) -> Self {
663         self.spacing = Some(spacing);
664         self
665     }
666 
above_child(mut self, above_child: bool) -> Self667     pub fn above_child(mut self, above_child: bool) -> Self {
668         self.above_child = Some(above_child);
669         self
670     }
671 
visible_window(mut self, visible_window: bool) -> Self672     pub fn visible_window(mut self, visible_window: bool) -> Self {
673         self.visible_window = Some(visible_window);
674         self
675     }
676 
border_width(mut self, border_width: u32) -> Self677     pub fn border_width(mut self, border_width: u32) -> Self {
678         self.border_width = Some(border_width);
679         self
680     }
681 
child<P: IsA<gtk::Widget>>(mut self, child: &P) -> Self682     pub fn child<P: IsA<gtk::Widget>>(mut self, child: &P) -> Self {
683         self.child = Some(child.clone().upcast());
684         self
685     }
686 
resize_mode(mut self, resize_mode: gtk::ResizeMode) -> Self687     pub fn resize_mode(mut self, resize_mode: gtk::ResizeMode) -> Self {
688         self.resize_mode = Some(resize_mode);
689         self
690     }
691 
app_paintable(mut self, app_paintable: bool) -> Self692     pub fn app_paintable(mut self, app_paintable: bool) -> Self {
693         self.app_paintable = Some(app_paintable);
694         self
695     }
696 
can_default(mut self, can_default: bool) -> Self697     pub fn can_default(mut self, can_default: bool) -> Self {
698         self.can_default = Some(can_default);
699         self
700     }
701 
can_focus(mut self, can_focus: bool) -> Self702     pub fn can_focus(mut self, can_focus: bool) -> Self {
703         self.can_focus = Some(can_focus);
704         self
705     }
706 
double_buffered(mut self, double_buffered: bool) -> Self707     pub fn double_buffered(mut self, double_buffered: bool) -> Self {
708         self.double_buffered = Some(double_buffered);
709         self
710     }
711 
events(mut self, events: gdk::EventMask) -> Self712     pub fn events(mut self, events: gdk::EventMask) -> Self {
713         self.events = Some(events);
714         self
715     }
716 
expand(mut self, expand: bool) -> Self717     pub fn expand(mut self, expand: bool) -> Self {
718         self.expand = Some(expand);
719         self
720     }
721 
focus_on_click(mut self, focus_on_click: bool) -> Self722     pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
723         self.focus_on_click = Some(focus_on_click);
724         self
725     }
726 
halign(mut self, halign: gtk::Align) -> Self727     pub fn halign(mut self, halign: gtk::Align) -> Self {
728         self.halign = Some(halign);
729         self
730     }
731 
has_default(mut self, has_default: bool) -> Self732     pub fn has_default(mut self, has_default: bool) -> Self {
733         self.has_default = Some(has_default);
734         self
735     }
736 
has_focus(mut self, has_focus: bool) -> Self737     pub fn has_focus(mut self, has_focus: bool) -> Self {
738         self.has_focus = Some(has_focus);
739         self
740     }
741 
has_tooltip(mut self, has_tooltip: bool) -> Self742     pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
743         self.has_tooltip = Some(has_tooltip);
744         self
745     }
746 
height_request(mut self, height_request: i32) -> Self747     pub fn height_request(mut self, height_request: i32) -> Self {
748         self.height_request = Some(height_request);
749         self
750     }
751 
hexpand(mut self, hexpand: bool) -> Self752     pub fn hexpand(mut self, hexpand: bool) -> Self {
753         self.hexpand = Some(hexpand);
754         self
755     }
756 
hexpand_set(mut self, hexpand_set: bool) -> Self757     pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
758         self.hexpand_set = Some(hexpand_set);
759         self
760     }
761 
is_focus(mut self, is_focus: bool) -> Self762     pub fn is_focus(mut self, is_focus: bool) -> Self {
763         self.is_focus = Some(is_focus);
764         self
765     }
766 
margin(mut self, margin: i32) -> Self767     pub fn margin(mut self, margin: i32) -> Self {
768         self.margin = Some(margin);
769         self
770     }
771 
margin_bottom(mut self, margin_bottom: i32) -> Self772     pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
773         self.margin_bottom = Some(margin_bottom);
774         self
775     }
776 
margin_end(mut self, margin_end: i32) -> Self777     pub fn margin_end(mut self, margin_end: i32) -> Self {
778         self.margin_end = Some(margin_end);
779         self
780     }
781 
margin_left(mut self, margin_left: i32) -> Self782     pub fn margin_left(mut self, margin_left: i32) -> Self {
783         self.margin_left = Some(margin_left);
784         self
785     }
786 
margin_right(mut self, margin_right: i32) -> Self787     pub fn margin_right(mut self, margin_right: i32) -> Self {
788         self.margin_right = Some(margin_right);
789         self
790     }
791 
margin_start(mut self, margin_start: i32) -> Self792     pub fn margin_start(mut self, margin_start: i32) -> Self {
793         self.margin_start = Some(margin_start);
794         self
795     }
796 
margin_top(mut self, margin_top: i32) -> Self797     pub fn margin_top(mut self, margin_top: i32) -> Self {
798         self.margin_top = Some(margin_top);
799         self
800     }
801 
name(mut self, name: &str) -> Self802     pub fn name(mut self, name: &str) -> Self {
803         self.name = Some(name.to_string());
804         self
805     }
806 
no_show_all(mut self, no_show_all: bool) -> Self807     pub fn no_show_all(mut self, no_show_all: bool) -> Self {
808         self.no_show_all = Some(no_show_all);
809         self
810     }
811 
opacity(mut self, opacity: f64) -> Self812     pub fn opacity(mut self, opacity: f64) -> Self {
813         self.opacity = Some(opacity);
814         self
815     }
816 
parent<P: IsA<gtk::Container>>(mut self, parent: &P) -> Self817     pub fn parent<P: IsA<gtk::Container>>(mut self, parent: &P) -> Self {
818         self.parent = Some(parent.clone().upcast());
819         self
820     }
821 
receives_default(mut self, receives_default: bool) -> Self822     pub fn receives_default(mut self, receives_default: bool) -> Self {
823         self.receives_default = Some(receives_default);
824         self
825     }
826 
sensitive(mut self, sensitive: bool) -> Self827     pub fn sensitive(mut self, sensitive: bool) -> Self {
828         self.sensitive = Some(sensitive);
829         self
830     }
831 
tooltip_markup(mut self, tooltip_markup: &str) -> Self832     pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
833         self.tooltip_markup = Some(tooltip_markup.to_string());
834         self
835     }
836 
tooltip_text(mut self, tooltip_text: &str) -> Self837     pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
838         self.tooltip_text = Some(tooltip_text.to_string());
839         self
840     }
841 
valign(mut self, valign: gtk::Align) -> Self842     pub fn valign(mut self, valign: gtk::Align) -> Self {
843         self.valign = Some(valign);
844         self
845     }
846 
vexpand(mut self, vexpand: bool) -> Self847     pub fn vexpand(mut self, vexpand: bool) -> Self {
848         self.vexpand = Some(vexpand);
849         self
850     }
851 
vexpand_set(mut self, vexpand_set: bool) -> Self852     pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
853         self.vexpand_set = Some(vexpand_set);
854         self
855     }
856 
visible(mut self, visible: bool) -> Self857     pub fn visible(mut self, visible: bool) -> Self {
858         self.visible = Some(visible);
859         self
860     }
861 
width_request(mut self, width_request: i32) -> Self862     pub fn width_request(mut self, width_request: i32) -> Self {
863         self.width_request = Some(width_request);
864         self
865     }
866 
orientation(mut self, orientation: gtk::Orientation) -> Self867     pub fn orientation(mut self, orientation: gtk::Orientation) -> Self {
868         self.orientation = Some(orientation);
869         self
870     }
871 }
872 
873 impl fmt::Display for Carousel {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result874     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
875         f.write_str("Carousel")
876     }
877 }
878