objc2-app-kit 0.3.2

Bindings to the AppKit framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::cell::UnsafeCell;
use core::ffi::*;
use core::marker::{PhantomData, PhantomPinned};
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-cloud-kit")]
#[cfg(target_vendor = "apple")]
use objc2_cloud_kit::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversion?language=objc)
// NS_TYPED_EXTENSIBLE_ENUM
pub type NSAppKitVersion = c_double;

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber?language=objc)
    pub static NSAppKitVersionNumber: NSAppKitVersion;
}

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_0?language=objc)
pub static NSAppKitVersionNumber10_0: NSAppKitVersion = 577 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_1?language=objc)
pub static NSAppKitVersionNumber10_1: NSAppKitVersion = 620 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_2?language=objc)
pub static NSAppKitVersionNumber10_2: NSAppKitVersion = 663 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_2_3?language=objc)
pub static NSAppKitVersionNumber10_2_3: NSAppKitVersion = 663.6 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_3?language=objc)
pub static NSAppKitVersionNumber10_3: NSAppKitVersion = 743 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_3_2?language=objc)
pub static NSAppKitVersionNumber10_3_2: NSAppKitVersion = 743.14 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_3_3?language=objc)
pub static NSAppKitVersionNumber10_3_3: NSAppKitVersion = 743.2 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_3_5?language=objc)
pub static NSAppKitVersionNumber10_3_5: NSAppKitVersion = 743.24 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_3_7?language=objc)
pub static NSAppKitVersionNumber10_3_7: NSAppKitVersion = 743.33 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_3_9?language=objc)
pub static NSAppKitVersionNumber10_3_9: NSAppKitVersion = 743.36 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_4?language=objc)
pub static NSAppKitVersionNumber10_4: NSAppKitVersion = 824 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_4_1?language=objc)
pub static NSAppKitVersionNumber10_4_1: NSAppKitVersion = 824.1 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_4_3?language=objc)
pub static NSAppKitVersionNumber10_4_3: NSAppKitVersion = 824.23 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_4_4?language=objc)
pub static NSAppKitVersionNumber10_4_4: NSAppKitVersion = 824.33 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_4_7?language=objc)
pub static NSAppKitVersionNumber10_4_7: NSAppKitVersion = 824.41 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_5?language=objc)
pub static NSAppKitVersionNumber10_5: NSAppKitVersion = 949 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_5_2?language=objc)
pub static NSAppKitVersionNumber10_5_2: NSAppKitVersion = 949.27 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_5_3?language=objc)
pub static NSAppKitVersionNumber10_5_3: NSAppKitVersion = 949.33 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_6?language=objc)
pub static NSAppKitVersionNumber10_6: NSAppKitVersion = 1038 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_7?language=objc)
pub static NSAppKitVersionNumber10_7: NSAppKitVersion = 1138 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_7_2?language=objc)
pub static NSAppKitVersionNumber10_7_2: NSAppKitVersion = 1138.23 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_7_3?language=objc)
pub static NSAppKitVersionNumber10_7_3: NSAppKitVersion = 1138.32 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_7_4?language=objc)
pub static NSAppKitVersionNumber10_7_4: NSAppKitVersion = 1138.47 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_8?language=objc)
pub static NSAppKitVersionNumber10_8: NSAppKitVersion = 1187 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_9?language=objc)
pub static NSAppKitVersionNumber10_9: NSAppKitVersion = 1265 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_10?language=objc)
pub static NSAppKitVersionNumber10_10: NSAppKitVersion = 1343 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_10_2?language=objc)
pub static NSAppKitVersionNumber10_10_2: NSAppKitVersion = 1344 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_10_3?language=objc)
pub static NSAppKitVersionNumber10_10_3: NSAppKitVersion = 1347 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_10_4?language=objc)
pub static NSAppKitVersionNumber10_10_4: NSAppKitVersion = 1348 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_10_5?language=objc)
pub static NSAppKitVersionNumber10_10_5: NSAppKitVersion = 1348 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_10_max?language=objc)
pub static NSAppKitVersionNumber10_10_Max: NSAppKitVersion = 1349 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_11?language=objc)
pub static NSAppKitVersionNumber10_11: NSAppKitVersion = 1404 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_11_1?language=objc)
pub static NSAppKitVersionNumber10_11_1: NSAppKitVersion = 1404.13 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_11_2?language=objc)
pub static NSAppKitVersionNumber10_11_2: NSAppKitVersion = 1404.34 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_11_3?language=objc)
pub static NSAppKitVersionNumber10_11_3: NSAppKitVersion = 1404.34 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_12?language=objc)
pub static NSAppKitVersionNumber10_12: NSAppKitVersion = 1504 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_12_1?language=objc)
pub static NSAppKitVersionNumber10_12_1: NSAppKitVersion = 1504.6 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_12_2?language=objc)
pub static NSAppKitVersionNumber10_12_2: NSAppKitVersion = 1504.76 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_13?language=objc)
pub static NSAppKitVersionNumber10_13: NSAppKitVersion = 1561 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_13_1?language=objc)
pub static NSAppKitVersionNumber10_13_1: NSAppKitVersion = 1561.1 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_13_2?language=objc)
pub static NSAppKitVersionNumber10_13_2: NSAppKitVersion = 1561.2 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_13_4?language=objc)
pub static NSAppKitVersionNumber10_13_4: NSAppKitVersion = 1561.4 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_14?language=objc)
pub static NSAppKitVersionNumber10_14: NSAppKitVersion = 1671 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_14_1?language=objc)
pub static NSAppKitVersionNumber10_14_1: NSAppKitVersion = 1671.1 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_14_2?language=objc)
pub static NSAppKitVersionNumber10_14_2: NSAppKitVersion = 1671.2 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_14_3?language=objc)
pub static NSAppKitVersionNumber10_14_3: NSAppKitVersion = 1671.3 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_14_4?language=objc)
pub static NSAppKitVersionNumber10_14_4: NSAppKitVersion = 1671.4 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_14_5?language=objc)
pub static NSAppKitVersionNumber10_14_5: NSAppKitVersion = 1671.5 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_15?language=objc)
pub static NSAppKitVersionNumber10_15: NSAppKitVersion = 1894 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_15_1?language=objc)
pub static NSAppKitVersionNumber10_15_1: NSAppKitVersion = 1894.1 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_15_2?language=objc)
pub static NSAppKitVersionNumber10_15_2: NSAppKitVersion = 1894.2 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_15_3?language=objc)
pub static NSAppKitVersionNumber10_15_3: NSAppKitVersion = 1894.3 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_15_4?language=objc)
pub static NSAppKitVersionNumber10_15_4: NSAppKitVersion = 1894.4 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_15_5?language=objc)
pub static NSAppKitVersionNumber10_15_5: NSAppKitVersion = 1894.5 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber10_15_6?language=objc)
pub static NSAppKitVersionNumber10_15_6: NSAppKitVersion = 1894.6 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber11_0?language=objc)
pub static NSAppKitVersionNumber11_0: NSAppKitVersion = 2022 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber11_1?language=objc)
pub static NSAppKitVersionNumber11_1: NSAppKitVersion = 2022.2 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber11_2?language=objc)
pub static NSAppKitVersionNumber11_2: NSAppKitVersion = 2022.3 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber11_3?language=objc)
pub static NSAppKitVersionNumber11_3: NSAppKitVersion = 2022.4 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber11_4?language=objc)
pub static NSAppKitVersionNumber11_4: NSAppKitVersion = 2022.5 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber11_5?language=objc)
pub static NSAppKitVersionNumber11_5: NSAppKitVersion = 2022.6 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber12_0?language=objc)
pub static NSAppKitVersionNumber12_0: NSAppKitVersion = 2113 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber12_1?language=objc)
pub static NSAppKitVersionNumber12_1: NSAppKitVersion = 2113.2 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber12_2?language=objc)
pub static NSAppKitVersionNumber12_2: NSAppKitVersion = 2113.3 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber12_3?language=objc)
pub static NSAppKitVersionNumber12_3: NSAppKitVersion = 2113.4 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber12_4?language=objc)
pub static NSAppKitVersionNumber12_4: NSAppKitVersion = 2113.5 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber12_5?language=objc)
pub static NSAppKitVersionNumber12_5: NSAppKitVersion = 2113.6 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber13_0?language=objc)
pub static NSAppKitVersionNumber13_0: NSAppKitVersion = 2299 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber13_1?language=objc)
pub static NSAppKitVersionNumber13_1: NSAppKitVersion = 2299.3 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber13_2?language=objc)
pub static NSAppKitVersionNumber13_2: NSAppKitVersion = 2299.3 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber13_3?language=objc)
pub static NSAppKitVersionNumber13_3: NSAppKitVersion = 2299.4 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber13_4?language=objc)
pub static NSAppKitVersionNumber13_4: NSAppKitVersion = 2299.5 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber13_5?language=objc)
pub static NSAppKitVersionNumber13_5: NSAppKitVersion = 2299.6 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber13_6?language=objc)
pub static NSAppKitVersionNumber13_6: NSAppKitVersion = 2299.7 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber14_0?language=objc)
pub static NSAppKitVersionNumber14_0: NSAppKitVersion = 2487 as _;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitversionnumber14_1?language=objc)
pub static NSAppKitVersionNumber14_1: NSAppKitVersion = 2487.2 as _;

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsmodalpanelrunloopmode?language=objc)
    pub static NSModalPanelRunLoopMode: &'static NSRunLoopMode;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nseventtrackingrunloopmode?language=objc)
    pub static NSEventTrackingRunLoopMode: &'static NSRunLoopMode;
}

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsmodalresponse?language=objc)
// NS_TYPED_EXTENSIBLE_ENUM
pub type NSModalResponse = NSInteger;

