objc2_ui_kit/generated/
UIPrintInteractionController.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/uiprintinteractioncompletionhandler?language=objc)
13#[cfg(feature = "block2")]
14pub type UIPrintInteractionCompletionHandler =
15    *mut block2::Block<dyn Fn(NonNull<UIPrintInteractionController>, Bool, *mut NSError)>;
16
17/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiprintercutterbehavior?language=objc)
18// NS_ENUM
19#[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    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiprintinteractioncontroller?language=objc)
45    #[unsafe(super(NSObject))]
46    #[thread_kind = MainThreadOnly]
47    #[derive(Debug, PartialEq, Eq, Hash)]
48    pub struct UIPrintInteractionController;
49);
50
51unsafe impl NSObjectProtocol for UIPrintInteractionController {}
52
53impl UIPrintInteractionController {
54    extern_methods!(
55        #[unsafe(method(isPrintingAvailable))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn isPrintingAvailable(mtm: MainThreadMarker) -> bool;
58
59        #[unsafe(method(printableUTIs))]
60        #[unsafe(method_family = none)]
61        pub unsafe fn printableUTIs(mtm: MainThreadMarker) -> Retained<NSSet<NSString>>;
62
63        #[unsafe(method(canPrintURL:))]
64        #[unsafe(method_family = none)]
65        pub unsafe fn canPrintURL(url: &NSURL, mtm: MainThreadMarker) -> bool;
66
67        #[unsafe(method(canPrintData:))]
68        #[unsafe(method_family = none)]
69        pub unsafe fn canPrintData(data: &NSData, mtm: MainThreadMarker) -> bool;
70
71        #[unsafe(method(sharedPrintController))]
72        #[unsafe(method_family = none)]
73        pub unsafe fn sharedPrintController(
74            mtm: MainThreadMarker,
75        ) -> Retained<UIPrintInteractionController>;
76
77        #[cfg(feature = "UIPrintInfo")]
78        #[unsafe(method(printInfo))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn printInfo(&self) -> Option<Retained<UIPrintInfo>>;
81
82        #[cfg(feature = "UIPrintInfo")]
83        /// Setter for [`printInfo`][Self::printInfo].
84        #[unsafe(method(setPrintInfo:))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn setPrintInfo(&self, print_info: Option<&UIPrintInfo>);
87
88        #[unsafe(method(delegate))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn delegate(
91            &self,
92        ) -> Option<Retained<ProtocolObject<dyn UIPrintInteractionControllerDelegate>>>;
93
94        /// This is a [weak property][objc2::topics::weak_property].
95        /// Setter for [`delegate`][Self::delegate].
96        #[unsafe(method(setDelegate:))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn setDelegate(
99            &self,
100            delegate: Option<&ProtocolObject<dyn UIPrintInteractionControllerDelegate>>,
101        );
102
103        #[deprecated = "Pages can be removed from the print preview, so page range is always shown."]
104        #[unsafe(method(showsPageRange))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn showsPageRange(&self) -> bool;
107
108        /// Setter for [`showsPageRange`][Self::showsPageRange].
109        #[deprecated = "Pages can be removed from the print preview, so page range is always shown."]
110        #[unsafe(method(setShowsPageRange:))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn setShowsPageRange(&self, shows_page_range: bool);
113
114        #[unsafe(method(showsNumberOfCopies))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn showsNumberOfCopies(&self) -> bool;
117
118        /// Setter for [`showsNumberOfCopies`][Self::showsNumberOfCopies].
119        #[unsafe(method(setShowsNumberOfCopies:))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn setShowsNumberOfCopies(&self, shows_number_of_copies: bool);
122
123        #[unsafe(method(showsPaperSelectionForLoadedPapers))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn showsPaperSelectionForLoadedPapers(&self) -> bool;
126
127        /// Setter for [`showsPaperSelectionForLoadedPapers`][Self::showsPaperSelectionForLoadedPapers].
128        #[unsafe(method(setShowsPaperSelectionForLoadedPapers:))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn setShowsPaperSelectionForLoadedPapers(
131            &self,
132            shows_paper_selection_for_loaded_papers: bool,
133        );
134
135        #[unsafe(method(showsPaperOrientation))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn showsPaperOrientation(&self) -> bool;
138
139        /// Setter for [`showsPaperOrientation`][Self::showsPaperOrientation].
140        #[unsafe(method(setShowsPaperOrientation:))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn setShowsPaperOrientation(&self, shows_paper_orientation: bool);
143
144        #[cfg(feature = "UIPrintPaper")]
145        #[unsafe(method(printPaper))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn printPaper(&self) -> Option<Retained<UIPrintPaper>>;
148
149        #[cfg(feature = "UIPrintPageRenderer")]
150        #[unsafe(method(printPageRenderer))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn printPageRenderer(&self) -> Option<Retained<UIPrintPageRenderer>>;
153
154        #[cfg(feature = "UIPrintPageRenderer")]
155        /// Setter for [`printPageRenderer`][Self::printPageRenderer].
156        #[unsafe(method(setPrintPageRenderer:))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn setPrintPageRenderer(
159            &self,
160            print_page_renderer: Option<&UIPrintPageRenderer>,
161        );
162
163        #[cfg(feature = "UIPrintFormatter")]
164        #[unsafe(method(printFormatter))]
165        #[unsafe(method_family = none)]
166        pub unsafe fn printFormatter(&self) -> Option<Retained<UIPrintFormatter>>;
167
168        #[cfg(feature = "UIPrintFormatter")]
169        /// Setter for [`printFormatter`][Self::printFormatter].
170        #[unsafe(method(setPrintFormatter:))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn setPrintFormatter(&self, print_formatter: Option<&UIPrintFormatter>);
173
174        #[unsafe(method(printingItem))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn printingItem(&self) -> Option<Retained<AnyObject>>;
177
178        /// Setter for [`printingItem`][Self::printingItem].
179        #[unsafe(method(setPrintingItem:))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn setPrintingItem(&self, printing_item: Option<&AnyObject>);
182
183        #[unsafe(method(printingItems))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn printingItems(&self) -> Option<Retained<NSArray>>;
186
187        /// Setter for [`printingItems`][Self::printingItems].
188        #[unsafe(method(setPrintingItems:))]
189        #[unsafe(method_family = none)]
190        pub unsafe fn setPrintingItems(&self, printing_items: Option<&NSArray>);
191
192        #[cfg(feature = "block2")]
193        #[unsafe(method(presentAnimated:completionHandler:))]
194        #[unsafe(method_family = none)]
195        pub unsafe fn presentAnimated_completionHandler(
196            &self,
197            animated: bool,
198            completion: UIPrintInteractionCompletionHandler,
199        ) -> bool;
200
201        #[cfg(all(
202            feature = "UIResponder",
203            feature = "UIView",
204            feature = "block2",
205            feature = "objc2-core-foundation"
206        ))]
207        #[unsafe(method(presentFromRect:inView:animated:completionHandler:))]
208        #[unsafe(method_family = none)]
209        pub unsafe fn presentFromRect_inView_animated_completionHandler(
210            &self,
211            rect: CGRect,
212            view: &UIView,
213            animated: bool,
214            completion: UIPrintInteractionCompletionHandler,
215        ) -> bool;
216
217        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem", feature = "block2"))]
218        #[unsafe(method(presentFromBarButtonItem:animated:completionHandler:))]
219        #[unsafe(method_family = none)]
220        pub unsafe fn presentFromBarButtonItem_animated_completionHandler(
221            &self,
222            item: &UIBarButtonItem,
223            animated: bool,
224            completion: UIPrintInteractionCompletionHandler,
225        ) -> bool;
226
227        #[cfg(all(feature = "UIPrinter", feature = "block2"))]
228        /// Use to print without showing the standard print panel. Use with a
229        /// UIPrinter found using the UIPrinterPickerController.
230        /// The value for the duplex property on printInfo will be ignored.
231        #[unsafe(method(printToPrinter:completionHandler:))]
232        #[unsafe(method_family = none)]
233        pub unsafe fn printToPrinter_completionHandler(
234            &self,
235            printer: &UIPrinter,
236            completion: UIPrintInteractionCompletionHandler,
237        ) -> bool;
238
239        #[unsafe(method(dismissAnimated:))]
240        #[unsafe(method_family = none)]
241        pub unsafe fn dismissAnimated(&self, animated: bool);
242    );
243}
244
245/// Methods declared on superclass `NSObject`.
246impl UIPrintInteractionController {
247    extern_methods!(
248        #[unsafe(method(init))]
249        #[unsafe(method_family = init)]
250        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
251
252        #[unsafe(method(new))]
253        #[unsafe(method_family = new)]
254        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
255    );
256}
257
258extern_protocol!(
259    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiprintinteractioncontrollerdelegate?language=objc)
260    pub unsafe trait UIPrintInteractionControllerDelegate:
261        NSObjectProtocol + MainThreadOnly
262    {
263        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
264        #[optional]
265        #[unsafe(method(printInteractionControllerParentViewController:))]
266        #[unsafe(method_family = none)]
267        unsafe fn printInteractionControllerParentViewController(
268            &self,
269            print_interaction_controller: &UIPrintInteractionController,
270        ) -> Option<Retained<UIViewController>>;
271
272        #[cfg(feature = "UIPrintPaper")]
273        #[optional]
274        #[unsafe(method(printInteractionController:choosePaper:))]
275        #[unsafe(method_family = none)]
276        unsafe fn printInteractionController_choosePaper(
277            &self,
278            print_interaction_controller: &UIPrintInteractionController,
279            paper_list: &NSArray<UIPrintPaper>,
280        ) -> Retained<UIPrintPaper>;
281
282        #[optional]
283        #[unsafe(method(printInteractionControllerWillPresentPrinterOptions:))]
284        #[unsafe(method_family = none)]
285        unsafe fn printInteractionControllerWillPresentPrinterOptions(
286            &self,
287            print_interaction_controller: &UIPrintInteractionController,
288        );
289
290        #[optional]
291        #[unsafe(method(printInteractionControllerDidPresentPrinterOptions:))]
292        #[unsafe(method_family = none)]
293        unsafe fn printInteractionControllerDidPresentPrinterOptions(
294            &self,
295            print_interaction_controller: &UIPrintInteractionController,
296        );
297
298        #[optional]
299        #[unsafe(method(printInteractionControllerWillDismissPrinterOptions:))]
300        #[unsafe(method_family = none)]
301        unsafe fn printInteractionControllerWillDismissPrinterOptions(
302            &self,
303            print_interaction_controller: &UIPrintInteractionController,
304        );
305
306        #[optional]
307        #[unsafe(method(printInteractionControllerDidDismissPrinterOptions:))]
308        #[unsafe(method_family = none)]
309        unsafe fn printInteractionControllerDidDismissPrinterOptions(
310            &self,
311            print_interaction_controller: &UIPrintInteractionController,
312        );
313
314        #[optional]
315        #[unsafe(method(printInteractionControllerWillStartJob:))]
316        #[unsafe(method_family = none)]
317        unsafe fn printInteractionControllerWillStartJob(
318            &self,
319            print_interaction_controller: &UIPrintInteractionController,
320        );
321
322        #[optional]
323        #[unsafe(method(printInteractionControllerDidFinishJob:))]
324        #[unsafe(method_family = none)]
325        unsafe fn printInteractionControllerDidFinishJob(
326            &self,
327            print_interaction_controller: &UIPrintInteractionController,
328        );
329
330        #[cfg(all(feature = "UIPrintPaper", feature = "objc2-core-foundation"))]
331        #[optional]
332        #[unsafe(method(printInteractionController:cutLengthForPaper:))]
333        #[unsafe(method_family = none)]
334        unsafe fn printInteractionController_cutLengthForPaper(
335            &self,
336            print_interaction_controller: &UIPrintInteractionController,
337            paper: &UIPrintPaper,
338        ) -> CGFloat;
339
340        #[optional]
341        #[unsafe(method(printInteractionController:chooseCutterBehavior:))]
342        #[unsafe(method_family = none)]
343        unsafe fn printInteractionController_chooseCutterBehavior(
344            &self,
345            print_interaction_controller: &UIPrintInteractionController,
346            available_behaviors: &NSArray,
347        ) -> UIPrinterCutterBehavior;
348    }
349);