objc2_app_kit/generated/
NSOpenPanel.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsopenpanel?language=objc)
12    #[unsafe(super(NSSavePanel, NSPanel, NSWindow, NSResponder, NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    #[cfg(all(
15        feature = "NSPanel",
16        feature = "NSResponder",
17        feature = "NSSavePanel",
18        feature = "NSWindow"
19    ))]
20    pub struct NSOpenPanel;
21);
22
23#[cfg(all(
24    feature = "NSAccessibilityProtocols",
25    feature = "NSPanel",
26    feature = "NSResponder",
27    feature = "NSSavePanel",
28    feature = "NSWindow"
29))]
30extern_conformance!(
31    unsafe impl NSAccessibility for NSOpenPanel {}
32);
33
34#[cfg(all(
35    feature = "NSAccessibilityProtocols",
36    feature = "NSPanel",
37    feature = "NSResponder",
38    feature = "NSSavePanel",
39    feature = "NSWindow"
40))]
41extern_conformance!(
42    unsafe impl NSAccessibilityElementProtocol for NSOpenPanel {}
43);
44
45#[cfg(all(
46    feature = "NSAnimation",
47    feature = "NSPanel",
48    feature = "NSResponder",
49    feature = "NSSavePanel",
50    feature = "NSWindow"
51))]
52extern_conformance!(
53    unsafe impl NSAnimatablePropertyContainer for NSOpenPanel {}
54);
55
56#[cfg(all(
57    feature = "NSAppearance",
58    feature = "NSPanel",
59    feature = "NSResponder",
60    feature = "NSSavePanel",
61    feature = "NSWindow"
62))]
63extern_conformance!(
64    unsafe impl NSAppearanceCustomization for NSOpenPanel {}
65);
66
67#[cfg(all(
68    feature = "NSPanel",
69    feature = "NSResponder",
70    feature = "NSSavePanel",
71    feature = "NSWindow"
72))]
73extern_conformance!(
74    unsafe impl NSCoding for NSOpenPanel {}
75);
76
77#[cfg(all(
78    feature = "NSMenu",
79    feature = "NSPanel",
80    feature = "NSResponder",
81    feature = "NSSavePanel",
82    feature = "NSWindow"
83))]
84extern_conformance!(
85    unsafe impl NSMenuItemValidation for NSOpenPanel {}
86);
87
88#[cfg(all(
89    feature = "NSPanel",
90    feature = "NSResponder",
91    feature = "NSSavePanel",
92    feature = "NSWindow"
93))]
94extern_conformance!(
95    unsafe impl NSObjectProtocol for NSOpenPanel {}
96);
97
98#[cfg(all(
99    feature = "NSPanel",
100    feature = "NSResponder",
101    feature = "NSSavePanel",
102    feature = "NSUserInterfaceItemIdentification",
103    feature = "NSWindow"
104))]
105extern_conformance!(
106    unsafe impl NSUserInterfaceItemIdentification for NSOpenPanel {}
107);
108
109#[cfg(all(
110    feature = "NSPanel",
111    feature = "NSResponder",
112    feature = "NSSavePanel",
113    feature = "NSUserInterfaceValidation",
114    feature = "NSWindow"
115))]
116extern_conformance!(
117    unsafe impl NSUserInterfaceValidations for NSOpenPanel {}
118);
119
120#[cfg(all(
121    feature = "NSPanel",
122    feature = "NSResponder",
123    feature = "NSSavePanel",
124    feature = "NSWindow"
125))]
126impl NSOpenPanel {
127    extern_methods!(
128        #[unsafe(method(openPanel))]
129        #[unsafe(method_family = none)]
130        pub fn openPanel(mtm: MainThreadMarker) -> Retained<NSOpenPanel>;
131
132        #[unsafe(method(URLs))]
133        #[unsafe(method_family = none)]
134        pub fn URLs(&self) -> Retained<NSArray<NSURL>>;
135
136        #[unsafe(method(resolvesAliases))]
137        #[unsafe(method_family = none)]
138        pub fn resolvesAliases(&self) -> bool;
139
140        /// Setter for [`resolvesAliases`][Self::resolvesAliases].
141        #[unsafe(method(setResolvesAliases:))]
142        #[unsafe(method_family = none)]
143        pub fn setResolvesAliases(&self, resolves_aliases: bool);
144
145        #[unsafe(method(canChooseDirectories))]
146        #[unsafe(method_family = none)]
147        pub fn canChooseDirectories(&self) -> bool;
148
149        /// Setter for [`canChooseDirectories`][Self::canChooseDirectories].
150        #[unsafe(method(setCanChooseDirectories:))]
151        #[unsafe(method_family = none)]
152        pub fn setCanChooseDirectories(&self, can_choose_directories: bool);
153
154        #[unsafe(method(allowsMultipleSelection))]
155        #[unsafe(method_family = none)]
156        pub fn allowsMultipleSelection(&self) -> bool;
157
158        /// Setter for [`allowsMultipleSelection`][Self::allowsMultipleSelection].
159        #[unsafe(method(setAllowsMultipleSelection:))]
160        #[unsafe(method_family = none)]
161        pub fn setAllowsMultipleSelection(&self, allows_multiple_selection: bool);
162
163        #[unsafe(method(canChooseFiles))]
164        #[unsafe(method_family = none)]
165        pub fn canChooseFiles(&self) -> bool;
166
167        /// Setter for [`canChooseFiles`][Self::canChooseFiles].
168        #[unsafe(method(setCanChooseFiles:))]
169        #[unsafe(method_family = none)]
170        pub fn setCanChooseFiles(&self, can_choose_files: bool);
171
172        #[unsafe(method(canResolveUbiquitousConflicts))]
173        #[unsafe(method_family = none)]
174        pub fn canResolveUbiquitousConflicts(&self) -> bool;
175
176        /// Setter for [`canResolveUbiquitousConflicts`][Self::canResolveUbiquitousConflicts].
177        #[unsafe(method(setCanResolveUbiquitousConflicts:))]
178        #[unsafe(method_family = none)]
179        pub fn setCanResolveUbiquitousConflicts(&self, can_resolve_ubiquitous_conflicts: bool);
180
181        #[unsafe(method(canDownloadUbiquitousContents))]
182        #[unsafe(method_family = none)]
183        pub fn canDownloadUbiquitousContents(&self) -> bool;
184
185        /// Setter for [`canDownloadUbiquitousContents`][Self::canDownloadUbiquitousContents].
186        #[unsafe(method(setCanDownloadUbiquitousContents:))]
187        #[unsafe(method_family = none)]
188        pub fn setCanDownloadUbiquitousContents(&self, can_download_ubiquitous_contents: bool);
189
190        #[unsafe(method(isAccessoryViewDisclosed))]
191        #[unsafe(method_family = none)]
192        pub fn isAccessoryViewDisclosed(&self) -> bool;
193
194        /// Setter for [`isAccessoryViewDisclosed`][Self::isAccessoryViewDisclosed].
195        #[unsafe(method(setAccessoryViewDisclosed:))]
196        #[unsafe(method_family = none)]
197        pub fn setAccessoryViewDisclosed(&self, accessory_view_disclosed: bool);
198    );
199}
200
201/// Methods declared on superclass `NSWindow`.
202#[cfg(all(
203    feature = "NSPanel",
204    feature = "NSResponder",
205    feature = "NSSavePanel",
206    feature = "NSWindow"
207))]
208impl NSOpenPanel {
209    extern_methods!(
210        #[cfg(feature = "NSGraphics")]
211        #[unsafe(method(initWithContentRect:styleMask:backing:defer:))]
212        #[unsafe(method_family = init)]
213        pub unsafe fn initWithContentRect_styleMask_backing_defer(
214            this: Allocated<Self>,
215            content_rect: NSRect,
216            style: NSWindowStyleMask,
217            backing_store_type: NSBackingStoreType,
218            flag: bool,
219        ) -> Retained<Self>;
220
221        #[cfg(all(feature = "NSGraphics", feature = "NSScreen"))]
222        #[unsafe(method(initWithContentRect:styleMask:backing:defer:screen:))]
223        #[unsafe(method_family = init)]
224        pub unsafe fn initWithContentRect_styleMask_backing_defer_screen(
225            this: Allocated<Self>,
226            content_rect: NSRect,
227            style: NSWindowStyleMask,
228            backing_store_type: NSBackingStoreType,
229            flag: bool,
230            screen: Option<&NSScreen>,
231        ) -> Retained<Self>;
232
233        /// # Safety
234        ///
235        /// `coder` possibly has further requirements.
236        #[unsafe(method(initWithCoder:))]
237        #[unsafe(method_family = init)]
238        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
239
240        #[cfg(feature = "NSViewController")]
241        /// Convenience method for creating an autoreleased titled window with the given contentViewController. A basic NSWindow with the following attributes is made: titled, closable, resizable, miniaturizable. The window's title is automatically bound to the contentViewController's title. The size of the window can easily be controlled by utilizing autolayout and applying size constraints to the view (or its subviews). The window has isReleasedWhenClosed set to NO, and it must be explicitly retained to keep the window instance alive. To have it automatically be freed when it is closed, do the following: [window retain] and [window setReleasedWhenClosed:YES].
242        #[unsafe(method(windowWithContentViewController:))]
243        #[unsafe(method_family = none)]
244        pub fn windowWithContentViewController(
245            content_view_controller: &NSViewController,
246        ) -> Retained<Self>;
247    );
248}
249
250/// Methods declared on superclass `NSResponder`.
251#[cfg(all(
252    feature = "NSPanel",
253    feature = "NSResponder",
254    feature = "NSSavePanel",
255    feature = "NSWindow"
256))]
257impl NSOpenPanel {
258    extern_methods!(
259        #[unsafe(method(init))]
260        #[unsafe(method_family = init)]
261        pub fn init(this: Allocated<Self>) -> Retained<Self>;
262    );
263}
264
265/// Methods declared on superclass `NSObject`.
266#[cfg(all(
267    feature = "NSPanel",
268    feature = "NSResponder",
269    feature = "NSSavePanel",
270    feature = "NSWindow"
271))]
272impl NSOpenPanel {
273    extern_methods!(
274        #[unsafe(method(new))]
275        #[unsafe(method_family = new)]
276        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
277    );
278}
279
280/// InheritedAndUnavailable.
281#[cfg(all(
282    feature = "NSPanel",
283    feature = "NSResponder",
284    feature = "NSSavePanel",
285    feature = "NSWindow"
286))]
287impl NSOpenPanel {
288    extern_methods!(
289        #[unsafe(method(showsContentTypes))]
290        #[unsafe(method_family = none)]
291        pub unsafe fn showsContentTypes(&self) -> bool;
292
293        /// Setter for [`showsContentTypes`][Self::showsContentTypes].
294        #[unsafe(method(setShowsContentTypes:))]
295        #[unsafe(method_family = none)]
296        pub unsafe fn setShowsContentTypes(&self, shows_content_types: bool);
297    );
298}
299
300/// NSDeprecated.
301#[cfg(all(
302    feature = "NSPanel",
303    feature = "NSResponder",
304    feature = "NSSavePanel",
305    feature = "NSWindow"
306))]
307impl NSOpenPanel {
308    extern_methods!(
309        #[deprecated]
310        #[unsafe(method(filenames))]
311        #[unsafe(method_family = none)]
312        pub fn filenames(&self) -> Retained<NSArray>;
313
314        /// # Safety
315        ///
316        /// - `file_types` generic should be of the correct type.
317        /// - `delegate` should be of the correct type.
318        /// - `did_end_selector` must be a valid selector.
319        /// - `context_info` must be a valid pointer or null.
320        #[deprecated]
321        #[unsafe(method(beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo:))]
322        #[unsafe(method_family = none)]
323        pub unsafe fn beginSheetForDirectory_file_types_modalForWindow_modalDelegate_didEndSelector_contextInfo(
324            &self,
325            path: Option<&NSString>,
326            name: Option<&NSString>,
327            file_types: Option<&NSArray>,
328            doc_window: Option<&NSWindow>,
329            delegate: Option<&AnyObject>,
330            did_end_selector: Option<Sel>,
331            context_info: *mut c_void,
332        );
333
334        /// # Safety
335        ///
336        /// - `file_types` generic should be of the correct type.
337        /// - `delegate` should be of the correct type.
338        /// - `did_end_selector` must be a valid selector.
339        /// - `context_info` must be a valid pointer or null.
340        #[deprecated]
341        #[unsafe(method(beginForDirectory:file:types:modelessDelegate:didEndSelector:contextInfo:))]
342        #[unsafe(method_family = none)]
343        pub unsafe fn beginForDirectory_file_types_modelessDelegate_didEndSelector_contextInfo(
344            &self,
345            path: Option<&NSString>,
346            name: Option<&NSString>,
347            file_types: Option<&NSArray>,
348            delegate: Option<&AnyObject>,
349            did_end_selector: Option<Sel>,
350            context_info: *mut c_void,
351        );
352
353        /// # Safety
354        ///
355        /// `file_types` generic should be of the correct type.
356        #[deprecated]
357        #[unsafe(method(runModalForDirectory:file:types:))]
358        #[unsafe(method_family = none)]
359        pub unsafe fn runModalForDirectory_file_types(
360            &self,
361            path: Option<&NSString>,
362            name: Option<&NSString>,
363            file_types: Option<&NSArray>,
364        ) -> NSInteger;
365
366        /// # Safety
367        ///
368        /// `file_types` generic should be of the correct type.
369        #[deprecated]
370        #[unsafe(method(runModalForTypes:))]
371        #[unsafe(method_family = none)]
372        pub unsafe fn runModalForTypes(&self, file_types: Option<&NSArray>) -> NSInteger;
373    );
374}