// This file was generated by gir (https://github.com/gtk-rs/gir)
// from ../gir-files
// from ../pps-girs
// DO NOT EDIT

use crate::{ffi, Mapping, Point};
use glib::translate::*;

glib::wrapper! {
    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
    pub struct MappingList(Shared<ffi::PpsMappingList>);

    match fn {
        ref => |ptr| ffi::pps_mapping_list_ref(ptr),
        unref => |ptr| ffi::pps_mapping_list_unref(ptr),
        type_ => || ffi::pps_mapping_list_get_type(),
    }
}

impl MappingList {
    //#[doc(alias = "pps_mapping_list_new")]
    //pub fn new(page: u32, list: &[Mapping]) -> MappingList {
    //    unsafe { TODO: call ffi:pps_mapping_list_new() }
    //}

    //#[doc(alias = "pps_mapping_list_find")]
    //pub fn find(&self, data: /*Unimplemented*/Option<Basic: Pointer>) -> Option<Mapping> {
    //    unsafe { TODO: call ffi:pps_mapping_list_find() }
    //}

    #[doc(alias = "pps_mapping_list_get")]
    pub fn get(&self, point: &Point) -> Option<Mapping> {
        unsafe {
            from_glib_none(ffi::pps_mapping_list_get(
                self.to_glib_none().0,
                point.to_glib_none().0,
            ))
        }
    }

    //#[doc(alias = "pps_mapping_list_get_data")]
    //#[doc(alias = "get_data")]
    //pub fn data(&self, point: &Point) -> /*Unimplemented*/Option<Basic: Pointer> {
    //    unsafe { TODO: call ffi:pps_mapping_list_get_data() }
    //}

    #[doc(alias = "pps_mapping_list_get_list")]
    #[doc(alias = "get_list")]
    pub fn list(&self) -> Vec<Mapping> {
        unsafe {
            FromGlibPtrContainer::from_glib_none(ffi::pps_mapping_list_get_list(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "pps_mapping_list_get_page")]
    #[doc(alias = "get_page")]
    pub fn page(&self) -> u32 {
        unsafe { ffi::pps_mapping_list_get_page(self.to_glib_none().0) }
    }

    #[doc(alias = "pps_mapping_list_length")]
    pub fn length(&self) -> u32 {
        unsafe { ffi::pps_mapping_list_length(self.to_glib_none().0) }
    }

    #[doc(alias = "pps_mapping_list_nth")]
    pub fn nth(&self, n: u32) -> Option<Mapping> {
        unsafe { from_glib_none(ffi::pps_mapping_list_nth(self.to_glib_none().0, n)) }
    }

    #[doc(alias = "pps_mapping_list_remove")]
    pub fn remove(&self, mapping: &mut Mapping) {
        unsafe {
            ffi::pps_mapping_list_remove(self.to_glib_none().0, mapping.to_glib_none_mut().0);
        }
    }
}
