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))]
30unsafe impl NSAccessibility for NSOpenPanel {}
31
32#[cfg(all(
33    feature = "NSAccessibilityProtocols",
34    feature = "NSPanel",
35    feature = "NSResponder",
36    feature = "NSSavePanel",
37    feature = "NSWindow"
38))]
39unsafe impl NSAccessibilityElementProtocol for NSOpenPanel {}
40
41#[cfg(all(
42    feature = "NSAnimation",
43    feature = "NSPanel",
44    feature = "NSResponder",
45    feature = "NSSavePanel",
46    feature = "NSWindow"
47))]
48unsafe impl NSAnimatablePropertyContainer for NSOpenPanel {}
49
50#[cfg(all(
51    feature = "NSAppearance",
52    feature = "NSPanel",
53    feature = "NSResponder",
54    feature = "NSSavePanel",
55    feature = "NSWindow"
56))]
57unsafe impl NSAppearanceCustomization for NSOpenPanel {}
58
59#[cfg(all(
60    feature = "NSPanel",
61    feature = "NSResponder",
62    feature = "NSSavePanel",
63    feature = "NSWindow"
64))]
65unsafe impl NSCoding for NSOpenPanel {}
66
67#[cfg(all(
68    feature = "NSMenu",
69    feature = "NSPanel",
70    feature = "NSResponder",
71    feature = "NSSavePanel",
72    feature = "NSWindow"
73))]
74unsafe impl NSMenuItemValidation for NSOpenPanel {}
75
76#[cfg(all(
77    feature = "NSPanel",
78    feature = "NSResponder",
79    feature = "NSSavePanel",
80    feature = "NSWindow"
81))]
82unsafe impl NSObjectProtocol for NSOpenPanel {}
83
84#[cfg(all(
85    feature = "NSPanel",
86    feature = "NSResponder",
87    feature = "NSSavePanel",
88    feature = "NSUserInterfaceItemIdentification",
89    feature = "NSWindow"
90))]
91unsafe impl NSUserInterfaceItemIdentification for NSOpenPanel {}
92
93#[cfg(all(
94    feature = "NSPanel",
95    feature = "NSResponder",
96    feature = "NSSavePanel",
97    feature = "NSUserInterfaceValidation",
98    feature = "NSWindow"
99))]
100unsafe impl NSUserInterfaceValidations for NSOpenPanel {}
101
102#[cfg(all(
103    feature = "NSPanel",
104    feature = "NSResponder",
105    feature = "NSSavePanel",
106    feature = "NSWindow"
107))]
108impl NSOpenPanel {
109    extern_methods!(
110        #[unsafe(method(openPanel))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn openPanel(mtm: MainThreadMarker) -> Retained<NSOpenPanel>;
113
114        #[unsafe(method(URLs))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn URLs(&self) -> Retained<NSArray<NSURL>>;
117
118        #[unsafe(method(resolvesAliases))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn resolvesAliases(&self) -> bool;
121
122        /// Setter for [`resolvesAliases`][Self::resolvesAliases].
123        #[unsafe(method(setResolvesAliases:))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn setResolvesAliases(&self, resolves_aliases: bool);
126
127        #[unsafe(method(canChooseDirectories))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn canChooseDirectories(&self) -> bool;
130
131        /// Setter for [`canChooseDirectories`][Self::canChooseDirectories].
132        #[unsafe(method(setCanChooseDirectories:))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn setCanChooseDirectories(&self, can_choose_directories: bool);
135
136        #[unsafe(method(allowsMultipleSelection))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn allowsMultipleSelection(&self) -> bool;
139
140        /// Setter for [`allowsMultipleSelection`][Self::allowsMultipleSelection].
141        #[unsafe(method(setAllowsMultipleSelection:))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn setAllowsMultipleSelection(&self, allows_multiple_selection: bool);
144
145        #[unsafe(method(canChooseFiles))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn canChooseFiles(&self) -> bool;
148
149        /// Setter for [`canChooseFiles`][Self::canChooseFiles].
150        #[unsafe(method(setCanChooseFiles:))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn setCanChooseFiles(&self, can_choose_files: bool);
153
154        #[unsafe(method(canResolveUbiquitousConflicts))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn canResolveUbiquitousConflicts(&self) -> bool;
157
158        /// Setter for [`canResolveUbiquitousConflicts`][Self::canResolveUbiquitousConflicts].
159        #[unsafe(method(setCanResolveUbiquitousConflicts:))]
160        #[unsafe(method_family = none)]
161        pub unsafe fn setCanResolveUbiquitousConflicts(
162            &self,
163            can_resolve_ubiquitous_conflicts: bool,
164        );
165
166        #[unsafe(method(canDownloadUbiquitousContents))]
167        #[unsafe(method_family = none)]
168        pub unsafe fn canDownloadUbiquitousContents(&self) -> bool;
169
170        /// Setter for [`canDownloadUbiquitousContents`][Self::canDownloadUbiquitousContents].
171        #[unsafe(method(setCanDownloadUbiquitousContents:))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn setCanDownloadUbiquitousContents(
174            &self,
175            can_download_ubiquitous_contents: bool,
176        );
177
178        #[unsafe(method(isAccessoryViewDisclosed))]
179        #[unsafe(method_family = none)]
180        pub unsafe fn isAccessoryViewDisclosed(&self) -> bool;
181
182        /// Setter for [`isAccessoryViewDisclosed`][Self::isAccessoryViewDisclosed].
183        #[unsafe(method(setAccessoryViewDisclosed:))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn setAccessoryViewDisclosed(&self, accessory_view_disclosed: bool);
186    );
187}
188
189/// Methods declared on superclass `NSWindow`.
190#[cfg(all(
191    feature = "NSPanel",
192    feature = "NSResponder",
193    feature = "NSSavePanel",
194    feature = "NSWindow"
195))]
196impl NSOpenPanel {
197    extern_methods!(
198        #[cfg(feature = "NSGraphics")]
199        #[unsafe(method(initWithContentRect:styleMask:backing:defer:))]
200        #[unsafe(method_family = init)]
201        pub unsafe fn initWithContentRect_styleMask_backing_defer(
202            this: Allocated<Self>,
203            content_rect: NSRect,
204            style: NSWindowStyleMask,
205            backing_store_type: NSBackingStoreType,
206            flag: bool,
207        ) -> Retained<Self>;
208
209        #[cfg(all(feature = "NSGraphics", feature = "NSScreen"))]
210        #[unsafe(method(initWithContentRect:styleMask:backing:defer:screen:))]
211        #[unsafe(method_family = init)]
212        pub unsafe fn initWithContentRect_styleMask_backing_defer_screen(
213            this: Allocated<Self>,
214            content_rect: NSRect,
215            style: NSWindowStyleMask,
216            backing_store_type: NSBackingStoreType,
217            flag: bool,
218            screen: Option<&NSScreen>,
219        ) -> Retained<Self>;
220
221        #[unsafe(method(initWithCoder:))]
222        #[unsafe(method_family = init)]
223        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
224
225        #[cfg(feature = "NSViewController")]
226        /// 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].
227        #[unsafe(method(windowWithContentViewController:))]
228        #[unsafe(method_family = none)]
229        pub unsafe fn windowWithContentViewController(
230            content_view_controller: &NSViewController,
231        ) -> Retained<Self>;
232    );
233}
234
235/// Methods declared on superclass `NSResponder`.
236#[cfg(all(
237    feature = "NSPanel",
238    feature = "NSResponder",
239    feature = "NSSavePanel",
240    feature = "NSWindow"
241))]
242impl NSOpenPanel {
243    extern_methods!(
244        #[unsafe(method(init))]
245        #[unsafe(method_family = init)]
246        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
247    );
248}
249
250/// Methods declared on superclass `NSObject`.
251#[cfg(all(
252    feature = "NSPanel",
253    feature = "NSResponder",
254    feature = "NSSavePanel",
255    feature = "NSWindow"
256))]
257impl NSOpenPanel {
258    extern_methods!(
259        #[unsafe(method(new))]
260        #[unsafe(method_family = new)]
261        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
262    );
263}
264
265/// InheritedAndUnavailable.
266#[cfg(all(
267    feature = "NSPanel",
268    feature = "NSResponder",
269    feature = "NSSavePanel",
270    feature = "NSWindow"
271))]
272impl NSOpenPanel {
273    extern_methods!(
274        #[unsafe(method(showsContentTypes))]
275        #[unsafe(method_family = none)]
276        pub unsafe fn showsContentTypes(&self) -> bool;
277
278        /// Setter for [`showsContentTypes`][Self::showsContentTypes].
279        #[unsafe(method(setShowsContentTypes:))]
280        #[unsafe(method_family = none)]
281        pub unsafe fn setShowsContentTypes(&self, shows_content_types: bool);
282    );
283}
284
285/// NSDeprecated.
286#[cfg(all(
287    feature = "NSPanel",
288    feature = "NSResponder",
289    feature = "NSSavePanel",
290    feature = "NSWindow"
291))]
292impl NSOpenPanel {
293    extern_methods!(
294        #[deprecated]
295        #[unsafe(method(filenames))]
296        #[unsafe(method_family = none)]
297        pub unsafe fn filenames(&self) -> Retained<NSArray>;
298
299        #[deprecated]
300        #[unsafe(method(beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo:))]
301        #[unsafe(method_family = none)]
302        pub unsafe fn beginSheetForDirectory_file_types_modalForWindow_modalDelegate_didEndSelector_contextInfo(
303            &self,
304            path: Option<&NSString>,
305            name: Option<&NSString>,
306            file_types: Option<&NSArray>,
307            doc_window: Option<&NSWindow>,
308            delegate: Option<&AnyObject>,
309            did_end_selector: Option<Sel>,
310            context_info: *mut c_void,
311        );
312
313        #[deprecated]
314        #[unsafe(method(beginForDirectory:file:types:modelessDelegate:didEndSelector:contextInfo:))]
315        #[unsafe(method_family = none)]
316        pub unsafe fn beginForDirectory_file_types_modelessDelegate_didEndSelector_contextInfo(
317            &self,
318            path: Option<&NSString>,
319            name: Option<&NSString>,
320            file_types: Option<&NSArray>,
321            delegate: Option<&AnyObject>,
322            did_end_selector: Option<Sel>,
323            context_info: *mut c_void,
324        );
325
326        #[deprecated]
327        #[unsafe(method(runModalForDirectory:file:types:))]
328        #[unsafe(method_family = none)]
329        pub unsafe fn runModalForDirectory_file_types(
330            &self,
331            path: Option<&NSString>,
332            name: Option<&NSString>,
333            file_types: Option<&NSArray>,
334        ) -> NSInteger;
335
336        #[deprecated]
337        #[unsafe(method(runModalForTypes:))]
338        #[unsafe(method_family = none)]
339        pub unsafe fn runModalForTypes(&self, file_types: Option<&NSArray>) -> NSInteger;
340    );
341}