// 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, AnnotExternalDataType, AnnotMarkupReplyType, Rectangle, ffi};
use glib::{prelude::*, translate::*};

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

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

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

pub trait AnnotMarkupExt: IsA<AnnotMarkup> + 'static {
    #[doc(alias = "poppler_annot_markup_get_date")]
    #[doc(alias = "get_date")]
    fn date(&self) -> Option<glib::Date> {
        unsafe {
            from_glib_full(ffi::poppler_annot_markup_get_date(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "poppler_annot_markup_get_external_data")]
    #[doc(alias = "get_external_data")]
    fn external_data(&self) -> AnnotExternalDataType {
        unsafe {
            from_glib(ffi::poppler_annot_markup_get_external_data(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "poppler_annot_markup_get_label")]
    #[doc(alias = "get_label")]
    fn label(&self) -> Option<glib::GString> {
        unsafe {
            from_glib_full(ffi::poppler_annot_markup_get_label(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "poppler_annot_markup_get_opacity")]
    #[doc(alias = "get_opacity")]
    fn opacity(&self) -> f64 {
        unsafe { ffi::poppler_annot_markup_get_opacity(self.as_ref().to_glib_none().0) }
    }

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

    #[doc(alias = "poppler_annot_markup_get_popup_rectangle")]
    #[doc(alias = "get_popup_rectangle")]
    fn popup_rectangle(&self) -> Option<Rectangle> {
        unsafe {
            let mut poppler_rect = Rectangle::uninitialized();
            let ret = from_glib(ffi::poppler_annot_markup_get_popup_rectangle(
                self.as_ref().to_glib_none().0,
                poppler_rect.to_glib_none_mut().0,
            ));
            if ret { Some(poppler_rect) } else { None }
        }
    }

    #[doc(alias = "poppler_annot_markup_get_reply_to")]
    #[doc(alias = "get_reply_to")]
    fn reply_to(&self) -> AnnotMarkupReplyType {
        unsafe {
            from_glib(ffi::poppler_annot_markup_get_reply_to(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "poppler_annot_markup_get_subject")]
    #[doc(alias = "get_subject")]
    fn subject(&self) -> Option<glib::GString> {
        unsafe {
            from_glib_full(ffi::poppler_annot_markup_get_subject(
                self.as_ref().to_glib_none().0,
            ))
        }
    }

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

    #[doc(alias = "poppler_annot_markup_set_label")]
    fn set_label(&self, label: Option<&str>) {
        unsafe {
            ffi::poppler_annot_markup_set_label(
                self.as_ref().to_glib_none().0,
                label.to_glib_none().0,
            );
        }
    }

    #[doc(alias = "poppler_annot_markup_set_opacity")]
    fn set_opacity(&self, opacity: f64) {
        unsafe {
            ffi::poppler_annot_markup_set_opacity(self.as_ref().to_glib_none().0, opacity);
        }
    }

    #[doc(alias = "poppler_annot_markup_set_popup")]
    fn set_popup(&self, popup_rect: &mut Rectangle) {
        unsafe {
            ffi::poppler_annot_markup_set_popup(
                self.as_ref().to_glib_none().0,
                popup_rect.to_glib_none_mut().0,
            );
        }
    }

    #[doc(alias = "poppler_annot_markup_set_popup_is_open")]
    fn set_popup_is_open(&self, is_open: bool) {
        unsafe {
            ffi::poppler_annot_markup_set_popup_is_open(
                self.as_ref().to_glib_none().0,
                is_open.into_glib(),
            );
        }
    }

    #[doc(alias = "poppler_annot_markup_set_popup_rectangle")]
    fn set_popup_rectangle(&self, poppler_rect: &mut Rectangle) {
        unsafe {
            ffi::poppler_annot_markup_set_popup_rectangle(
                self.as_ref().to_glib_none().0,
                poppler_rect.to_glib_none_mut().0,
            );
        }
    }
}

impl<O: IsA<AnnotMarkup>> AnnotMarkupExt for O {}
