objc2_ui_kit/generated/
UIGraphicsPDFRenderer.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uigraphicspdfdrawingactions?language=objc)
13#[cfg(all(feature = "UIGraphicsRenderer", feature = "block2"))]
14pub type UIGraphicsPDFDrawingActions =
15    *mut block2::DynBlock<dyn Fn(NonNull<UIGraphicsPDFRendererContext>)>;
16
17extern_class!(
18    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uigraphicspdfrendererformat?language=objc)
19    #[unsafe(super(UIGraphicsRendererFormat, NSObject))]
20    #[derive(Debug, PartialEq, Eq, Hash)]
21    #[cfg(feature = "UIGraphicsRenderer")]
22    pub struct UIGraphicsPDFRendererFormat;
23);
24
25#[cfg(feature = "UIGraphicsRenderer")]
26extern_conformance!(
27    unsafe impl NSCopying for UIGraphicsPDFRendererFormat {}
28);
29
30#[cfg(feature = "UIGraphicsRenderer")]
31unsafe impl CopyingHelper for UIGraphicsPDFRendererFormat {
32    type Result = Self;
33}
34
35#[cfg(feature = "UIGraphicsRenderer")]
36extern_conformance!(
37    unsafe impl NSObjectProtocol for UIGraphicsPDFRendererFormat {}
38);
39
40#[cfg(feature = "UIGraphicsRenderer")]
41impl UIGraphicsPDFRendererFormat {
42    extern_methods!(
43        #[unsafe(method(documentInfo))]
44        #[unsafe(method_family = none)]
45        pub fn documentInfo(&self) -> Retained<NSDictionary<NSString, AnyObject>>;
46
47        /// Setter for [`documentInfo`][Self::documentInfo].
48        ///
49        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
50        ///
51        /// # Safety
52        ///
53        /// `document_info` generic should be of the correct type.
54        #[unsafe(method(setDocumentInfo:))]
55        #[unsafe(method_family = none)]
56        pub unsafe fn setDocumentInfo(&self, document_info: &NSDictionary<NSString, AnyObject>);
57    );
58}
59
60/// Methods declared on superclass `UIGraphicsRendererFormat`.
61#[cfg(feature = "UIGraphicsRenderer")]
62impl UIGraphicsPDFRendererFormat {
63    extern_methods!(
64        #[deprecated]
65        #[unsafe(method(defaultFormat))]
66        #[unsafe(method_family = none)]
67        pub fn defaultFormat() -> Retained<Self>;
68
69        #[unsafe(method(preferredFormat))]
70        #[unsafe(method_family = none)]
71        pub fn preferredFormat() -> Retained<Self>;
72    );
73}
74
75/// Methods declared on superclass `NSObject`.
76#[cfg(feature = "UIGraphicsRenderer")]
77impl UIGraphicsPDFRendererFormat {
78    extern_methods!(
79        #[unsafe(method(init))]
80        #[unsafe(method_family = init)]
81        pub fn init(this: Allocated<Self>) -> Retained<Self>;
82
83        #[unsafe(method(new))]
84        #[unsafe(method_family = new)]
85        pub fn new() -> Retained<Self>;
86    );
87}
88
89#[cfg(feature = "UIGraphicsRenderer")]
90impl DefaultRetained for UIGraphicsPDFRendererFormat {
91    #[inline]
92    fn default_retained() -> Retained<Self> {
93        Self::new()
94    }
95}
96
97extern_class!(
98    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uigraphicspdfrenderercontext?language=objc)
99    #[unsafe(super(UIGraphicsRendererContext, NSObject))]
100    #[derive(Debug, PartialEq, Eq, Hash)]
101    #[cfg(feature = "UIGraphicsRenderer")]
102    pub struct UIGraphicsPDFRendererContext;
103);
104
105#[cfg(feature = "UIGraphicsRenderer")]
106extern_conformance!(
107    unsafe impl NSObjectProtocol for UIGraphicsPDFRendererContext {}
108);
109
110#[cfg(feature = "UIGraphicsRenderer")]
111impl UIGraphicsPDFRendererContext {
112    extern_methods!(
113        #[cfg(feature = "objc2-core-foundation")]
114        #[unsafe(method(pdfContextBounds))]
115        #[unsafe(method_family = none)]
116        pub fn pdfContextBounds(&self) -> CGRect;
117
118        #[unsafe(method(beginPage))]
119        #[unsafe(method_family = none)]
120        pub fn beginPage(&self);
121
122        #[cfg(feature = "objc2-core-foundation")]
123        /// # Safety
124        ///
125        /// `page_info` generic should be of the correct type.
126        #[unsafe(method(beginPageWithBounds:pageInfo:))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn beginPageWithBounds_pageInfo(
129            &self,
130            bounds: CGRect,
131            page_info: &NSDictionary<NSString, AnyObject>,
132        );
133
134        #[cfg(feature = "objc2-core-foundation")]
135        #[unsafe(method(setURL:forRect:))]
136        #[unsafe(method_family = none)]
137        pub fn setURL_forRect(&self, url: &NSURL, rect: CGRect);
138
139        #[cfg(feature = "objc2-core-foundation")]
140        #[unsafe(method(addDestinationWithName:atPoint:))]
141        #[unsafe(method_family = none)]
142        pub fn addDestinationWithName_atPoint(&self, name: &NSString, point: CGPoint);
143
144        #[cfg(feature = "objc2-core-foundation")]
145        #[unsafe(method(setDestinationWithName:forRect:))]
146        #[unsafe(method_family = none)]
147        pub fn setDestinationWithName_forRect(&self, name: &NSString, rect: CGRect);
148    );
149}
150
151/// Methods declared on superclass `NSObject`.
152#[cfg(feature = "UIGraphicsRenderer")]
153impl UIGraphicsPDFRendererContext {
154    extern_methods!(
155        #[unsafe(method(init))]
156        #[unsafe(method_family = init)]
157        pub fn init(this: Allocated<Self>) -> Retained<Self>;
158
159        #[unsafe(method(new))]
160        #[unsafe(method_family = new)]
161        pub fn new() -> Retained<Self>;
162    );
163}
164
165#[cfg(feature = "UIGraphicsRenderer")]
166impl DefaultRetained for UIGraphicsPDFRendererContext {
167    #[inline]
168    fn default_retained() -> Retained<Self> {
169        Self::new()
170    }
171}
172
173extern_class!(
174    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uigraphicspdfrenderer?language=objc)
175    #[unsafe(super(UIGraphicsRenderer, NSObject))]
176    #[derive(Debug, PartialEq, Eq, Hash)]
177    #[cfg(feature = "UIGraphicsRenderer")]
178    pub struct UIGraphicsPDFRenderer;
179);
180
181#[cfg(feature = "UIGraphicsRenderer")]
182extern_conformance!(
183    unsafe impl NSObjectProtocol for UIGraphicsPDFRenderer {}
184);
185
186#[cfg(feature = "UIGraphicsRenderer")]
187impl UIGraphicsPDFRenderer {
188    extern_methods!(
189        #[cfg(feature = "objc2-core-foundation")]
190        #[unsafe(method(initWithBounds:format:))]
191        #[unsafe(method_family = init)]
192        pub fn initWithBounds_format(
193            this: Allocated<Self>,
194            bounds: CGRect,
195            format: &UIGraphicsPDFRendererFormat,
196        ) -> Retained<Self>;
197
198        #[cfg(feature = "block2")]
199        /// # Safety
200        ///
201        /// `actions` must be a valid pointer.
202        #[unsafe(method(writePDFToURL:withActions:error:_))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn writePDFToURL_withActions_error(
205            &self,
206            url: &NSURL,
207            actions: UIGraphicsPDFDrawingActions,
208        ) -> Result<(), Retained<NSError>>;
209
210        #[cfg(feature = "block2")]
211        /// # Safety
212        ///
213        /// `actions` must be a valid pointer.
214        #[unsafe(method(PDFDataWithActions:))]
215        #[unsafe(method_family = none)]
216        pub unsafe fn PDFDataWithActions(
217            &self,
218            actions: UIGraphicsPDFDrawingActions,
219        ) -> Retained<NSData>;
220    );
221}
222
223/// Methods declared on superclass `UIGraphicsRenderer`.
224#[cfg(feature = "UIGraphicsRenderer")]
225impl UIGraphicsPDFRenderer {
226    extern_methods!(
227        #[cfg(feature = "objc2-core-foundation")]
228        #[unsafe(method(initWithBounds:))]
229        #[unsafe(method_family = init)]
230        pub fn initWithBounds(this: Allocated<Self>, bounds: CGRect) -> Retained<Self>;
231    );
232}
233
234/// Methods declared on superclass `NSObject`.
235#[cfg(feature = "UIGraphicsRenderer")]
236impl UIGraphicsPDFRenderer {
237    extern_methods!(
238        #[unsafe(method(init))]
239        #[unsafe(method_family = init)]
240        pub fn init(this: Allocated<Self>) -> Retained<Self>;
241
242        #[unsafe(method(new))]
243        #[unsafe(method_family = new)]
244        pub fn new() -> Retained<Self>;
245    );
246}
247
248#[cfg(feature = "UIGraphicsRenderer")]
249impl DefaultRetained for UIGraphicsPDFRenderer {
250    #[inline]
251    fn default_retained() -> Retained<Self> {
252        Self::new()
253    }
254}