objc2_ui_kit/generated/
UIPrintInteractionController.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(feature = "block2")]
14pub type UIPrintInteractionCompletionHandler =
15 *mut block2::DynBlock<dyn Fn(NonNull<UIPrintInteractionController>, Bool, *mut NSError)>;
16
17#[repr(transparent)]
20#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
21pub struct UIPrinterCutterBehavior(pub NSInteger);
22impl UIPrinterCutterBehavior {
23 #[doc(alias = "UIPrinterCutterBehaviorNoCut")]
24 pub const NoCut: Self = Self(0);
25 #[doc(alias = "UIPrinterCutterBehaviorPrinterDefault")]
26 pub const PrinterDefault: Self = Self(1);
27 #[doc(alias = "UIPrinterCutterBehaviorCutAfterEachPage")]
28 pub const CutAfterEachPage: Self = Self(2);
29 #[doc(alias = "UIPrinterCutterBehaviorCutAfterEachCopy")]
30 pub const CutAfterEachCopy: Self = Self(3);
31 #[doc(alias = "UIPrinterCutterBehaviorCutAfterEachJob")]
32 pub const CutAfterEachJob: Self = Self(4);
33}
34
35unsafe impl Encode for UIPrinterCutterBehavior {
36 const ENCODING: Encoding = NSInteger::ENCODING;
37}
38
39unsafe impl RefEncode for UIPrinterCutterBehavior {
40 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
41}
42
43extern_class!(
44 #[unsafe(super(NSObject))]
46 #[thread_kind = MainThreadOnly]
47 #[derive(Debug, PartialEq, Eq, Hash)]
48 pub struct UIPrintInteractionController;
49);
50
51extern_conformance!(
52 unsafe impl NSObjectProtocol for UIPrintInteractionController {}
53);
54
55impl UIPrintInteractionController {
56 extern_methods!(
57 #[unsafe(method(isPrintingAvailable))]
58 #[unsafe(method_family = none)]
59 pub unsafe fn isPrintingAvailable(mtm: MainThreadMarker) -> bool;
60
61 #[unsafe(method(printableUTIs))]
62 #[unsafe(method_family = none)]
63 pub unsafe fn printableUTIs(mtm: MainThreadMarker) -> Retained<NSSet<NSString>>;
64
65 #[unsafe(method(canPrintURL:))]
66 #[unsafe(method_family = none)]
67 pub unsafe fn canPrintURL(url: &NSURL, mtm: MainThreadMarker) -> bool;
68
69 #[unsafe(method(canPrintData:))]
70 #[unsafe(method_family = none)]
71 pub unsafe fn canPrintData(data: &NSData, mtm: MainThreadMarker) -> bool;
72
73 #[unsafe(method(sharedPrintController))]
74 #[unsafe(method_family = none)]
75 pub unsafe fn sharedPrintController(
76 mtm: MainThreadMarker,
77 ) -> Retained<UIPrintInteractionController>;
78
79 #[cfg(feature = "UIPrintInfo")]
80 #[unsafe(method(printInfo))]
81 #[unsafe(method_family = none)]
82 pub unsafe fn printInfo(&self) -> Option<Retained<UIPrintInfo>>;
83
84 #[cfg(feature = "UIPrintInfo")]
85 #[unsafe(method(setPrintInfo:))]
87 #[unsafe(method_family = none)]
88 pub unsafe fn setPrintInfo(&self, print_info: Option<&UIPrintInfo>);
89
90 #[unsafe(method(delegate))]
91 #[unsafe(method_family = none)]
92 pub unsafe fn delegate(
93 &self,
94 ) -> Option<Retained<ProtocolObject<dyn UIPrintInteractionControllerDelegate>>>;
95
96 #[unsafe(method(setDelegate:))]
99 #[unsafe(method_family = none)]
100 pub unsafe fn setDelegate(
101 &self,
102 delegate: Option<&ProtocolObject<dyn UIPrintInteractionControllerDelegate>>,
103 );
104
105 #[deprecated = "Pages can be removed from the print preview, so page range is always shown."]
106 #[unsafe(method(showsPageRange))]
107 #[unsafe(method_family = none)]
108 pub unsafe fn showsPageRange(&self) -> bool;
109
110 #[deprecated = "Pages can be removed from the print preview, so page range is always shown."]
112 #[unsafe(method(setShowsPageRange:))]
113 #[unsafe(method_family = none)]
114 pub unsafe fn setShowsPageRange(&self, shows_page_range: bool);
115
116 #[unsafe(method(showsNumberOfCopies))]
117 #[unsafe(method_family = none)]
118 pub unsafe fn showsNumberOfCopies(&self) -> bool;
119
120 #[unsafe(method(setShowsNumberOfCopies:))]
122 #[unsafe(method_family = none)]
123 pub unsafe fn setShowsNumberOfCopies(&self, shows_number_of_copies: bool);
124
125 #[unsafe(method(showsPaperSelectionForLoadedPapers))]
126 #[unsafe(method_family = none)]
127 pub unsafe fn showsPaperSelectionForLoadedPapers(&self) -> bool;
128
129 #[unsafe(method(setShowsPaperSelectionForLoadedPapers:))]
131 #[unsafe(method_family = none)]
132 pub unsafe fn setShowsPaperSelectionForLoadedPapers(
133 &self,
134 shows_paper_selection_for_loaded_papers: bool,
135 );
136
137 #[unsafe(method(showsPaperOrientation))]
138 #[unsafe(method_family = none)]
139 pub unsafe fn showsPaperOrientation(&self) -> bool;
140
141 #[unsafe(method(setShowsPaperOrientation:))]
143 #[unsafe(method_family = none)]
144 pub unsafe fn setShowsPaperOrientation(&self, shows_paper_orientation: bool);
145
146 #[cfg(feature = "UIPrintPaper")]
147 #[unsafe(method(printPaper))]
148 #[unsafe(method_family = none)]
149 pub unsafe fn printPaper(&self) -> Option<Retained<UIPrintPaper>>;
150
151 #[cfg(feature = "UIPrintPageRenderer")]
152 #[unsafe(method(printPageRenderer))]
153 #[unsafe(method_family = none)]
154 pub unsafe fn printPageRenderer(&self) -> Option<Retained<UIPrintPageRenderer>>;
155
156 #[cfg(feature = "UIPrintPageRenderer")]
157 #[unsafe(method(setPrintPageRenderer:))]
159 #[unsafe(method_family = none)]
160 pub unsafe fn setPrintPageRenderer(
161 &self,
162 print_page_renderer: Option<&UIPrintPageRenderer>,
163 );
164
165 #[cfg(feature = "UIPrintFormatter")]
166 #[unsafe(method(printFormatter))]
167 #[unsafe(method_family = none)]
168 pub unsafe fn printFormatter(&self) -> Option<Retained<UIPrintFormatter>>;
169
170 #[cfg(feature = "UIPrintFormatter")]
171 #[unsafe(method(setPrintFormatter:))]
173 #[unsafe(method_family = none)]
174 pub unsafe fn setPrintFormatter(&self, print_formatter: Option<&UIPrintFormatter>);
175
176 #[unsafe(method(printingItem))]
177 #[unsafe(method_family = none)]
178 pub unsafe fn printingItem(&self) -> Option<Retained<AnyObject>>;
179
180 #[unsafe(method(setPrintingItem:))]
182 #[unsafe(method_family = none)]
183 pub unsafe fn setPrintingItem(&self, printing_item: Option<&AnyObject>);
184
185 #[unsafe(method(printingItems))]
186 #[unsafe(method_family = none)]
187 pub unsafe fn printingItems(&self) -> Option<Retained<NSArray>>;
188
189 #[unsafe(method(setPrintingItems:))]
191 #[unsafe(method_family = none)]
192 pub unsafe fn setPrintingItems(&self, printing_items: Option<&NSArray>);
193
194 #[cfg(feature = "block2")]
195 #[unsafe(method(presentAnimated:completionHandler:))]
196 #[unsafe(method_family = none)]
197 pub unsafe fn presentAnimated_completionHandler(
198 &self,
199 animated: bool,
200 completion: UIPrintInteractionCompletionHandler,
201 ) -> bool;
202
203 #[cfg(all(
204 feature = "UIResponder",
205 feature = "UIView",
206 feature = "block2",
207 feature = "objc2-core-foundation"
208 ))]
209 #[unsafe(method(presentFromRect:inView:animated:completionHandler:))]
210 #[unsafe(method_family = none)]
211 pub unsafe fn presentFromRect_inView_animated_completionHandler(
212 &self,
213 rect: CGRect,
214 view: &UIView,
215 animated: bool,
216 completion: UIPrintInteractionCompletionHandler,
217 ) -> bool;
218
219 #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem", feature = "block2"))]
220 #[unsafe(method(presentFromBarButtonItem:animated:completionHandler:))]
221 #[unsafe(method_family = none)]
222 pub unsafe fn presentFromBarButtonItem_animated_completionHandler(
223 &self,
224 item: &UIBarButtonItem,
225 animated: bool,
226 completion: UIPrintInteractionCompletionHandler,
227 ) -> bool;
228
229 #[cfg(all(feature = "UIPrinter", feature = "block2"))]
230 #[unsafe(method(printToPrinter:completionHandler:))]
234 #[unsafe(method_family = none)]
235 pub unsafe fn printToPrinter_completionHandler(
236 &self,
237 printer: &UIPrinter,
238 completion: UIPrintInteractionCompletionHandler,
239 ) -> bool;
240
241 #[unsafe(method(dismissAnimated:))]
242 #[unsafe(method_family = none)]
243 pub unsafe fn dismissAnimated(&self, animated: bool);
244 );
245}
246
247impl UIPrintInteractionController {
249 extern_methods!(
250 #[unsafe(method(init))]
251 #[unsafe(method_family = init)]
252 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
253
254 #[unsafe(method(new))]
255 #[unsafe(method_family = new)]
256 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
257 );
258}
259
260extern_protocol!(
261 pub unsafe trait UIPrintInteractionControllerDelegate:
263 NSObjectProtocol + MainThreadOnly
264 {
265 #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
266 #[optional]
267 #[unsafe(method(printInteractionControllerParentViewController:))]
268 #[unsafe(method_family = none)]
269 unsafe fn printInteractionControllerParentViewController(
270 &self,
271 print_interaction_controller: &UIPrintInteractionController,
272 ) -> Option<Retained<UIViewController>>;
273
274 #[cfg(feature = "UIPrintPaper")]
275 #[optional]
276 #[unsafe(method(printInteractionController:choosePaper:))]
277 #[unsafe(method_family = none)]
278 unsafe fn printInteractionController_choosePaper(
279 &self,
280 print_interaction_controller: &UIPrintInteractionController,
281 paper_list: &NSArray<UIPrintPaper>,
282 ) -> Retained<UIPrintPaper>;
283
284 #[optional]
285 #[unsafe(method(printInteractionControllerWillPresentPrinterOptions:))]
286 #[unsafe(method_family = none)]
287 unsafe fn printInteractionControllerWillPresentPrinterOptions(
288 &self,
289 print_interaction_controller: &UIPrintInteractionController,
290 );
291
292 #[optional]
293 #[unsafe(method(printInteractionControllerDidPresentPrinterOptions:))]
294 #[unsafe(method_family = none)]
295 unsafe fn printInteractionControllerDidPresentPrinterOptions(
296 &self,
297 print_interaction_controller: &UIPrintInteractionController,
298 );
299
300 #[optional]
301 #[unsafe(method(printInteractionControllerWillDismissPrinterOptions:))]
302 #[unsafe(method_family = none)]
303 unsafe fn printInteractionControllerWillDismissPrinterOptions(
304 &self,
305 print_interaction_controller: &UIPrintInteractionController,
306 );
307
308 #[optional]
309 #[unsafe(method(printInteractionControllerDidDismissPrinterOptions:))]
310 #[unsafe(method_family = none)]
311 unsafe fn printInteractionControllerDidDismissPrinterOptions(
312 &self,
313 print_interaction_controller: &UIPrintInteractionController,
314 );
315
316 #[optional]
317 #[unsafe(method(printInteractionControllerWillStartJob:))]
318 #[unsafe(method_family = none)]
319 unsafe fn printInteractionControllerWillStartJob(
320 &self,
321 print_interaction_controller: &UIPrintInteractionController,
322 );
323
324 #[optional]
325 #[unsafe(method(printInteractionControllerDidFinishJob:))]
326 #[unsafe(method_family = none)]
327 unsafe fn printInteractionControllerDidFinishJob(
328 &self,
329 print_interaction_controller: &UIPrintInteractionController,
330 );
331
332 #[cfg(all(feature = "UIPrintPaper", feature = "objc2-core-foundation"))]
333 #[optional]
334 #[unsafe(method(printInteractionController:cutLengthForPaper:))]
335 #[unsafe(method_family = none)]
336 unsafe fn printInteractionController_cutLengthForPaper(
337 &self,
338 print_interaction_controller: &UIPrintInteractionController,
339 paper: &UIPrintPaper,
340 ) -> CGFloat;
341
342 #[optional]
343 #[unsafe(method(printInteractionController:chooseCutterBehavior:))]
344 #[unsafe(method_family = none)]
345 unsafe fn printInteractionController_chooseCutterBehavior(
346 &self,
347 print_interaction_controller: &UIPrintInteractionController,
348 available_behaviors: &NSArray,
349 ) -> UIPrinterCutterBehavior;
350 }
351);