#![macro_use]
macro_rules! impl_GObjectFunctions(
($gtk_struct:ident, $ffi_type:ident) => (
impl $gtk_struct {
pub fn get_pointer(&self) -> *mut ffi::$ffi_type {
self.pointer
}
pub fn wrap_pointer(pointer: *mut ffi::$ffi_type) -> $gtk_struct {
$gtk_struct {
pointer: pointer
}
}
}
)
);
macro_rules! impl_drop(
($gtk_struct:ident) => ( impl_drop!($gtk_struct, GTK_WIDGET); );
($gtk_struct:ident, $cast_func:ident) => (
impl Drop for $gtk_struct {
fn drop(&mut self) {
unsafe {
::glib::ffi::g_object_unref(self.pointer as *mut ::glib::ffi::C_GObject);
}
}
}
impl Clone for $gtk_struct {
fn clone(&self) -> $gtk_struct {
let pointer = unsafe {
::glib::ffi::g_object_ref(self.pointer as *mut ::glib::ffi::C_GObject)
};
$gtk_struct {
pointer: ::gtk::cast::$cast_func(pointer)
}
}
}
);
);