/// Also used as the default response for sheets
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsmodalresponsestop?language=objc)
pub static NSModalResponseStop: NSModalResponse = -1000;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsmodalresponseabort?language=objc)
pub static NSModalResponseAbort: NSModalResponse = -1001;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsmodalresponsecontinue?language=objc)
pub static NSModalResponseContinue: NSModalResponse = -1002;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsupdatewindowsrunloopordering?language=objc)
pub const NSUpdateWindowsRunLoopOrdering: c_uint = 500000;

/// Flags that comprise an application's
/// `presentationOptions.`
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationpresentationoptions?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSApplicationPresentationOptions(pub NSUInteger);
bitflags::bitflags! {
    impl NSApplicationPresentationOptions: NSUInteger {
        #[doc(alias = "NSApplicationPresentationDefault")]
        const Default = 0;
/// Dock appears when moused to.
        #[doc(alias = "NSApplicationPresentationAutoHideDock")]
        const AutoHideDock = 1<<0;
/// Dock is entirely unavailable.
        #[doc(alias = "NSApplicationPresentationHideDock")]
        const HideDock = 1<<1;
/// Menu Bar appears when moused to.
        #[doc(alias = "NSApplicationPresentationAutoHideMenuBar")]
        const AutoHideMenuBar = 1<<2;
/// Menu Bar is entirely unavailable.
        #[doc(alias = "NSApplicationPresentationHideMenuBar")]
        const HideMenuBar = 1<<3;
/// All Apple menu items are disabled.
        #[doc(alias = "NSApplicationPresentationDisableAppleMenu")]
        const DisableAppleMenu = 1<<4;
/// Cmd+Tab UI is disabled.
        #[doc(alias = "NSApplicationPresentationDisableProcessSwitching")]
        const DisableProcessSwitching = 1<<5;
/// Cmd+Opt+Esc panel is disabled.
        #[doc(alias = "NSApplicationPresentationDisableForceQuit")]
        const DisableForceQuit = 1<<6;
/// PowerKey panel and Restart/Shut Down/Log Out disabled.
        #[doc(alias = "NSApplicationPresentationDisableSessionTermination")]
        const DisableSessionTermination = 1<<7;
/// Application "Hide" menu item is disabled.
        #[doc(alias = "NSApplicationPresentationDisableHideApplication")]
        const DisableHideApplication = 1<<8;
/// Menu Bar's transparent appearance is disabled.
        #[doc(alias = "NSApplicationPresentationDisableMenuBarTransparency")]
        const DisableMenuBarTransparency = 1<<9;
/// Application is in fullscreen mode.
        #[doc(alias = "NSApplicationPresentationFullScreen")]
        const FullScreen = 1<<10;
/// Fullscreen window toolbar is detached from window and hides/shows on rollover.
/// May be used only when both
/// `NSApplicationPresentationFullScreen`is also set.
        #[doc(alias = "NSApplicationPresentationAutoHideToolbar")]
        const AutoHideToolbar = 1<<11;
/// "Shake mouse pointer to locate" is disabled for this application.
        #[doc(alias = "NSApplicationPresentationDisableCursorLocationAssistance")]
        const DisableCursorLocationAssistance = 1<<12;
    }
}

unsafe impl Encode for NSApplicationPresentationOptions {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSApplicationPresentationOptions {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationocclusionstate?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSApplicationOcclusionState(pub NSUInteger);
bitflags::bitflags! {
    impl NSApplicationOcclusionState: NSUInteger {
/// 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.
        #[doc(alias = "NSApplicationOcclusionStateVisible")]
        const Visible = 1<<1;
    }
}

unsafe impl Encode for NSApplicationOcclusionState {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSApplicationOcclusionState {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nswindowlistoptions?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSWindowListOptions(pub NSInteger);
bitflags::bitflags! {
    impl NSWindowListOptions: NSInteger {
/// Onscreen application windows in front to back order. By default, -[NSApp windows] is used.
        #[doc(alias = "NSWindowListOrderedFrontToBack")]
        const OrderedFrontToBack = 1<<0;
    }
}

unsafe impl Encode for NSWindowListOptions {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for NSWindowListOptions {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/_nsmodalsession?language=objc)
#[repr(C)]
#[derive(Debug)]
pub struct _NSModalSession {
    inner: [u8; 0],
    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}

unsafe impl RefEncode for _NSModalSession {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Encoding::Struct("_NSModalSession", &[]));
}

/// Information used by the system during modal sessions.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsmodalsession?language=objc)
pub type NSModalSession = *mut _NSModalSession;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsrequestuserattentiontype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSRequestUserAttentionType(pub NSUInteger);
impl NSRequestUserAttentionType {
    #[doc(alias = "NSCriticalRequest")]
    pub const CriticalRequest: Self = Self(0);
    #[doc(alias = "NSInformationalRequest")]
    pub const InformationalRequest: Self = Self(10);
}

unsafe impl Encode for NSRequestUserAttentionType {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSRequestUserAttentionType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationdelegatereply?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSApplicationDelegateReply(pub NSUInteger);
impl NSApplicationDelegateReply {
    #[doc(alias = "NSApplicationDelegateReplySuccess")]
    pub const Success: Self = Self(0);
    #[doc(alias = "NSApplicationDelegateReplyCancel")]
    pub const Cancel: Self = Self(1);
    #[doc(alias = "NSApplicationDelegateReplyFailure")]
    pub const Failure: Self = Self(2);
}

unsafe impl Encode for NSApplicationDelegateReply {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSApplicationDelegateReply {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplication?language=objc)
    #[unsafe(super(NSResponder, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "NSResponder")]
    pub struct NSApplication;
);

#[cfg(all(feature = "NSAccessibilityProtocols", feature = "NSResponder"))]
extern_conformance!(
    unsafe impl NSAccessibility for NSApplication {}
);

#[cfg(all(feature = "NSAccessibilityProtocols", feature = "NSResponder"))]
extern_conformance!(
    unsafe impl NSAccessibilityElementProtocol for NSApplication {}
);

#[cfg(feature = "NSResponder")]
extern_conformance!(
    unsafe impl NSCoding for NSApplication {}
);

#[cfg(all(feature = "NSMenu", feature = "NSResponder"))]
extern_conformance!(
    unsafe impl NSMenuItemValidation for NSApplication {}
);

#[cfg(feature = "NSResponder")]
extern_conformance!(
    unsafe impl NSObjectProtocol for NSApplication {}
);

#[cfg(all(feature = "NSResponder", feature = "NSUserInterfaceValidation"))]
extern_conformance!(
    unsafe impl NSUserInterfaceValidations for NSApplication {}
);

#[cfg(feature = "NSResponder")]
impl NSApplication {
    extern_methods!(
        #[unsafe(method(sharedApplication))]
        #[unsafe(method_family = none)]
        pub fn sharedApplication(mtm: MainThreadMarker) -> Retained<NSApplication>;

        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSApplicationDelegate>>>;

        /// Setter for [`delegate`][Self::delegate].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setDelegate:))]
        #[unsafe(method_family = none)]
        pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSApplicationDelegate>>);

        #[unsafe(method(hide:))]
        #[unsafe(method_family = none)]
        pub fn hide(&self, sender: Option<&AnyObject>);

        #[unsafe(method(unhide:))]
        #[unsafe(method_family = none)]
        pub fn unhide(&self, sender: Option<&AnyObject>);

        #[unsafe(method(unhideWithoutActivation))]
        #[unsafe(method_family = none)]
        pub fn unhideWithoutActivation(&self);

        #[cfg(feature = "NSWindow")]
        #[unsafe(method(windowWithWindowNumber:))]
        #[unsafe(method_family = none)]
        pub fn windowWithWindowNumber(&self, window_num: NSInteger) -> Option<Retained<NSWindow>>;

        #[cfg(feature = "NSWindow")]
        #[unsafe(method(mainWindow))]
        #[unsafe(method_family = none)]
        pub fn mainWindow(&self) -> Option<Retained<NSWindow>>;

        #[cfg(feature = "NSWindow")]
        #[unsafe(method(keyWindow))]
        #[unsafe(method_family = none)]
        pub fn keyWindow(&self) -> Option<Retained<NSWindow>>;

        #[unsafe(method(isActive))]
        #[unsafe(method_family = none)]
        pub fn isActive(&self) -> bool;

        #[unsafe(method(isHidden))]
        #[unsafe(method_family = none)]
        pub fn isHidden(&self) -> bool;

        #[unsafe(method(isRunning))]
        #[unsafe(method_family = none)]
        pub fn isRunning(&self) -> bool;

