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

use crate::{Annot, AnnotMarkup, Document, Path, Rectangle, ffi};
use glib::{prelude::*, translate::*};

glib::wrapper! {
    #[doc(alias = "PopplerAnnotInk")]
    pub struct AnnotInk(Object<ffi::PopplerAnnotInk>) @extends AnnotMarkup, Annot;

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

impl AnnotInk {
    #[doc(alias = "poppler_annot_ink_new")]
    pub fn new(doc: &Document, rect: &Rectangle) -> AnnotInk {
        unsafe {
            Annot::from_glib_full(ffi::poppler_annot_ink_new(
                doc.to_glib_none().0,
                mut_override(rect.to_glib_none().0),
            ))
            .unsafe_cast()
        }
    }

    #[cfg(feature = "v25_10")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v25_10")))]
    #[doc(alias = "poppler_annot_ink_get_draw_below")]
    #[doc(alias = "get_draw_below")]
    pub fn draws_below(&self) -> bool {
        unsafe { from_glib(ffi::poppler_annot_ink_get_draw_below(self.to_glib_none().0)) }
    }

    #[doc(alias = "poppler_annot_ink_get_ink_list")]
    #[doc(alias = "get_ink_list")]
    pub fn ink_list(&self) -> Vec<Path> {
        unsafe {
            let mut n_paths = std::mem::MaybeUninit::uninit();
            let ret = FromGlibContainer::from_glib_full_num(
                ffi::poppler_annot_ink_get_ink_list(self.to_glib_none().0, n_paths.as_mut_ptr()),
                n_paths.assume_init() as _,
            );
            ret
        }
    }

    #[cfg(feature = "v25_10")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v25_10")))]
    #[doc(alias = "poppler_annot_ink_set_draw_below")]
    pub fn set_draw_below(&self, draw_below: bool) {
        unsafe {
            ffi::poppler_annot_ink_set_draw_below(self.to_glib_none().0, draw_below.into_glib());
        }
    }
}
