objc2_app_kit/generated/
NSApplication.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7use objc2::__framework_prelude::*;
8#[cfg(feature = "objc2-cloud-kit")]
9#[cfg(target_vendor = "apple")]
10use objc2_cloud_kit::*;
11use objc2_foundation::*;
12
13use crate::*;
14
15/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversion?language=objc)
16// NS_TYPED_EXTENSIBLE_ENUM
17pub type NSAppKitVersion = c_double;
18
19extern "C" {
20    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber?language=objc)
21    pub static NSAppKitVersionNumber: NSAppKitVersion;
22}
23
24/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_0?language=objc)
25pub static NSAppKitVersionNumber10_0: NSAppKitVersion = 577 as _;
26
27/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_1?language=objc)
28pub static NSAppKitVersionNumber10_1: NSAppKitVersion = 620 as _;
29
30/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_2?language=objc)
31pub static NSAppKitVersionNumber10_2: NSAppKitVersion = 663 as _;
32
33/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_2_3?language=objc)
34pub static NSAppKitVersionNumber10_2_3: NSAppKitVersion = 663.6 as _;
35
36/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_3?language=objc)
37pub static NSAppKitVersionNumber10_3: NSAppKitVersion = 743 as _;
38
39/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_3_2?language=objc)
40pub static NSAppKitVersionNumber10_3_2: NSAppKitVersion = 743.14 as _;
41
42/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_3_3?language=objc)
43pub static NSAppKitVersionNumber10_3_3: NSAppKitVersion = 743.2 as _;
44
45/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_3_5?language=objc)
46pub static NSAppKitVersionNumber10_3_5: NSAppKitVersion = 743.24 as _;
47
48/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_3_7?language=objc)
49pub static NSAppKitVersionNumber10_3_7: NSAppKitVersion = 743.33 as _;
50
51/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_3_9?language=objc)
52pub static NSAppKitVersionNumber10_3_9: NSAppKitVersion = 743.36 as _;
53
54/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_4?language=objc)
55pub static NSAppKitVersionNumber10_4: NSAppKitVersion = 824 as _;
56
57/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_4_1?language=objc)
58pub static NSAppKitVersionNumber10_4_1: NSAppKitVersion = 824.1 as _;
59
60/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_4_3?language=objc)
61pub static NSAppKitVersionNumber10_4_3: NSAppKitVersion = 824.23 as _;
62
63/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_4_4?language=objc)
64pub static NSAppKitVersionNumber10_4_4: NSAppKitVersion = 824.33 as _;
65
66/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_4_7?language=objc)
67pub static NSAppKitVersionNumber10_4_7: NSAppKitVersion = 824.41 as _;
68
69/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_5?language=objc)
70pub static NSAppKitVersionNumber10_5: NSAppKitVersion = 949 as _;
71
72/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_5_2?language=objc)
73pub static NSAppKitVersionNumber10_5_2: NSAppKitVersion = 949.27 as _;
74
75/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_5_3?language=objc)
76pub static NSAppKitVersionNumber10_5_3: NSAppKitVersion = 949.33 as _;
77
78/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_6?language=objc)
79pub static NSAppKitVersionNumber10_6: NSAppKitVersion = 1038 as _;
80
81/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_7?language=objc)
82pub static NSAppKitVersionNumber10_7: NSAppKitVersion = 1138 as _;
83
84/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_7_2?language=objc)
85pub static NSAppKitVersionNumber10_7_2: NSAppKitVersion = 1138.23 as _;
86
87/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_7_3?language=objc)
88pub static NSAppKitVersionNumber10_7_3: NSAppKitVersion = 1138.32 as _;
89
90/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_7_4?language=objc)
91pub static NSAppKitVersionNumber10_7_4: NSAppKitVersion = 1138.47 as _;
92
93/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_8?language=objc)
94pub static NSAppKitVersionNumber10_8: NSAppKitVersion = 1187 as _;
95
96/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_9?language=objc)
97pub static NSAppKitVersionNumber10_9: NSAppKitVersion = 1265 as _;
98
99/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_10?language=objc)
100pub static NSAppKitVersionNumber10_10: NSAppKitVersion = 1343 as _;
101
102/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_10_2?language=objc)
103pub static NSAppKitVersionNumber10_10_2: NSAppKitVersion = 1344 as _;
104
105/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_10_3?language=objc)
106pub static NSAppKitVersionNumber10_10_3: NSAppKitVersion = 1347 as _;
107
108/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_10_4?language=objc)
109pub static NSAppKitVersionNumber10_10_4: NSAppKitVersion = 1348 as _;
110
111/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_10_5?language=objc)
112pub static NSAppKitVersionNumber10_10_5: NSAppKitVersion = 1348 as _;
113
114/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_10_max?language=objc)
115pub static NSAppKitVersionNumber10_10_Max: NSAppKitVersion = 1349 as _;
116
117/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_11?language=objc)
118pub static NSAppKitVersionNumber10_11: NSAppKitVersion = 1404 as _;
119
120/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_11_1?language=objc)
121pub static NSAppKitVersionNumber10_11_1: NSAppKitVersion = 1404.13 as _;
122
123/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_11_2?language=objc)
124pub static NSAppKitVersionNumber10_11_2: NSAppKitVersion = 1404.34 as _;
125
126/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_11_3?language=objc)
127pub static NSAppKitVersionNumber10_11_3: NSAppKitVersion = 1404.34 as _;
128
129/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_12?language=objc)
130pub static NSAppKitVersionNumber10_12: NSAppKitVersion = 1504 as _;
131
132/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_12_1?language=objc)
133pub static NSAppKitVersionNumber10_12_1: NSAppKitVersion = 1504.6 as _;
134
135/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_12_2?language=objc)
136pub static NSAppKitVersionNumber10_12_2: NSAppKitVersion = 1504.76 as _;
137
138/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_13?language=objc)
139pub static NSAppKitVersionNumber10_13: NSAppKitVersion = 1561 as _;
140
141/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_13_1?language=objc)
142pub static NSAppKitVersionNumber10_13_1: NSAppKitVersion = 1561.1 as _;
143
144/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_13_2?language=objc)
145pub static NSAppKitVersionNumber10_13_2: NSAppKitVersion = 1561.2 as _;
146
147/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_13_4?language=objc)
148pub static NSAppKitVersionNumber10_13_4: NSAppKitVersion = 1561.4 as _;
149
150/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_14?language=objc)
151pub static NSAppKitVersionNumber10_14: NSAppKitVersion = 1671 as _;
152
153/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_14_1?language=objc)
154pub static NSAppKitVersionNumber10_14_1: NSAppKitVersion = 1671.1 as _;
155
156/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_14_2?language=objc)
157pub static NSAppKitVersionNumber10_14_2: NSAppKitVersion = 1671.2 as _;
158
159/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_14_3?language=objc)
160pub static NSAppKitVersionNumber10_14_3: NSAppKitVersion = 1671.3 as _;
161
162/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_14_4?language=objc)
163pub static NSAppKitVersionNumber10_14_4: NSAppKitVersion = 1671.4 as _;
164
165/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_14_5?language=objc)
166pub static NSAppKitVersionNumber10_14_5: NSAppKitVersion = 1671.5 as _;
167
168/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_15?language=objc)
169pub static NSAppKitVersionNumber10_15: NSAppKitVersion = 1894 as _;
170
171/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_15_1?language=objc)
172pub static NSAppKitVersionNumber10_15_1: NSAppKitVersion = 1894.1 as _;
173
174/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_15_2?language=objc)
175pub static NSAppKitVersionNumber10_15_2: NSAppKitVersion = 1894.2 as _;
176
177/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_15_3?language=objc)
178pub static NSAppKitVersionNumber10_15_3: NSAppKitVersion = 1894.3 as _;
179
180/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_15_4?language=objc)
181pub static NSAppKitVersionNumber10_15_4: NSAppKitVersion = 1894.4 as _;
182
183/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_15_5?language=objc)
184pub static NSAppKitVersionNumber10_15_5: NSAppKitVersion = 1894.5 as _;
185
186/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_15_6?language=objc)
187pub static NSAppKitVersionNumber10_15_6: NSAppKitVersion = 1894.6 as _;
188
189/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber11_0?language=objc)
190pub static NSAppKitVersionNumber11_0: NSAppKitVersion = 2022 as _;
191
192/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber11_1?language=objc)
193pub static NSAppKitVersionNumber11_1: NSAppKitVersion = 2022.2 as _;
194
195/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber11_2?language=objc)
196pub static NSAppKitVersionNumber11_2: NSAppKitVersion = 2022.3 as _;
197
198/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber11_3?language=objc)
199pub static NSAppKitVersionNumber11_3: NSAppKitVersion = 2022.4 as _;
200
201/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber11_4?language=objc)
202pub static NSAppKitVersionNumber11_4: NSAppKitVersion = 2022.5 as _;
203
204/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber11_5?language=objc)
205pub static NSAppKitVersionNumber11_5: NSAppKitVersion = 2022.6 as _;
206
207/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber12_0?language=objc)
208pub static NSAppKitVersionNumber12_0: NSAppKitVersion = 2113 as _;
209
210/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber12_1?language=objc)
211pub static NSAppKitVersionNumber12_1: NSAppKitVersion = 2113.2 as _;
212
213/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber12_2?language=objc)
214pub static NSAppKitVersionNumber12_2: NSAppKitVersion = 2113.3 as _;
215
216/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber12_3?language=objc)
217pub static NSAppKitVersionNumber12_3: NSAppKitVersion = 2113.4 as _;
218
219/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber12_4?language=objc)
220pub static NSAppKitVersionNumber12_4: NSAppKitVersion = 2113.5 as _;
221
222/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber12_5?language=objc)
223pub static NSAppKitVersionNumber12_5: NSAppKitVersion = 2113.6 as _;
224
225/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber13_0?language=objc)
226pub static NSAppKitVersionNumber13_0: NSAppKitVersion = 2299 as _;
227
228/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber13_1?language=objc)
229pub static NSAppKitVersionNumber13_1: NSAppKitVersion = 2299.3 as _;
230
231/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber13_2?language=objc)
232pub static NSAppKitVersionNumber13_2: NSAppKitVersion = 2299.3 as _;
233
234/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber13_3?language=objc)
235pub static NSAppKitVersionNumber13_3: NSAppKitVersion = 2299.4 as _;
236
237/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber13_4?language=objc)
238pub static NSAppKitVersionNumber13_4: NSAppKitVersion = 2299.5 as _;
239
240/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber13_5?language=objc)
241pub static NSAppKitVersionNumber13_5: NSAppKitVersion = 2299.6 as _;
242
243/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber13_6?language=objc)
244pub static NSAppKitVersionNumber13_6: NSAppKitVersion = 2299.7 as _;
245
246/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber14_0?language=objc)
247pub static NSAppKitVersionNumber14_0: NSAppKitVersion = 2487 as _;
248
249/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber14_1?language=objc)
250pub static NSAppKitVersionNumber14_1: NSAppKitVersion = 2487.2 as _;
251
252extern "C" {
253    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsmodalpanelrunloopmode?language=objc)
254    pub static NSModalPanelRunLoopMode: &'static NSRunLoopMode;
255}
256
257extern "C" {
258    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nseventtrackingrunloopmode?language=objc)
259    pub static NSEventTrackingRunLoopMode: &'static NSRunLoopMode;
260}
261
262/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsmodalresponse?language=objc)
263// NS_TYPED_EXTENSIBLE_ENUM
264pub type NSModalResponse = NSInteger;
265
266/// Also used as the default response for sheets
267///
268/// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsmodalresponsestop?language=objc)
269pub static NSModalResponseStop: NSModalResponse = -1000;
270
271/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsmodalresponseabort?language=objc)
272pub static NSModalResponseAbort: NSModalResponse = -1001;
273
274/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsmodalresponsecontinue?language=objc)
275pub static NSModalResponseContinue: NSModalResponse = -1002;
276
277/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsupdatewindowsrunloopordering?language=objc)
278pub const NSUpdateWindowsRunLoopOrdering: c_uint = 500000;
279
280/// Flags that comprise an application's
281/// `presentationOptions.`
282///
283/// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationpresentationoptions?language=objc)
284// NS_OPTIONS
285#[repr(transparent)]
286#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
287pub struct NSApplicationPresentationOptions(pub NSUInteger);
288bitflags::bitflags! {
289    impl NSApplicationPresentationOptions: NSUInteger {
290        #[doc(alias = "NSApplicationPresentationDefault")]
291        const Default = 0;
292/// Dock appears when moused to.
293        #[doc(alias = "NSApplicationPresentationAutoHideDock")]
294        const AutoHideDock = 1<<0;
295/// Dock is entirely unavailable.
296        #[doc(alias = "NSApplicationPresentationHideDock")]
297        const HideDock = 1<<1;
298/// Menu Bar appears when moused to.
299        #[doc(alias = "NSApplicationPresentationAutoHideMenuBar")]
300        const AutoHideMenuBar = 1<<2;
301/// Menu Bar is entirely unavailable.
302        #[doc(alias = "NSApplicationPresentationHideMenuBar")]
303        const HideMenuBar = 1<<3;
304/// All Apple menu items are disabled.
305        #[doc(alias = "NSApplicationPresentationDisableAppleMenu")]
306        const DisableAppleMenu = 1<<4;
307/// Cmd+Tab UI is disabled.
308        #[doc(alias = "NSApplicationPresentationDisableProcessSwitching")]
309        const DisableProcessSwitching = 1<<5;
310/// Cmd+Opt+Esc panel is disabled.
311        #[doc(alias = "NSApplicationPresentationDisableForceQuit")]
312        const DisableForceQuit = 1<<6;
313/// PowerKey panel and Restart/Shut Down/Log Out disabled.
314        #[doc(alias = "NSApplicationPresentationDisableSessionTermination")]
315        const DisableSessionTermination = 1<<7;
316/// Application "Hide" menu item is disabled.
317        #[doc(alias = "NSApplicationPresentationDisableHideApplication")]
318        const DisableHideApplication = 1<<8;
319/// Menu Bar's transparent appearance is disabled.
320        #[doc(alias = "NSApplicationPresentationDisableMenuBarTransparency")]
321        const DisableMenuBarTransparency = 1<<9;
322/// Application is in fullscreen mode.
323        #[doc(alias = "NSApplicationPresentationFullScreen")]
324        const FullScreen = 1<<10;
325/// Fullscreen window toolbar is detached from window and hides/shows on rollover.
326/// May be used only when both
327/// `NSApplicationPresentationFullScreen`is also set.
328        #[doc(alias = "NSApplicationPresentationAutoHideToolbar")]
329        const AutoHideToolbar = 1<<11;
330/// "Shake mouse pointer to locate" is disabled for this application.
331        #[doc(alias = "NSApplicationPresentationDisableCursorLocationAssistance")]
332        const DisableCursorLocationAssistance = 1<<12;
333    }
334}
335
336unsafe impl Encode for NSApplicationPresentationOptions {
337    const ENCODING: Encoding = NSUInteger::ENCODING;
338}
339
340unsafe impl RefEncode for NSApplicationPresentationOptions {
341    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
342}
343
344/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationocclusionstate?language=objc)
345// NS_OPTIONS
346#[repr(transparent)]
347#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
348pub struct NSApplicationOcclusionState(pub NSUInteger);
349bitflags::bitflags! {
350    impl NSApplicationOcclusionState: NSUInteger {
351/// If set, at least part of any window owned by this application is visible. If not set, all parts of all windows owned by this application are completely occluded. The menu bar does not count as a window owned by this application, so if only the menu bar is showing then the application is considered not visible. Status items, however, have windows owned by your application. If the status item is present in the menu bar, your application will be considered visible as long as the menu bar is visible.
352        #[doc(alias = "NSApplicationOcclusionStateVisible")]
353        const Visible = 1<<1;
354    }
355}
356
357unsafe impl Encode for NSApplicationOcclusionState {
358    const ENCODING: Encoding = NSUInteger::ENCODING;
359}
360
361unsafe impl RefEncode for NSApplicationOcclusionState {
362    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
363}
364
365/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nswindowlistoptions?language=objc)
366// NS_OPTIONS
367#[repr(transparent)]
368#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
369pub struct NSWindowListOptions(pub NSInteger);
370bitflags::bitflags! {
371    impl NSWindowListOptions: NSInteger {
372/// Onscreen application windows in front to back order. By default, -[NSApp windows] is used.
373        #[doc(alias = "NSWindowListOrderedFrontToBack")]
374        const OrderedFrontToBack = 1<<0;
375    }
376}
377
378unsafe impl Encode for NSWindowListOptions {
379    const ENCODING: Encoding = NSInteger::ENCODING;
380}
381
382unsafe impl RefEncode for NSWindowListOptions {
383    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
384}
385
386/// [Apple's documentation](https://developer.apple.com/documentation/appkit/_nsmodalsession?language=objc)
387#[repr(C)]
388#[derive(Debug)]
389pub struct _NSModalSession {
390    inner: [u8; 0],
391    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
392}
393
394unsafe impl RefEncode for _NSModalSession {
395    const ENCODING_REF: Encoding = Encoding::Pointer(&Encoding::Struct("_NSModalSession", &[]));
396}
397
398/// Information used by the system during modal sessions.
399///
400/// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsmodalsession?language=objc)
401pub type NSModalSession = *mut _NSModalSession;
402
403/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsrequestuserattentiontype?language=objc)
404// NS_ENUM
405#[repr(transparent)]
406#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
407pub struct NSRequestUserAttentionType(pub NSUInteger);
408impl NSRequestUserAttentionType {
409    #[doc(alias = "NSCriticalRequest")]
410    pub const CriticalRequest: Self = Self(0);
411    #[doc(alias = "NSInformationalRequest")]
412    pub const InformationalRequest: Self = Self(10);
413}
414
415unsafe impl Encode for NSRequestUserAttentionType {
416    const ENCODING: Encoding = NSUInteger::ENCODING;
417}
418
419unsafe impl RefEncode for NSRequestUserAttentionType {
420    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
421}
422
423/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationdelegatereply?language=objc)
424// NS_ENUM
425#[repr(transparent)]
426#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
427pub struct NSApplicationDelegateReply(pub NSUInteger);
428impl NSApplicationDelegateReply {
429    #[doc(alias = "NSApplicationDelegateReplySuccess")]
430    pub const Success: Self = Self(0);
431    #[doc(alias = "NSApplicationDelegateReplyCancel")]
432    pub const Cancel: Self = Self(1);
433    #[doc(alias = "NSApplicationDelegateReplyFailure")]
434    pub const Failure: Self = Self(2);
435}
436
437unsafe impl Encode for NSApplicationDelegateReply {
438    const ENCODING: Encoding = NSUInteger::ENCODING;
439}
440
441unsafe impl RefEncode for NSApplicationDelegateReply {
442    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
443}
444
445extern_class!(
446    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplication?language=objc)
447    #[unsafe(super(NSResponder, NSObject))]
448    #[derive(Debug, PartialEq, Eq, Hash)]
449    #[cfg(feature = "NSResponder")]
450    pub struct NSApplication;
451);
452
453#[cfg(all(feature = "NSAccessibilityProtocols", feature = "NSResponder"))]
454extern_conformance!(
455    unsafe impl NSAccessibility for NSApplication {}
456);
457
458#[cfg(all(feature = "NSAccessibilityProtocols", feature = "NSResponder"))]
459extern_conformance!(
460    unsafe impl NSAccessibilityElementProtocol for NSApplication {}
461);
462
463#[cfg(feature = "NSResponder")]
464extern_conformance!(
465    unsafe impl NSCoding for NSApplication {}
466);
467
468#[cfg(all(feature = "NSMenu", feature = "NSResponder"))]
469extern_conformance!(
470    unsafe impl NSMenuItemValidation for NSApplication {}
471);
472
473#[cfg(feature = "NSResponder")]
474extern_conformance!(
475    unsafe impl NSObjectProtocol for NSApplication {}
476);
477
478#[cfg(all(feature = "NSResponder", feature = "NSUserInterfaceValidation"))]
479extern_conformance!(
480    unsafe impl NSUserInterfaceValidations for NSApplication {}
481);
482
483#[cfg(feature = "NSResponder")]
484impl NSApplication {
485    extern_methods!(
486        #[unsafe(method(sharedApplication))]
487        #[unsafe(method_family = none)]
488        pub fn sharedApplication(mtm: MainThreadMarker) -> Retained<NSApplication>;
489
490        #[unsafe(method(delegate))]
491        #[unsafe(method_family = none)]
492        pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSApplicationDelegate>>>;
493
494        /// Setter for [`delegate`][Self::delegate].
495        ///
496        /// This is a [weak property][objc2::topics::weak_property].
497        #[unsafe(method(setDelegate:))]
498        #[unsafe(method_family = none)]
499        pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSApplicationDelegate>>);
500
501        #[unsafe(method(hide:))]
502        #[unsafe(method_family = none)]
503        pub fn hide(&self, sender: Option<&AnyObject>);
504
505        #[unsafe(method(unhide:))]
506        #[unsafe(method_family = none)]
507        pub fn unhide(&self, sender: Option<&AnyObject>);
508
509        #[unsafe(method(unhideWithoutActivation))]
510        #[unsafe(method_family = none)]
511        pub fn unhideWithoutActivation(&self);
512
513        #[cfg(feature = "NSWindow")]
514        #[unsafe(method(windowWithWindowNumber:))]
515        #[unsafe(method_family = none)]
516        pub fn windowWithWindowNumber(&self, window_num: NSInteger) -> Option<Retained<NSWindow>>;
517
518        #[cfg(feature = "NSWindow")]
519        #[unsafe(method(mainWindow))]
520        #[unsafe(method_family = none)]
521        pub fn mainWindow(&self) -> Option<Retained<NSWindow>>;
522
523        #[cfg(feature = "NSWindow")]
524        #[unsafe(method(keyWindow))]
525        #[unsafe(method_family = none)]
526        pub fn keyWindow(&self) -> Option<Retained<NSWindow>>;
527
528        #[unsafe(method(isActive))]
529        #[unsafe(method_family = none)]
530        pub fn isActive(&self) -> bool;
531
532        #[unsafe(method(isHidden))]
533        #[unsafe(method_family = none)]
534        pub fn isHidden(&self) -> bool;
535
536        #[unsafe(method(isRunning))]
537        #[unsafe(method_family = none)]
538        pub fn isRunning(&self) -> bool;
539
540        /// A boolean value indicating whether your application should suppress HDR content based on established policy.
541        /// Built-in AppKit components such as NSImageView will automatically behave correctly with HDR content. You should use this value in conjunction with notifications (`NSApplicationShouldBeginSuppressingHighDynamicRangeContentNotification` and `NSApplicationShouldEndSuppressingHighDynamicRangeContentNotification`) to suppress HDR content in your application when signaled to do so.
542        #[unsafe(method(applicationShouldSuppressHighDynamicRangeContent))]
543        #[unsafe(method_family = none)]
544        pub fn applicationShouldSuppressHighDynamicRangeContent(&self) -> bool;
545
546        #[unsafe(method(deactivate))]
547        #[unsafe(method_family = none)]
548        pub fn deactivate(&self);
549
550        /// Makes the receiver the active app.
551        /// - Parameter ignoreOtherApps: If `NO`, the app is activated only if no other app is currently active. If `YES`, the app activates regardless.
552        #[deprecated = "This method will be deprecated in a future release. Use NSApp.activate instead."]
553        #[unsafe(method(activateIgnoringOtherApps:))]
554        #[unsafe(method_family = none)]
555        pub fn activateIgnoringOtherApps(&self, ignore_other_apps: bool);
556
557        /// Makes the receiver the active app, if possible.
558        ///
559        /// You shouldn’t assume the app will be active immediately
560        /// after sending this message. The framework also does not
561        /// guarantee that the app will be activated at all.
562        ///
563        /// For cooperative activation, the other application should
564        /// call `-yieldActivationToApplication:` or equivalent prior
565        /// to the target application invoking `-activate`.
566        ///
567        /// Invoking `-activate` on an already-active application
568        /// cancels any pending activation yields by the receiver.
569        #[unsafe(method(activate))]
570        #[unsafe(method_family = none)]
571        pub fn activate(&self);
572
573        #[cfg(feature = "NSRunningApplication")]
574        /// Explicitly allows another application to make itself active.
575        ///
576        /// Calling this method will not deactivate the current app, nor
577        /// will it activate the other app. For cooperative or coordinated
578        /// activation, the other app should request to be activated at
579        /// some point in the future by calling `activate` or equivalent.
580        #[unsafe(method(yieldActivationToApplication:))]
581        #[unsafe(method_family = none)]
582        pub fn yieldActivationToApplication(&self, application: &NSRunningApplication);
583
584        /// Same as `-yieldActivationToApplication:`, but the provided
585        /// bundle identifier does not have to correspond to a currently
586        /// running application.
587        ///
588        /// This method should be used to yield activation to apps that
589        /// may not be running at the time of invoking it. If it is known
590        /// that the target application is currently running, use
591        /// `-yieldActivationToApplication:` instead.
592        #[unsafe(method(yieldActivationToApplicationWithBundleIdentifier:))]
593        #[unsafe(method_family = none)]
594        pub fn yieldActivationToApplicationWithBundleIdentifier(
595            &self,
596            bundle_identifier: &NSString,
597        );
598
599        #[unsafe(method(hideOtherApplications:))]
600        #[unsafe(method_family = none)]
601        pub fn hideOtherApplications(&self, sender: Option<&AnyObject>);
602
603        #[unsafe(method(unhideAllApplications:))]
604        #[unsafe(method_family = none)]
605        pub fn unhideAllApplications(&self, sender: Option<&AnyObject>);
606
607        #[unsafe(method(finishLaunching))]
608        #[unsafe(method_family = none)]
609        pub fn finishLaunching(&self);
610
611        #[unsafe(method(run))]
612        #[unsafe(method_family = none)]
613        pub fn run(&self);
614
615        #[cfg(feature = "NSWindow")]
616        #[unsafe(method(runModalForWindow:))]
617        #[unsafe(method_family = none)]
618        pub fn runModalForWindow(&self, window: &NSWindow) -> NSModalResponse;
619
620        #[unsafe(method(stop:))]
621        #[unsafe(method_family = none)]
622        pub fn stop(&self, sender: Option<&AnyObject>);
623
624        #[unsafe(method(stopModal))]
625        #[unsafe(method_family = none)]
626        pub fn stopModal(&self);
627
628        #[unsafe(method(stopModalWithCode:))]
629        #[unsafe(method_family = none)]
630        pub fn stopModalWithCode(&self, return_code: NSModalResponse);
631
632        #[unsafe(method(abortModal))]
633        #[unsafe(method_family = none)]
634        pub fn abortModal(&self);
635
636        #[cfg(feature = "NSWindow")]
637        #[unsafe(method(modalWindow))]
638        #[unsafe(method_family = none)]
639        pub fn modalWindow(&self) -> Option<Retained<NSWindow>>;
640
641        #[cfg(feature = "NSWindow")]
642        #[unsafe(method(beginModalSessionForWindow:))]
643        #[unsafe(method_family = none)]
644        pub fn beginModalSessionForWindow(&self, window: &NSWindow) -> NSModalSession;
645
646        /// # Safety
647        ///
648        /// `session` must be a valid pointer.
649        #[unsafe(method(runModalSession:))]
650        #[unsafe(method_family = none)]
651        pub unsafe fn runModalSession(&self, session: NSModalSession) -> NSModalResponse;
652
653        /// # Safety
654        ///
655        /// `session` must be a valid pointer.
656        #[unsafe(method(endModalSession:))]
657        #[unsafe(method_family = none)]
658        pub unsafe fn endModalSession(&self, session: NSModalSession);
659
660        #[unsafe(method(terminate:))]
661        #[unsafe(method_family = none)]
662        pub fn terminate(&self, sender: Option<&AnyObject>);
663
664        /// Inform the user that this application needs attention - call this method only if your application is not already active.
665        #[unsafe(method(requestUserAttention:))]
666        #[unsafe(method_family = none)]
667        pub fn requestUserAttention(&self, request_type: NSRequestUserAttentionType) -> NSInteger;
668
669        #[unsafe(method(cancelUserAttentionRequest:))]
670        #[unsafe(method_family = none)]
671        pub fn cancelUserAttentionRequest(&self, request: NSInteger);
672
673        #[cfg(all(feature = "NSWindow", feature = "block2"))]
674        /// Execute a block for each of the app's windows. Set `*stop = YES` if desired, to halt the enumeration early.
675        #[unsafe(method(enumerateWindowsWithOptions:usingBlock:))]
676        #[unsafe(method_family = none)]
677        pub fn enumerateWindowsWithOptions_usingBlock(
678            &self,
679            options: NSWindowListOptions,
680            block: &block2::DynBlock<dyn Fn(NonNull<NSWindow>, NonNull<Bool>) + '_>,
681        );
682
683        #[unsafe(method(preventWindowOrdering))]
684        #[unsafe(method_family = none)]
685        pub fn preventWindowOrdering(&self);
686
687        #[cfg(feature = "NSWindow")]
688        #[unsafe(method(windows))]
689        #[unsafe(method_family = none)]
690        pub fn windows(&self) -> Retained<NSArray<NSWindow>>;
691
692        #[unsafe(method(setWindowsNeedUpdate:))]
693        #[unsafe(method_family = none)]
694        pub fn setWindowsNeedUpdate(&self, need_update: bool);
695
696        #[unsafe(method(updateWindows))]
697        #[unsafe(method_family = none)]
698        pub fn updateWindows(&self);
699
700        #[cfg(feature = "NSMenu")]
701        #[unsafe(method(mainMenu))]
702        #[unsafe(method_family = none)]
703        pub fn mainMenu(&self) -> Option<Retained<NSMenu>>;
704
705        #[cfg(feature = "NSMenu")]
706        /// Setter for [`mainMenu`][Self::mainMenu].
707        #[unsafe(method(setMainMenu:))]
708        #[unsafe(method_family = none)]
709        pub fn setMainMenu(&self, main_menu: Option<&NSMenu>);
710
711        #[cfg(feature = "NSMenu")]
712        /// Set or get the Help menu for the app.  If a non-nil menu is set as the Help menu, Spotlight for Help will be installed in it; otherwise AppKit will install Spotlight for Help into a menu of its choosing (and that menu is not returned from `-helpMenu`).  If you wish to completely suppress Spotlight for Help, you can set a menu that does not appear in the menu bar.
713        /// `NSApplication`retains its Help menu and releases it when a different menu is set.
714        #[unsafe(method(helpMenu))]
715        #[unsafe(method_family = none)]
716        pub fn helpMenu(&self) -> Option<Retained<NSMenu>>;
717
718        #[cfg(feature = "NSMenu")]
719        /// Setter for [`helpMenu`][Self::helpMenu].
720        #[unsafe(method(setHelpMenu:))]
721        #[unsafe(method_family = none)]
722        pub fn setHelpMenu(&self, help_menu: Option<&NSMenu>);
723
724        #[cfg(feature = "NSImage")]
725        #[unsafe(method(applicationIconImage))]
726        #[unsafe(method_family = none)]
727        pub fn applicationIconImage(&self) -> Option<Retained<NSImage>>;
728
729        #[cfg(feature = "NSImage")]
730        /// Setter for [`applicationIconImage`][Self::applicationIconImage].
731        ///
732        /// # Safety
733        ///
734        /// `application_icon_image` might not allow `None`.
735        #[unsafe(method(setApplicationIconImage:))]
736        #[unsafe(method_family = none)]
737        pub unsafe fn setApplicationIconImage(&self, application_icon_image: Option<&NSImage>);
738
739        #[cfg(feature = "NSRunningApplication")]
740        /// Returns: The activation policy of the application.
741        #[unsafe(method(activationPolicy))]
742        #[unsafe(method_family = none)]
743        pub fn activationPolicy(&self) -> NSApplicationActivationPolicy;
744
745        #[cfg(feature = "NSRunningApplication")]
746        /// Attempts to modify the application's activation policy.  In OS X 10.9, any policy may be set; prior to 10.9, the activation policy may be changed to
747        /// `NSApplicationActivationPolicyProhibited`or
748        /// `NSApplicationActivationPolicyRegular,`but may not be changed to
749        /// `NSApplicationActivationPolicyAccessory.`This returns
750        /// `YES`if setting the activation policy is successful, and
751        /// `NO`if not.
752        #[unsafe(method(setActivationPolicy:))]
753        #[unsafe(method_family = none)]
754        pub fn setActivationPolicy(&self, activation_policy: NSApplicationActivationPolicy)
755            -> bool;
756
757        #[cfg(feature = "NSDockTile")]
758        #[unsafe(method(dockTile))]
759        #[unsafe(method_family = none)]
760        pub fn dockTile(&self) -> Retained<NSDockTile>;
761
762        #[unsafe(method(reportException:))]
763        #[unsafe(method_family = none)]
764        pub fn reportException(&self, exception: &NSException);
765
766        /// # Safety
767        ///
768        /// - `selector` must be a valid selector.
769        /// - `target` should be of the correct type.
770        /// - `argument` should be of the correct type.
771        #[unsafe(method(detachDrawingThread:toTarget:withObject:))]
772        #[unsafe(method_family = none)]
773        pub unsafe fn detachDrawingThread_toTarget_withObject(
774            selector: Sel,
775            target: &AnyObject,
776            argument: Option<&AnyObject>,
777            mtm: MainThreadMarker,
778        );
779
780        /// If an application delegate returns NSTerminateLater from -applicationShouldTerminate:, -replyToApplicationShouldTerminate: must be called with YES or NO once the application decides if it can terminate.
781        #[unsafe(method(replyToApplicationShouldTerminate:))]
782        #[unsafe(method_family = none)]
783        pub fn replyToApplicationShouldTerminate(&self, should_terminate: bool);
784
785        /// If an application delegate encounters an error while handling `-application:openFiles:` or` -application:printFiles:`, `-replyToOpenOrPrint:` should be called with
786        /// `NSApplicationDelegateReplyFailure.`If the user cancels the operation,
787        /// `NSApplicationDelegateReplyCancel`should be used, and if the operation succeeds,
788        /// `NSApplicationDelegateReplySuccess`should be used .
789        #[unsafe(method(replyToOpenOrPrint:))]
790        #[unsafe(method_family = none)]
791        pub fn replyToOpenOrPrint(&self, reply: NSApplicationDelegateReply);
792
793        /// Opens the character palette.
794        #[unsafe(method(orderFrontCharacterPalette:))]
795        #[unsafe(method_family = none)]
796        pub fn orderFrontCharacterPalette(&self, sender: Option<&AnyObject>);
797
798        /// Gets or sets the
799        /// `presentationOptions`that should be in effect for the system when this application is the active application.  Only certain combinations of
800        /// `NSApplicationPresentationOptions`flags are allowed, as detailed in the AppKit Release Notes and the reference documentation for `-setPresentationOptions:`.  When given an invalid combination of option flags, `-setPresentationOptions:` raises an exception.
801        #[unsafe(method(presentationOptions))]
802        #[unsafe(method_family = none)]
803        pub fn presentationOptions(&self) -> NSApplicationPresentationOptions;
804
805        /// Setter for [`presentationOptions`][Self::presentationOptions].
806        #[unsafe(method(setPresentationOptions:))]
807        #[unsafe(method_family = none)]
808        pub fn setPresentationOptions(
809            &self,
810            presentation_options: NSApplicationPresentationOptions,
811        );
812
813        /// Returns: The set of application presentation options that are currently in effect for the system.
814        /// These are the presentation options that have been put into effect by the currently active application.
815        #[unsafe(method(currentSystemPresentationOptions))]
816        #[unsafe(method_family = none)]
817        pub fn currentSystemPresentationOptions(&self) -> NSApplicationPresentationOptions;
818
819        #[unsafe(method(occlusionState))]
820        #[unsafe(method_family = none)]
821        pub fn occlusionState(&self) -> NSApplicationOcclusionState;
822
823        #[unsafe(method(isProtectedDataAvailable))]
824        #[unsafe(method_family = none)]
825        pub fn isProtectedDataAvailable(&self) -> bool;
826    );
827}
828
829/// Methods declared on superclass `NSResponder`.
830#[cfg(feature = "NSResponder")]
831impl NSApplication {
832    extern_methods!(
833        #[unsafe(method(init))]
834        #[unsafe(method_family = init)]
835        pub fn init(this: Allocated<Self>) -> Retained<Self>;
836
837        /// # Safety
838        ///
839        /// `coder` possibly has further requirements.
840        #[unsafe(method(initWithCoder:))]
841        #[unsafe(method_family = init)]
842        pub unsafe fn initWithCoder(
843            this: Allocated<Self>,
844            coder: &NSCoder,
845        ) -> Option<Retained<Self>>;
846    );
847}
848
849/// Methods declared on superclass `NSObject`.
850#[cfg(feature = "NSResponder")]
851impl NSApplication {
852    extern_methods!(
853        #[unsafe(method(new))]
854        #[unsafe(method_family = new)]
855        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
856    );
857}
858
859/// NSAppearanceCustomization.
860#[cfg(feature = "NSResponder")]
861impl NSApplication {
862    extern_methods!(
863        #[cfg(feature = "NSAppearance")]
864        #[unsafe(method(appearance))]
865        #[unsafe(method_family = none)]
866        pub fn appearance(&self) -> Option<Retained<NSAppearance>>;
867
868        #[cfg(feature = "NSAppearance")]
869        /// Setter for [`appearance`][Self::appearance].
870        #[unsafe(method(setAppearance:))]
871        #[unsafe(method_family = none)]
872        pub fn setAppearance(&self, appearance: Option<&NSAppearance>);
873
874        #[cfg(feature = "NSAppearance")]
875        #[unsafe(method(effectiveAppearance))]
876        #[unsafe(method_family = none)]
877        pub fn effectiveAppearance(&self) -> Retained<NSAppearance>;
878    );
879}
880
881#[cfg(all(feature = "NSAppearance", feature = "NSResponder"))]
882extern_conformance!(
883    unsafe impl NSAppearanceCustomization for NSApplication {}
884);
885
886/// NSEvent.
887#[cfg(feature = "NSResponder")]
888impl NSApplication {
889    extern_methods!(
890        #[cfg(feature = "NSEvent")]
891        #[unsafe(method(sendEvent:))]
892        #[unsafe(method_family = none)]
893        pub fn sendEvent(&self, event: &NSEvent);
894
895        #[cfg(feature = "NSEvent")]
896        #[unsafe(method(postEvent:atStart:))]
897        #[unsafe(method_family = none)]
898        pub fn postEvent_atStart(&self, event: &NSEvent, at_start: bool);
899
900        #[cfg(feature = "NSEvent")]
901        #[unsafe(method(currentEvent))]
902        #[unsafe(method_family = none)]
903        pub fn currentEvent(&self) -> Option<Retained<NSEvent>>;
904
905        #[cfg(feature = "NSEvent")]
906        #[unsafe(method(nextEventMatchingMask:untilDate:inMode:dequeue:))]
907        #[unsafe(method_family = none)]
908        pub fn nextEventMatchingMask_untilDate_inMode_dequeue(
909            &self,
910            mask: NSEventMask,
911            expiration: Option<&NSDate>,
912            mode: &NSRunLoopMode,
913            deq_flag: bool,
914        ) -> Option<Retained<NSEvent>>;
915
916        #[cfg(feature = "NSEvent")]
917        #[unsafe(method(discardEventsMatchingMask:beforeEvent:))]
918        #[unsafe(method_family = none)]
919        pub fn discardEventsMatchingMask_beforeEvent(
920            &self,
921            mask: NSEventMask,
922            last_event: Option<&NSEvent>,
923        );
924    );
925}
926
927/// NSResponder.
928#[cfg(feature = "NSResponder")]
929impl NSApplication {
930    extern_methods!(
931        /// # Safety
932        ///
933        /// - `action` must be a valid selector.
934        /// - `target` should be of the correct type.
935        /// - `sender` should be of the correct type.
936        #[unsafe(method(sendAction:to:from:))]
937        #[unsafe(method_family = none)]
938        pub unsafe fn sendAction_to_from(
939            &self,
940            action: Sel,
941            target: Option<&AnyObject>,
942            sender: Option<&AnyObject>,
943        ) -> bool;
944
945        /// # Safety
946        ///
947        /// `action` must be a valid selector.
948        #[unsafe(method(targetForAction:))]
949        #[unsafe(method_family = none)]
950        pub unsafe fn targetForAction(&self, action: Sel) -> Option<Retained<AnyObject>>;
951
952        /// # Safety
953        ///
954        /// - `action` must be a valid selector.
955        /// - `target` should be of the correct type.
956        /// - `sender` should be of the correct type.
957        #[unsafe(method(targetForAction:to:from:))]
958        #[unsafe(method_family = none)]
959        pub unsafe fn targetForAction_to_from(
960            &self,
961            action: Sel,
962            target: Option<&AnyObject>,
963            sender: Option<&AnyObject>,
964        ) -> Option<Retained<AnyObject>>;
965
966        /// # Safety
967        ///
968        /// - `action` must be a valid selector.
969        /// - `object` should be of the correct type.
970        #[unsafe(method(tryToPerform:with:))]
971        #[unsafe(method_family = none)]
972        pub unsafe fn tryToPerform_with(&self, action: Sel, object: Option<&AnyObject>) -> bool;
973
974        #[cfg(feature = "NSPasteboard")]
975        #[unsafe(method(validRequestorForSendType:returnType:))]
976        #[unsafe(method_family = none)]
977        pub fn validRequestorForSendType_returnType(
978            &self,
979            send_type: Option<&NSPasteboardType>,
980            return_type: Option<&NSPasteboardType>,
981        ) -> Option<Retained<AnyObject>>;
982    );
983}
984
985/// NSWindowsMenu.
986#[cfg(feature = "NSResponder")]
987impl NSApplication {
988    extern_methods!(
989        #[cfg(feature = "NSMenu")]
990        #[unsafe(method(windowsMenu))]
991        #[unsafe(method_family = none)]
992        pub fn windowsMenu(&self) -> Option<Retained<NSMenu>>;
993
994        #[cfg(feature = "NSMenu")]
995        /// Setter for [`windowsMenu`][Self::windowsMenu].
996        #[unsafe(method(setWindowsMenu:))]
997        #[unsafe(method_family = none)]
998        pub fn setWindowsMenu(&self, windows_menu: Option<&NSMenu>);
999
1000        #[unsafe(method(arrangeInFront:))]
1001        #[unsafe(method_family = none)]
1002        pub fn arrangeInFront(&self, sender: Option<&AnyObject>);
1003
1004        #[cfg(feature = "NSWindow")]
1005        #[unsafe(method(removeWindowsItem:))]
1006        #[unsafe(method_family = none)]
1007        pub fn removeWindowsItem(&self, win: &NSWindow);
1008
1009        #[cfg(feature = "NSWindow")]
1010        #[unsafe(method(addWindowsItem:title:filename:))]
1011        #[unsafe(method_family = none)]
1012        pub fn addWindowsItem_title_filename(
1013            &self,
1014            win: &NSWindow,
1015            string: &NSString,
1016            is_filename: bool,
1017        );
1018
1019        #[cfg(feature = "NSWindow")]
1020        #[unsafe(method(changeWindowsItem:title:filename:))]
1021        #[unsafe(method_family = none)]
1022        pub fn changeWindowsItem_title_filename(
1023            &self,
1024            win: &NSWindow,
1025            string: &NSString,
1026            is_filename: bool,
1027        );
1028
1029        #[cfg(feature = "NSWindow")]
1030        #[unsafe(method(updateWindowsItem:))]
1031        #[unsafe(method_family = none)]
1032        pub fn updateWindowsItem(&self, win: &NSWindow);
1033
1034        #[unsafe(method(miniaturizeAll:))]
1035        #[unsafe(method_family = none)]
1036        pub fn miniaturizeAll(&self, sender: Option<&AnyObject>);
1037    );
1038}
1039
1040/// NSFullKeyboardAccess.
1041#[cfg(feature = "NSResponder")]
1042impl NSApplication {
1043    extern_methods!(
1044        /// A Boolean value indicating whether keyboard navigation is enabled in System Settings > Keyboard.
1045        /// - Note: The value of this property is `YES` if keyboard navigation is enabled or `NO` if it’s not. You might use this value to implement your own key loop or to implement in-control tabbing behavior similar to `NSTableView`. Because of the nature of the preference storage, you won’t be notified of changes to this property if you attempt to observe it through key-value observing; however, accessing this property is fairly inexpensive, so you can access it directly rather than caching it.
1046        /// - Note: This property’s value isn’t necessarily reflective of the separate accessibility setting named “Full Keyboard Access” in System Settings > Accessibility > Keyboard.
1047        #[unsafe(method(isFullKeyboardAccessEnabled))]
1048        #[unsafe(method_family = none)]
1049        pub fn isFullKeyboardAccessEnabled(&self) -> bool;
1050    );
1051}
1052
1053/// Return values for `-applicationShouldTerminate:`.
1054///
1055/// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationterminatereply?language=objc)
1056// NS_ENUM
1057#[repr(transparent)]
1058#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1059pub struct NSApplicationTerminateReply(pub NSUInteger);
1060impl NSApplicationTerminateReply {
1061    #[doc(alias = "NSTerminateCancel")]
1062    pub const TerminateCancel: Self = Self(0);
1063    #[doc(alias = "NSTerminateNow")]
1064    pub const TerminateNow: Self = Self(1);
1065    #[doc(alias = "NSTerminateLater")]
1066    pub const TerminateLater: Self = Self(2);
1067}
1068
1069unsafe impl Encode for NSApplicationTerminateReply {
1070    const ENCODING: Encoding = NSUInteger::ENCODING;
1071}
1072
1073unsafe impl RefEncode for NSApplicationTerminateReply {
1074    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1075}
1076
1077/// Return values for `-application:printFiles:withSettings:showPrintPanels:`.
1078///
1079/// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationprintreply?language=objc)
1080// NS_ENUM
1081#[repr(transparent)]
1082#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1083pub struct NSApplicationPrintReply(pub NSUInteger);
1084impl NSApplicationPrintReply {
1085    #[doc(alias = "NSPrintingCancelled")]
1086    pub const PrintingCancelled: Self = Self(0);
1087    #[doc(alias = "NSPrintingSuccess")]
1088    pub const PrintingSuccess: Self = Self(1);
1089    #[doc(alias = "NSPrintingReplyLater")]
1090    pub const PrintingReplyLater: Self = Self(2);
1091    #[doc(alias = "NSPrintingFailure")]
1092    pub const PrintingFailure: Self = Self(3);
1093}
1094
1095unsafe impl Encode for NSApplicationPrintReply {
1096    const ENCODING: Encoding = NSUInteger::ENCODING;
1097}
1098
1099unsafe impl RefEncode for NSApplicationPrintReply {
1100    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1101}
1102
1103extern_protocol!(
1104    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationdelegate?language=objc)
1105    pub unsafe trait NSApplicationDelegate: NSObjectProtocol + MainThreadOnly {
1106        #[cfg(feature = "NSResponder")]
1107        /// Allowable return values are:
1108        /// `NSTerminateNow`- it is ok to proceed with termination
1109        /// `NSTerminateCancel`- the application should not be terminated
1110        /// `NSTerminateLater`- it may be ok to proceed with termination later.  The application must call `-replyToApplicationShouldTerminate:` with
1111        /// `YES`or
1112        /// `NO`once the answer is known
1113        ///
1114        /// Note: This return value is for delegates who need to provide document modal alerts (sheets) in order to decide whether to quit.
1115        #[optional]
1116        #[unsafe(method(applicationShouldTerminate:))]
1117        #[unsafe(method_family = none)]
1118        fn applicationShouldTerminate(&self, sender: &NSApplication)
1119            -> NSApplicationTerminateReply;
1120
1121        #[cfg(feature = "NSResponder")]
1122        /// This will be called for any URLs your application is asked to open. This includes URL types (CFBundleURLTypes) defined in your Info.plist, and Document types (
1123        /// `CFBundleDocumentTypes)`that have no associated
1124        /// `NSDocument`class. Document URLs that have an associated
1125        /// `NSDocument`class will be opened through
1126        /// `NSDocumentController.`If this is implemented, `-application:openFiles:` and `-application:openFile:` will not be called.
1127        #[optional]
1128        #[unsafe(method(application:openURLs:))]
1129        #[unsafe(method_family = none)]
1130        fn application_openURLs(&self, application: &NSApplication, urls: &NSArray<NSURL>);
1131
1132        #[cfg(feature = "NSResponder")]
1133        #[optional]
1134        #[unsafe(method(application:openFile:))]
1135        #[unsafe(method_family = none)]
1136        fn application_openFile(&self, sender: &NSApplication, filename: &NSString) -> bool;
1137
1138        #[cfg(feature = "NSResponder")]
1139        #[optional]
1140        #[unsafe(method(application:openFiles:))]
1141        #[unsafe(method_family = none)]
1142        fn application_openFiles(&self, sender: &NSApplication, filenames: &NSArray<NSString>);
1143
1144        #[cfg(feature = "NSResponder")]
1145        #[optional]
1146        #[unsafe(method(application:openTempFile:))]
1147        #[unsafe(method_family = none)]
1148        fn application_openTempFile(&self, sender: &NSApplication, filename: &NSString) -> bool;
1149
1150        #[cfg(feature = "NSResponder")]
1151        #[optional]
1152        #[unsafe(method(applicationShouldOpenUntitledFile:))]
1153        #[unsafe(method_family = none)]
1154        fn applicationShouldOpenUntitledFile(&self, sender: &NSApplication) -> bool;
1155
1156        #[cfg(feature = "NSResponder")]
1157        #[optional]
1158        #[unsafe(method(applicationOpenUntitledFile:))]
1159        #[unsafe(method_family = none)]
1160        fn applicationOpenUntitledFile(&self, sender: &NSApplication) -> bool;
1161
1162        /// # Safety
1163        ///
1164        /// `sender` should be of the correct type.
1165        #[optional]
1166        #[unsafe(method(application:openFileWithoutUI:))]
1167        #[unsafe(method_family = none)]
1168        unsafe fn application_openFileWithoutUI(
1169            &self,
1170            sender: &AnyObject,
1171            filename: &NSString,
1172        ) -> bool;
1173
1174        #[cfg(feature = "NSResponder")]
1175        #[optional]
1176        #[unsafe(method(application:printFile:))]
1177        #[unsafe(method_family = none)]
1178        fn application_printFile(&self, sender: &NSApplication, filename: &NSString) -> bool;
1179
1180        #[cfg(all(feature = "NSPrintInfo", feature = "NSResponder"))]
1181        /// # Safety
1182        ///
1183        /// `print_settings` generic should be of the correct type.
1184        #[optional]
1185        #[unsafe(method(application:printFiles:withSettings:showPrintPanels:))]
1186        #[unsafe(method_family = none)]
1187        unsafe fn application_printFiles_withSettings_showPrintPanels(
1188            &self,
1189            application: &NSApplication,
1190            file_names: &NSArray<NSString>,
1191            print_settings: &NSDictionary<NSPrintInfoAttributeKey, AnyObject>,
1192            show_print_panels: bool,
1193        ) -> NSApplicationPrintReply;
1194
1195        #[cfg(feature = "NSResponder")]
1196        #[optional]
1197        #[unsafe(method(applicationShouldTerminateAfterLastWindowClosed:))]
1198        #[unsafe(method_family = none)]
1199        fn applicationShouldTerminateAfterLastWindowClosed(&self, sender: &NSApplication) -> bool;
1200
1201        #[cfg(feature = "NSResponder")]
1202        #[optional]
1203        #[unsafe(method(applicationShouldHandleReopen:hasVisibleWindows:))]
1204        #[unsafe(method_family = none)]
1205        fn applicationShouldHandleReopen_hasVisibleWindows(
1206            &self,
1207            sender: &NSApplication,
1208            has_visible_windows: bool,
1209        ) -> bool;
1210
1211        #[cfg(all(feature = "NSMenu", feature = "NSResponder"))]
1212        #[optional]
1213        #[unsafe(method(applicationDockMenu:))]
1214        #[unsafe(method_family = none)]
1215        fn applicationDockMenu(&self, sender: &NSApplication) -> Option<Retained<NSMenu>>;
1216
1217        #[cfg(feature = "NSResponder")]
1218        #[optional]
1219        #[unsafe(method(application:willPresentError:))]
1220        #[unsafe(method_family = none)]
1221        fn application_willPresentError(
1222            &self,
1223            application: &NSApplication,
1224            error: &NSError,
1225        ) -> Retained<NSError>;
1226
1227        #[cfg(feature = "NSResponder")]
1228        #[optional]
1229        #[unsafe(method(application:didRegisterForRemoteNotificationsWithDeviceToken:))]
1230        #[unsafe(method_family = none)]
1231        fn application_didRegisterForRemoteNotificationsWithDeviceToken(
1232            &self,
1233            application: &NSApplication,
1234            device_token: &NSData,
1235        );
1236
1237        #[cfg(feature = "NSResponder")]
1238        #[optional]
1239        #[unsafe(method(application:didFailToRegisterForRemoteNotificationsWithError:))]
1240        #[unsafe(method_family = none)]
1241        fn application_didFailToRegisterForRemoteNotificationsWithError(
1242            &self,
1243            application: &NSApplication,
1244            error: &NSError,
1245        );
1246
1247        #[cfg(feature = "NSResponder")]
1248        /// # Safety
1249        ///
1250        /// `user_info` generic should be of the correct type.
1251        #[optional]
1252        #[unsafe(method(application:didReceiveRemoteNotification:))]
1253        #[unsafe(method_family = none)]
1254        unsafe fn application_didReceiveRemoteNotification(
1255            &self,
1256            application: &NSApplication,
1257            user_info: &NSDictionary<NSString, AnyObject>,
1258        );
1259
1260        #[cfg(feature = "NSResponder")]
1261        /// Method to opt-in to secure restorable state.
1262        ///
1263        /// When this returns
1264        /// `YES:`NSCoders that are passed into the various
1265        /// `NSWindowRestoration`methods will
1266        /// `requiresSecureCoding`and have a
1267        /// `decodingFailurePolicy`of
1268        /// `NSDecodingFailurePolicySetErrorAndReturn.`Any
1269        /// `restorationClass`set on a window must explicitly conform to
1270        /// `NSWindowRestoration.`This method will be called prior to any state encoding or restoration.
1271        #[optional]
1272        #[unsafe(method(applicationSupportsSecureRestorableState:))]
1273        #[unsafe(method_family = none)]
1274        fn applicationSupportsSecureRestorableState(&self, app: &NSApplication) -> bool;
1275
1276        #[cfg(feature = "NSResponder")]
1277        /// Method called by `-[NSApplication encodeRestorableStateWithCoder:]` to give the delegate a chance to encode any additional state into the
1278        /// `NSCoder.`If the restorable state managed by the delegate changes, you must call `-[NSApplication invalidateRestorableState]` so that it will be re-encoded. See the header `NSWindowRestoration.h` for more information.
1279        ///
1280        /// # Safety
1281        ///
1282        /// `coder` possibly has further requirements.
1283        #[optional]
1284        #[unsafe(method(application:willEncodeRestorableState:))]
1285        #[unsafe(method_family = none)]
1286        unsafe fn application_willEncodeRestorableState(
1287            &self,
1288            app: &NSApplication,
1289            coder: &NSCoder,
1290        );
1291
1292        #[cfg(feature = "NSResponder")]
1293        /// Method called by `-[NSApplication restoreStateWithCoder:]` to give the delegate a chance to restore its own state, which it may decode from the
1294        /// `NSCoder.`See the header `NSWindowRestoration.h` for more information.
1295        ///
1296        /// # Safety
1297        ///
1298        /// `coder` possibly has further requirements.
1299        #[optional]
1300        #[unsafe(method(application:didDecodeRestorableState:))]
1301        #[unsafe(method_family = none)]
1302        unsafe fn application_didDecodeRestorableState(&self, app: &NSApplication, coder: &NSCoder);
1303
1304        #[cfg(feature = "NSResponder")]
1305        /// This will be called on the main thread as soon as the user indicates they want to continue an activity in your application. The
1306        /// `NSUserActivity`object may not be available instantly, so use this as an opportunity to show the user that an activity will be continued shortly. Return
1307        /// `YES`to indicate that you are doing so. Return
1308        /// `NO`(or leave it unimplemented) and AppKit/UIKit will put up a default UI.
1309        ///
1310        /// For each `-application:willContinueUserActivityWithType:` invocation, you are guaranteed to get exactly one invocation of `-application:continueUserActivity:restorationHandler:` on success, or `-application:didFailToContinueUserActivityWithType:error:` if an error was encountered.
1311        #[optional]
1312        #[unsafe(method(application:willContinueUserActivityWithType:))]
1313        #[unsafe(method_family = none)]
1314        fn application_willContinueUserActivityWithType(
1315            &self,
1316            application: &NSApplication,
1317            user_activity_type: &NSString,
1318        ) -> bool;
1319
1320        #[cfg(all(
1321            feature = "NSResponder",
1322            feature = "NSUserActivity",
1323            feature = "block2"
1324        ))]
1325        /// This will be called on the main thread after the
1326        /// `NSUserActivity`object is available. Use the data you stored in the NSUserActivity object to re-create what the user was doing.
1327        ///
1328        ///
1329        /// Returns: `YES`to indicate that the activity was handled. Return
1330        /// `NO`(or leave it unimplemented) and AppKit will attempt to continue the user activity.
1331        ///
1332        /// You should create/fetch any restorable objects associated with the user activity, and pass them to the restorationHandler. They will then get the above `-restoreUserActivityState:` method invoked with the user activity. Invoking the
1333        /// `restorationHandler`is optional. It may be copied and invoked later, but must be invoked on the main thread.
1334        ///
1335        /// If this user activity was created automatically by having
1336        /// `NSUbiquitousDocumentUserActivityType`in a
1337        /// `CFBundleDocumentTypes`entry, AppKit can automatically restore the NSUserActivity on OS X if NO is returned, or this method is unimplemented. It will do so by creating a document of the appropriate type using the URL stored in the userInfo under the
1338        /// `NSUserActivityDocumentURLKey.`The document will have `-restoreUserActivity:` called on it.
1339        #[optional]
1340        #[unsafe(method(application:continueUserActivity:restorationHandler:))]
1341        #[unsafe(method_family = none)]
1342        fn application_continueUserActivity_restorationHandler(
1343            &self,
1344            application: &NSApplication,
1345            user_activity: &NSUserActivity,
1346            restoration_handler: &block2::DynBlock<
1347                dyn Fn(NonNull<NSArray<ProtocolObject<dyn NSUserActivityRestoring>>>),
1348            >,
1349        ) -> bool;
1350
1351        #[cfg(feature = "NSResponder")]
1352        /// There are instances where continuing a
1353        /// `NSUserActivity`may fail. This will get called on the main thread if it does so. If it is unimplemented, AppKit will present the error.
1354        #[optional]
1355        #[unsafe(method(application:didFailToContinueUserActivityWithType:error:))]
1356        #[unsafe(method_family = none)]
1357        fn application_didFailToContinueUserActivityWithType_error(
1358            &self,
1359            application: &NSApplication,
1360            user_activity_type: &NSString,
1361            error: &NSError,
1362        );
1363
1364        #[cfg(feature = "NSResponder")]
1365        /// This will be called on the main thread when a user activity managed by AppKit/UIKit has been updated. You should use this as a last chance to add additional data to the
1366        /// `userActivity.`
1367        #[optional]
1368        #[unsafe(method(application:didUpdateUserActivity:))]
1369        #[unsafe(method_family = none)]
1370        fn application_didUpdateUserActivity(
1371            &self,
1372            application: &NSApplication,
1373            user_activity: &NSUserActivity,
1374        );
1375
1376        #[cfg(all(feature = "NSResponder", feature = "objc2-cloud-kit"))]
1377        #[cfg(target_vendor = "apple")]
1378        /// This will be called on the main thread after the user indicates they want to accept a CloudKit sharing invitation in your application.
1379        ///
1380        /// You should use the
1381        /// `CKShareMetadata`object's
1382        /// `shareURL`and containerIdentifier to schedule a
1383        /// `CKAcceptSharesOperation,`then start using the resulting
1384        /// `CKShare`and its associated record(s), which will appear in the
1385        /// `CKContainer's`shared database in a zone matching that of the record's owner.
1386        #[optional]
1387        #[unsafe(method(application:userDidAcceptCloudKitShareWithMetadata:))]
1388        #[unsafe(method_family = none)]
1389        fn application_userDidAcceptCloudKitShareWithMetadata(
1390            &self,
1391            application: &NSApplication,
1392            metadata: &CKShareMetadata,
1393        );
1394
1395        #[cfg(feature = "NSResponder")]
1396        /// Returns: `YES`if the receiving delegate object can respond to key value coding messages for a specific keyed attribute, to-one relationship, or to-many relationship.  Return
1397        /// `NO`otherwise.
1398        #[optional]
1399        #[unsafe(method(application:delegateHandlesKey:))]
1400        #[unsafe(method_family = none)]
1401        fn application_delegateHandlesKey(&self, sender: &NSApplication, key: &NSString) -> bool;
1402
1403        #[cfg(feature = "NSResponder")]
1404        /// This method will be called once during application launch at `-[NSApplication finishLaunching]`.
1405        ///
1406        ///
1407        /// Returns: `NO`if the receiving delegate object wishes to opt-out of system-wide keyboard shortcut localization for all application-supplied menus. Return
1408        /// `YES`by default for apps linked against 12.0 and later SDK.
1409        #[optional]
1410        #[unsafe(method(applicationShouldAutomaticallyLocalizeKeyEquivalents:))]
1411        #[unsafe(method_family = none)]
1412        fn applicationShouldAutomaticallyLocalizeKeyEquivalents(
1413            &self,
1414            application: &NSApplication,
1415        ) -> bool;
1416
1417        #[optional]
1418        #[unsafe(method(applicationWillFinishLaunching:))]
1419        #[unsafe(method_family = none)]
1420        fn applicationWillFinishLaunching(&self, notification: &NSNotification);
1421
1422        #[optional]
1423        #[unsafe(method(applicationDidFinishLaunching:))]
1424        #[unsafe(method_family = none)]
1425        fn applicationDidFinishLaunching(&self, notification: &NSNotification);
1426
1427        #[optional]
1428        #[unsafe(method(applicationWillHide:))]
1429        #[unsafe(method_family = none)]
1430        fn applicationWillHide(&self, notification: &NSNotification);
1431
1432        #[optional]
1433        #[unsafe(method(applicationDidHide:))]
1434        #[unsafe(method_family = none)]
1435        fn applicationDidHide(&self, notification: &NSNotification);
1436
1437        #[optional]
1438        #[unsafe(method(applicationWillUnhide:))]
1439        #[unsafe(method_family = none)]
1440        fn applicationWillUnhide(&self, notification: &NSNotification);
1441
1442        #[optional]
1443        #[unsafe(method(applicationDidUnhide:))]
1444        #[unsafe(method_family = none)]
1445        fn applicationDidUnhide(&self, notification: &NSNotification);
1446
1447        #[optional]
1448        #[unsafe(method(applicationWillBecomeActive:))]
1449        #[unsafe(method_family = none)]
1450        fn applicationWillBecomeActive(&self, notification: &NSNotification);
1451
1452        #[optional]
1453        #[unsafe(method(applicationDidBecomeActive:))]
1454        #[unsafe(method_family = none)]
1455        fn applicationDidBecomeActive(&self, notification: &NSNotification);
1456
1457        #[optional]
1458        #[unsafe(method(applicationWillResignActive:))]
1459        #[unsafe(method_family = none)]
1460        fn applicationWillResignActive(&self, notification: &NSNotification);
1461
1462        #[optional]
1463        #[unsafe(method(applicationDidResignActive:))]
1464        #[unsafe(method_family = none)]
1465        fn applicationDidResignActive(&self, notification: &NSNotification);
1466
1467        #[optional]
1468        #[unsafe(method(applicationWillUpdate:))]
1469        #[unsafe(method_family = none)]
1470        fn applicationWillUpdate(&self, notification: &NSNotification);
1471
1472        #[optional]
1473        #[unsafe(method(applicationDidUpdate:))]
1474        #[unsafe(method_family = none)]
1475        fn applicationDidUpdate(&self, notification: &NSNotification);
1476
1477        #[optional]
1478        #[unsafe(method(applicationWillTerminate:))]
1479        #[unsafe(method_family = none)]
1480        fn applicationWillTerminate(&self, notification: &NSNotification);
1481
1482        #[optional]
1483        #[unsafe(method(applicationDidChangeScreenParameters:))]
1484        #[unsafe(method_family = none)]
1485        fn applicationDidChangeScreenParameters(&self, notification: &NSNotification);
1486
1487        #[optional]
1488        #[unsafe(method(applicationDidChangeOcclusionState:))]
1489        #[unsafe(method_family = none)]
1490        fn applicationDidChangeOcclusionState(&self, notification: &NSNotification);
1491
1492        #[optional]
1493        #[unsafe(method(applicationProtectedDataWillBecomeUnavailable:))]
1494        #[unsafe(method_family = none)]
1495        fn applicationProtectedDataWillBecomeUnavailable(&self, notification: &NSNotification);
1496
1497        #[optional]
1498        #[unsafe(method(applicationProtectedDataDidBecomeAvailable:))]
1499        #[unsafe(method_family = none)]
1500        fn applicationProtectedDataDidBecomeAvailable(&self, notification: &NSNotification);
1501    }
1502);
1503
1504/// NSServicesMenu.
1505#[cfg(feature = "NSResponder")]
1506impl NSApplication {
1507    extern_methods!(
1508        #[cfg(feature = "NSMenu")]
1509        #[unsafe(method(servicesMenu))]
1510        #[unsafe(method_family = none)]
1511        pub fn servicesMenu(&self) -> Option<Retained<NSMenu>>;
1512
1513        #[cfg(feature = "NSMenu")]
1514        /// Setter for [`servicesMenu`][Self::servicesMenu].
1515        #[unsafe(method(setServicesMenu:))]
1516        #[unsafe(method_family = none)]
1517        pub fn setServicesMenu(&self, services_menu: Option<&NSMenu>);
1518
1519        #[cfg(feature = "NSPasteboard")]
1520        #[unsafe(method(registerServicesMenuSendTypes:returnTypes:))]
1521        #[unsafe(method_family = none)]
1522        pub fn registerServicesMenuSendTypes_returnTypes(
1523            &self,
1524            send_types: &NSArray<NSPasteboardType>,
1525            return_types: &NSArray<NSPasteboardType>,
1526        );
1527    );
1528}
1529
1530extern_protocol!(
1531    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsservicesmenurequestor?language=objc)
1532    pub unsafe trait NSServicesMenuRequestor: NSObjectProtocol {
1533        #[cfg(feature = "NSPasteboard")]
1534        #[optional]
1535        #[unsafe(method(writeSelectionToPasteboard:types:))]
1536        #[unsafe(method_family = none)]
1537        fn writeSelectionToPasteboard_types(
1538            &self,
1539            pboard: &NSPasteboard,
1540            types: &NSArray<NSPasteboardType>,
1541        ) -> bool;
1542
1543        #[cfg(feature = "NSPasteboard")]
1544        #[optional]
1545        #[unsafe(method(readSelectionFromPasteboard:))]
1546        #[unsafe(method_family = none)]
1547        fn readSelectionFromPasteboard(&self, pboard: &NSPasteboard) -> bool;
1548    }
1549);
1550
1551/// NSServicesHandling.
1552#[cfg(feature = "NSResponder")]
1553impl NSApplication {
1554    extern_methods!(
1555        #[unsafe(method(servicesProvider))]
1556        #[unsafe(method_family = none)]
1557        pub fn servicesProvider(&self) -> Option<Retained<AnyObject>>;
1558
1559        /// Setter for [`servicesProvider`][Self::servicesProvider].
1560        ///
1561        /// # Safety
1562        ///
1563        /// `services_provider` should be of the correct type.
1564        #[unsafe(method(setServicesProvider:))]
1565        #[unsafe(method_family = none)]
1566        pub unsafe fn setServicesProvider(&self, services_provider: Option<&AnyObject>);
1567    );
1568}
1569
1570/// Optional keys in `-orderFrontStandardAboutPanelWithOptions:`
1571/// `optionsDictionary.`
1572///
1573/// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsaboutpaneloptionkey?language=objc)
1574// NS_TYPED_ENUM
1575pub type NSAboutPanelOptionKey = NSString;
1576
1577extern "C" {
1578    /// NSAttributedString displayed in the info area of the panel. If not specified, contents obtained from "Credits.rtf" (.rtfd, .html) in [NSBundle mainBundle]; if not available, blank. Note that  in applications built against the 10.14 SDK or earlier, the credits are shown in light appearance even when the application is running in dark appearance, except when the credits are specified as an attributed string, or come from a file are the text is just pure black. In applications built against the 10.15 SDK or newer, credits will be shown in dark appearance, using the "adaptive color mapping" setting in NSTextView.
1579    ///
1580    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsaboutpaneloptioncredits?language=objc)
1581    pub static NSAboutPanelOptionCredits: &'static NSAboutPanelOptionKey;
1582}
1583
1584extern "C" {
1585    /// NSString displayed in place of the default app name. If not specified, uses the value of CFBundleName (localizable). Fallback is [[NSProcessInfo processInfo] processName].
1586    ///
1587    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsaboutpaneloptionapplicationname?language=objc)
1588    pub static NSAboutPanelOptionApplicationName: &'static NSAboutPanelOptionKey;
1589}
1590
1591extern "C" {
1592    /// NSImage displayed in place of NSApplicationIcon. If not specified, use [NSImage imageNamed:
1593    /// "
1594    /// NSApplicationIcon"]; if not available, generic icon.
1595    ///
1596    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsaboutpaneloptionapplicationicon?language=objc)
1597    pub static NSAboutPanelOptionApplicationIcon: &'static NSAboutPanelOptionKey;
1598}
1599
1600extern "C" {
1601    /// NSString containing the build version number of the application ("58.4", "1.2d3"); displayed as "Version 58.4" or "Version 1.0 (58.4) depending on the presence of ApplicationVersion. If not specified, obtain from the CFBundleVersion key in infoDictionary; if not specified or empty string, leave blank.
1602    ///
1603    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsaboutpaneloptionversion?language=objc)
1604    pub static NSAboutPanelOptionVersion: &'static NSAboutPanelOptionKey;
1605}
1606
1607extern "C" {
1608    /// NSString displayed as the marketing version  ("1.0", "Mac OS X", "3", "WebObjects 3.5", ...), before the build version. If not specified, obtain from CFBundleShortVersionString key in infoDictionary. Prefixed with word "Version" if it looks like a number.
1609    ///
1610    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsaboutpaneloptionapplicationversion?language=objc)
1611    pub static NSAboutPanelOptionApplicationVersion: &'static NSAboutPanelOptionKey;
1612}
1613
1614/// NSStandardAboutPanel.
1615#[cfg(feature = "NSResponder")]
1616impl NSApplication {
1617    extern_methods!(
1618        #[unsafe(method(orderFrontStandardAboutPanel:))]
1619        #[unsafe(method_family = none)]
1620        pub fn orderFrontStandardAboutPanel(&self, sender: Option<&AnyObject>);
1621
1622        /// # Safety
1623        ///
1624        /// `options_dictionary` generic should be of the correct type.
1625        #[unsafe(method(orderFrontStandardAboutPanelWithOptions:))]
1626        #[unsafe(method_family = none)]
1627        pub unsafe fn orderFrontStandardAboutPanelWithOptions(
1628            &self,
1629            options_dictionary: &NSDictionary<NSAboutPanelOptionKey, AnyObject>,
1630        );
1631    );
1632}
1633
1634/// NSApplicationLayoutDirection.
1635#[cfg(feature = "NSResponder")]
1636impl NSApplication {
1637    extern_methods!(
1638        #[cfg(feature = "NSUserInterfaceLayout")]
1639        #[unsafe(method(userInterfaceLayoutDirection))]
1640        #[unsafe(method_family = none)]
1641        pub fn userInterfaceLayoutDirection(&self) -> NSUserInterfaceLayoutDirection;
1642    );
1643}
1644
1645/// NSRestorableUserInterface.
1646#[cfg(feature = "NSResponder")]
1647impl NSApplication {
1648    extern_methods!(
1649        /// Disable or reenable relaunching this app on login, if the app was running at the time the user logged out.  These methods increment and decrement a counter respectively; if the counter is 0 at the time the user logs out, then the app may be relaunched when the user logs back in.  The counter is initially zero, so by default apps are relaunched.
1650        ///
1651        /// If your app should not be relaunched because it launches via some other mechanism (e.g. launchd), then the recommended usage is to call `-[NSApp disableRelaunchOnLogin]` once, and never pair it with an -enable call.
1652        ///
1653        /// If your app should not be relaunched because it triggers a restart (e.g. an installer), then the recommended usage is to call `-[NSApp disableRelaunchOnLogin]` immediately before you attempt to trigger a restart, and `-[NSApp enableRelaunchOnLogin]` immediately after.  This is because the user may cancel restarting; if the user later restarts for another reason, then your app should be brought back.
1654        ///
1655        /// These methods are thread safe.
1656        #[unsafe(method(disableRelaunchOnLogin))]
1657        #[unsafe(method_family = none)]
1658        pub fn disableRelaunchOnLogin(&self);
1659
1660        #[unsafe(method(enableRelaunchOnLogin))]
1661        #[unsafe(method_family = none)]
1662        pub fn enableRelaunchOnLogin(&self);
1663    );
1664}
1665
1666/// Soft deprecated.
1667/// Please use `NSApplication`'s `-registerForRemoteNotifications` along with `-requestAuthorizationWithOptions:` from the `UserNotifications.framework` to specify allowable notification types.
1668///
1669/// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsremotenotificationtype?language=objc)
1670// NS_OPTIONS
1671#[repr(transparent)]
1672#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1673pub struct NSRemoteNotificationType(pub NSUInteger);
1674bitflags::bitflags! {
1675    impl NSRemoteNotificationType: NSUInteger {
1676        #[doc(alias = "NSRemoteNotificationTypeNone")]
1677        const None = 0;
1678        #[doc(alias = "NSRemoteNotificationTypeBadge")]
1679        const Badge = 1<<0;
1680        #[doc(alias = "NSRemoteNotificationTypeSound")]
1681        const Sound = 1<<1;
1682        #[doc(alias = "NSRemoteNotificationTypeAlert")]
1683        const Alert = 1<<2;
1684    }
1685}
1686
1687unsafe impl Encode for NSRemoteNotificationType {
1688    const ENCODING: Encoding = NSUInteger::ENCODING;
1689}
1690
1691unsafe impl RefEncode for NSRemoteNotificationType {
1692    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1693}
1694
1695/// NSRemoteNotifications.
1696#[cfg(feature = "NSResponder")]
1697impl NSApplication {
1698    extern_methods!(
1699        #[unsafe(method(registerForRemoteNotifications))]
1700        #[unsafe(method_family = none)]
1701        pub fn registerForRemoteNotifications(&self);
1702
1703        #[unsafe(method(unregisterForRemoteNotifications))]
1704        #[unsafe(method_family = none)]
1705        pub fn unregisterForRemoteNotifications(&self);
1706
1707        /// Returns: `YES`if the application is currently registered for remote notifications, taking into account any systemwide settings; doesn't relate to connectivity.
1708        #[unsafe(method(isRegisteredForRemoteNotifications))]
1709        #[unsafe(method_family = none)]
1710        pub fn isRegisteredForRemoteNotifications(&self) -> bool;
1711
1712        /// The following are soft deprecated.
1713        /// Please use the `-registerForRemoteNotifications` above and `-requestAuthorizationWithOptions:` from `UserNotifications.framework`.
1714        #[unsafe(method(registerForRemoteNotificationTypes:))]
1715        #[unsafe(method_family = none)]
1716        pub fn registerForRemoteNotificationTypes(&self, types: NSRemoteNotificationType);
1717
1718        #[unsafe(method(enabledRemoteNotificationTypes))]
1719        #[unsafe(method_family = none)]
1720        pub fn enabledRemoteNotificationTypes(&self) -> NSRemoteNotificationType;
1721    );
1722}
1723
1724#[cfg(feature = "NSResponder")]
1725impl NSApplication {
1726    /// An Application's startup function.
1727    ///
1728    /// # Safety
1729    ///
1730    /// `argv` must be a valid pointer.
1731    #[doc(alias = "NSApplicationMain")]
1732    #[inline]
1733    pub(crate) unsafe fn __main(argc: c_int, argv: NonNull<NonNull<c_char>>) -> c_int {
1734        extern "C-unwind" {
1735            fn NSApplicationMain(argc: c_int, argv: NonNull<NonNull<c_char>>) -> c_int;
1736        }
1737        unsafe { NSApplicationMain(argc, argv) }
1738    }
1739
1740    /// `NSApplicationLoad`should be called when loading a Cocoa bundle in a Carbon app in order to initialize
1741    /// `NSApplication`and other Cocoa objects.  Redundant calls are ignored.
1742    #[doc(alias = "NSApplicationLoad")]
1743    #[inline]
1744    pub fn load() -> bool {
1745        extern "C-unwind" {
1746            fn NSApplicationLoad() -> Bool;
1747        }
1748        unsafe { NSApplicationLoad() }.as_bool()
1749    }
1750}
1751
1752/// `NSShowsServicesMenuItem()`always returns
1753/// `YES.`
1754#[inline]
1755pub extern "C-unwind" fn NSShowsServicesMenuItem(item_name: &NSString) -> bool {
1756    extern "C-unwind" {
1757        fn NSShowsServicesMenuItem(item_name: &NSString) -> Bool;
1758    }
1759    unsafe { NSShowsServicesMenuItem(item_name) }.as_bool()
1760}
1761
1762/// `NSSetShowsServicesMenuItem()`has no effect, and always returns 0.
1763#[inline]
1764pub extern "C-unwind" fn NSSetShowsServicesMenuItem(
1765    item_name: &NSString,
1766    enabled: bool,
1767) -> NSInteger {
1768    extern "C-unwind" {
1769        fn NSSetShowsServicesMenuItem(item_name: &NSString, enabled: Bool) -> NSInteger;
1770    }
1771    unsafe { NSSetShowsServicesMenuItem(item_name, Bool::new(enabled)) }
1772}
1773
1774/// `NSUpdateDynamicServices()`causes the services information for the system to be updated.
1775/// This will only be necessary if your program adds dynamic services to the system (i.e. services not found in mach-o segments of executables).
1776#[inline]
1777pub extern "C-unwind" fn NSUpdateDynamicServices() {
1778    extern "C-unwind" {
1779        fn NSUpdateDynamicServices();
1780    }
1781    unsafe { NSUpdateDynamicServices() }
1782}
1783
1784#[cfg(feature = "NSPasteboard")]
1785#[inline]
1786pub extern "C-unwind" fn NSPerformService(
1787    item_name: &NSString,
1788    pboard: Option<&NSPasteboard>,
1789) -> bool {
1790    extern "C-unwind" {
1791        fn NSPerformService(item_name: &NSString, pboard: Option<&NSPasteboard>) -> Bool;
1792    }
1793    unsafe { NSPerformService(item_name, pboard) }.as_bool()
1794}
1795
1796/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsserviceprovidername?language=objc)
1797pub type NSServiceProviderName = NSString;
1798
1799extern "C-unwind" {
1800    /// Apps should use -setServicesProvider.
1801    ///
1802    /// # Safety
1803    ///
1804    /// `provider` should be of the correct type.
1805    pub fn NSRegisterServicesProvider(provider: Option<&AnyObject>, name: &NSServiceProviderName);
1806}
1807
1808#[inline]
1809pub extern "C-unwind" fn NSUnregisterServicesProvider(name: &NSServiceProviderName) {
1810    extern "C-unwind" {
1811        fn NSUnregisterServicesProvider(name: &NSServiceProviderName);
1812    }
1813    unsafe { NSUnregisterServicesProvider(name) }
1814}
1815
1816extern "C" {
1817    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationdidbecomeactivenotification?language=objc)
1818    pub static NSApplicationDidBecomeActiveNotification: &'static NSNotificationName;
1819}
1820
1821extern "C" {
1822    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationdidhidenotification?language=objc)
1823    pub static NSApplicationDidHideNotification: &'static NSNotificationName;
1824}
1825
1826extern "C" {
1827    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationdidfinishlaunchingnotification?language=objc)
1828    pub static NSApplicationDidFinishLaunchingNotification: &'static NSNotificationName;
1829}
1830
1831extern "C" {
1832    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationdidresignactivenotification?language=objc)
1833    pub static NSApplicationDidResignActiveNotification: &'static NSNotificationName;
1834}
1835
1836extern "C" {
1837    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationdidunhidenotification?language=objc)
1838    pub static NSApplicationDidUnhideNotification: &'static NSNotificationName;
1839}
1840
1841extern "C" {
1842    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationdidupdatenotification?language=objc)
1843    pub static NSApplicationDidUpdateNotification: &'static NSNotificationName;
1844}
1845
1846extern "C" {
1847    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationwillbecomeactivenotification?language=objc)
1848    pub static NSApplicationWillBecomeActiveNotification: &'static NSNotificationName;
1849}
1850
1851extern "C" {
1852    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationwillhidenotification?language=objc)
1853    pub static NSApplicationWillHideNotification: &'static NSNotificationName;
1854}
1855
1856extern "C" {
1857    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationwillfinishlaunchingnotification?language=objc)
1858    pub static NSApplicationWillFinishLaunchingNotification: &'static NSNotificationName;
1859}
1860
1861extern "C" {
1862    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationwillresignactivenotification?language=objc)
1863    pub static NSApplicationWillResignActiveNotification: &'static NSNotificationName;
1864}
1865
1866extern "C" {
1867    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationwillunhidenotification?language=objc)
1868    pub static NSApplicationWillUnhideNotification: &'static NSNotificationName;
1869}
1870
1871extern "C" {
1872    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationwillupdatenotification?language=objc)
1873    pub static NSApplicationWillUpdateNotification: &'static NSNotificationName;
1874}
1875
1876extern "C" {
1877    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationwillterminatenotification?language=objc)
1878    pub static NSApplicationWillTerminateNotification: &'static NSNotificationName;
1879}
1880
1881extern "C" {
1882    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationdidchangescreenparametersnotification?language=objc)
1883    pub static NSApplicationDidChangeScreenParametersNotification: &'static NSNotificationName;
1884}
1885
1886extern "C" {
1887    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationprotecteddatawillbecomeunavailablenotification?language=objc)
1888    pub static NSApplicationProtectedDataWillBecomeUnavailableNotification:
1889        &'static NSNotificationName;
1890}
1891
1892extern "C" {
1893    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationprotecteddatadidbecomeavailablenotification?language=objc)
1894    pub static NSApplicationProtectedDataDidBecomeAvailableNotification:
1895        &'static NSNotificationName;
1896}
1897
1898extern "C" {
1899    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationshouldbeginsuppressinghighdynamicrangecontentnotification?language=objc)
1900    pub static NSApplicationShouldBeginSuppressingHighDynamicRangeContentNotification:
1901        &'static NSNotificationName;
1902}
1903
1904extern "C" {
1905    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationshouldendsuppressinghighdynamicrangecontentnotification?language=objc)
1906    pub static NSApplicationShouldEndSuppressingHighDynamicRangeContentNotification:
1907        &'static NSNotificationName;
1908}
1909
1910extern "C" {
1911    /// The following key is present in the userInfo of NSApplicationDidFinishLaunchingNotification.  Its value is an NSNumber containing a bool.  It will be NO if the app was launched to open or print a file, to perform a Service, if the app had saved state that will be restored, or if the app launch was in some other sense not a "default" launch.  Otherwise its value will be YES.
1912    ///
1913    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationlaunchisdefaultlaunchkey?language=objc)
1914    pub static NSApplicationLaunchIsDefaultLaunchKey: &'static NSString;
1915}
1916
1917extern "C" {
1918    /// The following key is present in the userInfo of NSApplicationDidFinishLaunchingNotification. It will be present if your application was launched because a user activated a notification in the Notification Center. Its value is an NSUserNotification object.
1919    ///
1920    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationlaunchusernotificationkey?language=objc)
1921    pub static NSApplicationLaunchUserNotificationKey: &'static NSString;
1922}
1923
1924extern "C" {
1925    /// NSApplicationLaunchRemoteNotificationKey is unimplemented.  Please use NSApplicationLaunchUserNotificationKey to get the NSUserNotification object.  The NSUserNotification object has an isRemote property to indicate whether this application was launched as a result of a remote notification
1926    ///
1927    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationlaunchremotenotificationkey?language=objc)
1928    #[deprecated]
1929    pub static NSApplicationLaunchRemoteNotificationKey: &'static NSString;
1930}
1931
1932extern "C" {
1933    /// Upon receiving this notification, you can query the NSApplication for its occlusion state. Note that this only notifies about changes in the state of the occlusion, not when the occlusion region changes. You can use this notification to increase responsiveness and save power, by halting any expensive calculations that the user can not see.
1934    ///
1935    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationdidchangeocclusionstatenotification?language=objc)
1936    pub static NSApplicationDidChangeOcclusionStateNotification: &'static NSNotificationName;
1937}
1938
1939/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsrunstoppedresponse?language=objc)
1940#[deprecated = "Use NSModalResponseStop instead"]
1941pub const NSRunStoppedResponse: c_int = -1000;
1942/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsrunabortedresponse?language=objc)
1943#[deprecated = "Use NSModalResponseAbort instead"]
1944pub const NSRunAbortedResponse: c_int = -1001;
1945/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsruncontinuesresponse?language=objc)
1946#[deprecated = "Use NSModalResponseContinue instead"]
1947pub const NSRunContinuesResponse: c_int = -1002;
1948
1949/// NSDeprecated.
1950#[cfg(feature = "NSResponder")]
1951impl NSApplication {
1952    extern_methods!(
1953        #[cfg(feature = "NSWindow")]
1954        /// `-runModalForWindow:relativeToWindow:` was deprecated in Mac OS X 10.0. Please use `-[NSWindow beginSheet:completionHandler:]` instead.
1955        ///
1956        /// # Safety
1957        ///
1958        /// - `window` might not allow `None`.
1959        /// - `doc_window` might not allow `None`.
1960        #[deprecated = "Use -[NSWindow beginSheet:completionHandler:] instead"]
1961        #[unsafe(method(runModalForWindow:relativeToWindow:))]
1962        #[unsafe(method_family = none)]
1963        pub unsafe fn runModalForWindow_relativeToWindow(
1964            &self,
1965            window: Option<&NSWindow>,
1966            doc_window: Option<&NSWindow>,
1967        ) -> NSInteger;
1968
1969        #[cfg(feature = "NSWindow")]
1970        /// `-beginModalSessionForWindow:relativeToWindow:` was deprecated in Mac OS X 10.0. Please use `-[NSWindow beginSheet:completionHandler:]` instead.
1971        ///
1972        /// # Safety
1973        ///
1974        /// - `window` might not allow `None`.
1975        /// - `doc_window` might not allow `None`.
1976        #[deprecated = "Use -[NSWindow beginSheet:completionHandler:] instead"]
1977        #[unsafe(method(beginModalSessionForWindow:relativeToWindow:))]
1978        #[unsafe(method_family = none)]
1979        pub unsafe fn beginModalSessionForWindow_relativeToWindow(
1980            &self,
1981            window: Option<&NSWindow>,
1982            doc_window: Option<&NSWindow>,
1983        ) -> NSModalSession;
1984
1985        /// `-application:printFiles:` was deprecated in Mac OS X 10.4.
1986        /// Implement `-application:printFiles:withSettings:showPrintPanels:` in your application delegate instead.
1987        ///
1988        /// # Safety
1989        ///
1990        /// - `sender` might not allow `None`.
1991        /// - `filenames` might not allow `None`.
1992        #[deprecated]
1993        #[unsafe(method(application:printFiles:))]
1994        #[unsafe(method_family = none)]
1995        pub unsafe fn application_printFiles(
1996            &self,
1997            sender: Option<&NSApplication>,
1998            filenames: Option<&NSArray<NSString>>,
1999        );
2000
2001        #[cfg(feature = "NSWindow")]
2002        /// `NSWindow`'s `-beginSheet:completionHandler:` and `-endSheet:returnCode:` should be used instead.  `NSApplication`'s `-beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:` will continue to work as it previously did, leaking contextInfo and failing when there is already an existing sheet.
2003        ///
2004        /// # Safety
2005        ///
2006        /// - `modal_delegate` should be of the correct type.
2007        /// - `did_end_selector` must be a valid selector.
2008        /// - `context_info` must be a valid pointer.
2009        #[deprecated = "Use -[NSWindow beginSheet:completionHandler:] instead"]
2010        #[unsafe(method(beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:))]
2011        #[unsafe(method_family = none)]
2012        pub unsafe fn beginSheet_modalForWindow_modalDelegate_didEndSelector_contextInfo(
2013            &self,
2014            sheet: &NSWindow,
2015            doc_window: &NSWindow,
2016            modal_delegate: Option<&AnyObject>,
2017            did_end_selector: Option<Sel>,
2018            context_info: *mut c_void,
2019        );
2020
2021        #[cfg(feature = "NSWindow")]
2022        #[deprecated = "Use -[NSWindow endSheet:] instead"]
2023        #[unsafe(method(endSheet:))]
2024        #[unsafe(method_family = none)]
2025        pub fn endSheet(&self, sheet: &NSWindow);
2026
2027        #[cfg(feature = "NSWindow")]
2028        #[deprecated = "Use -[NSWindow endSheet:returnCode:] instead"]
2029        #[unsafe(method(endSheet:returnCode:))]
2030        #[unsafe(method_family = none)]
2031        pub fn endSheet_returnCode(&self, sheet: &NSWindow, return_code: NSInteger);
2032
2033        #[cfg(feature = "NSWindow")]
2034        /// # Safety
2035        ///
2036        /// `selector` must be a valid selector.
2037        #[deprecated = "Use -enumerateWindowsWithOptions:usingBlock: instead"]
2038        #[unsafe(method(makeWindowsPerform:inOrder:))]
2039        #[unsafe(method_family = none)]
2040        pub unsafe fn makeWindowsPerform_inOrder(
2041            &self,
2042            selector: Sel,
2043            in_order: bool,
2044        ) -> Option<Retained<NSWindow>>;
2045
2046        #[cfg(feature = "NSGraphicsContext")]
2047        /// This method is deprecated as of macOS 10.12. Beginning in OS X 10.11 it would always return nil. Prior to this it would return an undefined graphics context that was not generally suitable for drawing.
2048        #[deprecated = "This method always returns nil. If you need access to the current drawing context, use [NSGraphicsContext currentContext] inside of a draw operation."]
2049        #[unsafe(method(context))]
2050        #[unsafe(method_family = none)]
2051        pub fn context(&self) -> Option<Retained<NSGraphicsContext>>;
2052    );
2053}
2054
2055extern "C-unwind" {
2056    #[deprecated = "renamed to `NSApplication::__main`"]
2057    pub fn NSApplicationMain(argc: c_int, argv: NonNull<NonNull<c_char>>) -> c_int;
2058}
2059
2060#[deprecated = "renamed to `NSApplication::load`"]
2061#[inline]
2062pub extern "C-unwind" fn NSApplicationLoad() -> bool {
2063    extern "C-unwind" {
2064        fn NSApplicationLoad() -> Bool;
2065    }
2066    unsafe { NSApplicationLoad() }.as_bool()
2067}