[go: up one dir, main page]

gtk 0.1.0

Rust bindings for the GTK+ 3 library
// This file was generated by gir (4d68d19) from gir-files (11e0e6d)
// DO NOT EDIT

use TextBuffer;
use ffi;
use gdk;
use gdk_pixbuf;
use glib::translate::*;

glib_wrapper! {
    pub struct SelectionData(Boxed<ffi::GtkSelectionData>);

    match fn {
        copy => |ptr| ffi::gtk_selection_data_copy(mut_override(ptr)),
        free => |ptr| ffi::gtk_selection_data_free(ptr),
    }
}

impl SelectionData {

    //pub fn get_data(&self) -> /*Unimplemented*/Option<CArray TypeId { ns_id: 0, id: 3 }> {
    //    unsafe { TODO: call ffi::gtk_selection_data_get_data() }
    //}

    //pub fn get_data_type(&self) -> /*Ignored*/Option<gdk::Atom> {
    //    unsafe { TODO: call ffi::gtk_selection_data_get_data_type() }
    //}

    //pub fn get_data_with_length(&self) -> (/*Unimplemented*/CArray TypeId { ns_id: 0, id: 3 }, i32) {
    //    unsafe { TODO: call ffi::gtk_selection_data_get_data_with_length() }
    //}

    pub fn get_display(&self) -> Option<gdk::Display> {
        unsafe {
            from_glib_none(ffi::gtk_selection_data_get_display(self.to_glib_none().0))
        }
    }

    pub fn get_format(&self) -> i32 {
        unsafe {
            ffi::gtk_selection_data_get_format(self.to_glib_none().0)
        }
    }

    pub fn get_length(&self) -> i32 {
        unsafe {
            ffi::gtk_selection_data_get_length(self.to_glib_none().0)
        }
    }

    pub fn get_pixbuf(&self) -> Option<gdk_pixbuf::Pixbuf> {
        unsafe {
            from_glib_full(ffi::gtk_selection_data_get_pixbuf(self.to_glib_none().0))
        }
    }

    //pub fn get_selection(&self) -> /*Ignored*/Option<gdk::Atom> {
    //    unsafe { TODO: call ffi::gtk_selection_data_get_selection() }
    //}

    //pub fn get_target(&self) -> /*Ignored*/Option<gdk::Atom> {
    //    unsafe { TODO: call ffi::gtk_selection_data_get_target() }
    //}

    //pub fn get_targets(&self, targets: /*Unimplemented*/Vec<gdk::Atom>) -> Option<i32> {
    //    unsafe { TODO: call ffi::gtk_selection_data_get_targets() }
    //}

    pub fn get_text(&self) -> Option<String> {
        unsafe {
            from_glib_full(ffi::gtk_selection_data_get_text(self.to_glib_none().0))
        }
    }

    pub fn get_uris(&self) -> Vec<String> {
        unsafe {
            FromGlibPtrContainer::from_glib_full(ffi::gtk_selection_data_get_uris(self.to_glib_none().0))
        }
    }

    //pub fn set(&mut self, type_: /*Ignored*/&gdk::Atom, format: i32, data: /*Unimplemented*/&CArray TypeId { ns_id: 0, id: 3 }, length: i32) {
    //    unsafe { TODO: call ffi::gtk_selection_data_set() }
    //}

    pub fn set_pixbuf(&mut self, pixbuf: &gdk_pixbuf::Pixbuf) -> bool {
        unsafe {
            from_glib(ffi::gtk_selection_data_set_pixbuf(self.to_glib_none_mut().0, pixbuf.to_glib_none().0))
        }
    }

    pub fn set_text(&mut self, str: &str, len: i32) -> bool {
        unsafe {
            from_glib(ffi::gtk_selection_data_set_text(self.to_glib_none_mut().0, str.to_glib_none().0, len))
        }
    }

    pub fn set_uris(&mut self, uris: &[&str]) -> bool {
        unsafe {
            from_glib(ffi::gtk_selection_data_set_uris(self.to_glib_none_mut().0, uris.to_glib_none().0))
        }
    }

    pub fn targets_include_image(&self, writable: bool) -> bool {
        unsafe {
            from_glib(ffi::gtk_selection_data_targets_include_image(self.to_glib_none().0, writable.to_glib()))
        }
    }

    pub fn targets_include_rich_text(&self, buffer: &TextBuffer) -> bool {
        unsafe {
            from_glib(ffi::gtk_selection_data_targets_include_rich_text(self.to_glib_none().0, buffer.to_glib_none().0))
        }
    }

    pub fn targets_include_text(&self) -> bool {
        unsafe {
            from_glib(ffi::gtk_selection_data_targets_include_text(self.to_glib_none().0))
        }
    }

    pub fn targets_include_uri(&self) -> bool {
        unsafe {
            from_glib(ffi::gtk_selection_data_targets_include_uri(self.to_glib_none().0))
        }
    }
}