        /// A boolean value indicating whether your application should suppress HDR content based on established policy.
        /// 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.
        #[unsafe(method(applicationShouldSuppressHighDynamicRangeContent))]
        #[unsafe(method_family = none)]
        pub fn applicationShouldSuppressHighDynamicRangeContent(&self) -> bool;

        #[unsafe(method(deactivate))]
        #[unsafe(method_family = none)]
        pub fn deactivate(&self);

        /// Makes the receiver the active app.
        /// - Parameter ignoreOtherApps: If `NO`, the app is activated only if no other app is currently active. If `YES`, the app activates regardless.
        #[deprecated = "This method will be deprecated in a future release. Use NSApp.activate instead."]
        #[unsafe(method(activateIgnoringOtherApps:))]
        #[unsafe(method_family = none)]
        pub fn activateIgnoringOtherApps(&self, ignore_other_apps: bool);

        /// Makes the receiver the active app, if possible.
        ///
        /// You shouldn’t assume the app will be active immediately
        /// after sending this message. The framework also does not
        /// guarantee that the app will be activated at all.
        ///
        /// For cooperative activation, the other application should
        /// call `-yieldActivationToApplication:` or equivalent prior
        /// to the target application invoking `-activate`.
        ///
        /// Invoking `-activate` on an already-active application
        /// cancels any pending activation yields by the receiver.
        #[unsafe(method(activate))]
        #[unsafe(method_family = none)]
        pub fn activate(&self);

        #[cfg(feature = "NSRunningApplication")]
        /// Explicitly allows another application to make itself active.
        ///
        /// Calling this method will not deactivate the current app, nor
        /// will it activate the other app. For cooperative or coordinated
        /// activation, the other app should request to be activated at
        /// some point in the future by calling `activate` or equivalent.
        #[unsafe(method(yieldActivationToApplication:))]
        #[unsafe(method_family = none)]
        pub fn yieldActivationToApplication(&self, application: &NSRunningApplication);

        /// Same as `-yieldActivationToApplication:`, but the provided
        /// bundle identifier does not have to correspond to a currently
        /// running application.
        ///
        /// This method should be used to yield activation to apps that
        /// may not be running at the time of invoking it. If it is known
        /// that the target application is currently running, use
        /// `-yieldActivationToApplication:` instead.
        #[unsafe(method(yieldActivationToApplicationWithBundleIdentifier:))]
        #[unsafe(method_family = none)]
        pub fn yieldActivationToApplicationWithBundleIdentifier(
            &self,
            bundle_identifier: &NSString,
        );

        #[unsafe(method(hideOtherApplications:))]
        #[unsafe(method_family = none)]
        pub fn hideOtherApplications(&self, sender: Option<&AnyObject>);

        #[unsafe(method(unhideAllApplications:))]
        #[unsafe(method_family = none)]
        pub fn unhideAllApplications(&self, sender: Option<&AnyObject>);

        #[unsafe(method(finishLaunching))]
        #[unsafe(method_family = none)]
        pub fn finishLaunching(&self);

        #[unsafe(method(run))]
        #[unsafe(method_family = none)]
        pub fn run(&self);

        #[cfg(feature = "NSWindow")]
        #[unsafe(method(runModalForWindow:))]
        #[unsafe(method_family = none)]
        pub fn runModalForWindow(&self, window: &NSWindow) -> NSModalResponse;

        #[unsafe(method(stop:))]
        #[unsafe(method_family = none)]
        pub fn stop(&self, sender: Option<&AnyObject>);

        #[unsafe(method(stopModal))]
        #[unsafe(method_family = none)]
        pub fn stopModal(&self);

        #[unsafe(method(stopModalWithCode:))]
        #[unsafe(method_family = none)]
        pub fn stopModalWithCode(&self, return_code: NSModalResponse);

        #[unsafe(method(abortModal))]
        #[unsafe(method_family = none)]
        pub fn abortModal(&self);

        #[cfg(feature = "NSWindow")]
        #[unsafe(method(modalWindow))]
        #[unsafe(method_family = none)]
        pub fn modalWindow(&self) -> Option<Retained<NSWindow>>;

        #[cfg(feature = "NSWindow")]
        #[unsafe(method(beginModalSessionForWindow:))]
        #[unsafe(method_family = none)]
        pub fn beginModalSessionForWindow(&self, window: &NSWindow) -> NSModalSession;

        /// # Safety
        ///
        /// `session` must be a valid pointer.
        #[unsafe(method(runModalSession:))]
        #[unsafe(method_family = none)]
        pub unsafe fn runModalSession(&self, session: NSModalSession) -> NSModalResponse;

        /// # Safety
        ///
        /// `session` must be a valid pointer.
        #[unsafe(method(endModalSession:))]
        #[unsafe(method_family = none)]
        pub unsafe fn endModalSession(&self, session: NSModalSession);

        #[unsafe(method(terminate:))]
        #[unsafe(method_family = none)]
        pub fn terminate(&self, sender: Option<&AnyObject>);

        /// Inform the user that this application needs attention - call this method only if your application is not already active.
        #[unsafe(method(requestUserAttention:))]
        #[unsafe(method_family = none)]
        pub fn requestUserAttention(&self, request_type: NSRequestUserAttentionType) -> NSInteger;

        #[unsafe(method(cancelUserAttentionRequest:))]
        #[unsafe(method_family = none)]
        pub fn cancelUserAttentionRequest(&self, request: NSInteger);

        #[cfg(all(feature = "NSWindow", feature = "block2"))]
        /// Execute a block for each of the app's windows. Set `*stop = YES` if desired, to halt the enumeration early.
        #[unsafe(method(enumerateWindowsWithOptions:usingBlock:))]
        #[unsafe(method_family = none)]
        pub fn enumerateWindowsWithOptions_usingBlock(
            &self,
            options: NSWindowListOptions,
            block: &block2::DynBlock<dyn Fn(NonNull<NSWindow>, NonNull<Bool>) + '_>,
        );

        #[unsafe(method(preventWindowOrdering))]
        #[unsafe(method_family = none)]
        pub fn preventWindowOrdering(&self);

        #[cfg(feature = "NSWindow")]
        #[unsafe(method(windows))]
        #[unsafe(method_family = none)]
        pub fn windows(&self) -> Retained<NSArray<NSWindow>>;

        #[unsafe(method(setWindowsNeedUpdate:))]
        #[unsafe(method_family = none)]
        pub fn setWindowsNeedUpdate(&self, need_update: bool);

        #[unsafe(method(updateWindows))]
        #[unsafe(method_family = none)]
        pub fn updateWindows(&self);

        #[cfg(feature = "NSMenu")]
        #[unsafe(method(mainMenu))]
        #[unsafe(method_family = none)]
        pub fn mainMenu(&self) -> Option<Retained<NSMenu>>;

        #[cfg(feature = "NSMenu")]
        /// Setter for [`mainMenu`][Self::mainMenu].
        #[unsafe(method(setMainMenu:))]
        #[unsafe(method_family = none)]
        pub fn setMainMenu(&self, main_menu: Option<&NSMenu>);

        #[cfg(feature = "NSMenu")]
        /// 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.
        /// `NSApplication`retains its Help menu and releases it when a different menu is set.
        #[unsafe(method(helpMenu))]
        #[unsafe(method_family = none)]
        pub fn helpMenu(&self) -> Option<Retained<NSMenu>>;

        #[cfg(feature = "NSMenu")]
        /// Setter for [`helpMenu`][Self::helpMenu].
        #[unsafe(method(setHelpMenu:))]
        #[unsafe(method_family = none)]
        pub fn setHelpMenu(&self, help_menu: Option<&NSMenu>);

        #[cfg(feature = "NSImage")]
        #[unsafe(method(applicationIconImage))]
        #[unsafe(method_family = none)]
        pub fn applicationIconImage(&self) -> Option<Retained<NSImage>>;

        #[cfg(feature = "NSImage")]
        /// Setter for [`applicationIconImage`][Self::applicationIconImage].
        ///
        /// # Safety
        ///
        /// `application_icon_image` might not allow `None`.
        #[unsafe(method(setApplicationIconImage:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setApplicationIconImage(&self, application_icon_image: Option<&NSImage>);

        #[cfg(feature = "NSRunningApplication")]
        /// Returns: The activation policy of the application.
        #[unsafe(method(activationPolicy))]
        #[unsafe(method_family = none)]
        pub fn activationPolicy(&self) -> NSApplicationActivationPolicy;

        #[cfg(feature = "NSRunningApplication")]
        /// 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
        /// `NSApplicationActivationPolicyProhibited`or
        /// `NSApplicationActivationPolicyRegular,`but may not be changed to
        /// `NSApplicationActivationPolicyAccessory.`This returns
        /// `YES`if setting the activation policy is successful, and
        /// `NO`if not.
        #[unsafe(method(setActivationPolicy:))]
        #[unsafe(method_family = none)]
        pub fn setActivationPolicy(&self, activation_policy: NSApplicationActivationPolicy)
            -> bool;

        #[cfg(feature = "NSDockTile")]
        #[unsafe(method(dockTile))]
        #[unsafe(method_family = none)]
        pub fn dockTile(&self) -> Retained<NSDockTile>;

        #[unsafe(method(reportException:))]
        #[unsafe(method_family = none)]
        pub fn reportException(&self, exception: &NSException);

