1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
#[cfg(feature = "block2")]
use block2::*;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
    pub struct NSSavePanel;

    #[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
    unsafe impl ClassType for NSSavePanel {
        #[inherits(NSWindow, NSResponder, NSObject)]
        type Super = NSPanel;
        type Mutability = MainThreadOnly;
    }
);

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSPanel",
    feature = "NSResponder",
    feature = "NSWindow"
))]
unsafe impl NSAccessibility for NSSavePanel {}

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSPanel",
    feature = "NSResponder",
    feature = "NSWindow"
))]
unsafe impl NSAccessibilityElementProtocol for NSSavePanel {}

#[cfg(all(
    feature = "NSAnimation",
    feature = "NSPanel",
    feature = "NSResponder",
    feature = "NSWindow"
))]
unsafe impl NSAnimatablePropertyContainer for NSSavePanel {}

#[cfg(all(
    feature = "NSAppearance",
    feature = "NSPanel",
    feature = "NSResponder",
    feature = "NSWindow"
))]
unsafe impl NSAppearanceCustomization for NSSavePanel {}

#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
unsafe impl NSCoding for NSSavePanel {}

#[cfg(all(
    feature = "NSMenu",
    feature = "NSPanel",
    feature = "NSResponder",
    feature = "NSWindow"
))]
unsafe impl NSMenuItemValidation for NSSavePanel {}

#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
unsafe impl NSObjectProtocol for NSSavePanel {}

#[cfg(all(
    feature = "NSPanel",
    feature = "NSResponder",
    feature = "NSUserInterfaceItemIdentification",
    feature = "NSWindow"
))]
unsafe impl NSUserInterfaceItemIdentification for NSSavePanel {}

#[cfg(all(
    feature = "NSPanel",
    feature = "NSResponder",
    feature = "NSUserInterfaceValidation",
    feature = "NSWindow"
))]
unsafe impl NSUserInterfaceValidations for NSSavePanel {}

