1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from
// from gir-files (https://github.com/gtk-rs/gir-files.git)
// DO NOT EDIT

use crate::{ffi, AnimationTarget};
use glib::translate::*;
use std::boxed::Box as Box_;

glib::wrapper! {
    ///
    ///
    /// # Implements
    ///
    /// [`AnimationTargetExt`][trait@crate::prelude::AnimationTargetExt], [`trait@glib::ObjectExt`]
    #[doc(alias = "HeCallbackAnimationTarget")]
    pub struct CallbackAnimationTarget(Object<ffi::HeCallbackAnimationTarget, ffi::HeCallbackAnimationTargetClass>) @extends AnimationTarget;

    match fn {
        type_ => || ffi::he_callback_animation_target_get_type(),
    }
}

impl CallbackAnimationTarget {
    #[doc(alias = "he_callback_animation_target_new")]
    pub fn new<P: Fn(f64) + 'static>(callback: P) -> CallbackAnimationTarget {
        assert_initialized_main_thread!();
        let callback_data: Box_<P> = Box_::new(callback);
        unsafe extern "C" fn callback_func<P: Fn(f64) + 'static>(
            value: libc::c_double,
            user_data: glib::ffi::gpointer,
        ) {
            let callback = &*(user_data as *mut P);
            (*callback)(value)
        }
        let callback = Some(callback_func::<P> as _);
        unsafe extern "C" fn callback_target_destroy_notify_func<P: Fn(f64) + 'static>(
            data: glib::ffi::gpointer,
        ) {
            let _callback = Box_::from_raw(data as *mut P);
        }
        let destroy_call2 = Some(callback_target_destroy_notify_func::<P> as _);
        let super_callback0: Box_<P> = callback_data;
        unsafe {
            from_glib_full(ffi::he_callback_animation_target_new(
                callback,
                Box_::into_raw(super_callback0) as *mut _,
                destroy_call2,
            ))
        }
    }
}