        /// # Safety
        ///
        /// - `selector` must be a valid selector.
        /// - `target` should be of the correct type.
        /// - `argument` should be of the correct type.
        #[unsafe(method(detachDrawingThread:toTarget:withObject:))]
        #[unsafe(method_family = none)]
        pub unsafe fn detachDrawingThread_toTarget_withObject(
            selector: Sel,
            target: &AnyObject,
            argument: Option<&AnyObject>,
            mtm: MainThreadMarker,
        );

        /// If an application delegate returns NSTerminateLater from -applicationShouldTerminate:, -replyToApplicationShouldTerminate: must be called with YES or NO once the application decides if it can terminate.
        #[unsafe(method(replyToApplicationShouldTerminate:))]
        #[unsafe(method_family = none)]
        pub fn replyToApplicationShouldTerminate(&self, should_terminate: bool);

        /// If an application delegate encounters an error while handling `-application:openFiles:` or` -application:printFiles:`, `-replyToOpenOrPrint:` should be called with
        /// `NSApplicationDelegateReplyFailure.`If the user cancels the operation,
        /// `NSApplicationDelegateReplyCancel`should be used, and if the operation succeeds,
        /// `NSApplicationDelegateReplySuccess`should be used .
        #[unsafe(method(replyToOpenOrPrint:))]
        #[unsafe(method_family = none)]
        pub fn replyToOpenOrPrint(&self, reply: NSApplicationDelegateReply);

        /// Opens the character palette.
        #[unsafe(method(orderFrontCharacterPalette:))]
        #[unsafe(method_family = none)]
        pub fn orderFrontCharacterPalette(&self, sender: Option<&AnyObject>);

        /// Gets or sets the
        /// `presentationOptions`that should be in effect for the system when this application is the active application.  Only certain combinations of
        /// `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.
        #[unsafe(method(presentationOptions))]
        #[unsafe(method_family = none)]
        pub fn presentationOptions(&self) -> NSApplicationPresentationOptions;

        /// Setter for [`presentationOptions`][Self::presentationOptions].
        #[unsafe(method(setPresentationOptions:))]
        #[unsafe(method_family = none)]
        pub fn setPresentationOptions(
            &self,
            presentation_options: NSApplicationPresentationOptions,
        );

        /// Returns: The set of application presentation options that are currently in effect for the system.
        /// These are the presentation options that have been put into effect by the currently active application.
        #[unsafe(method(currentSystemPresentationOptions))]
        #[unsafe(method_family = none)]
        pub fn currentSystemPresentationOptions(&self) -> NSApplicationPresentationOptions;

        #[unsafe(method(occlusionState))]
        #[unsafe(method_family = none)]
        pub fn occlusionState(&self) -> NSApplicationOcclusionState;

        #[unsafe(method(isProtectedDataAvailable))]
        #[unsafe(method_family = none)]
        pub fn isProtectedDataAvailable(&self) -> bool;
    );
}

/// Methods declared on superclass `NSResponder`.
#[cfg(feature = "NSResponder")]
impl NSApplication {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "NSResponder")]
impl NSApplication {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}

/// NSAppearanceCustomization.
#[cfg(feature = "NSResponder")]
impl NSApplication {
    extern_methods!(
        #[cfg(feature = "NSAppearance")]
        #[unsafe(method(appearance))]
        #[unsafe(method_family = none)]
        pub fn appearance(&self) -> Option<Retained<NSAppearance>>;

        #[cfg(feature = "NSAppearance")]
        /// Setter for [`appearance`][Self::appearance].
        #[unsafe(method(setAppearance:))]
        #[unsafe(method_family = none)]
        pub fn setAppearance(&self, appearance: Option<&NSAppearance>);

        #[cfg(feature = "NSAppearance")]
        #[unsafe(method(effectiveAppearance))]
        #[unsafe(method_family = none)]
        pub fn effectiveAppearance(&self) -> Retained<NSAppearance>;
    );
}

#[cfg(all(feature = "NSAppearance", feature = "NSResponder"))]
extern_conformance!(
    unsafe impl NSAppearanceCustomization for NSApplication {}
);

/// NSEvent.
#[cfg(feature = "NSResponder")]
impl NSApplication {
    extern_methods!(
        #[cfg(feature = "NSEvent")]
        #[unsafe(method(sendEvent:))]
        #[unsafe(method_family = none)]
        pub fn sendEvent(&self, event: &NSEvent);

        #[cfg(feature = "NSEvent")]
        #[unsafe(method(postEvent:atStart:))]
        #[unsafe(method_family = none)]
        pub fn postEvent_atStart(&self, event: &NSEvent, at_start: bool);

        #[cfg(feature = "NSEvent")]
        #[unsafe(method(currentEvent))]
        #[unsafe(method_family = none)]
        pub fn currentEvent(&self) -> Option<Retained<NSEvent>>;

        #[cfg(feature = "NSEvent")]
        #[unsafe(method(nextEventMatchingMask:untilDate:inMode:dequeue:))]
        #[unsafe(method_family = none)]
        pub fn nextEventMatchingMask_untilDate_inMode_dequeue(
            &self,
            mask: NSEventMask,
            expiration: Option<&NSDate>,
            mode: &NSRunLoopMode,
            deq_flag: bool,
        ) -> Option<Retained<NSEvent>>;

        #[cfg(feature = "NSEvent")]
        #[unsafe(method(discardEventsMatchingMask:beforeEvent:))]
        #[unsafe(method_family = none)]
        pub fn discardEventsMatchingMask_beforeEvent(
            &self,
            mask: NSEventMask,
            last_event: Option<&NSEvent>,
        );
    );
}

/// NSResponder.
#[cfg(feature = "NSResponder")]
impl NSApplication {
    extern_methods!(
        /// # Safety
        ///
        /// - `action` must be a valid selector.
        /// - `target` should be of the correct type.
        /// - `sender` should be of the correct type.
        #[unsafe(method(sendAction:to:from:))]
        #[unsafe(method_family = none)]
        pub unsafe fn sendAction_to_from(
            &self,
            action: Sel,
            target: Option<&AnyObject>,
            sender: Option<&AnyObject>,
        ) -> bool;

        /// # Safety
        ///
        /// `action` must be a valid selector.
        #[unsafe(method(targetForAction:))]
        #[unsafe(method_family = none)]
        pub unsafe fn targetForAction(&self, action: Sel) -> Option<Retained<AnyObject>>;

        /// # Safety
        ///
        /// - `action` must be a valid selector.
        /// - `target` should be of the correct type.
        /// - `sender` should be of the correct type.
        #[unsafe(method(targetForAction:to:from:))]
        #[unsafe(method_family = none)]
        pub unsafe fn targetForAction_to_from(
            &self,
            action: Sel,
            target: Option<&AnyObject>,
            sender: Option<&AnyObject>,
        ) -> Option<Retained<AnyObject>>;

        /// # Safety
        ///
        /// - `action` must be a valid selector.
        /// - `object` should be of the correct type.
        #[unsafe(method(tryToPerform:with:))]
        #[unsafe(method_family = none)]
        pub unsafe fn tryToPerform_with(&self, action: Sel, object: Option<&AnyObject>) -> bool;

        #[cfg(feature = "NSPasteboard")]
        #[unsafe(method(validRequestorForSendType:returnType:))]
        #[unsafe(method_family = none)]
        pub fn validRequestorForSendType_returnType(
            &self,
            send_type: Option<&NSPasteboardType>,
            return_type: Option<&NSPasteboardType>,
        ) -> Option<Retained<AnyObject>>;
    );
}

/// NSWindowsMenu.
#[cfg(feature = "NSResponder")]
impl NSApplication {
    extern_methods!(
        #[cfg(feature = "NSMenu")]
        #[unsafe(method(windowsMenu))]
        #[unsafe(method_family = none)]
        pub fn windowsMenu(&self) -> Option<Retained<NSMenu>>;

        #[cfg(feature = "NSMenu")]
        /// Setter for [`windowsMenu`][Self::windowsMenu].
        #[unsafe(method(setWindowsMenu:))]
        #[unsafe(method_family = none)]
        pub fn setWindowsMenu(&self, windows_menu: Option<&NSMenu>);

        #[unsafe(method(arrangeInFront:))]
        #[unsafe(method_family = none)]
        pub fn arrangeInFront(&self, sender: Option<&AnyObject>);

        #[cfg(feature = "NSWindow")]
        #[unsafe(method(removeWindowsItem:))]
        #[unsafe(method_family = none)]
        pub fn removeWindowsItem(&self, win: &NSWindow);

        #[cfg(feature = "NSWindow")]
        #[unsafe(method(addWindowsItem:title:filename:))]
        #[unsafe(method_family = none)]
        pub fn addWindowsItem_title_filename(
            &self,
            win: &NSWindow,
            string: &NSString,
            is_filename: bool,
        );

        #[cfg(feature = "NSWindow")]
        #[unsafe(method(changeWindowsItem:title:filename:))]
        #[unsafe(method_family = none)]
        pub fn changeWindowsItem_title_filename(
            &self,
            win: &NSWindow,
            string: &NSString,
            is_filename: bool,
        );

        #[cfg(feature = "NSWindow")]
        #[unsafe(method(updateWindowsItem:))]
        #[unsafe(method_family = none)]
        pub fn updateWindowsItem(&self, win: &NSWindow);

        #[unsafe(method(miniaturizeAll:))]
        #[unsafe(method_family = none)]
        pub fn miniaturizeAll(&self, sender: Option<&AnyObject>);
    );
}

/// NSFullKeyboardAccess.
#[cfg(feature = "NSResponder")]
impl NSApplication {
    extern_methods!(
        /// A Boolean value indicating whether keyboard navigation is enabled in System Settings > Keyboard.
        /// - 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.
        /// - Note: This property’s value isn’t necessarily reflective of the separate accessibility setting named “Full Keyboard Access” in System Settings > Accessibility > Keyboard.
        #[unsafe(method(isFullKeyboardAccessEnabled))]
        #[unsafe(method_family = none)]
        pub fn isFullKeyboardAccessEnabled(&self) -> bool;
    );
}

/// Return values for `-applicationShouldTerminate:`.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationterminatereply?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSApplicationTerminateReply(pub NSUInteger);
impl NSApplicationTerminateReply {
    #[doc(alias = "NSTerminateCancel")]
    pub const TerminateCancel: Self = Self(0);
    #[doc(alias = "NSTerminateNow")]
    pub const TerminateNow: Self = Self(1);
    #[doc(alias = "NSTerminateLater")]
    pub const TerminateLater: Self = Self(2);
}

unsafe impl Encode for NSApplicationTerminateReply {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSApplicationTerminateReply {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// Return values for `-application:printFiles:withSettings:showPrintPanels:`.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationprintreply?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSApplicationPrintReply(pub NSUInteger);
impl NSApplicationPrintReply {
    #[doc(alias = "NSPrintingCancelled")]
    pub const PrintingCancelled: Self = Self(0);
    #[doc(alias = "NSPrintingSuccess")]
    pub const PrintingSuccess: Self = Self(1);
    #[doc(alias = "NSPrintingReplyLater")]
    pub const PrintingReplyLater: Self = Self(2);
    #[doc(alias = "NSPrintingFailure")]
    pub const PrintingFailure: Self = Self(3);
}

unsafe impl Encode for NSApplicationPrintReply {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSApplicationPrintReply {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationdelegate?language=objc)
    pub unsafe trait NSApplicationDelegate: NSObjectProtocol + MainThreadOnly {
        #[cfg(feature = "NSResponder")]
        /// Allowable return values are:
        /// `NSTerminateNow`- it is ok to proceed with termination
        /// `NSTerminateCancel`- the application should not be terminated
        /// `NSTerminateLater`- it may be ok to proceed with termination later.  The application must call `-replyToApplicationShouldTerminate:` with
        /// `YES`or
        /// `NO`once the answer is known
        ///
        /// Note: This return value is for delegates who need to provide document modal alerts (sheets) in order to decide whether to quit.
        #[optional]
        #[unsafe(method(applicationShouldTerminate:))]
        #[unsafe(method_family = none)]
        fn applicationShouldTerminate(&self, sender: &NSApplication)
            -> NSApplicationTerminateReply;

