objc2_ui_kit/generated/
UIDocumentPickerViewController.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7#[cfg(feature = "objc2-uniform-type-identifiers")]
8use objc2_uniform_type_identifiers::*;
9
10use crate::*;
11
12extern_protocol!(
13 pub unsafe trait UIDocumentPickerDelegate: NSObjectProtocol + MainThreadOnly {
15 #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
16 #[optional]
17 #[unsafe(method(documentPicker:didPickDocumentsAtURLs:))]
18 #[unsafe(method_family = none)]
19 unsafe fn documentPicker_didPickDocumentsAtURLs(
20 &self,
21 controller: &UIDocumentPickerViewController,
22 urls: &NSArray<NSURL>,
23 );
24
25 #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
26 #[optional]
27 #[unsafe(method(documentPickerWasCancelled:))]
28 #[unsafe(method_family = none)]
29 unsafe fn documentPickerWasCancelled(&self, controller: &UIDocumentPickerViewController);
30
31 #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
32 #[deprecated]
33 #[optional]
34 #[unsafe(method(documentPicker:didPickDocumentAtURL:))]
35 #[unsafe(method_family = none)]
36 unsafe fn documentPicker_didPickDocumentAtURL(
37 &self,
38 controller: &UIDocumentPickerViewController,
39 url: &NSURL,
40 );
41 }
42);
43
44#[deprecated = "Use appropriate initializers instead"]
47#[repr(transparent)]
48#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
49pub struct UIDocumentPickerMode(pub NSUInteger);
50impl UIDocumentPickerMode {
51 #[doc(alias = "UIDocumentPickerModeImport")]
52 #[deprecated = "Use appropriate initializers instead"]
53 pub const Import: Self = Self(0);
54 #[doc(alias = "UIDocumentPickerModeOpen")]
55 #[deprecated = "Use appropriate initializers instead"]
56 pub const Open: Self = Self(1);
57 #[doc(alias = "UIDocumentPickerModeExportToService")]
58 #[deprecated = "Use appropriate initializers instead"]
59 pub const ExportToService: Self = Self(2);
60 #[doc(alias = "UIDocumentPickerModeMoveToService")]
61 #[deprecated = "Use appropriate initializers instead"]
62 pub const MoveToService: Self = Self(3);
63}
64
65unsafe impl Encode for UIDocumentPickerMode {
66 const ENCODING: Encoding = NSUInteger::ENCODING;
67}
68
69unsafe impl RefEncode for UIDocumentPickerMode {
70 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
71}
72
73extern_class!(
74 #[unsafe(super(UIViewController, UIResponder, NSObject))]
76 #[thread_kind = MainThreadOnly]
77 #[derive(Debug, PartialEq, Eq, Hash)]
78 #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
79 pub struct UIDocumentPickerViewController;
80);
81
82#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
83extern_conformance!(
84 unsafe impl NSCoding for UIDocumentPickerViewController {}
85);
86
87#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
88extern_conformance!(
89 unsafe impl NSObjectProtocol for UIDocumentPickerViewController {}
90);
91
92#[cfg(all(
93 feature = "UIAppearance",
94 feature = "UIResponder",
95 feature = "UIViewController"
96))]
97extern_conformance!(
98 unsafe impl UIAppearanceContainer for UIDocumentPickerViewController {}
99);
100
101#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
102extern_conformance!(
103 unsafe impl UIContentContainer for UIDocumentPickerViewController {}
104);
105
106#[cfg(all(
107 feature = "UIFocus",
108 feature = "UIResponder",
109 feature = "UIViewController"
110))]
111extern_conformance!(
112 unsafe impl UIFocusEnvironment for UIDocumentPickerViewController {}
113);
114
115#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
116extern_conformance!(
117 unsafe impl UIResponderStandardEditActions for UIDocumentPickerViewController {}
118);
119
120#[cfg(all(
121 feature = "UIResponder",
122 feature = "UITraitCollection",
123 feature = "UIViewController"
124))]
125extern_conformance!(
126 unsafe impl UITraitEnvironment for UIDocumentPickerViewController {}
127);
128
129#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
130impl UIDocumentPickerViewController {
131 extern_methods!(
132 #[deprecated]
133 #[unsafe(method(initWithDocumentTypes:inMode:))]
134 #[unsafe(method_family = init)]
135 pub unsafe fn initWithDocumentTypes_inMode(
136 this: Allocated<Self>,
137 allowed_ut_is: &NSArray<NSString>,
138 mode: UIDocumentPickerMode,
139 ) -> Retained<Self>;
140
141 #[cfg(feature = "objc2-uniform-type-identifiers")]
142 #[unsafe(method(initForOpeningContentTypes:asCopy:))]
146 #[unsafe(method_family = init)]
147 pub unsafe fn initForOpeningContentTypes_asCopy(
148 this: Allocated<Self>,
149 content_types: &NSArray<UTType>,
150 as_copy: bool,
151 ) -> Retained<Self>;
152
153 #[cfg(feature = "objc2-uniform-type-identifiers")]
154 #[unsafe(method(initForOpeningContentTypes:))]
156 #[unsafe(method_family = init)]
157 pub unsafe fn initForOpeningContentTypes(
158 this: Allocated<Self>,
159 content_types: &NSArray<UTType>,
160 ) -> Retained<Self>;
161
162 #[unsafe(method(initWithCoder:))]
163 #[unsafe(method_family = init)]
164 pub unsafe fn initWithCoder(
165 this: Allocated<Self>,
166 coder: &NSCoder,
167 ) -> Option<Retained<Self>>;
168
169 #[deprecated]
170 #[unsafe(method(initWithURL:inMode:))]
171 #[unsafe(method_family = init)]
172 pub unsafe fn initWithURL_inMode(
173 this: Allocated<Self>,
174 url: &NSURL,
175 mode: UIDocumentPickerMode,
176 ) -> Retained<Self>;
177
178 #[deprecated]
179 #[unsafe(method(initWithURLs:inMode:))]
180 #[unsafe(method_family = init)]
181 pub unsafe fn initWithURLs_inMode(
182 this: Allocated<Self>,
183 urls: &NSArray<NSURL>,
184 mode: UIDocumentPickerMode,
185 ) -> Retained<Self>;
186
187 #[unsafe(method(initForExportingURLs:asCopy:))]
191 #[unsafe(method_family = init)]
192 pub unsafe fn initForExportingURLs_asCopy(
193 this: Allocated<Self>,
194 urls: &NSArray<NSURL>,
195 as_copy: bool,
196 ) -> Retained<Self>;
197
198 #[unsafe(method(initForExportingURLs:))]
200 #[unsafe(method_family = init)]
201 pub unsafe fn initForExportingURLs(
202 this: Allocated<Self>,
203 urls: &NSArray<NSURL>,
204 ) -> Retained<Self>;
205
206 #[unsafe(method(delegate))]
207 #[unsafe(method_family = none)]
208 pub unsafe fn delegate(
209 &self,
210 ) -> Option<Retained<ProtocolObject<dyn UIDocumentPickerDelegate>>>;
211
212 #[unsafe(method(setDelegate:))]
215 #[unsafe(method_family = none)]
216 pub unsafe fn setDelegate(
217 &self,
218 delegate: Option<&ProtocolObject<dyn UIDocumentPickerDelegate>>,
219 );
220
221 #[deprecated = "Use appropriate initializers instead"]
222 #[unsafe(method(documentPickerMode))]
223 #[unsafe(method_family = none)]
224 pub unsafe fn documentPickerMode(&self) -> UIDocumentPickerMode;
225
226 #[unsafe(method(allowsMultipleSelection))]
227 #[unsafe(method_family = none)]
228 pub unsafe fn allowsMultipleSelection(&self) -> bool;
229
230 #[unsafe(method(setAllowsMultipleSelection:))]
232 #[unsafe(method_family = none)]
233 pub unsafe fn setAllowsMultipleSelection(&self, allows_multiple_selection: bool);
234
235 #[unsafe(method(shouldShowFileExtensions))]
237 #[unsafe(method_family = none)]
238 pub unsafe fn shouldShowFileExtensions(&self) -> bool;
239
240 #[unsafe(method(setShouldShowFileExtensions:))]
242 #[unsafe(method_family = none)]
243 pub unsafe fn setShouldShowFileExtensions(&self, should_show_file_extensions: bool);
244
245 #[unsafe(method(directoryURL))]
247 #[unsafe(method_family = none)]
248 pub unsafe fn directoryURL(&self) -> Option<Retained<NSURL>>;
249
250 #[unsafe(method(setDirectoryURL:))]
252 #[unsafe(method_family = none)]
253 pub unsafe fn setDirectoryURL(&self, directory_url: Option<&NSURL>);
254 );
255}
256
257#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
259impl UIDocumentPickerViewController {
260 extern_methods!(
261 #[unsafe(method(initWithNibName:bundle:))]
262 #[unsafe(method_family = init)]
263 pub unsafe fn initWithNibName_bundle(
264 this: Allocated<Self>,
265 nib_name_or_nil: Option<&NSString>,
266 nib_bundle_or_nil: Option<&NSBundle>,
267 ) -> Retained<Self>;
268 );
269}
270
271#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
273impl UIDocumentPickerViewController {
274 extern_methods!(
275 #[unsafe(method(init))]
276 #[unsafe(method_family = init)]
277 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
278
279 #[unsafe(method(new))]
280 #[unsafe(method_family = new)]
281 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
282 );
283}