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 glib::object::Cast;
6 use glib::object::IsA;
7 use glib::signal::connect_raw;
8 use glib::signal::SignalHandlerId;
9 use glib::translate::*;
10 use glib_sys;
11 use gtk;
12 use handy_sys;
13 use std::boxed::Box as Box_;
14 use std::fmt;
15 use std::mem::transmute;
16 use ArrowsDirection;
17 
18 glib_wrapper! {
19     pub struct Arrows(Object<handy_sys::HdyArrows, handy_sys::HdyArrowsClass, ArrowsClass>) @extends gtk::DrawingArea, gtk::Widget;
20 
21     match fn {
22         get_type => || handy_sys::hdy_arrows_get_type(),
23     }
24 }
25 
26 impl Arrows {
27     #[cfg_attr(feature = "v0_0_12", deprecated)]
new() -> Arrows28     pub fn new() -> Arrows {
29         assert_initialized_main_thread!();
30         unsafe {
31             gtk::Widget::from_glib_none(handy_sys::hdy_arrows_new()).unsafe_cast()
32         }
33     }
34 }
35 
36 #[cfg_attr(feature = "v0_0_12", deprecated)]
37 impl Default for Arrows {
default() -> Self38     fn default() -> Self {
39         Self::new()
40     }
41 }
42 
43 pub const NONE_ARROWS: Option<&Arrows> = None;
44 
45 pub trait ArrowsExt: 'static {
46     #[cfg_attr(feature = "v0_0_12", deprecated)]
animate(&self)47     fn animate(&self);
48 
49     #[cfg_attr(feature = "v0_0_12", deprecated)]
get_count(&self) -> u3250     fn get_count(&self) -> u32;
51 
52     #[cfg_attr(feature = "v0_0_12", deprecated)]
get_direction(&self) -> ArrowsDirection53     fn get_direction(&self) -> ArrowsDirection;
54 
55     #[cfg_attr(feature = "v0_0_12", deprecated)]
get_duration(&self) -> u3256     fn get_duration(&self) -> u32;
57 
58     #[cfg_attr(feature = "v0_0_12", deprecated)]
set_count(&self, count: u32)59     fn set_count(&self, count: u32);
60 
61     #[cfg_attr(feature = "v0_0_12", deprecated)]
set_direction(&self, direction: ArrowsDirection)62     fn set_direction(&self, direction: ArrowsDirection);
63 
64     #[cfg_attr(feature = "v0_0_12", deprecated)]
set_duration(&self, duration: u32)65     fn set_duration(&self, duration: u32);
66 
connect_property_count_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId67     fn connect_property_count_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
68 
connect_property_direction_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId69     fn connect_property_direction_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
70 
connect_property_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId71     fn connect_property_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
72 }
73 
74 impl<O: IsA<Arrows>> ArrowsExt for O {
animate(&self)75     fn animate(&self) {
76         unsafe {
77             handy_sys::hdy_arrows_animate(self.as_ref().to_glib_none().0);
78         }
79     }
80 
get_count(&self) -> u3281     fn get_count(&self) -> u32 {
82         unsafe {
83             handy_sys::hdy_arrows_get_count(self.as_ref().to_glib_none().0)
84         }
85     }
86 
get_direction(&self) -> ArrowsDirection87     fn get_direction(&self) -> ArrowsDirection {
88         unsafe {
89             from_glib(handy_sys::hdy_arrows_get_direction(self.as_ref().to_glib_none().0))
90         }
91     }
92 
get_duration(&self) -> u3293     fn get_duration(&self) -> u32 {
94         unsafe {
95             handy_sys::hdy_arrows_get_duration(self.as_ref().to_glib_none().0)
96         }
97     }
98 
set_count(&self, count: u32)99     fn set_count(&self, count: u32) {
100         unsafe {
101             handy_sys::hdy_arrows_set_count(self.as_ref().to_glib_none().0, count);
102         }
103     }
104 
set_direction(&self, direction: ArrowsDirection)105     fn set_direction(&self, direction: ArrowsDirection) {
106         unsafe {
107             handy_sys::hdy_arrows_set_direction(self.as_ref().to_glib_none().0, direction.to_glib());
108         }
109     }
110 
set_duration(&self, duration: u32)111     fn set_duration(&self, duration: u32) {
112         unsafe {
113             handy_sys::hdy_arrows_set_duration(self.as_ref().to_glib_none().0, duration);
114         }
115     }
116 
connect_property_count_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId117     fn connect_property_count_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
118         unsafe extern "C" fn notify_count_trampoline<P, F: Fn(&P) + 'static>(this: *mut handy_sys::HdyArrows, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer)
119             where P: IsA<Arrows>
120         {
121             let f: &F = &*(f as *const F);
122             f(&Arrows::from_glib_borrow(this).unsafe_cast())
123         }
124         unsafe {
125             let f: Box_<F> = Box_::new(f);
126             connect_raw(self.as_ptr() as *mut _, b"notify::count\0".as_ptr() as *const _,
127                 Some(transmute(notify_count_trampoline::<Self, F> as usize)), Box_::into_raw(f))
128         }
129     }
130 
connect_property_direction_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId131     fn connect_property_direction_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
132         unsafe extern "C" fn notify_direction_trampoline<P, F: Fn(&P) + 'static>(this: *mut handy_sys::HdyArrows, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer)
133             where P: IsA<Arrows>
134         {
135             let f: &F = &*(f as *const F);
136             f(&Arrows::from_glib_borrow(this).unsafe_cast())
137         }
138         unsafe {
139             let f: Box_<F> = Box_::new(f);
140             connect_raw(self.as_ptr() as *mut _, b"notify::direction\0".as_ptr() as *const _,
141                 Some(transmute(notify_direction_trampoline::<Self, F> as usize)), Box_::into_raw(f))
142         }
143     }
144 
connect_property_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId145     fn connect_property_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
146         unsafe extern "C" fn notify_duration_trampoline<P, F: Fn(&P) + 'static>(this: *mut handy_sys::HdyArrows, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer)
147             where P: IsA<Arrows>
148         {
149             let f: &F = &*(f as *const F);
150             f(&Arrows::from_glib_borrow(this).unsafe_cast())
151         }
152         unsafe {
153             let f: Box_<F> = Box_::new(f);
154             connect_raw(self.as_ptr() as *mut _, b"notify::duration\0".as_ptr() as *const _,
155                 Some(transmute(notify_duration_trampoline::<Self, F> as usize)), Box_::into_raw(f))
156         }
157     }
158 }
159 
160 impl fmt::Display for Arrows {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result161     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
162         write!(f, "Arrows")
163     }
164 }
165