        #[cfg(feature = "NSResponder")]
        /// 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 (
        /// `CFBundleDocumentTypes)`that have no associated
        /// `NSDocument`class. Document URLs that have an associated
        /// `NSDocument`class will be opened through
        /// `NSDocumentController.`If this is implemented, `-application:openFiles:` and `-application:openFile:` will not be called.
        #[optional]
        #[unsafe(method(application:openURLs:))]
        #[unsafe(method_family = none)]
        fn application_openURLs(&self, application: &NSApplication, urls: &NSArray<NSURL>);

        #[cfg(feature = "NSResponder")]
        #[optional]
        #[unsafe(method(application:openFile:))]
        #[unsafe(method_family = none)]
        fn application_openFile(&self, sender: &NSApplication, filename: &NSString) -> bool;

        #[cfg(feature = "NSResponder")]
        #[optional]
        #[unsafe(method(application:openFiles:))]
        #[unsafe(method_family = none)]
        fn application_openFiles(&self, sender: &NSApplication, filenames: &NSArray<NSString>);

        #[cfg(feature = "NSResponder")]
        #[optional]
        #[unsafe(method(application:openTempFile:))]
        #[unsafe(method_family = none)]
        fn application_openTempFile(&self, sender: &NSApplication, filename: &NSString) -> bool;

        #[cfg(feature = "NSResponder")]
        #[optional]
        #[unsafe(method(applicationShouldOpenUntitledFile:))]
        #[unsafe(method_family = none)]
        fn applicationShouldOpenUntitledFile(&self, sender: &NSApplication) -> bool;

        #[cfg(feature = "NSResponder")]
        #[optional]
        #[unsafe(method(applicationOpenUntitledFile:))]
        #[unsafe(method_family = none)]
        fn applicationOpenUntitledFile(&self, sender: &NSApplication) -> bool;

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[optional]
        #[unsafe(method(application:openFileWithoutUI:))]
        #[unsafe(method_family = none)]
        unsafe fn application_openFileWithoutUI(
            &self,
            sender: &AnyObject,
            filename: &NSString,
        ) -> bool;

        #[cfg(feature = "NSResponder")]
        #[optional]
        #[unsafe(method(application:printFile:))]
        #[unsafe(method_family = none)]
        fn application_printFile(&self, sender: &NSApplication, filename: &NSString) -> bool;

        #[cfg(all(feature = "NSPrintInfo", feature = "NSResponder"))]
        /// # Safety
        ///
        /// `print_settings` generic should be of the correct type.
        #[optional]
        #[unsafe(method(application:printFiles:withSettings:showPrintPanels:))]
        #[unsafe(method_family = none)]
        unsafe fn application_printFiles_withSettings_showPrintPanels(
            &self,
            application: &NSApplication,
            file_names: &NSArray<NSString>,
            print_settings: &NSDictionary<NSPrintInfoAttributeKey, AnyObject>,
            show_print_panels: bool,
        ) -> NSApplicationPrintReply;

        #[cfg(feature = "NSResponder")]
        #[optional]
        #[unsafe(method(applicationShouldTerminateAfterLastWindowClosed:))]
        #[unsafe(method_family = none)]
        fn applicationShouldTerminateAfterLastWindowClosed(&self, sender: &NSApplication) -> bool;

        #[cfg(feature = "NSResponder")]
        #[optional]
        #[unsafe(method(applicationShouldHandleReopen:hasVisibleWindows:))]
        #[unsafe(method_family = none)]
        fn applicationShouldHandleReopen_hasVisibleWindows(
            &self,
            sender: &NSApplication,
            has_visible_windows: bool,
        ) -> bool;

        #[cfg(all(feature = "NSMenu", feature = "NSResponder"))]
        #[optional]
        #[unsafe(method(applicationDockMenu:))]
        #[unsafe(method_family = none)]
        fn applicationDockMenu(&self, sender: &NSApplication) -> Option<Retained<NSMenu>>;

        #[cfg(feature = "NSResponder")]
        #[optional]
        #[unsafe(method(application:willPresentError:))]
        #[unsafe(method_family = none)]
        fn application_willPresentError(
            &self,
            application: &NSApplication,
            error: &NSError,
        ) -> Retained<NSError>;

        #[cfg(feature = "NSResponder")]
        #[optional]
        #[unsafe(method(application:didRegisterForRemoteNotificationsWithDeviceToken:))]
        #[unsafe(method_family = none)]
        fn application_didRegisterForRemoteNotificationsWithDeviceToken(
            &self,
            application: &NSApplication,
            device_token: &NSData,
        );

        #[cfg(feature = "NSResponder")]
        #[optional]
        #[unsafe(method(application:didFailToRegisterForRemoteNotificationsWithError:))]
        #[unsafe(method_family = none)]
        fn application_didFailToRegisterForRemoteNotificationsWithError(
            &self,
            application: &NSApplication,
            error: &NSError,
        );

        #[cfg(feature = "NSResponder")]
        /// # Safety
        ///
        /// `user_info` generic should be of the correct type.
        #[optional]
        #[unsafe(method(application:didReceiveRemoteNotification:))]
        #[unsafe(method_family = none)]
        unsafe fn application_didReceiveRemoteNotification(
            &self,
            application: &NSApplication,
            user_info: &NSDictionary<NSString, AnyObject>,
        );

        #[cfg(feature = "NSResponder")]
        /// Method to opt-in to secure restorable state.
        ///
        /// When this returns
        /// `YES:`NSCoders that are passed into the various
        /// `NSWindowRestoration`methods will
        /// `requiresSecureCoding`and have a
        /// `decodingFailurePolicy`of
        /// `NSDecodingFailurePolicySetErrorAndReturn.`Any
        /// `restorationClass`set on a window must explicitly conform to
        /// `NSWindowRestoration.`This method will be called prior to any state encoding or restoration.
        #[optional]
        #[unsafe(method(applicationSupportsSecureRestorableState:))]
        #[unsafe(method_family = none)]
        fn applicationSupportsSecureRestorableState(&self, app: &NSApplication) -> bool;

