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 unsafe fn openPanel(mtm: MainThreadMarker) -> Retained<NSOpenPanel>;
131
132        #[unsafe(method(URLs))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn URLs(&self) -> Retained<NSArray<NSURL>>;
135
136        #[unsafe(method(resolvesAliases))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn resolvesAliases(&self) -> bool;
139
140        /// Setter for [`resolvesAliases`][Self::resolvesAliases].
141        #[unsafe(method(setResolvesAliases:))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn setResolvesAliases(&self, resolves_aliases: bool);
144
145        #[unsafe(method(canChooseDirectories))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn canChooseDirectories(&self) -> bool;
148
149        /// Setter for [`canChooseDirectories`][Self::canChooseDirectories].
150        #[unsafe(method(setCanChooseDirectories:))]
151        #[unsafe(method_family = none)]
152        pub unsafe fn setCanChooseDirectories(&self, can_choose_directories: bool);
153
154        #[unsafe(method(allowsMultipleSelection))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn allowsMultipleSelection(&self) -> bool;
157
158        /// Setter for [`allowsMultipleSelection`][Self::allowsMultipleSelection].
159        #[unsafe(method(setAllowsMultipleSelection:))]
160        #[unsafe(method_family = none)]
161        pub unsafe fn setAllowsMultipleSelection(&self, allows_multiple_selection: bool);
162
163        #[unsafe(method(canChooseFiles))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn canChooseFiles(&self) -> bool;
166
167        /// Setter for [`canChooseFiles`][Self::canChooseFiles].
168        #[unsafe(method(setCanChooseFiles:))]
169        #[unsafe(method_family = none)]
170        pub unsafe fn setCanChooseFiles(&self, can_choose_files: bool);
171
172        #[unsafe(method(canResolveUbiquitousConflicts))]
173        #[unsafe(method_family = none)]
174        pub unsafe fn canResolveUbiquitousConflicts(&self) -> bool;
175
176        /// Setter for [`canResolveUbiquitousConflicts`][Self::canResolveUbiquitousConflicts].
177        #[unsafe(method(setCanResolveUbiquitousConflicts:))]
178        #[unsafe(method_family = none)]
179        pub unsafe fn setCanResolveUbiquitousConflicts(
180            &self,
181            can_resolve_ubiquitous_conflicts: bool,
182        );
183
184        #[unsafe(method(canDownloadUbiquitousContents))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn canDownloadUbiquitousContents(&self) -> bool;
187
188        /// Setter for [`canDownloadUbiquitousContents`][Self::canDownloadUbiquitousContents].
189        #[unsafe(method(setCanDownloadUbiquitousContents:))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn setCanDownloadUbiquitousContents(
192            &self,
193            can_download_ubiquitous_contents: bool,
194        );
195
196        #[unsafe(method(isAccessoryViewDisclosed))]
197        #[unsafe(method_family = none)]
198        pub unsafe fn isAccessoryViewDisclosed(&self) -> bool;
199
200        /// Setter for [`isAccessoryViewDisclosed`][Self::isAccessoryViewDisclosed].
201        #[unsafe(method(setAccessoryViewDisclosed:))]
202        #[unsafe(method_family = none)]
203        pub unsafe fn setAccessoryViewDisclosed(&self, accessory_view_disclosed: bool);
204    );
205}
206
207/// Methods declared on superclass `NSWindow`.
208#[cfg(all(
209    feature = "NSPanel",
210    feature = "NSResponder",
211    feature = "NSSavePanel",
212    feature = "NSWindow"
213))]
214impl NSOpenPanel {
215    extern_methods!(
216        #[cfg(feature = "NSGraphics")]
217        #[unsafe(method(initWithContentRect:styleMask:backing:defer:))]
218        #[unsafe(method_family = init)]
219        pub unsafe fn initWithContentRect_styleMask_backing_defer(
220            this: Allocated<Self>,
221            content_rect: NSRect,
222            style: NSWindowStyleMask,
223            backing_store_type: NSBackingStoreType,
224            flag: bool,
225        ) -> Retained<Self>;
226
227        #[cfg(all(feature = "NSGraphics", feature = "NSScreen"))]
228        #[unsafe(method(initWithContentRect:styleMask:backing:defer:screen:))]
229        #[unsafe(method_family = init)]
230        pub unsafe fn initWithContentRect_styleMask_backing_defer_screen(
231            this: Allocated<Self>,
232            content_rect: NSRect,
233            style: NSWindowStyleMask,
234            backing_store_type: NSBackingStoreType,
235            flag: bool,
236            screen: Option<&NSScreen>,
237        ) -> Retained<Self>;
238
239        #[unsafe(method(initWithCoder:))]
240        #[unsafe(method_family = init)]
241        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
242
243        #[cfg(feature = "NSViewController")]
244        /// 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].
245        #[unsafe(method(windowWithContentViewController:))]
246        #[unsafe(method_family = none)]
247        pub unsafe fn windowWithContentViewController(
248            content_view_controller: &NSViewController,
249        ) -> Retained<Self>;
250    );
251}
252
253/// Methods declared on superclass `NSResponder`.
254#[cfg(all(
255    feature = "NSPanel",
256    feature = "NSResponder",
257    feature = "NSSavePanel",
258    feature = "NSWindow"
259))]
260impl NSOpenPanel {
261    extern_methods!(
262        #[unsafe(method(init))]
263        #[unsafe(method_family = init)]
264        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
265    );
266}
267
268/// Methods declared on superclass `NSObject`.
269#[cfg(all(
270    feature = "NSPanel",
271    feature = "NSResponder",
272    feature = "NSSavePanel",
273    feature = "NSWindow"
274))]
275impl NSOpenPanel {
276    extern_methods!(
277        #[unsafe(method(new))]
278        #[unsafe(method_family = new)]
279        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
280    );
281}
282
283/// InheritedAndUnavailable.
284#[cfg(all(
285    feature = "NSPanel",
286    feature = "NSResponder",
287    feature = "NSSavePanel",
288    feature = "NSWindow"
289))]
290impl NSOpenPanel {
291    extern_methods!(
292        #[unsafe(method(showsContentTypes))]
293        #[unsafe(method_family = none)]
294        pub unsafe fn showsContentTypes(&self) -> bool;
295
296        /// Setter for [`showsContentTypes`][Self::showsContentTypes].
297        #[unsafe(method(setShowsContentTypes:))]
298        #[unsafe(method_family = none)]
299        pub unsafe fn setShowsContentTypes(&self, shows_content_types: bool);
300    );
301}
302
303/// NSDeprecated.
304#[cfg(all(
305    feature = "NSPanel",
306    feature = "NSResponder",
307    feature = "NSSavePanel",
308    feature = "NSWindow"
309))]
310impl NSOpenPanel {
311    extern_methods!(
312        #[deprecated]
313        #[unsafe(method(filenames))]
314        #[unsafe(method_family = none)]
315        pub unsafe fn filenames(&self) -> Retained<NSArray>;
316
317        #[deprecated]
318        #[unsafe(method(beginSheetForDirectory:file:types:modalForWindow:modalDelegate:didEndSelector:contextInfo:))]
319        #[unsafe(method_family = none)]
320        pub unsafe fn beginSheetForDirectory_file_types_modalForWindow_modalDelegate_didEndSelector_contextInfo(
321            &self,
322            path: Option<&NSString>,
323            name: Option<&NSString>,
324            file_types: Option<&NSArray>,
325            doc_window: Option<&NSWindow>,
326            delegate: Option<&AnyObject>,
327            did_end_selector: Option<Sel>,
328            context_info: *mut c_void,
329        );
330
331        #[deprecated]
332        #[unsafe(method(beginForDirectory:file:types:modelessDelegate:didEndSelector:contextInfo:))]
333        #[unsafe(method_family = none)]
334        pub unsafe fn beginForDirectory_file_types_modelessDelegate_didEndSelector_contextInfo(
335            &self,
336            path: Option<&NSString>,
337            name: Option<&NSString>,
338            file_types: Option<&NSArray>,
339            delegate: Option<&AnyObject>,
340            did_end_selector: Option<Sel>,
341            context_info: *mut c_void,
342        );
343
344        #[deprecated]
345        #[unsafe(method(runModalForDirectory:file:types:))]
346        #[unsafe(method_family = none)]
347        pub unsafe fn runModalForDirectory_file_types(
348            &self,
349            path: Option<&NSString>,
350            name: Option<&NSString>,
351            file_types: Option<&NSArray>,
352        ) -> NSInteger;
353
354        #[deprecated]
355        #[unsafe(method(runModalForTypes:))]
356        #[unsafe(method_family = none)]
357        pub unsafe fn runModalForTypes(&self, file_types: Option<&NSArray>) -> NSInteger;
358    );
359}