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

use crate::{ffi, Annotation, AnnotationsOverMarkup, AnnotationsSaveMask, MappingList, Page};
use glib::{prelude::*, translate::*};

glib::wrapper! {
    #[doc(alias = "PpsDocumentAnnotations")]
    pub struct DocumentAnnotations(Interface<ffi::PpsDocumentAnnotations, ffi::PpsDocumentAnnotationsInterface>);

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

impl DocumentAnnotations {
    pub const NONE: Option<&'static DocumentAnnotations> = None;
}

mod sealed {
    pub trait Sealed {}
    impl<T: super::IsA<super::DocumentAnnotations>> Sealed for T {}
}

pub trait DocumentAnnotationsExt: IsA<DocumentAnnotations> + sealed::Sealed + 'static {
    #[doc(alias = "pps_document_annotations_add_annotation")]
    fn add_annotation(&self, annot: &impl IsA<Annotation>) {
        unsafe {
            ffi::pps_document_annotations_add_annotation(
                self.as_ref().to_glib_none().0,
                annot.as_ref().to_glib_none().0,
            );
        }
    }

    #[doc(alias = "pps_document_annotations_can_add_annotation")]
    fn can_add_annotation(&self) -> bool {
        unsafe {
            from_glib(ffi::pps_document_annotations_can_add_annotation(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "pps_document_annotations_can_remove_annotation")]
    fn can_remove_annotation(&self) -> bool {
        unsafe {
            from_glib(ffi::pps_document_annotations_can_remove_annotation(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "pps_document_annotations_document_is_modified")]
    fn document_is_modified(&self) -> bool {
        unsafe {
            from_glib(ffi::pps_document_annotations_document_is_modified(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "pps_document_annotations_get_annotations")]
    #[doc(alias = "get_annotations")]
    fn annotations(&self, page: &impl IsA<Page>) -> Vec<Annotation> {
        unsafe {
            FromGlibPtrContainer::from_glib_none(ffi::pps_document_annotations_get_annotations(
                self.as_ref().to_glib_none().0,
                page.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "pps_document_annotations_get_annotations_mapping")]
    #[doc(alias = "get_annotations_mapping")]
    fn annotations_mapping(&self, page: &impl IsA<Page>) -> Option<MappingList> {
        unsafe {
            from_glib_full(ffi::pps_document_annotations_get_annotations_mapping(
                self.as_ref().to_glib_none().0,
                page.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "pps_document_annotations_over_markup")]
    fn over_markup(&self, annot: &impl IsA<Annotation>, x: f64, y: f64) -> AnnotationsOverMarkup {
        unsafe {
            from_glib(ffi::pps_document_annotations_over_markup(
                self.as_ref().to_glib_none().0,
                annot.as_ref().to_glib_none().0,
                x,
                y,
            ))
        }
    }

    #[doc(alias = "pps_document_annotations_remove_annotation")]
    fn remove_annotation(&self, annot: &impl IsA<Annotation>) {
        unsafe {
            ffi::pps_document_annotations_remove_annotation(
                self.as_ref().to_glib_none().0,
                annot.as_ref().to_glib_none().0,
            );
        }
    }

    #[doc(alias = "pps_document_annotations_save_annotation")]
    fn save_annotation(&self, annot: &impl IsA<Annotation>, mask: AnnotationsSaveMask) {
        unsafe {
            ffi::pps_document_annotations_save_annotation(
                self.as_ref().to_glib_none().0,
                annot.as_ref().to_glib_none().0,
                mask.into_glib(),
            );
        }
    }
}

impl<O: IsA<DocumentAnnotations>> DocumentAnnotationsExt for O {}