        #[cfg(feature = "NSResponder")]
        /// Method called by `-[NSApplication encodeRestorableStateWithCoder:]` to give the delegate a chance to encode any additional state into the
        /// `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.
        ///
        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[optional]
        #[unsafe(method(application:willEncodeRestorableState:))]
        #[unsafe(method_family = none)]
        unsafe fn application_willEncodeRestorableState(
            &self,
            app: &NSApplication,
            coder: &NSCoder,
        );

        #[cfg(feature = "NSResponder")]
        /// Method called by `-[NSApplication restoreStateWithCoder:]` to give the delegate a chance to restore its own state, which it may decode from the
        /// `NSCoder.`See the header `NSWindowRestoration.h` for more information.
        ///
        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[optional]
        #[unsafe(method(application:didDecodeRestorableState:))]
        #[unsafe(method_family = none)]
        unsafe fn application_didDecodeRestorableState(&self, app: &NSApplication, coder: &NSCoder);

        #[cfg(feature = "NSResponder")]
        /// This will be called on the main thread as soon as the user indicates they want to continue an activity in your application. The
        /// `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
        /// `YES`to indicate that you are doing so. Return
        /// `NO`(or leave it unimplemented) and AppKit/UIKit will put up a default UI.
        ///
        /// 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.
        #[optional]
        #[unsafe(method(application:willContinueUserActivityWithType:))]
        #[unsafe(method_family = none)]
        fn application_willContinueUserActivityWithType(
            &self,
            application: &NSApplication,
            user_activity_type: &NSString,
        ) -> bool;

        #[cfg(all(
            feature = "NSResponder",
            feature = "NSUserActivity",
            feature = "block2"
        ))]
        /// This will be called on the main thread after the
        /// `NSUserActivity`object is available. Use the data you stored in the NSUserActivity object to re-create what the user was doing.
        ///
        ///
        /// Returns: `YES`to indicate that the activity was handled. Return
        /// `NO`(or leave it unimplemented) and AppKit will attempt to continue the user activity.
        ///
        /// 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
        /// `restorationHandler`is optional. It may be copied and invoked later, but must be invoked on the main thread.
        ///
        /// If this user activity was created automatically by having
        /// `NSUbiquitousDocumentUserActivityType`in a
        /// `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
        /// `NSUserActivityDocumentURLKey.`The document will have `-restoreUserActivity:` called on it.
        #[optional]
        #[unsafe(method(application:continueUserActivity:restorationHandler:))]
        #[unsafe(method_family = none)]
        fn application_continueUserActivity_restorationHandler(
            &self,
            application: &NSApplication,
            user_activity: &NSUserActivity,
            restoration_handler: &block2::DynBlock<
                dyn Fn(NonNull<NSArray<ProtocolObject<dyn NSUserActivityRestoring>>>),
            >,
        ) -> bool;

        #[cfg(feature = "NSResponder")]
        /// There are instances where continuing a
        /// `NSUserActivity`may fail. This will get called on the main thread if it does so. If it is unimplemented, AppKit will present the error.
        #[optional]
        #[unsafe(method(application:didFailToContinueUserActivityWithType:error:))]
        #[unsafe(method_family = none)]
        fn application_didFailToContinueUserActivityWithType_error(
            &self,
            application: &NSApplication,
            user_activity_type: &NSString,
            error: &NSError,
        );

        #[cfg(feature = "NSResponder")]
        /// 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
        /// `userActivity.`
        #[optional]
        #[unsafe(method(application:didUpdateUserActivity:))]
        #[unsafe(method_family = none)]
        fn application_didUpdateUserActivity(
            &self,
            application: &NSApplication,
            user_activity: &NSUserActivity,
        );

        #[cfg(all(feature = "NSResponder", feature = "objc2-cloud-kit"))]
        #[cfg(target_vendor = "apple")]
        /// This will be called on the main thread after the user indicates they want to accept a CloudKit sharing invitation in your application.
        ///
        /// You should use the
        /// `CKShareMetadata`object's
        /// `shareURL`and containerIdentifier to schedule a
        /// `CKAcceptSharesOperation,`then start using the resulting
        /// `CKShare`and its associated record(s), which will appear in the
        /// `CKContainer's`shared database in a zone matching that of the record's owner.
        #[optional]
        #[unsafe(method(application:userDidAcceptCloudKitShareWithMetadata:))]
        #[unsafe(method_family = none)]
        fn application_userDidAcceptCloudKitShareWithMetadata(
            &self,
            application: &NSApplication,
            metadata: &CKShareMetadata,
        );

        #[cfg(feature = "NSResponder")]
        /// 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
        /// `NO`otherwise.
        #[optional]
        #[unsafe(method(application:delegateHandlesKey:))]
        #[unsafe(method_family = none)]
        fn application_delegateHandlesKey(&self, sender: &NSApplication, key: &NSString) -> bool;

        #[cfg(feature = "NSResponder")]
        /// This method will be called once during application launch at `-[NSApplication finishLaunching]`.
        ///
        ///
        /// Returns: `NO`if the receiving delegate object wishes to opt-out of system-wide keyboard shortcut localization for all application-supplied menus. Return
        /// `YES`by default for apps linked against 12.0 and later SDK.
        #[optional]
        #[unsafe(method(applicationShouldAutomaticallyLocalizeKeyEquivalents:))]
        #[unsafe(method_family = none)]
        fn applicationShouldAutomaticallyLocalizeKeyEquivalents(
            &self,
            application: &NSApplication,
        ) -> bool;

        #[optional]
        #[unsafe(method(applicationWillFinishLaunching:))]
        #[unsafe(method_family = none)]
        fn applicationWillFinishLaunching(&self, notification: &NSNotification);

        #[optional]
        #[unsafe(method(applicationDidFinishLaunching:))]
        #[unsafe(method_family = none)]
        fn applicationDidFinishLaunching(&self, notification: &NSNotification);

        #[optional]
        #[unsafe(method(applicationWillHide:))]
        #[unsafe(method_family = none)]
        fn applicationWillHide(&self, notification: &NSNotification);

        #[optional]
        #[unsafe(method(applicationDidHide:))]
        #[unsafe(method_family = none)]
        fn applicationDidHide(&self, notification: &NSNotification);

        #[optional]
        #[unsafe(method(applicationWillUnhide:))]
        #[unsafe(method_family = none)]
        fn applicationWillUnhide(&self, notification: &NSNotification);

        #[optional]
        #[unsafe(method(applicationDidUnhide:))]
        #[unsafe(method_family = none)]
        fn applicationDidUnhide(&self, notification: &NSNotification);

        #[optional]
        #[unsafe(method(applicationWillBecomeActive:))]
        #[unsafe(method_family = none)]
        fn applicationWillBecomeActive(&self, notification: &NSNotification);

        #[optional]
        #[unsafe(method(applicationDidBecomeActive:))]
        #[unsafe(method_family = none)]
        fn applicationDidBecomeActive(&self, notification: &NSNotification);

        #[optional]
        #[unsafe(method(applicationWillResignActive:))]
        #[unsafe(method_family = none)]
        fn applicationWillResignActive(&self, notification: &NSNotification);

        #[optional]
        #[unsafe(method(applicationDidResignActive:))]
        #[unsafe(method_family = none)]
        fn applicationDidResignActive(&self, notification: &NSNotification);

        #[optional]
        #[unsafe(method(applicationWillUpdate:))]
        #[unsafe(method_family = none)]
        fn applicationWillUpdate(&self, notification: &NSNotification);

        #[optional]
        #[unsafe(method(applicationDidUpdate:))]
        #[unsafe(method_family = none)]
        fn applicationDidUpdate(&self, notification: &NSNotification);

        #[optional]
        #[unsafe(method(applicationWillTerminate:))]
        #[unsafe(method_family = none)]
        fn applicationWillTerminate(&self, notification: &NSNotification);

        #[optional]
        #[unsafe(method(applicationDidChangeScreenParameters:))]
        #[unsafe(method_family = none)]
        fn applicationDidChangeScreenParameters(&self, notification: &NSNotification);

        #[optional]
        #[unsafe(method(applicationDidChangeOcclusionState:))]
        #[unsafe(method_family = none)]
        fn applicationDidChangeOcclusionState(&self, notification: &NSNotification);

        #[optional]
        #[unsafe(method(applicationProtectedDataWillBecomeUnavailable:))]
        #[unsafe(method_family = none)]
        fn applicationProtectedDataWillBecomeUnavailable(&self, notification: &NSNotification);

        #[optional]
        #[unsafe(method(applicationProtectedDataDidBecomeAvailable:))]
        #[unsafe(method_family = none)]
        fn applicationProtectedDataDidBecomeAvailable(&self, notification: &NSNotification);
    }
);

/// NSServicesMenu.
#[cfg(feature = "NSResponder")]
impl NSApplication {
    extern_methods!(
        #[cfg(feature = "NSMenu")]
        #[unsafe(method(servicesMenu))]
        #[unsafe(method_family = none)]
        pub fn servicesMenu(&self) -> Option<Retained<NSMenu>>;

        #[cfg(feature = "NSMenu")]
        /// Setter for [`servicesMenu`][Self::servicesMenu].
        #[unsafe(method(setServicesMenu:))]
        #[unsafe(method_family = none)]
        pub fn setServicesMenu(&self, services_menu: Option<&NSMenu>);

        #[cfg(feature = "NSPasteboard")]
        #[unsafe(method(registerServicesMenuSendTypes:returnTypes:))]
        #[unsafe(method_family = none)]
        pub fn registerServicesMenuSendTypes_returnTypes(
            &self,
            send_types: &NSArray<NSPasteboardType>,
            return_types: &NSArray<NSPasteboardType>,
        );
    );
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsservicesmenurequestor?language=objc)
    pub unsafe trait NSServicesMenuRequestor: NSObjectProtocol {
        #[cfg(feature = "NSPasteboard")]
        #[optional]
        #[unsafe(method(writeSelectionToPasteboard:types:))]
        #[unsafe(method_family = none)]
        fn writeSelectionToPasteboard_types(
            &self,
            pboard: &NSPasteboard,
            types: &NSArray<NSPasteboardType>,
        ) -> bool;

