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 fn isPrintingAvailable(mtm: MainThreadMarker) -> bool;
60
61 #[unsafe(method(printableUTIs))]
62 #[unsafe(method_family = none)]
63 pub fn printableUTIs(mtm: MainThreadMarker) -> Retained<NSSet<NSString>>;
64
65 #[unsafe(method(canPrintURL:))]
66 #[unsafe(method_family = none)]
67 pub fn canPrintURL(url: &NSURL, mtm: MainThreadMarker) -> bool;
68
69 #[unsafe(method(canPrintData:))]
70 #[unsafe(method_family = none)]
71 pub fn canPrintData(data: &NSData, mtm: MainThreadMarker) -> bool;
72
73 #[unsafe(method(sharedPrintController))]
74 #[unsafe(method_family = none)]
75 pub fn sharedPrintController(
76 mtm: MainThreadMarker,
77 ) -> Retained<UIPrintInteractionController>;
78
79 #[cfg(feature = "UIPrintInfo")]
80 #[unsafe(method(printInfo))]
81 #[unsafe(method_family = none)]
82 pub fn printInfo(&self) -> Option<Retained<UIPrintInfo>>;
83
84 #[cfg(feature = "UIPrintInfo")]
85 #[unsafe(method(setPrintInfo:))]
87 #[unsafe(method_family = none)]
88 pub fn setPrintInfo(&self, print_info: Option<&UIPrintInfo>);
89
90 #[unsafe(method(delegate))]
91 #[unsafe(method_family = none)]
92 pub fn delegate(
93 &self,
94 ) -> Option<Retained<ProtocolObject<dyn UIPrintInteractionControllerDelegate>>>;
95
96 #[unsafe(method(setDelegate:))]
100 #[unsafe(method_family = none)]
101 pub fn setDelegate(
102 &self,
103 delegate: Option<&ProtocolObject<dyn UIPrintInteractionControllerDelegate>>,
104 );
105
106 #[deprecated = "Pages can be removed from the print preview, so page range is always shown."]
107 #[unsafe(method(showsPageRange))]
108 #[unsafe(method_family = none)]
109 pub fn showsPageRange(&self) -> bool;
110
111 #[deprecated = "Pages can be removed from the print preview, so page range is always shown."]
113 #[unsafe(method(setShowsPageRange:))]
114 #[unsafe(method_family = none)]
115 pub fn setShowsPageRange(&self, shows_page_range: bool);
116
117 #[unsafe(method(showsNumberOfCopies))]
118 #[unsafe(method_family = none)]
119 pub fn showsNumberOfCopies(&self) -> bool;
120
121 #[unsafe(method(setShowsNumberOfCopies:))]
123 #[unsafe(method_family = none)]
124 pub fn setShowsNumberOfCopies(&self, shows_number_of_copies: bool);
125
126 #[unsafe(method(showsPaperSelectionForLoadedPapers))]
127 #[unsafe(method_family = none)]
128 pub fn showsPaperSelectionForLoadedPapers(&self) -> bool;
129
130 #[unsafe(method(setShowsPaperSelectionForLoadedPapers:))]
132 #[unsafe(method_family = none)]
133 pub fn setShowsPaperSelectionForLoadedPapers(
134 &self,
135 shows_paper_selection_for_loaded_papers: bool,
136 );
137
138 #[unsafe(method(showsPaperOrientation))]
139 #[unsafe(method_family = none)]
140 pub fn showsPaperOrientation(&self) -> bool;
141
142 #[unsafe(method(setShowsPaperOrientation:))]
144 #[unsafe(method_family = none)]
145 pub fn setShowsPaperOrientation(&self, shows_paper_orientation: bool);
146
147 #[cfg(feature = "UIPrintPaper")]
148 #[unsafe(method(printPaper))]
149 #[unsafe(method_family = none)]
150 pub fn printPaper(&self) -> Option<Retained<UIPrintPaper>>;
151
152 #[cfg(feature = "UIPrintPageRenderer")]
153 #[unsafe(method(printPageRenderer))]
154 #[unsafe(method_family = none)]
155 pub fn printPageRenderer(&self) -> Option<Retained<UIPrintPageRenderer>>;
156
157 #[cfg(feature = "UIPrintPageRenderer")]
158 #[unsafe(method(setPrintPageRenderer:))]
160 #[unsafe(method_family = none)]
161 pub fn setPrintPageRenderer(&self, print_page_renderer: Option<&UIPrintPageRenderer>);
162
163 #[cfg(feature = "UIPrintFormatter")]
164 #[unsafe(method(printFormatter))]
165 #[unsafe(method_family = none)]
166 pub fn printFormatter(&self) -> Option<Retained<UIPrintFormatter>>;
167
168 #[cfg(feature = "UIPrintFormatter")]
169 #[unsafe(method(setPrintFormatter:))]
171 #[unsafe(method_family = none)]
172 pub fn setPrintFormatter(&self, print_formatter: Option<&UIPrintFormatter>);
173
174 #[unsafe(method(printingItem))]
175 #[unsafe(method_family = none)]
176 pub fn printingItem(&self) -> Option<Retained<AnyObject>>;
177
178 #[unsafe(method(setPrintingItem:))]
186 #[unsafe(method_family = none)]
187 pub unsafe fn setPrintingItem(&self, printing_item: Option<&AnyObject>);
188
189 #[unsafe(method(printingItems))]
190 #[unsafe(method_family = none)]
191 pub fn printingItems(&self) -> Option<Retained<NSArray>>;
192
193 #[unsafe(method(setPrintingItems:))]
201 #[unsafe(method_family = none)]
202 pub unsafe fn setPrintingItems(&self, printing_items: Option<&NSArray>);
203
204 #[cfg(feature = "block2")]
205 #[unsafe(method(presentAnimated:completionHandler:))]
209 #[unsafe(method_family = none)]
210 pub unsafe fn presentAnimated_completionHandler(
211 &self,
212 animated: bool,
213 completion: UIPrintInteractionCompletionHandler,
214 ) -> bool;
215
216 #[cfg(all(
217 feature = "UIResponder",
218 feature = "UIView",
219 feature = "block2",
220 feature = "objc2-core-foundation"
221 ))]
222 #[unsafe(method(presentFromRect:inView:animated:completionHandler:))]
226 #[unsafe(method_family = none)]
227 pub unsafe fn presentFromRect_inView_animated_completionHandler(
228 &self,
229 rect: CGRect,
230 view: &UIView,
231 animated: bool,
232 completion: UIPrintInteractionCompletionHandler,
233 ) -> bool;
234
235 #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem", feature = "block2"))]
236 #[unsafe(method(presentFromBarButtonItem:animated:completionHandler:))]
240 #[unsafe(method_family = none)]
241 pub unsafe fn presentFromBarButtonItem_animated_completionHandler(
242 &self,
243 item: &UIBarButtonItem,
244 animated: bool,
245 completion: UIPrintInteractionCompletionHandler,
246 ) -> bool;
247
248 #[cfg(all(feature = "UIPrinter", feature = "block2"))]
249 #[unsafe(method(printToPrinter:completionHandler:))]
257 #[unsafe(method_family = none)]
258 pub unsafe fn printToPrinter_completionHandler(
259 &self,
260 printer: &UIPrinter,
261 completion: UIPrintInteractionCompletionHandler,
262 ) -> bool;
263
264 #[unsafe(method(dismissAnimated:))]
265 #[unsafe(method_family = none)]
266 pub fn dismissAnimated(&self, animated: bool);
267 );
268}
269
270impl UIPrintInteractionController {
272 extern_methods!(
273 #[unsafe(method(init))]
274 #[unsafe(method_family = init)]
275 pub fn init(this: Allocated<Self>) -> Retained<Self>;
276
277 #[unsafe(method(new))]
278 #[unsafe(method_family = new)]
279 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
280 );
281}
282
283extern_protocol!(
284 pub unsafe trait UIPrintInteractionControllerDelegate:
286 NSObjectProtocol + MainThreadOnly
287 {
288 #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
289 #[optional]
290 #[unsafe(method(printInteractionControllerParentViewController:))]
291 #[unsafe(method_family = none)]
292 fn printInteractionControllerParentViewController(
293 &self,
294 print_interaction_controller: &UIPrintInteractionController,
295 ) -> Option<Retained<UIViewController>>;
296
297 #[cfg(feature = "UIPrintPaper")]
298 #[optional]
299 #[unsafe(method(printInteractionController:choosePaper:))]
300 #[unsafe(method_family = none)]
301 fn printInteractionController_choosePaper(
302 &self,
303 print_interaction_controller: &UIPrintInteractionController,
304 paper_list: &NSArray<UIPrintPaper>,
305 ) -> Retained<UIPrintPaper>;
306
307 #[optional]
308 #[unsafe(method(printInteractionControllerWillPresentPrinterOptions:))]
309 #[unsafe(method_family = none)]
310 fn printInteractionControllerWillPresentPrinterOptions(
311 &self,
312 print_interaction_controller: &UIPrintInteractionController,
313 );
314
315 #[optional]
316 #[unsafe(method(printInteractionControllerDidPresentPrinterOptions:))]
317 #[unsafe(method_family = none)]
318 fn printInteractionControllerDidPresentPrinterOptions(
319 &self,
320 print_interaction_controller: &UIPrintInteractionController,
321 );
322
323 #[optional]
324 #[unsafe(method(printInteractionControllerWillDismissPrinterOptions:))]
325 #[unsafe(method_family = none)]
326 fn printInteractionControllerWillDismissPrinterOptions(
327 &self,
328 print_interaction_controller: &UIPrintInteractionController,
329 );
330
331 #[optional]
332 #[unsafe(method(printInteractionControllerDidDismissPrinterOptions:))]
333 #[unsafe(method_family = none)]
334 fn printInteractionControllerDidDismissPrinterOptions(
335 &self,
336 print_interaction_controller: &UIPrintInteractionController,
337 );
338
339 #[optional]
340 #[unsafe(method(printInteractionControllerWillStartJob:))]
341 #[unsafe(method_family = none)]
342 fn printInteractionControllerWillStartJob(
343 &self,
344 print_interaction_controller: &UIPrintInteractionController,
345 );
346
347 #[optional]
348 #[unsafe(method(printInteractionControllerDidFinishJob:))]
349 #[unsafe(method_family = none)]
350 fn printInteractionControllerDidFinishJob(
351 &self,
352 print_interaction_controller: &UIPrintInteractionController,
353 );
354
355 #[cfg(all(feature = "UIPrintPaper", feature = "objc2-core-foundation"))]
356 #[optional]
357 #[unsafe(method(printInteractionController:cutLengthForPaper:))]
358 #[unsafe(method_family = none)]
359 fn printInteractionController_cutLengthForPaper(
360 &self,
361 print_interaction_controller: &UIPrintInteractionController,
362 paper: &UIPrintPaper,
363 ) -> CGFloat;
364
365 #[optional]
369 #[unsafe(method(printInteractionController:chooseCutterBehavior:))]
370 #[unsafe(method_family = none)]
371 unsafe fn printInteractionController_chooseCutterBehavior(
372 &self,
373 print_interaction_controller: &UIPrintInteractionController,
374 available_behaviors: &NSArray,
375 ) -> UIPrinterCutterBehavior;
376 }
377);