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 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 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 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 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 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 fn initForOpeningContentTypes(
158 this: Allocated<Self>,
159 content_types: &NSArray<UTType>,
160 ) -> Retained<Self>;
161
162 #[unsafe(method(initWithCoder:))]
166 #[unsafe(method_family = init)]
167 pub unsafe fn initWithCoder(
168 this: Allocated<Self>,
169 coder: &NSCoder,
170 ) -> Option<Retained<Self>>;
171
172 #[deprecated]
173 #[unsafe(method(initWithURL:inMode:))]
174 #[unsafe(method_family = init)]
175 pub fn initWithURL_inMode(
176 this: Allocated<Self>,
177 url: &NSURL,
178 mode: UIDocumentPickerMode,
179 ) -> Retained<Self>;
180
181 #[deprecated]
182 #[unsafe(method(initWithURLs:inMode:))]
183 #[unsafe(method_family = init)]
184 pub fn initWithURLs_inMode(
185 this: Allocated<Self>,
186 urls: &NSArray<NSURL>,
187 mode: UIDocumentPickerMode,
188 ) -> Retained<Self>;
189
190 #[unsafe(method(initForExportingURLs:asCopy:))]
194 #[unsafe(method_family = init)]
195 pub fn initForExportingURLs_asCopy(
196 this: Allocated<Self>,
197 urls: &NSArray<NSURL>,
198 as_copy: bool,
199 ) -> Retained<Self>;
200
201 #[unsafe(method(initForExportingURLs:))]
203 #[unsafe(method_family = init)]
204 pub fn initForExportingURLs(this: Allocated<Self>, urls: &NSArray<NSURL>)
205 -> Retained<Self>;
206
207 #[unsafe(method(delegate))]
208 #[unsafe(method_family = none)]
209 pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn UIDocumentPickerDelegate>>>;
210
211 #[unsafe(method(setDelegate:))]
215 #[unsafe(method_family = none)]
216 pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn UIDocumentPickerDelegate>>);
217
218 #[deprecated = "Use appropriate initializers instead"]
219 #[unsafe(method(documentPickerMode))]
220 #[unsafe(method_family = none)]
221 pub fn documentPickerMode(&self) -> UIDocumentPickerMode;
222
223 #[unsafe(method(allowsMultipleSelection))]
224 #[unsafe(method_family = none)]
225 pub fn allowsMultipleSelection(&self) -> bool;
226
227 #[unsafe(method(setAllowsMultipleSelection:))]
229 #[unsafe(method_family = none)]
230 pub fn setAllowsMultipleSelection(&self, allows_multiple_selection: bool);
231
232 #[unsafe(method(shouldShowFileExtensions))]
234 #[unsafe(method_family = none)]
235 pub fn shouldShowFileExtensions(&self) -> bool;
236
237 #[unsafe(method(setShouldShowFileExtensions:))]
239 #[unsafe(method_family = none)]
240 pub fn setShouldShowFileExtensions(&self, should_show_file_extensions: bool);
241
242 #[unsafe(method(directoryURL))]
244 #[unsafe(method_family = none)]
245 pub fn directoryURL(&self) -> Option<Retained<NSURL>>;
246
247 #[unsafe(method(setDirectoryURL:))]
251 #[unsafe(method_family = none)]
252 pub fn setDirectoryURL(&self, directory_url: Option<&NSURL>);
253 );
254}
255
256#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
258impl UIDocumentPickerViewController {
259 extern_methods!(
260 #[unsafe(method(initWithNibName:bundle:))]
261 #[unsafe(method_family = init)]
262 pub fn initWithNibName_bundle(
263 this: Allocated<Self>,
264 nib_name_or_nil: Option<&NSString>,
265 nib_bundle_or_nil: Option<&NSBundle>,
266 ) -> Retained<Self>;
267 );
268}
269
270#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
272impl UIDocumentPickerViewController {
273 extern_methods!(
274 #[unsafe(method(init))]
275 #[unsafe(method_family = init)]
276 pub fn init(this: Allocated<Self>) -> Retained<Self>;
277
278 #[unsafe(method(new))]
279 #[unsafe(method_family = new)]
280 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
281 );
282}