        #[cfg(feature = "NSPasteboard")]
        #[optional]
        #[unsafe(method(readSelectionFromPasteboard:))]
        #[unsafe(method_family = none)]
        fn readSelectionFromPasteboard(&self, pboard: &NSPasteboard) -> bool;
    }
);

/// NSServicesHandling.
#[cfg(feature = "NSResponder")]
impl NSApplication {
    extern_methods!(
        #[unsafe(method(servicesProvider))]
        #[unsafe(method_family = none)]
        pub fn servicesProvider(&self) -> Option<Retained<AnyObject>>;

        /// Setter for [`servicesProvider`][Self::servicesProvider].
        ///
        /// # Safety
        ///
        /// `services_provider` should be of the correct type.
        #[unsafe(method(setServicesProvider:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setServicesProvider(&self, services_provider: Option<&AnyObject>);
    );
}

/// Optional keys in `-orderFrontStandardAboutPanelWithOptions:`
/// `optionsDictionary.`
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsaboutpaneloptionkey?language=objc)
// NS_TYPED_ENUM
pub type NSAboutPanelOptionKey = NSString;

extern "C" {
    /// 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.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsaboutpaneloptioncredits?language=objc)
    pub static NSAboutPanelOptionCredits: &'static NSAboutPanelOptionKey;
}

extern "C" {
    /// NSString displayed in place of the default app name. If not specified, uses the value of CFBundleName (localizable). Fallback is [[NSProcessInfo processInfo] processName].
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsaboutpaneloptionapplicationname?language=objc)
    pub static NSAboutPanelOptionApplicationName: &'static NSAboutPanelOptionKey;
}

extern "C" {
    /// NSImage displayed in place of NSApplicationIcon. If not specified, use [NSImage imageNamed:
    /// "
    /// NSApplicationIcon"]; if not available, generic icon.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsaboutpaneloptionapplicationicon?language=objc)
    pub static NSAboutPanelOptionApplicationIcon: &'static NSAboutPanelOptionKey;
}

extern "C" {
    /// 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.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsaboutpaneloptionversion?language=objc)
    pub static NSAboutPanelOptionVersion: &'static NSAboutPanelOptionKey;
}

extern "C" {
    /// 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.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsaboutpaneloptionapplicationversion?language=objc)
    pub static NSAboutPanelOptionApplicationVersion: &'static NSAboutPanelOptionKey;
}

/// NSStandardAboutPanel.
#[cfg(feature = "NSResponder")]
impl NSApplication {
    extern_methods!(
        #[unsafe(method(orderFrontStandardAboutPanel:))]
        #[unsafe(method_family = none)]
        pub fn orderFrontStandardAboutPanel(&self, sender: Option<&AnyObject>);

        /// # Safety
        ///
        /// `options_dictionary` generic should be of the correct type.
        #[unsafe(method(orderFrontStandardAboutPanelWithOptions:))]
        #[unsafe(method_family = none)]
        pub unsafe fn orderFrontStandardAboutPanelWithOptions(
            &self,
            options_dictionary: &NSDictionary<NSAboutPanelOptionKey, AnyObject>,
        );
    );
}

/// NSApplicationLayoutDirection.
#[cfg(feature = "NSResponder")]
impl NSApplication {
    extern_methods!(
        #[cfg(feature = "NSUserInterfaceLayout")]
        #[unsafe(method(userInterfaceLayoutDirection))]
        #[unsafe(method_family = none)]
        pub fn userInterfaceLayoutDirection(&self) -> NSUserInterfaceLayoutDirection;
    );
}

/// NSRestorableUserInterface.
#[cfg(feature = "NSResponder")]
impl NSApplication {
    extern_methods!(
        /// 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.
        ///
        /// 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.
        ///
        /// 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.
        ///
        /// These methods are thread safe.
        #[unsafe(method(disableRelaunchOnLogin))]
        #[unsafe(method_family = none)]
        pub fn disableRelaunchOnLogin(&self);

        #[unsafe(method(enableRelaunchOnLogin))]
        #[unsafe(method_family = none)]
        pub fn enableRelaunchOnLogin(&self);
    );
}

/// Soft deprecated.
/// Please use `NSApplication`'s `-registerForRemoteNotifications` along with `-requestAuthorizationWithOptions:` from the `UserNotifications.framework` to specify allowable notification types.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsremotenotificationtype?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSRemoteNotificationType(pub NSUInteger);
bitflags::bitflags! {
    impl NSRemoteNotificationType: NSUInteger {
        #[doc(alias = "NSRemoteNotificationTypeNone")]
        const None = 0;
        #[doc(alias = "NSRemoteNotificationTypeBadge")]
        const Badge = 1<<0;
        #[doc(alias = "NSRemoteNotificationTypeSound")]
        const Sound = 1<<1;
        #[doc(alias = "NSRemoteNotificationTypeAlert")]
        const Alert = 1<<2;
    }
}

unsafe impl Encode for NSRemoteNotificationType {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSRemoteNotificationType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// NSRemoteNotifications.
#[cfg(feature = "NSResponder")]
impl NSApplication {
    extern_methods!(
        #[unsafe(method(registerForRemoteNotifications))]
        #[unsafe(method_family = none)]
        pub fn registerForRemoteNotifications(&self);

        #[unsafe(method(unregisterForRemoteNotifications))]
        #[unsafe(method_family = none)]
        pub fn unregisterForRemoteNotifications(&self);

        /// Returns: `YES`if the application is currently registered for remote notifications, taking into account any systemwide settings; doesn't relate to connectivity.
        #[unsafe(method(isRegisteredForRemoteNotifications))]
        #[unsafe(method_family = none)]
        pub fn isRegisteredForRemoteNotifications(&self) -> bool;

        /// The following are soft deprecated.
        /// Please use the `-registerForRemoteNotifications` above and `-requestAuthorizationWithOptions:` from `UserNotifications.framework`.
        #[unsafe(method(registerForRemoteNotificationTypes:))]
        #[unsafe(method_family = none)]
        pub fn registerForRemoteNotificationTypes(&self, types: NSRemoteNotificationType);

        #[unsafe(method(enabledRemoteNotificationTypes))]
        #[unsafe(method_family = none)]
        pub fn enabledRemoteNotificationTypes(&self) -> NSRemoteNotificationType;
    );
}

#[cfg(feature = "NSResponder")]
impl NSApplication {
    /// An Application's startup function.
    ///
    /// # Safety
    ///
    /// `argv` must be a valid pointer.
    #[doc(alias = "NSApplicationMain")]
    #[inline]
    pub(crate) unsafe fn __main(argc: c_int, argv: NonNull<NonNull<c_char>>) -> c_int {
        extern "C-unwind" {
            fn NSApplicationMain(argc: c_int, argv: NonNull<NonNull<c_char>>) -> c_int;
        }
        unsafe { NSApplicationMain(argc, argv) }
    }

    /// `NSApplicationLoad`should be called when loading a Cocoa bundle in a Carbon app in order to initialize
    /// `NSApplication`and other Cocoa objects.  Redundant calls are ignored.
    #[doc(alias = "NSApplicationLoad")]
    #[inline]
    pub fn load() -> bool {
        extern "C-unwind" {
            fn NSApplicationLoad() -> Bool;
        }
        unsafe { NSApplicationLoad() }.as_bool()
    }
}

/// `NSShowsServicesMenuItem()`always returns
/// `YES.`
#[inline]
pub extern "C-unwind" fn NSShowsServicesMenuItem(item_name: &NSString) -> bool {
    extern "C-unwind" {
        fn NSShowsServicesMenuItem(item_name: &NSString) -> Bool;
    }
    unsafe { NSShowsServicesMenuItem(item_name) }.as_bool()
}

/// `NSSetShowsServicesMenuItem()`has no effect, and always returns 0.
#[inline]
pub extern "C-unwind" fn NSSetShowsServicesMenuItem(
    item_name: &NSString,
    enabled: bool,
) -> NSInteger {
    extern "C-unwind" {
        fn NSSetShowsServicesMenuItem(item_name: &NSString, enabled: Bool) -> NSInteger;
    }
    unsafe { NSSetShowsServicesMenuItem(item_name, Bool::new(enabled)) }
}

/// `NSUpdateDynamicServices()`causes the services information for the system to be updated.
/// 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).
#[inline]
pub extern "C-unwind" fn NSUpdateDynamicServices() {
    extern "C-unwind" {
        fn NSUpdateDynamicServices();
    }
    unsafe { NSUpdateDynamicServices() }
}

#[cfg(feature = "NSPasteboard")]
#[inline]
pub extern "C-unwind" fn NSPerformService(
    item_name: &NSString,
    pboard: Option<&NSPasteboard>,
) -> bool {
    extern "C-unwind" {
        fn NSPerformService(item_name: &NSString, pboard: Option<&NSPasteboard>) -> Bool;
    }
    unsafe { NSPerformService(item_name, pboard) }.as_bool()
}

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsserviceprovidername?language=objc)
pub type NSServiceProviderName = NSString;

