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_pixbuf_sys;
6 use glib::object::ObjectType as ObjectType_;
7 use glib::signal::connect_raw;
8 use glib::signal::SignalHandlerId;
9 use glib::translate::*;
10 use glib_sys;
11 use std::boxed::Box as Box_;
12 use std::fmt;
13 use std::mem::transmute;
14 use Pixbuf;
15 use PixbufAnimation;
16 
17 glib_wrapper! {
18     pub struct PixbufSimpleAnim(Object<gdk_pixbuf_sys::GdkPixbufSimpleAnim, gdk_pixbuf_sys::GdkPixbufSimpleAnimClass, PixbufSimpleAnimClass>) @extends PixbufAnimation;
19 
20     match fn {
21         get_type => || gdk_pixbuf_sys::gdk_pixbuf_simple_anim_get_type(),
22     }
23 }
24 
25 impl PixbufSimpleAnim {
new(width: i32, height: i32, rate: f32) -> PixbufSimpleAnim26     pub fn new(width: i32, height: i32, rate: f32) -> PixbufSimpleAnim {
27         unsafe {
28             from_glib_full(gdk_pixbuf_sys::gdk_pixbuf_simple_anim_new(
29                 width, height, rate,
30             ))
31         }
32     }
33 
add_frame(&self, pixbuf: &Pixbuf)34     pub fn add_frame(&self, pixbuf: &Pixbuf) {
35         unsafe {
36             gdk_pixbuf_sys::gdk_pixbuf_simple_anim_add_frame(
37                 self.to_glib_none().0,
38                 pixbuf.to_glib_none().0,
39             );
40         }
41     }
42 
get_loop(&self) -> bool43     pub fn get_loop(&self) -> bool {
44         unsafe {
45             from_glib(gdk_pixbuf_sys::gdk_pixbuf_simple_anim_get_loop(
46                 self.to_glib_none().0,
47             ))
48         }
49     }
50 
set_loop(&self, loop_: bool)51     pub fn set_loop(&self, loop_: bool) {
52         unsafe {
53             gdk_pixbuf_sys::gdk_pixbuf_simple_anim_set_loop(self.to_glib_none().0, loop_.to_glib());
54         }
55     }
56 
connect_property_loop_notify<F: Fn(&PixbufSimpleAnim) + 'static>( &self, f: F, ) -> SignalHandlerId57     pub fn connect_property_loop_notify<F: Fn(&PixbufSimpleAnim) + 'static>(
58         &self,
59         f: F,
60     ) -> SignalHandlerId {
61         unsafe extern "C" fn notify_loop_trampoline<F: Fn(&PixbufSimpleAnim) + 'static>(
62             this: *mut gdk_pixbuf_sys::GdkPixbufSimpleAnim,
63             _param_spec: glib_sys::gpointer,
64             f: glib_sys::gpointer,
65         ) {
66             let f: &F = &*(f as *const F);
67             f(&from_glib_borrow(this))
68         }
69         unsafe {
70             let f: Box_<F> = Box_::new(f);
71             connect_raw(
72                 self.as_ptr() as *mut _,
73                 b"notify::loop\0".as_ptr() as *const _,
74                 Some(transmute(notify_loop_trampoline::<F> as usize)),
75                 Box_::into_raw(f),
76             )
77         }
78     }
79 }
80 
81 impl fmt::Display for PixbufSimpleAnim {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result82     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
83         write!(f, "PixbufSimpleAnim")
84     }
85 }
86