pdfium_render/pdf/document/page/field/
button.rs1use std::marker::PhantomData;
5
6use crate::bindgen::{FPDF_ANNOTATION, FPDF_FORMHANDLE};
7use crate::pdf::document::page::field::private::internal::PdfFormFieldPrivate;
8use crate::pdfium::PdfiumLibraryBindingsAccessor;
9
10#[cfg(doc)]
11use {
12 crate::pdf::document::form::PdfForm,
13 crate::pdf::document::page::annotation::PdfPageAnnotationType,
14 crate::pdf::document::page::field::{PdfFormField, PdfFormFieldType},
15};
16
17pub struct PdfFormPushButtonField<'a> {
25 form_handle: FPDF_FORMHANDLE,
26 annotation_handle: FPDF_ANNOTATION,
27 lifetime: PhantomData<&'a FPDF_ANNOTATION>,
28}
29
30impl<'a> PdfFormPushButtonField<'a> {
31 #[inline]
32 pub(crate) fn from_pdfium(
33 form_handle: FPDF_FORMHANDLE,
34 annotation_handle: FPDF_ANNOTATION,
35 ) -> Self {
36 PdfFormPushButtonField {
37 form_handle,
38 annotation_handle,
39 lifetime: PhantomData,
40 }
41 }
42}
43
44impl<'a> PdfFormFieldPrivate<'a> for PdfFormPushButtonField<'a> {
45 #[inline]
46 fn form_handle(&self) -> FPDF_FORMHANDLE {
47 self.form_handle
48 }
49
50 #[inline]
51 fn annotation_handle(&self) -> FPDF_ANNOTATION {
52 self.annotation_handle
53 }
54}
55
56impl<'a> PdfiumLibraryBindingsAccessor<'a> for PdfFormPushButtonField<'a> {}
57
58#[cfg(feature = "thread_safe")]
59unsafe impl<'a> Send for PdfFormPushButtonField<'a> {}
60
61#[cfg(feature = "thread_safe")]
62unsafe impl<'a> Sync for PdfFormPushButtonField<'a> {}