extern "C-unwind" {
    /// Apps should use -setServicesProvider.
    ///
    /// # Safety
    ///
    /// `provider` should be of the correct type.
    pub fn NSRegisterServicesProvider(provider: Option<&AnyObject>, name: &NSServiceProviderName);
}

#[inline]
pub extern "C-unwind" fn NSUnregisterServicesProvider(name: &NSServiceProviderName) {
    extern "C-unwind" {
        fn NSUnregisterServicesProvider(name: &NSServiceProviderName);
    }
    unsafe { NSUnregisterServicesProvider(name) }
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationdidbecomeactivenotification?language=objc)
    pub static NSApplicationDidBecomeActiveNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationdidhidenotification?language=objc)
    pub static NSApplicationDidHideNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationdidfinishlaunchingnotification?language=objc)
    pub static NSApplicationDidFinishLaunchingNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationdidresignactivenotification?language=objc)
    pub static NSApplicationDidResignActiveNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationdidunhidenotification?language=objc)
    pub static NSApplicationDidUnhideNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationdidupdatenotification?language=objc)
    pub static NSApplicationDidUpdateNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationwillbecomeactivenotification?language=objc)
    pub static NSApplicationWillBecomeActiveNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationwillhidenotification?language=objc)
    pub static NSApplicationWillHideNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationwillfinishlaunchingnotification?language=objc)
    pub static NSApplicationWillFinishLaunchingNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationwillresignactivenotification?language=objc)
    pub static NSApplicationWillResignActiveNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationwillunhidenotification?language=objc)
    pub static NSApplicationWillUnhideNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationwillupdatenotification?language=objc)
    pub static NSApplicationWillUpdateNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationwillterminatenotification?language=objc)
    pub static NSApplicationWillTerminateNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationdidchangescreenparametersnotification?language=objc)
    pub static NSApplicationDidChangeScreenParametersNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationprotecteddatawillbecomeunavailablenotification?language=objc)
    pub static NSApplicationProtectedDataWillBecomeUnavailableNotification:
        &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationprotecteddatadidbecomeavailablenotification?language=objc)
    pub static NSApplicationProtectedDataDidBecomeAvailableNotification:
        &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationshouldbeginsuppressinghighdynamicrangecontentnotification?language=objc)
    pub static NSApplicationShouldBeginSuppressingHighDynamicRangeContentNotification:
        &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationshouldendsuppressinghighdynamicrangecontentnotification?language=objc)
    pub static NSApplicationShouldEndSuppressingHighDynamicRangeContentNotification:
        &'static NSNotificationName;
}

extern "C" {
    /// 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.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationlaunchisdefaultlaunchkey?language=objc)
    pub static NSApplicationLaunchIsDefaultLaunchKey: &'static NSString;
}

extern "C" {
    /// 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.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationlaunchusernotificationkey?language=objc)
    pub static NSApplicationLaunchUserNotificationKey: &'static NSString;
}

extern "C" {
    /// 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
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationlaunchremotenotificationkey?language=objc)
    #[deprecated]
    pub static NSApplicationLaunchRemoteNotificationKey: &'static NSString;
}

extern "C" {
    /// 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.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationdidchangeocclusionstatenotification?language=objc)
    pub static NSApplicationDidChangeOcclusionStateNotification: &'static NSNotificationName;
}

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsrunstoppedresponse?language=objc)
#[deprecated = "Use NSModalResponseStop instead"]
pub const NSRunStoppedResponse: c_int = -1000;
/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsrunabortedresponse?language=objc)
#[deprecated = "Use NSModalResponseAbort instead"]
pub const NSRunAbortedResponse: c_int = -1001;
/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsruncontinuesresponse?language=objc)
#[deprecated = "Use NSModalResponseContinue instead"]
pub const NSRunContinuesResponse: c_int = -1002;

/// NSDeprecated.
#[cfg(feature = "NSResponder")]
impl NSApplication {
    extern_methods!(
        #[cfg(feature = "NSWindow")]
        /// `-runModalForWindow:relativeToWindow:` was deprecated in Mac OS X 10.0. Please use `-[NSWindow beginSheet:completionHandler:]` instead.
        ///
        /// # Safety
        ///
        /// - `window` might not allow `None`.
        /// - `doc_window` might not allow `None`.
        #[deprecated = "Use -[NSWindow beginSheet:completionHandler:] instead"]
        #[unsafe(method(runModalForWindow:relativeToWindow:))]
        #[unsafe(method_family = none)]
        pub unsafe fn runModalForWindow_relativeToWindow(
            &self,
            window: Option<&NSWindow>,
            doc_window: Option<&NSWindow>,
        ) -> NSInteger;

        #[cfg(feature = "NSWindow")]
        /// `-beginModalSessionForWindow:relativeToWindow:` was deprecated in Mac OS X 10.0. Please use `-[NSWindow beginSheet:completionHandler:]` instead.
        ///
        /// # Safety
        ///
        /// - `window` might not allow `None`.
        /// - `doc_window` might not allow `None`.
        #[deprecated = "Use -[NSWindow beginSheet:completionHandler:] instead"]
        #[unsafe(method(beginModalSessionForWindow:relativeToWindow:))]
        #[unsafe(method_family = none)]
        pub unsafe fn beginModalSessionForWindow_relativeToWindow(
            &self,
            window: Option<&NSWindow>,
            doc_window: Option<&NSWindow>,
        ) -> NSModalSession;

        /// `-application:printFiles:` was deprecated in Mac OS X 10.4.
        /// Implement `-application:printFiles:withSettings:showPrintPanels:` in your application delegate instead.
        ///
        /// # Safety
        ///
        /// - `sender` might not allow `None`.
        /// - `filenames` might not allow `None`.
        #[deprecated]
        #[unsafe(method(application:printFiles:))]
        #[unsafe(method_family = none)]
        pub unsafe fn application_printFiles(
            &self,
            sender: Option<&NSApplication>,
            filenames: Option<&NSArray<NSString>>,
        );

        #[cfg(feature = "NSWindow")]
        /// `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.
        ///
        /// # Safety
        ///
        /// - `modal_delegate` should be of the correct type.
        /// - `did_end_selector` must be a valid selector.
        /// - `context_info` must be a valid pointer.
        #[deprecated = "Use -[NSWindow beginSheet:completionHandler:] instead"]
        #[unsafe(method(beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:))]
        #[unsafe(method_family = none)]
        pub unsafe fn beginSheet_modalForWindow_modalDelegate_didEndSelector_contextInfo(
            &self,
            sheet: &NSWindow,
            doc_window: &NSWindow,
            modal_delegate: Option<&AnyObject>,
            did_end_selector: Option<Sel>,
            context_info: *mut c_void,
        );

        #[cfg(feature = "NSWindow")]
        #[deprecated = "Use -[NSWindow endSheet:] instead"]
        #[unsafe(method(endSheet:))]
        #[unsafe(method_family = none)]
        pub fn endSheet(&self, sheet: &NSWindow);

        #[cfg(feature = "NSWindow")]
        #[deprecated = "Use -[NSWindow endSheet:returnCode:] instead"]
        #[unsafe(method(endSheet:returnCode:))]
        #[unsafe(method_family = none)]
        pub fn endSheet_returnCode(&self, sheet: &NSWindow, return_code: NSInteger);

        #[cfg(feature = "NSWindow")]
        /// # Safety
        ///
        /// `selector` must be a valid selector.
        #[deprecated = "Use -enumerateWindowsWithOptions:usingBlock: instead"]
        #[unsafe(method(makeWindowsPerform:inOrder:))]
        #[unsafe(method_family = none)]
        pub unsafe fn makeWindowsPerform_inOrder(
            &self,
            selector: Sel,
            in_order: bool,
        ) -> Option<Retained<NSWindow>>;

        #[cfg(feature = "NSGraphicsContext")]
        /// 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.
        #[deprecated = "This method always returns nil. If you need access to the current drawing context, use [NSGraphicsContext currentContext] inside of a draw operation."]
        #[unsafe(method(context))]
        #[unsafe(method_family = none)]
        pub fn context(&self) -> Option<Retained<NSGraphicsContext>>;
    );
}

extern "C-unwind" {
    #[deprecated = "renamed to `NSApplication::__main`"]
    pub fn NSApplicationMain(argc: c_int, argv: NonNull<NonNull<c_char>>) -> c_int;
}

#[deprecated = "renamed to `NSApplication::load`"]
#[inline]
pub extern "C-unwind" fn NSApplicationLoad() -> bool {
    extern "C-unwind" {
        fn NSApplicationLoad() -> Bool;
    }
    unsafe { NSApplicationLoad() }.as_bool()
}