objc2_ui_kit/generated/
UIGraphicsPDFRenderer.rs1use 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#[cfg(all(feature = "UIGraphicsRenderer", feature = "block2"))]
14pub type UIGraphicsPDFDrawingActions =
15 *mut block2::Block<dyn Fn(NonNull<UIGraphicsPDFRendererContext>)>;
16
17extern_class!(
18 #[unsafe(super(UIGraphicsRendererFormat, NSObject))]
20 #[derive(Debug, PartialEq, Eq, Hash)]
21 #[cfg(feature = "UIGraphicsRenderer")]
22 pub struct UIGraphicsPDFRendererFormat;
23);
24
25#[cfg(feature = "UIGraphicsRenderer")]
26unsafe impl NSCopying for UIGraphicsPDFRendererFormat {}
27
28#[cfg(feature = "UIGraphicsRenderer")]
29unsafe impl CopyingHelper for UIGraphicsPDFRendererFormat {
30 type Result = Self;
31}
32
33#[cfg(feature = "UIGraphicsRenderer")]
34unsafe impl NSObjectProtocol for UIGraphicsPDFRendererFormat {}
35
36#[cfg(feature = "UIGraphicsRenderer")]
37impl UIGraphicsPDFRendererFormat {
38 extern_methods!(
39 #[unsafe(method(documentInfo))]
40 #[unsafe(method_family = none)]
41 pub unsafe fn documentInfo(&self) -> Retained<NSDictionary<NSString, AnyObject>>;
42
43 #[unsafe(method(setDocumentInfo:))]
45 #[unsafe(method_family = none)]
46 pub unsafe fn setDocumentInfo(&self, document_info: &NSDictionary<NSString, AnyObject>);
47 );
48}
49
50#[cfg(feature = "UIGraphicsRenderer")]
52impl UIGraphicsPDFRendererFormat {
53 extern_methods!(
54 #[deprecated]
55 #[unsafe(method(defaultFormat))]
56 #[unsafe(method_family = none)]
57 pub unsafe fn defaultFormat() -> Retained<Self>;
58
59 #[unsafe(method(preferredFormat))]
60 #[unsafe(method_family = none)]
61 pub unsafe fn preferredFormat() -> Retained<Self>;
62 );
63}
64
65#[cfg(feature = "UIGraphicsRenderer")]
67impl UIGraphicsPDFRendererFormat {
68 extern_methods!(
69 #[unsafe(method(init))]
70 #[unsafe(method_family = init)]
71 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
72
73 #[unsafe(method(new))]
74 #[unsafe(method_family = new)]
75 pub unsafe fn new() -> Retained<Self>;
76 );
77}
78
79extern_class!(
80 #[unsafe(super(UIGraphicsRendererContext, NSObject))]
82 #[derive(Debug, PartialEq, Eq, Hash)]
83 #[cfg(feature = "UIGraphicsRenderer")]
84 pub struct UIGraphicsPDFRendererContext;
85);
86
87#[cfg(feature = "UIGraphicsRenderer")]
88unsafe impl NSObjectProtocol for UIGraphicsPDFRendererContext {}
89
90#[cfg(feature = "UIGraphicsRenderer")]
91impl UIGraphicsPDFRendererContext {
92 extern_methods!(
93 #[cfg(feature = "objc2-core-foundation")]
94 #[unsafe(method(pdfContextBounds))]
95 #[unsafe(method_family = none)]
96 pub unsafe fn pdfContextBounds(&self) -> CGRect;
97
98 #[unsafe(method(beginPage))]
99 #[unsafe(method_family = none)]
100 pub unsafe fn beginPage(&self);
101
102 #[cfg(feature = "objc2-core-foundation")]
103 #[unsafe(method(beginPageWithBounds:pageInfo:))]
104 #[unsafe(method_family = none)]
105 pub unsafe fn beginPageWithBounds_pageInfo(
106 &self,
107 bounds: CGRect,
108 page_info: &NSDictionary<NSString, AnyObject>,
109 );
110
111 #[cfg(feature = "objc2-core-foundation")]
112 #[unsafe(method(setURL:forRect:))]
113 #[unsafe(method_family = none)]
114 pub unsafe fn setURL_forRect(&self, url: &NSURL, rect: CGRect);
115
116 #[cfg(feature = "objc2-core-foundation")]
117 #[unsafe(method(addDestinationWithName:atPoint:))]
118 #[unsafe(method_family = none)]
119 pub unsafe fn addDestinationWithName_atPoint(&self, name: &NSString, point: CGPoint);
120
121 #[cfg(feature = "objc2-core-foundation")]
122 #[unsafe(method(setDestinationWithName:forRect:))]
123 #[unsafe(method_family = none)]
124 pub unsafe fn setDestinationWithName_forRect(&self, name: &NSString, rect: CGRect);
125 );
126}
127
128#[cfg(feature = "UIGraphicsRenderer")]
130impl UIGraphicsPDFRendererContext {
131 extern_methods!(
132 #[unsafe(method(init))]
133 #[unsafe(method_family = init)]
134 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
135
136 #[unsafe(method(new))]
137 #[unsafe(method_family = new)]
138 pub unsafe fn new() -> Retained<Self>;
139 );
140}
141
142extern_class!(
143 #[unsafe(super(UIGraphicsRenderer, NSObject))]
145 #[derive(Debug, PartialEq, Eq, Hash)]
146 #[cfg(feature = "UIGraphicsRenderer")]
147 pub struct UIGraphicsPDFRenderer;
148);
149
150#[cfg(feature = "UIGraphicsRenderer")]
151unsafe impl NSObjectProtocol for UIGraphicsPDFRenderer {}
152
153#[cfg(feature = "UIGraphicsRenderer")]
154impl UIGraphicsPDFRenderer {
155 extern_methods!(
156 #[cfg(feature = "objc2-core-foundation")]
157 #[unsafe(method(initWithBounds:format:))]
158 #[unsafe(method_family = init)]
159 pub unsafe fn initWithBounds_format(
160 this: Allocated<Self>,
161 bounds: CGRect,
162 format: &UIGraphicsPDFRendererFormat,
163 ) -> Retained<Self>;
164
165 #[cfg(feature = "block2")]
166 #[unsafe(method(writePDFToURL:withActions:error:_))]
167 #[unsafe(method_family = none)]
168 pub unsafe fn writePDFToURL_withActions_error(
169 &self,
170 url: &NSURL,
171 actions: UIGraphicsPDFDrawingActions,
172 ) -> Result<(), Retained<NSError>>;
173
174 #[cfg(feature = "block2")]
175 #[unsafe(method(PDFDataWithActions:))]
176 #[unsafe(method_family = none)]
177 pub unsafe fn PDFDataWithActions(
178 &self,
179 actions: UIGraphicsPDFDrawingActions,
180 ) -> Retained<NSData>;
181 );
182}
183
184#[cfg(feature = "UIGraphicsRenderer")]
186impl UIGraphicsPDFRenderer {
187 extern_methods!(
188 #[cfg(feature = "objc2-core-foundation")]
189 #[unsafe(method(initWithBounds:))]
190 #[unsafe(method_family = init)]
191 pub unsafe fn initWithBounds(this: Allocated<Self>, bounds: CGRect) -> Retained<Self>;
192 );
193}
194
195#[cfg(feature = "UIGraphicsRenderer")]
197impl UIGraphicsPDFRenderer {
198 extern_methods!(
199 #[unsafe(method(init))]
200 #[unsafe(method_family = init)]
201 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
202
203 #[unsafe(method(new))]
204 #[unsafe(method_family = new)]
205 pub unsafe fn new() -> Retained<Self>;
206 );
207}