// 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, 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;
}

pub trait DocumentAnnotationsExt: IsA<DocumentAnnotations> + '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_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,
            );
        }
    }
}

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