// 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, AnnotCalloutLine, AnnotFreeTextQuadding, AnnotMarkup, Document, Rectangle, ffi,
};
#[cfg(feature = "v24_12")]
#[cfg_attr(docsrs, doc(cfg(feature = "v24_12")))]
use crate::{Color, FontDescription};
use glib::{prelude::*, translate::*};

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

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

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

    #[doc(alias = "poppler_annot_free_text_get_callout_line")]
    #[doc(alias = "get_callout_line")]
    pub fn callout_line(&self) -> Option<AnnotCalloutLine> {
        unsafe {
            from_glib_full(ffi::poppler_annot_free_text_get_callout_line(
                self.to_glib_none().0,
            ))
        }
    }

    #[cfg(feature = "v24_12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v24_12")))]
    #[doc(alias = "poppler_annot_free_text_get_font_color")]
    #[doc(alias = "get_font_color")]
    pub fn font_color(&self) -> Option<Color> {
        unsafe {
            from_glib_full(ffi::poppler_annot_free_text_get_font_color(
                self.to_glib_none().0,
            ))
        }
    }

    #[cfg(feature = "v24_12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v24_12")))]
    #[doc(alias = "poppler_annot_free_text_get_font_desc")]
    #[doc(alias = "get_font_desc")]
    pub fn font_desc(&self) -> Option<FontDescription> {
        unsafe {
            from_glib_full(ffi::poppler_annot_free_text_get_font_desc(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "poppler_annot_free_text_get_quadding")]
    #[doc(alias = "get_quadding")]
    pub fn quadding(&self) -> AnnotFreeTextQuadding {
        unsafe {
            from_glib(ffi::poppler_annot_free_text_get_quadding(
                self.to_glib_none().0,
            ))
        }
    }

    #[cfg(feature = "v24_12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v24_12")))]
    #[doc(alias = "poppler_annot_free_text_set_font_color")]
    pub fn set_font_color(&self, color: &mut Color) {
        unsafe {
            ffi::poppler_annot_free_text_set_font_color(
                self.to_glib_none().0,
                color.to_glib_none_mut().0,
            );
        }
    }

    #[cfg(feature = "v24_12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v24_12")))]
    #[doc(alias = "poppler_annot_free_text_set_font_desc")]
    pub fn set_font_desc(&self, font_desc: &mut FontDescription) {
        unsafe {
            ffi::poppler_annot_free_text_set_font_desc(
                self.to_glib_none().0,
                font_desc.to_glib_none_mut().0,
            );
        }
    }
}
