1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// 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, Color, Document, Rectangle};
use glib::{prelude::*, translate::*};
use std::fmt;

glib::wrapper! {
    ///
    ///
    /// # Implements
    ///
    /// [`AnnotMarkupExt`][trait@crate::prelude::AnnotMarkupExt], [`AnnotExt`][trait@crate::prelude::AnnotExt]
    #[doc(alias = "PopplerAnnotCircle")]
    pub struct AnnotCircle(Object<ffi::PopplerAnnotCircle>) @extends AnnotMarkup, Annot;

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

impl AnnotCircle {
    /// Creates a new Circle annotation that will be
    /// located on `rect` when added to a page. See
    /// [`Page::add_annot()`][crate::Page::add_annot()]
    /// ## `doc`
    /// a [`Document`][crate::Document]
    /// ## `rect`
    /// a [`Rectangle`][crate::Rectangle]
    ///
    /// # Returns
    ///
    /// a newly created [`AnnotCircle`][crate::AnnotCircle] annotation
    #[doc(alias = "poppler_annot_circle_new")]
    pub fn new(doc: &Document, rect: &mut Rectangle) -> AnnotCircle {
        unsafe {
            Annot::from_glib_full(ffi::poppler_annot_circle_new(
                doc.to_glib_none().0,
                rect.to_glib_none_mut().0,
            ))
            .unsafe_cast()
        }
    }

    /// Retrieves the interior color of `self`.
    ///
    /// # Returns
    ///
    /// a new allocated [`Color`][crate::Color] with the color values of
    ///  `self`, or [`None`]. It must be freed with `g_free()` when done.
    #[doc(alias = "poppler_annot_circle_get_interior_color")]
    #[doc(alias = "get_interior_color")]
    pub fn interior_color(&self) -> Option<Color> {
        unsafe {
            from_glib_full(ffi::poppler_annot_circle_get_interior_color(
                self.to_glib_none().0,
            ))
        }
    }

    /// Sets the interior color of `self`.
    /// ## `poppler_color`
    /// a [`Color`][crate::Color], or [`None`]
    #[doc(alias = "poppler_annot_circle_set_interior_color")]
    pub fn set_interior_color(&self, poppler_color: Option<&Color>) {
        unsafe {
            ffi::poppler_annot_circle_set_interior_color(
                self.to_glib_none().0,
                mut_override(poppler_color.to_glib_none().0),
            );
        }
    }
}

impl fmt::Display for AnnotCircle {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        f.write_str("AnnotCircle")
    }
}