Skip to main content

poppler/auto/
annot.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from
3// from gir-files (https://github.com/gtk-rs/gir-files)
4// DO NOT EDIT
5
6use crate::{AnnotFlag, AnnotType, Color, Rectangle, ffi};
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10    #[doc(alias = "PopplerAnnot")]
11    pub struct Annot(Object<ffi::PopplerAnnot>);
12
13    match fn {
14        type_ => || ffi::poppler_annot_get_type(),
15    }
16}
17
18impl Annot {
19    pub const NONE: Option<&'static Annot> = None;
20}
21
22pub trait AnnotExt: IsA<Annot> + 'static {
23    #[doc(alias = "poppler_annot_get_annot_type")]
24    #[doc(alias = "get_annot_type")]
25    fn annot_type(&self) -> AnnotType {
26        unsafe {
27            from_glib(ffi::poppler_annot_get_annot_type(
28                self.as_ref().to_glib_none().0,
29            ))
30        }
31    }
32
33    #[doc(alias = "poppler_annot_get_color")]
34    #[doc(alias = "get_color")]
35    fn color(&self) -> Option<Color> {
36        unsafe { from_glib_full(ffi::poppler_annot_get_color(self.as_ref().to_glib_none().0)) }
37    }
38
39    #[doc(alias = "poppler_annot_get_contents")]
40    #[doc(alias = "get_contents")]
41    fn contents(&self) -> Option<glib::GString> {
42        unsafe {
43            from_glib_full(ffi::poppler_annot_get_contents(
44                self.as_ref().to_glib_none().0,
45            ))
46        }
47    }
48
49    #[doc(alias = "poppler_annot_get_flags")]
50    #[doc(alias = "get_flags")]
51    fn flags(&self) -> AnnotFlag {
52        unsafe { from_glib(ffi::poppler_annot_get_flags(self.as_ref().to_glib_none().0)) }
53    }
54
55    #[doc(alias = "poppler_annot_get_modified")]
56    #[doc(alias = "get_modified")]
57    fn modified(&self) -> Option<glib::GString> {
58        unsafe {
59            from_glib_full(ffi::poppler_annot_get_modified(
60                self.as_ref().to_glib_none().0,
61            ))
62        }
63    }
64
65    #[doc(alias = "poppler_annot_get_name")]
66    #[doc(alias = "get_name")]
67    fn name(&self) -> Option<glib::GString> {
68        unsafe { from_glib_full(ffi::poppler_annot_get_name(self.as_ref().to_glib_none().0)) }
69    }
70
71    #[doc(alias = "poppler_annot_get_page_index")]
72    #[doc(alias = "get_page_index")]
73    fn page_index(&self) -> i32 {
74        unsafe { ffi::poppler_annot_get_page_index(self.as_ref().to_glib_none().0) }
75    }
76
77    #[doc(alias = "poppler_annot_get_rectangle")]
78    #[doc(alias = "get_rectangle")]
79    fn rectangle(&self) -> Rectangle {
80        unsafe {
81            let mut poppler_rect = Rectangle::uninitialized();
82            ffi::poppler_annot_get_rectangle(
83                self.as_ref().to_glib_none().0,
84                poppler_rect.to_glib_none_mut().0,
85            );
86            poppler_rect
87        }
88    }
89
90    #[cfg(feature = "v24_12")]
91    #[cfg_attr(docsrs, doc(cfg(feature = "v24_12")))]
92    #[doc(alias = "poppler_annot_set_border_width")]
93    fn set_border_width(&self, width: f64) {
94        unsafe {
95            ffi::poppler_annot_set_border_width(self.as_ref().to_glib_none().0, width);
96        }
97    }
98
99    #[doc(alias = "poppler_annot_set_color")]
100    fn set_color(&self, poppler_color: Option<&Color>) {
101        unsafe {
102            ffi::poppler_annot_set_color(
103                self.as_ref().to_glib_none().0,
104                mut_override(poppler_color.to_glib_none().0),
105            );
106        }
107    }
108
109    #[doc(alias = "poppler_annot_set_contents")]
110    fn set_contents(&self, contents: &str) {
111        unsafe {
112            ffi::poppler_annot_set_contents(
113                self.as_ref().to_glib_none().0,
114                contents.to_glib_none().0,
115            );
116        }
117    }
118
119    #[doc(alias = "poppler_annot_set_flags")]
120    fn set_flags(&self, flags: AnnotFlag) {
121        unsafe {
122            ffi::poppler_annot_set_flags(self.as_ref().to_glib_none().0, flags.into_glib());
123        }
124    }
125
126    #[doc(alias = "poppler_annot_set_rectangle")]
127    fn set_rectangle(&self, poppler_rect: &mut Rectangle) {
128        unsafe {
129            ffi::poppler_annot_set_rectangle(
130                self.as_ref().to_glib_none().0,
131                poppler_rect.to_glib_none_mut().0,
132            );
133        }
134    }
135}
136
137impl<O: IsA<Annot>> AnnotExt for O {}