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

#[cfg(feature = "v48")]
#[cfg_attr(docsrs, doc(cfg(feature = "v48")))]
use crate::AnnotationTool;
use crate::ffi;
use glib::{
    prelude::*,
    signal::{SignalHandlerId, connect_raw},
    translate::*,
};
use std::boxed::Box as Box_;

glib::wrapper! {
    #[doc(alias = "PpsAnnotationModel")]
    pub struct AnnotationModel(Object<ffi::PpsAnnotationModel, ffi::PpsAnnotationModelClass>);

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

impl AnnotationModel {
    #[doc(alias = "pps_annotation_model_new")]
    pub fn new() -> AnnotationModel {
        assert_initialized_main_thread!();
        unsafe { from_glib_full(ffi::pps_annotation_model_new()) }
    }

    #[doc(alias = "pps_annotation_model_get_eraser_objects")]
    #[doc(alias = "get_eraser_objects")]
    #[doc(alias = "eraser-objects")]
    pub fn is_eraser_objects(&self) -> bool {
        unsafe {
            from_glib(ffi::pps_annotation_model_get_eraser_objects(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "pps_annotation_model_get_eraser_radius")]
    #[doc(alias = "get_eraser_radius")]
    #[doc(alias = "eraser-radius")]
    pub fn eraser_radius(&self) -> f64 {
        unsafe { ffi::pps_annotation_model_get_eraser_radius(self.to_glib_none().0) }
    }

    //#[doc(alias = "pps_annotation_model_get_font_desc")]
    //#[doc(alias = "get_font_desc")]
    //pub fn font_desc(&self) -> /*Ignored*/Option<pango::FontDescription> {
    //    unsafe { TODO: call ffi:pps_annotation_model_get_font_desc() }
    //}

    #[doc(alias = "pps_annotation_model_get_highlight_color")]
    #[doc(alias = "get_highlight_color")]
    #[doc(alias = "highlight-color")]
    pub fn highlight_color(&self) -> Option<gdk::RGBA> {
        unsafe {
            from_glib_full(ffi::pps_annotation_model_get_highlight_color(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "pps_annotation_model_get_highlight_radius")]
    #[doc(alias = "get_highlight_radius")]
    #[doc(alias = "highlight-radius")]
    pub fn highlight_radius(&self) -> f64 {
        unsafe { ffi::pps_annotation_model_get_highlight_radius(self.to_glib_none().0) }
    }

    #[doc(alias = "pps_annotation_model_get_pen_color")]
    #[doc(alias = "get_pen_color")]
    #[doc(alias = "pen-color")]
    pub fn pen_color(&self) -> Option<gdk::RGBA> {
        unsafe {
            from_glib_full(ffi::pps_annotation_model_get_pen_color(
                self.to_glib_none().0,
            ))
        }
    }

    #[doc(alias = "pps_annotation_model_get_pen_radius")]
    #[doc(alias = "get_pen_radius")]
    #[doc(alias = "pen-radius")]
    pub fn pen_radius(&self) -> f64 {
        unsafe { ffi::pps_annotation_model_get_pen_radius(self.to_glib_none().0) }
    }

    #[doc(alias = "pps_annotation_model_get_text_color")]
    #[doc(alias = "get_text_color")]
    #[doc(alias = "text-color")]
    pub fn text_color(&self) -> Option<gdk::RGBA> {
        unsafe {
            from_glib_full(ffi::pps_annotation_model_get_text_color(
                self.to_glib_none().0,
            ))
        }
    }

    #[cfg(feature = "v48")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v48")))]
    #[doc(alias = "pps_annotation_model_get_tool")]
    #[doc(alias = "get_tool")]
    pub fn tool(&self) -> AnnotationTool {
        unsafe { from_glib(ffi::pps_annotation_model_get_tool(self.to_glib_none().0)) }
    }

    #[doc(alias = "pps_annotation_model_set_eraser_radius")]
    #[doc(alias = "eraser-radius")]
    pub fn set_eraser_radius(&self, radius: f64) {
        unsafe {
            ffi::pps_annotation_model_set_eraser_radius(self.to_glib_none().0, radius);
        }
    }

    //#[doc(alias = "pps_annotation_model_set_font_desc")]
    //pub fn set_font_desc(&self, font_desc: /*Ignored*/&pango::FontDescription) {
    //    unsafe { TODO: call ffi:pps_annotation_model_set_font_desc() }
    //}

    #[doc(alias = "pps_annotation_model_set_font_size")]
    pub fn set_font_size(&self, font_size: f64) {
        unsafe {
            ffi::pps_annotation_model_set_font_size(self.to_glib_none().0, font_size);
        }
    }

    #[doc(alias = "pps_annotation_model_set_highlight_color")]
    #[doc(alias = "highlight-color")]
    pub fn set_highlight_color(&self, pen_color: &gdk::RGBA) {
        unsafe {
            ffi::pps_annotation_model_set_highlight_color(
                self.to_glib_none().0,
                pen_color.to_glib_none().0,
            );
        }
    }

    #[doc(alias = "pps_annotation_model_set_highlight_radius")]
    #[doc(alias = "highlight-radius")]
    pub fn set_highlight_radius(&self, radius: f64) {
        unsafe {
            ffi::pps_annotation_model_set_highlight_radius(self.to_glib_none().0, radius);
        }
    }

    #[doc(alias = "pps_annotation_model_set_pen_color")]
    #[doc(alias = "pen-color")]
    pub fn set_pen_color(&self, pen_color: &gdk::RGBA) {
        unsafe {
            ffi::pps_annotation_model_set_pen_color(
                self.to_glib_none().0,
                pen_color.to_glib_none().0,
            );
        }
    }

    #[doc(alias = "pps_annotation_model_set_pen_radius")]
    #[doc(alias = "pen-radius")]
    pub fn set_pen_radius(&self, radius: f64) {
        unsafe {
            ffi::pps_annotation_model_set_pen_radius(self.to_glib_none().0, radius);
        }
    }

    #[doc(alias = "pps_annotation_model_set_text_color")]
    #[doc(alias = "text-color")]
    pub fn set_text_color(&self, color: &gdk::RGBA) {
        unsafe {
            ffi::pps_annotation_model_set_text_color(self.to_glib_none().0, color.to_glib_none().0);
        }
    }

    #[cfg(feature = "v48")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v48")))]
    #[doc(alias = "pps_annotation_model_set_tool")]
    #[doc(alias = "tool")]
    pub fn set_tool(&self, tool: AnnotationTool) {
        unsafe {
            ffi::pps_annotation_model_set_tool(self.to_glib_none().0, tool.into_glib());
        }
    }

    #[doc(alias = "active-tool-str")]
    pub fn active_tool_str(&self) -> Option<glib::GString> {
        ObjectExt::property(self, "active-tool-str")
    }

    #[doc(alias = "active-tool-str")]
    pub fn set_active_tool_str(&self, active_tool_str: Option<&str>) {
        ObjectExt::set_property(self, "active-tool-str", active_tool_str)
    }

    #[doc(alias = "eraser-objects")]
    pub fn set_eraser_objects(&self, eraser_objects: bool) {
        ObjectExt::set_property(self, "eraser-objects", eraser_objects)
    }

    //#[doc(alias = "text-font")]
    //pub fn text_font(&self) -> /*Ignored*/Option<pango::FontDescription> {
    //    ObjectExt::property(self, "text-font")
    //}

    //#[doc(alias = "text-font")]
    //pub fn set_text_font(&self, text_font: /*Ignored*/Option<&pango::FontDescription>) {
    //    ObjectExt::set_property(self,"text-font", text_font)
    //}

    #[doc(alias = "text-font-size")]
    pub fn text_font_size(&self) -> f64 {
        ObjectExt::property(self, "text-font-size")
    }

    #[doc(alias = "text-font-size")]
    pub fn set_text_font_size(&self, text_font_size: f64) {
        ObjectExt::set_property(self, "text-font-size", text_font_size)
    }

    #[cfg(not(feature = "v48"))]
    #[cfg_attr(docsrs, doc(cfg(not(feature = "v48"))))]
    pub fn tool(&self) -> i32 {
        ObjectExt::property(self, "tool")
    }

    #[cfg(not(feature = "v48"))]
    #[cfg_attr(docsrs, doc(cfg(not(feature = "v48"))))]
    pub fn set_tool(&self, tool: i32) {
        ObjectExt::set_property(self, "tool", tool)
    }

    #[doc(alias = "active-tool-str")]
    pub fn connect_active_tool_str_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_active_tool_str_trampoline<
            F: Fn(&AnnotationModel) + 'static,
        >(
            this: *mut ffi::PpsAnnotationModel,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            unsafe {
                let f: &F = &*(f as *const F);
                f(&from_glib_borrow(this))
            }
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::active-tool-str".as_ptr(),
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_active_tool_str_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "eraser-objects")]
    pub fn connect_eraser_objects_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_eraser_objects_trampoline<F: Fn(&AnnotationModel) + 'static>(
            this: *mut ffi::PpsAnnotationModel,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            unsafe {
                let f: &F = &*(f as *const F);
                f(&from_glib_borrow(this))
            }
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::eraser-objects".as_ptr(),
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_eraser_objects_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "eraser-radius")]
    pub fn connect_eraser_radius_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_eraser_radius_trampoline<F: Fn(&AnnotationModel) + 'static>(
            this: *mut ffi::PpsAnnotationModel,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            unsafe {
                let f: &F = &*(f as *const F);
                f(&from_glib_borrow(this))
            }
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::eraser-radius".as_ptr(),
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_eraser_radius_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "highlight-color")]
    pub fn connect_highlight_color_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_highlight_color_trampoline<
            F: Fn(&AnnotationModel) + 'static,
        >(
            this: *mut ffi::PpsAnnotationModel,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            unsafe {
                let f: &F = &*(f as *const F);
                f(&from_glib_borrow(this))
            }
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::highlight-color".as_ptr(),
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_highlight_color_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "highlight-radius")]
    pub fn connect_highlight_radius_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_highlight_radius_trampoline<
            F: Fn(&AnnotationModel) + 'static,
        >(
            this: *mut ffi::PpsAnnotationModel,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            unsafe {
                let f: &F = &*(f as *const F);
                f(&from_glib_borrow(this))
            }
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::highlight-radius".as_ptr(),
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_highlight_radius_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "pen-color")]
    pub fn connect_pen_color_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_pen_color_trampoline<F: Fn(&AnnotationModel) + 'static>(
            this: *mut ffi::PpsAnnotationModel,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            unsafe {
                let f: &F = &*(f as *const F);
                f(&from_glib_borrow(this))
            }
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::pen-color".as_ptr(),
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_pen_color_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "pen-radius")]
    pub fn connect_pen_radius_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_pen_radius_trampoline<F: Fn(&AnnotationModel) + 'static>(
            this: *mut ffi::PpsAnnotationModel,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            unsafe {
                let f: &F = &*(f as *const F);
                f(&from_glib_borrow(this))
            }
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::pen-radius".as_ptr(),
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_pen_radius_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "text-color")]
    pub fn connect_text_color_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_text_color_trampoline<F: Fn(&AnnotationModel) + 'static>(
            this: *mut ffi::PpsAnnotationModel,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            unsafe {
                let f: &F = &*(f as *const F);
                f(&from_glib_borrow(this))
            }
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::text-color".as_ptr(),
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_text_color_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "text-font")]
    pub fn connect_text_font_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_text_font_trampoline<F: Fn(&AnnotationModel) + 'static>(
            this: *mut ffi::PpsAnnotationModel,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            unsafe {
                let f: &F = &*(f as *const F);
                f(&from_glib_borrow(this))
            }
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::text-font".as_ptr(),
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_text_font_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "text-font-size")]
    pub fn connect_text_font_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_text_font_size_trampoline<F: Fn(&AnnotationModel) + 'static>(
            this: *mut ffi::PpsAnnotationModel,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            unsafe {
                let f: &F = &*(f as *const F);
                f(&from_glib_borrow(this))
            }
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::text-font-size".as_ptr(),
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_text_font_size_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }

    #[doc(alias = "tool")]
    pub fn connect_tool_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
        unsafe extern "C" fn notify_tool_trampoline<F: Fn(&AnnotationModel) + 'static>(
            this: *mut ffi::PpsAnnotationModel,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            unsafe {
                let f: &F = &*(f as *const F);
                f(&from_glib_borrow(this))
            }
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                c"notify::tool".as_ptr(),
                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
                    notify_tool_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }
}

impl Default for AnnotationModel {
    fn default() -> Self {
        Self::new()
    }
}