extern_methods!(
    #[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
    unsafe impl NSSavePanel {
        #[method_id(@__retain_semantics Other savePanel)]
        pub unsafe fn savePanel(mtm: MainThreadMarker) -> Id<NSSavePanel>;

        #[method_id(@__retain_semantics Other URL)]
        pub unsafe fn URL(&self) -> Option<Id<NSURL>>;

        #[cfg(feature = "NSUserInterfaceItemIdentification")]
        #[method_id(@__retain_semantics Other identifier)]
        pub unsafe fn identifier(&self) -> Option<Id<NSUserInterfaceItemIdentifier>>;

        #[cfg(feature = "NSUserInterfaceItemIdentification")]
        #[method(setIdentifier:)]
        pub unsafe fn setIdentifier(&self, identifier: Option<&NSUserInterfaceItemIdentifier>);

        #[method_id(@__retain_semantics Other directoryURL)]
        pub unsafe fn directoryURL(&self) -> Option<Id<NSURL>>;

        #[method(setDirectoryURL:)]
        pub unsafe fn setDirectoryURL(&self, directory_url: Option<&NSURL>);

        #[method(allowsOtherFileTypes)]
        pub unsafe fn allowsOtherFileTypes(&self) -> bool;

        #[method(setAllowsOtherFileTypes:)]
        pub unsafe fn setAllowsOtherFileTypes(&self, allows_other_file_types: bool);

        #[cfg(feature = "NSView")]
        #[method_id(@__retain_semantics Other accessoryView)]
        pub unsafe fn accessoryView(&self) -> Option<Id<NSView>>;

        #[cfg(feature = "NSView")]
        #[method(setAccessoryView:)]
        pub unsafe fn setAccessoryView(&self, accessory_view: Option<&NSView>);

        #[method_id(@__retain_semantics Other delegate)]
        pub unsafe fn delegate(&self) -> Option<Id<ProtocolObject<dyn NSOpenSavePanelDelegate>>>;

        #[method(setDelegate:)]
        pub unsafe fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn NSOpenSavePanelDelegate>>,
        );

        #[method(isExpanded)]
        pub unsafe fn isExpanded(&self) -> bool;

        #[method(canCreateDirectories)]
        pub unsafe fn canCreateDirectories(&self) -> bool;

        #[method(setCanCreateDirectories:)]
        pub unsafe fn setCanCreateDirectories(&self, can_create_directories: bool);

        #[method(canSelectHiddenExtension)]
        pub unsafe fn canSelectHiddenExtension(&self) -> bool;

        #[method(setCanSelectHiddenExtension:)]
        pub unsafe fn setCanSelectHiddenExtension(&self, can_select_hidden_extension: bool);

        #[method(isExtensionHidden)]
        pub unsafe fn isExtensionHidden(&self) -> bool;

        #[method(setExtensionHidden:)]
        pub unsafe fn setExtensionHidden(&self, extension_hidden: bool);

        #[method(treatsFilePackagesAsDirectories)]
        pub unsafe fn treatsFilePackagesAsDirectories(&self) -> bool;

        #[method(setTreatsFilePackagesAsDirectories:)]
        pub unsafe fn setTreatsFilePackagesAsDirectories(
            &self,
            treats_file_packages_as_directories: bool,
        );

        #[method_id(@__retain_semantics Other prompt)]
        pub unsafe fn prompt(&self) -> Id<NSString>;

        #[method(setPrompt:)]
        pub unsafe fn setPrompt(&self, prompt: Option<&NSString>);

        #[method_id(@__retain_semantics Other title)]
        pub unsafe fn title(&self) -> Id<NSString>;

        #[method(setTitle:)]
        pub unsafe fn setTitle(&self, title: Option<&NSString>);

        #[method_id(@__retain_semantics Other nameFieldLabel)]
        pub unsafe fn nameFieldLabel(&self) -> Id<NSString>;

        #[method(setNameFieldLabel:)]
        pub unsafe fn setNameFieldLabel(&self, name_field_label: Option<&NSString>);

        #[method_id(@__retain_semantics Other nameFieldStringValue)]
        pub unsafe fn nameFieldStringValue(&self) -> Id<NSString>;

        #[method(setNameFieldStringValue:)]
        pub unsafe fn setNameFieldStringValue(&self, name_field_string_value: &NSString);

        #[method_id(@__retain_semantics Other message)]
        pub unsafe fn message(&self) -> Id<NSString>;

        #[method(setMessage:)]
        pub unsafe fn setMessage(&self, message: Option<&NSString>);

        #[method(validateVisibleColumns)]
        pub unsafe fn validateVisibleColumns(&self);

        #[method(showsHiddenFiles)]
        pub unsafe fn showsHiddenFiles(&self) -> bool;

        #[method(setShowsHiddenFiles:)]
        pub unsafe fn setShowsHiddenFiles(&self, shows_hidden_files: bool);

        #[method(showsTagField)]
        pub unsafe fn showsTagField(&self) -> bool;

        #[method(setShowsTagField:)]
        pub unsafe fn setShowsTagField(&self, shows_tag_field: bool);

        #[method_id(@__retain_semantics Other tagNames)]
        pub unsafe fn tagNames(&self) -> Option<Id<NSArray<NSString>>>;

        #[method(setTagNames:)]
        pub unsafe fn setTagNames(&self, tag_names: Option<&NSArray<NSString>>);

        #[method(ok:)]
        pub unsafe fn ok(&self, sender: Option<&AnyObject>);

        #[method(cancel:)]
        pub unsafe fn cancel(&self, sender: Option<&AnyObject>);

        #[cfg(all(feature = "NSApplication", feature = "block2"))]
        #[method(beginSheetModalForWindow:completionHandler:)]
        pub unsafe fn beginSheetModalForWindow_completionHandler(
            &self,
            window: &NSWindow,
            handler: &Block<dyn Fn(NSModalResponse)>,
        );

        #[cfg(all(feature = "NSApplication", feature = "block2"))]
        #[method(beginWithCompletionHandler:)]
        pub unsafe fn beginWithCompletionHandler(&self, handler: &Block<dyn Fn(NSModalResponse)>);

        #[cfg(feature = "NSApplication")]
        #[method(runModal)]
        pub unsafe fn runModal(&self) -> NSModalResponse;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSWindow`
    #[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
    unsafe impl NSSavePanel {
        #[cfg(feature = "NSGraphics")]
        #[method_id(@__retain_semantics Init initWithContentRect:styleMask:backing:defer:)]
        pub unsafe fn initWithContentRect_styleMask_backing_defer(
            this: Allocated<Self>,
            content_rect: NSRect,
            style: NSWindowStyleMask,
            backing_store_type: NSBackingStoreType,
            flag: bool,
        ) -> Id<Self>;

        #[cfg(all(feature = "NSGraphics", feature = "NSScreen"))]
        #[method_id(@__retain_semantics Init initWithContentRect:styleMask:backing:defer:screen:)]
        pub unsafe fn initWithContentRect_styleMask_backing_defer_screen(
            this: Allocated<Self>,
            content_rect: NSRect,
            style: NSWindowStyleMask,
            backing_store_type: NSBackingStoreType,
            flag: bool,
            screen: Option<&NSScreen>,
        ) -> Id<Self>;

        #[method_id(@__retain_semantics Init initWithCoder:)]
        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Id<Self>;

        #[cfg(feature = "NSViewController")]
        #[method_id(@__retain_semantics Other windowWithContentViewController:)]
        pub unsafe fn windowWithContentViewController(
            content_view_controller: &NSViewController,
        ) -> Id<Self>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSResponder`
    #[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
    unsafe impl NSSavePanel {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
    unsafe impl NSSavePanel {
        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Id<Self>;
    }
);

extern_protocol!(
    pub unsafe trait NSOpenSavePanelDelegate: NSObjectProtocol + IsMainThreadOnly {
        #[optional]
        #[method(panel:shouldEnableURL:)]
        unsafe fn panel_shouldEnableURL(&self, sender: &AnyObject, url: &NSURL) -> bool;

        #[optional]
        #[method(panel:validateURL:error:_)]
        unsafe fn panel_validateURL_error(
            &self,
            sender: &AnyObject,
            url: &NSURL,
        ) -> Result<(), Id<NSError>>;

        #[optional]
        #[method(panel:didChangeToDirectoryURL:)]
        unsafe fn panel_didChangeToDirectoryURL(&self, sender: &AnyObject, url: Option<&NSURL>);

        #[optional]
        #[method_id(@__retain_semantics Other panel:userEnteredFilename:confirmed:)]
        unsafe fn panel_userEnteredFilename_confirmed(
            &self,
            sender: &AnyObject,
            filename: &NSString,
            ok_flag: bool,
        ) -> Option<Id<NSString>>;

        #[optional]
        #[method(panel:willExpand:)]
        unsafe fn panel_willExpand(&self, sender: &AnyObject, expanding: bool);

        #[optional]
        #[method(panelSelectionDidChange:)]
        unsafe fn panelSelectionDidChange(&self, sender: Option<&AnyObject>);
    }

    unsafe impl ProtocolType for dyn NSOpenSavePanelDelegate {}
);

extern_methods!(
    /// NSDeprecated
    #[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
    unsafe impl NSSavePanel {
        #[deprecated = "Use -URL instead"]
        #[method_id(@__retain_semantics Other filename)]
        pub unsafe fn filename(&self) -> Id<NSString>;

        #[deprecated = "Use -directoryURL instead"]
        #[method_id(@__retain_semantics Other directory)]
        pub unsafe fn directory(&self) -> Id<NSString>;

        #[deprecated = "Use -setDirectoryURL: instead"]
        #[method(setDirectory:)]
        pub unsafe fn setDirectory(&self, path: Option<&NSString>);

        #[deprecated = "Use -allowedFileTypes instead"]
        #[method_id(@__retain_semantics Other requiredFileType)]
        pub unsafe fn requiredFileType(&self) -> Option<Id<NSString>>;

        #[deprecated = "Use -setAllowedFileTypes: instead"]
        #[method(setRequiredFileType:)]
        pub unsafe fn setRequiredFileType(&self, r#type: Option<&NSString>);

        #[deprecated = "Use beginSheetModalForWindow:completionHandler: instead. The following parameters are replaced by properties: 'path' is replaced by 'directoryURL' and 'name' by 'nameFieldStringValue'."]
        #[method(beginSheetForDirectory:file:modalForWindow:modalDelegate:didEndSelector:contextInfo:)]
        pub unsafe fn beginSheetForDirectory_file_modalForWindow_modalDelegate_didEndSelector_contextInfo(
            &self,
            path: &NSString,
            name: Option<&NSString>,
            doc_window: Option<&NSWindow>,
            delegate: Option<&AnyObject>,
            did_end_selector: Option<Sel>,
            context_info: *mut c_void,
        );

        #[deprecated = "Use -runModal instead. The following parameters are replaced by properties: 'path' is replaced by 'directoryURL' and 'name' by 'nameFieldStringValue'."]
        #[method(runModalForDirectory:file:)]
        pub unsafe fn runModalForDirectory_file(
            &self,
            path: Option<&NSString>,
            name: Option<&NSString>,
        ) -> NSInteger;

        #[deprecated = "Default implementation does nothing."]
        #[method(selectText:)]
        pub unsafe fn selectText(&self, sender: Option<&AnyObject>);

        #[deprecated = "Use -allowedContentTypes instead"]
        #[method_id(@__retain_semantics Other allowedFileTypes)]
        pub unsafe fn allowedFileTypes(&self) -> Option<Id<NSArray<NSString>>>;

        #[deprecated = "Use -allowedContentTypes instead"]
        #[method(setAllowedFileTypes:)]
        pub unsafe fn setAllowedFileTypes(&self, allowed_file_types: Option<&NSArray<NSString>>);
    }
);