objc2_ui_kit/generated/
UIDocumentInteractionController.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
12extern_class!(
13    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidocumentinteractioncontroller?language=objc)
14    #[unsafe(super(NSObject))]
15    #[thread_kind = MainThreadOnly]
16    #[derive(Debug, PartialEq, Eq, Hash)]
17    pub struct UIDocumentInteractionController;
18);
19
20extern_conformance!(
21    unsafe impl NSObjectProtocol for UIDocumentInteractionController {}
22);
23
24#[cfg(feature = "UIActionSheet")]
25extern_conformance!(
26    unsafe impl UIActionSheetDelegate for UIDocumentInteractionController {}
27);
28
29impl UIDocumentInteractionController {
30    extern_methods!(
31        #[unsafe(method(interactionControllerWithURL:))]
32        #[unsafe(method_family = none)]
33        pub fn interactionControllerWithURL(
34            url: &NSURL,
35            mtm: MainThreadMarker,
36        ) -> Retained<UIDocumentInteractionController>;
37
38        #[unsafe(method(delegate))]
39        #[unsafe(method_family = none)]
40        pub fn delegate(
41            &self,
42        ) -> Option<Retained<ProtocolObject<dyn UIDocumentInteractionControllerDelegate>>>;
43
44        /// Setter for [`delegate`][Self::delegate].
45        ///
46        /// This is a [weak property][objc2::topics::weak_property].
47        #[unsafe(method(setDelegate:))]
48        #[unsafe(method_family = none)]
49        pub fn setDelegate(
50            &self,
51            delegate: Option<&ProtocolObject<dyn UIDocumentInteractionControllerDelegate>>,
52        );
53
54        #[unsafe(method(URL))]
55        #[unsafe(method_family = none)]
56        pub fn URL(&self) -> Option<Retained<NSURL>>;
57
58        /// Setter for [`URL`][Self::URL].
59        #[unsafe(method(setURL:))]
60        #[unsafe(method_family = none)]
61        pub fn setURL(&self, url: Option<&NSURL>);
62
63        #[unsafe(method(UTI))]
64        #[unsafe(method_family = none)]
65        pub fn UTI(&self) -> Option<Retained<NSString>>;
66
67        /// Setter for [`UTI`][Self::UTI].
68        ///
69        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
70        #[unsafe(method(setUTI:))]
71        #[unsafe(method_family = none)]
72        pub fn setUTI(&self, uti: Option<&NSString>);
73
74        #[unsafe(method(name))]
75        #[unsafe(method_family = none)]
76        pub fn name(&self) -> Option<Retained<NSString>>;
77
78        /// Setter for [`name`][Self::name].
79        ///
80        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
81        #[unsafe(method(setName:))]
82        #[unsafe(method_family = none)]
83        pub fn setName(&self, name: Option<&NSString>);
84
85        #[cfg(feature = "UIImage")]
86        #[unsafe(method(icons))]
87        #[unsafe(method_family = none)]
88        pub fn icons(&self) -> Retained<NSArray<UIImage>>;
89
90        #[unsafe(method(annotation))]
91        #[unsafe(method_family = none)]
92        pub fn annotation(&self) -> Option<Retained<AnyObject>>;
93
94        /// Setter for [`annotation`][Self::annotation].
95        ///
96        /// # Safety
97        ///
98        /// `annotation` should be of the correct type.
99        #[unsafe(method(setAnnotation:))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn setAnnotation(&self, annotation: Option<&AnyObject>);
102
103        #[cfg(all(
104            feature = "UIResponder",
105            feature = "UIView",
106            feature = "objc2-core-foundation"
107        ))]
108        #[unsafe(method(presentOptionsMenuFromRect:inView:animated:))]
109        #[unsafe(method_family = none)]
110        pub fn presentOptionsMenuFromRect_inView_animated(
111            &self,
112            rect: CGRect,
113            view: &UIView,
114            animated: bool,
115        ) -> bool;
116
117        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
118        #[unsafe(method(presentOptionsMenuFromBarButtonItem:animated:))]
119        #[unsafe(method_family = none)]
120        pub fn presentOptionsMenuFromBarButtonItem_animated(
121            &self,
122            item: &UIBarButtonItem,
123            animated: bool,
124        ) -> bool;
125
126        #[unsafe(method(presentPreviewAnimated:))]
127        #[unsafe(method_family = none)]
128        pub fn presentPreviewAnimated(&self, animated: bool) -> bool;
129
130        #[cfg(all(
131            feature = "UIResponder",
132            feature = "UIView",
133            feature = "objc2-core-foundation"
134        ))]
135        #[unsafe(method(presentOpenInMenuFromRect:inView:animated:))]
136        #[unsafe(method_family = none)]
137        pub fn presentOpenInMenuFromRect_inView_animated(
138            &self,
139            rect: CGRect,
140            view: &UIView,
141            animated: bool,
142        ) -> bool;
143
144        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
145        #[unsafe(method(presentOpenInMenuFromBarButtonItem:animated:))]
146        #[unsafe(method_family = none)]
147        pub fn presentOpenInMenuFromBarButtonItem_animated(
148            &self,
149            item: &UIBarButtonItem,
150            animated: bool,
151        ) -> bool;
152
153        #[unsafe(method(dismissPreviewAnimated:))]
154        #[unsafe(method_family = none)]
155        pub fn dismissPreviewAnimated(&self, animated: bool);
156
157        #[unsafe(method(dismissMenuAnimated:))]
158        #[unsafe(method_family = none)]
159        pub fn dismissMenuAnimated(&self, animated: bool);
160
161        #[cfg(feature = "UIGestureRecognizer")]
162        #[unsafe(method(gestureRecognizers))]
163        #[unsafe(method_family = none)]
164        pub fn gestureRecognizers(&self) -> Retained<NSArray<UIGestureRecognizer>>;
165    );
166}
167
168/// Methods declared on superclass `NSObject`.
169impl UIDocumentInteractionController {
170    extern_methods!(
171        #[unsafe(method(init))]
172        #[unsafe(method_family = init)]
173        pub fn init(this: Allocated<Self>) -> Retained<Self>;
174
175        #[unsafe(method(new))]
176        #[unsafe(method_family = new)]
177        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
178    );
179}
180
181extern_protocol!(
182    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidocumentinteractioncontrollerdelegate?language=objc)
183    pub unsafe trait UIDocumentInteractionControllerDelegate: NSObjectProtocol {
184        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
185        #[optional]
186        #[unsafe(method(documentInteractionControllerViewControllerForPreview:))]
187        #[unsafe(method_family = none)]
188        fn documentInteractionControllerViewControllerForPreview(
189            &self,
190            controller: &UIDocumentInteractionController,
191        ) -> Retained<UIViewController>;
192
193        #[cfg(feature = "objc2-core-foundation")]
194        #[optional]
195        #[unsafe(method(documentInteractionControllerRectForPreview:))]
196        #[unsafe(method_family = none)]
197        fn documentInteractionControllerRectForPreview(
198            &self,
199            controller: &UIDocumentInteractionController,
200        ) -> CGRect;
201
202        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
203        #[optional]
204        #[unsafe(method(documentInteractionControllerViewForPreview:))]
205        #[unsafe(method_family = none)]
206        fn documentInteractionControllerViewForPreview(
207            &self,
208            controller: &UIDocumentInteractionController,
209        ) -> Option<Retained<UIView>>;
210
211        #[optional]
212        #[unsafe(method(documentInteractionControllerWillBeginPreview:))]
213        #[unsafe(method_family = none)]
214        fn documentInteractionControllerWillBeginPreview(
215            &self,
216            controller: &UIDocumentInteractionController,
217        );
218
219        #[optional]
220        #[unsafe(method(documentInteractionControllerDidEndPreview:))]
221        #[unsafe(method_family = none)]
222        fn documentInteractionControllerDidEndPreview(
223            &self,
224            controller: &UIDocumentInteractionController,
225        );
226
227        #[optional]
228        #[unsafe(method(documentInteractionControllerWillPresentOptionsMenu:))]
229        #[unsafe(method_family = none)]
230        fn documentInteractionControllerWillPresentOptionsMenu(
231            &self,
232            controller: &UIDocumentInteractionController,
233        );
234
235        #[optional]
236        #[unsafe(method(documentInteractionControllerDidDismissOptionsMenu:))]
237        #[unsafe(method_family = none)]
238        fn documentInteractionControllerDidDismissOptionsMenu(
239            &self,
240            controller: &UIDocumentInteractionController,
241        );
242
243        #[optional]
244        #[unsafe(method(documentInteractionControllerWillPresentOpenInMenu:))]
245        #[unsafe(method_family = none)]
246        fn documentInteractionControllerWillPresentOpenInMenu(
247            &self,
248            controller: &UIDocumentInteractionController,
249        );
250
251        #[optional]
252        #[unsafe(method(documentInteractionControllerDidDismissOpenInMenu:))]
253        #[unsafe(method_family = none)]
254        fn documentInteractionControllerDidDismissOpenInMenu(
255            &self,
256            controller: &UIDocumentInteractionController,
257        );
258
259        #[optional]
260        #[unsafe(method(documentInteractionController:willBeginSendingToApplication:))]
261        #[unsafe(method_family = none)]
262        fn documentInteractionController_willBeginSendingToApplication(
263            &self,
264            controller: &UIDocumentInteractionController,
265            application: Option<&NSString>,
266        );
267
268        #[optional]
269        #[unsafe(method(documentInteractionController:didEndSendingToApplication:))]
270        #[unsafe(method_family = none)]
271        fn documentInteractionController_didEndSendingToApplication(
272            &self,
273            controller: &UIDocumentInteractionController,
274            application: Option<&NSString>,
275        );
276
277        /// # Safety
278        ///
279        /// `action` must be a valid selector.
280        #[deprecated]
281        #[optional]
282        #[unsafe(method(documentInteractionController:canPerformAction:))]
283        #[unsafe(method_family = none)]
284        unsafe fn documentInteractionController_canPerformAction(
285            &self,
286            controller: &UIDocumentInteractionController,
287            action: Option<Sel>,
288        ) -> bool;
289
290        /// # Safety
291        ///
292        /// `action` must be a valid selector.
293        #[deprecated]
294        #[optional]
295        #[unsafe(method(documentInteractionController:performAction:))]
296        #[unsafe(method_family = none)]
297        unsafe fn documentInteractionController_performAction(
298            &self,
299            controller: &UIDocumentInteractionController,
300            action: Option<Sel>,
301        ) -> bool;
302    }
303);