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
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
#[cfg(feature = "objc2-core-image")]
#[cfg(target_vendor = "apple")]
use objc2_core_image::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-quartz-core")]
#[cfg(target_vendor = "apple")]
use objc2_quartz_core::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsautoresizingmaskoptions?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSAutoresizingMaskOptions(pub NSUInteger);
bitflags::bitflags! {
    impl NSAutoresizingMaskOptions: NSUInteger {
        #[doc(alias = "NSViewNotSizable")]
        const ViewNotSizable = 0;
        #[doc(alias = "NSViewMinXMargin")]
        const ViewMinXMargin = 1;
        #[doc(alias = "NSViewWidthSizable")]
        const ViewWidthSizable = 2;
        #[doc(alias = "NSViewMaxXMargin")]
        const ViewMaxXMargin = 4;
        #[doc(alias = "NSViewMinYMargin")]
        const ViewMinYMargin = 8;
        #[doc(alias = "NSViewHeightSizable")]
        const ViewHeightSizable = 16;
        #[doc(alias = "NSViewMaxYMargin")]
        const ViewMaxYMargin = 32;
    }
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsbordertype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSBorderType(pub NSUInteger);
impl NSBorderType {
    #[doc(alias = "NSNoBorder")]
    pub const NoBorder: Self = Self(0);
    #[doc(alias = "NSLineBorder")]
    pub const LineBorder: Self = Self(1);
    #[doc(alias = "NSBezelBorder")]
    pub const BezelBorder: Self = Self(2);
    #[doc(alias = "NSGrooveBorder")]
    pub const GrooveBorder: Self = Self(3);
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsviewlayercontentsredrawpolicy?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSViewLayerContentsRedrawPolicy(pub NSInteger);
impl NSViewLayerContentsRedrawPolicy {
    #[doc(alias = "NSViewLayerContentsRedrawNever")]
    pub const Never: Self = Self(0);
    #[doc(alias = "NSViewLayerContentsRedrawOnSetNeedsDisplay")]
    pub const OnSetNeedsDisplay: Self = Self(1);
    #[doc(alias = "NSViewLayerContentsRedrawDuringViewResize")]
    pub const DuringViewResize: Self = Self(2);
    #[doc(alias = "NSViewLayerContentsRedrawBeforeViewResize")]
    pub const BeforeViewResize: Self = Self(3);
    #[doc(alias = "NSViewLayerContentsRedrawCrossfade")]
    pub const Crossfade: Self = Self(4);
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsviewlayercontentsplacement?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSViewLayerContentsPlacement(pub NSInteger);
impl NSViewLayerContentsPlacement {
    #[doc(alias = "NSViewLayerContentsPlacementScaleAxesIndependently")]
    pub const ScaleAxesIndependently: Self = Self(0);
    #[doc(alias = "NSViewLayerContentsPlacementScaleProportionallyToFit")]
    pub const ScaleProportionallyToFit: Self = Self(1);
    #[doc(alias = "NSViewLayerContentsPlacementScaleProportionallyToFill")]
    pub const ScaleProportionallyToFill: Self = Self(2);
    #[doc(alias = "NSViewLayerContentsPlacementCenter")]
    pub const Center: Self = Self(3);
    #[doc(alias = "NSViewLayerContentsPlacementTop")]
    pub const Top: Self = Self(4);
    #[doc(alias = "NSViewLayerContentsPlacementTopRight")]
    pub const TopRight: Self = Self(5);
    #[doc(alias = "NSViewLayerContentsPlacementRight")]
    pub const Right: Self = Self(6);
    #[doc(alias = "NSViewLayerContentsPlacementBottomRight")]
    pub const BottomRight: Self = Self(7);
    #[doc(alias = "NSViewLayerContentsPlacementBottom")]
    pub const Bottom: Self = Self(8);
    #[doc(alias = "NSViewLayerContentsPlacementBottomLeft")]
    pub const BottomLeft: Self = Self(9);
    #[doc(alias = "NSViewLayerContentsPlacementLeft")]
    pub const Left: Self = Self(10);
    #[doc(alias = "NSViewLayerContentsPlacementTopLeft")]
    pub const TopLeft: Self = Self(11);
}

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

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

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

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

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

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

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

#[cfg(all(feature = "NSAnimation", feature = "NSResponder"))]
extern_conformance!(
    unsafe impl NSAnimatablePropertyContainer for NSView {}
);

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

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

#[cfg(all(feature = "NSDragging", feature = "NSResponder"))]
extern_conformance!(
    unsafe impl NSDraggingDestination for NSView {}
);

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

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

#[cfg(feature = "NSResponder")]
impl NSView {
    extern_methods!(
        #[unsafe(method(initWithFrame:))]
        #[unsafe(method_family = init)]
        pub fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> 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>>;

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

        /// # Safety
        ///
        /// This is not retained internally, you must ensure the object is still alive.
        #[unsafe(method(superview))]
        #[unsafe(method_family = none)]
        pub unsafe fn superview(&self) -> Option<Retained<NSView>>;

        #[unsafe(method(subviews))]
        #[unsafe(method_family = none)]
        pub fn subviews(&self) -> Retained<NSArray<NSView>>;

        /// Setter for [`subviews`][Self::subviews].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setSubviews:))]
        #[unsafe(method_family = none)]
        pub fn setSubviews(&self, subviews: &NSArray<NSView>);

        #[unsafe(method(isDescendantOf:))]
        #[unsafe(method_family = none)]
        pub fn isDescendantOf(&self, view: &NSView) -> bool;

        #[unsafe(method(ancestorSharedWithView:))]
        #[unsafe(method_family = none)]
        pub fn ancestorSharedWithView(&self, view: &NSView) -> Option<Retained<NSView>>;

        /// # Safety
        ///
        /// This is not retained internally, you must ensure the object is still alive.
        #[unsafe(method(opaqueAncestor))]
        #[unsafe(method_family = none)]
        pub unsafe fn opaqueAncestor(&self) -> Option<Retained<NSView>>;

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

        /// Setter for [`isHidden`][Self::isHidden].
        #[unsafe(method(setHidden:))]
        #[unsafe(method_family = none)]
        pub fn setHidden(&self, hidden: bool);

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

        /// # Safety
        ///
        /// - `rects` must be a valid pointer or null.
        /// - `count` must be a valid pointer or null.
        #[unsafe(method(getRectsBeingDrawn:count:))]
        #[unsafe(method_family = none)]
        pub unsafe fn getRectsBeingDrawn_count(
            &self,
            rects: *mut *const NSRect,
            count: *mut NSInteger,
        );

        #[unsafe(method(needsToDrawRect:))]
        #[unsafe(method_family = none)]
        pub fn needsToDrawRect(&self, rect: NSRect) -> bool;

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

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

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

        #[unsafe(method(addSubview:))]
        #[unsafe(method_family = none)]
        pub fn addSubview(&self, view: &NSView);

        #[cfg(feature = "NSGraphics")]
        #[unsafe(method(addSubview:positioned:relativeTo:))]
        #[unsafe(method_family = none)]
        pub fn addSubview_positioned_relativeTo(
            &self,
            view: &NSView,
            place: NSWindowOrderingMode,
            other_view: Option<&NSView>,
        );

        /// # Safety
        ///
        /// - `compare` must be implemented correctly.
        /// - `context` must be a valid pointer or null.
        #[unsafe(method(sortSubviewsUsingFunction:context:))]
        #[unsafe(method_family = none)]
        pub unsafe fn sortSubviewsUsingFunction_context(
            &self,
            compare: unsafe extern "C-unwind" fn(
                NonNull<NSView>,
                NonNull<NSView>,
                *mut c_void,
            ) -> NSComparisonResult,
            context: *mut c_void,
        );

        #[cfg(feature = "NSWindow")]
        #[unsafe(method(viewWillMoveToWindow:))]
        #[unsafe(method_family = none)]
        pub fn viewWillMoveToWindow(&self, new_window: Option<&NSWindow>);

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

        #[unsafe(method(viewWillMoveToSuperview:))]
        #[unsafe(method_family = none)]
        pub fn viewWillMoveToSuperview(&self, new_superview: Option<&NSView>);

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

        #[unsafe(method(didAddSubview:))]
        #[unsafe(method_family = none)]
        pub fn didAddSubview(&self, subview: &NSView);

        #[unsafe(method(willRemoveSubview:))]
        #[unsafe(method_family = none)]
        pub fn willRemoveSubview(&self, subview: &NSView);

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

        #[unsafe(method(replaceSubview:with:))]
        #[unsafe(method_family = none)]
        pub fn replaceSubview_with(&self, old_view: &NSView, new_view: &NSView);

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

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

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

        /// Setter for [`postsFrameChangedNotifications`][Self::postsFrameChangedNotifications].
        #[unsafe(method(setPostsFrameChangedNotifications:))]
        #[unsafe(method_family = none)]
        pub fn setPostsFrameChangedNotifications(&self, posts_frame_changed_notifications: bool);

        #[unsafe(method(resizeSubviewsWithOldSize:))]
        #[unsafe(method_family = none)]
        pub fn resizeSubviewsWithOldSize(&self, old_size: NSSize);

        #[unsafe(method(resizeWithOldSuperviewSize:))]
        #[unsafe(method_family = none)]
        pub fn resizeWithOldSuperviewSize(&self, old_size: NSSize);

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

        /// Setter for [`autoresizesSubviews`][Self::autoresizesSubviews].
        #[unsafe(method(setAutoresizesSubviews:))]
        #[unsafe(method_family = none)]
        pub fn setAutoresizesSubviews(&self, autoresizes_subviews: bool);

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

        /// Setter for [`autoresizingMask`][Self::autoresizingMask].
        #[unsafe(method(setAutoresizingMask:))]
        #[unsafe(method_family = none)]
        pub fn setAutoresizingMask(&self, autoresizing_mask: NSAutoresizingMaskOptions);

        #[unsafe(method(setFrameOrigin:))]
        #[unsafe(method_family = none)]
        pub fn setFrameOrigin(&self, new_origin: NSPoint);

        #[unsafe(method(setFrameSize:))]
        #[unsafe(method_family = none)]
        pub fn setFrameSize(&self, new_size: NSSize);

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

        /// Setter for [`frame`][Self::frame].
        #[unsafe(method(setFrame:))]
        #[unsafe(method_family = none)]
        pub fn setFrame(&self, frame: NSRect);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(frameRotation))]
        #[unsafe(method_family = none)]
        pub fn frameRotation(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`frameRotation`][Self::frameRotation].
        #[unsafe(method(setFrameRotation:))]
        #[unsafe(method_family = none)]
        pub fn setFrameRotation(&self, frame_rotation: CGFloat);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(frameCenterRotation))]
        #[unsafe(method_family = none)]
        pub fn frameCenterRotation(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`frameCenterRotation`][Self::frameCenterRotation].
        #[unsafe(method(setFrameCenterRotation:))]
        #[unsafe(method_family = none)]
        pub fn setFrameCenterRotation(&self, frame_center_rotation: CGFloat);

        #[unsafe(method(setBoundsOrigin:))]
        #[unsafe(method_family = none)]
        pub fn setBoundsOrigin(&self, new_origin: NSPoint);

        #[unsafe(method(setBoundsSize:))]
        #[unsafe(method_family = none)]
        pub fn setBoundsSize(&self, new_size: NSSize);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(boundsRotation))]
        #[unsafe(method_family = none)]
        pub fn boundsRotation(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`boundsRotation`][Self::boundsRotation].
        #[unsafe(method(setBoundsRotation:))]
        #[unsafe(method_family = none)]
        pub fn setBoundsRotation(&self, bounds_rotation: CGFloat);

        #[unsafe(method(translateOriginToPoint:))]
        #[unsafe(method_family = none)]
        pub fn translateOriginToPoint(&self, translation: NSPoint);

        #[unsafe(method(scaleUnitSquareToSize:))]
        #[unsafe(method_family = none)]
        pub fn scaleUnitSquareToSize(&self, new_unit_size: NSSize);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(rotateByAngle:))]
        #[unsafe(method_family = none)]
        pub fn rotateByAngle(&self, angle: CGFloat);

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

        /// Setter for [`bounds`][Self::bounds].
        #[unsafe(method(setBounds:))]
        #[unsafe(method_family = none)]
        pub fn setBounds(&self, bounds: NSRect);

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

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

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

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

        #[unsafe(method(convertPoint:fromView:))]
        #[unsafe(method_family = none)]
        pub fn convertPoint_fromView(&self, point: NSPoint, view: Option<&NSView>) -> NSPoint;

        #[unsafe(method(convertPoint:toView:))]
        #[unsafe(method_family = none)]
        pub fn convertPoint_toView(&self, point: NSPoint, view: Option<&NSView>) -> NSPoint;

        #[unsafe(method(convertSize:fromView:))]
        #[unsafe(method_family = none)]
        pub fn convertSize_fromView(&self, size: NSSize, view: Option<&NSView>) -> NSSize;

        #[unsafe(method(convertSize:toView:))]
        #[unsafe(method_family = none)]
        pub fn convertSize_toView(&self, size: NSSize, view: Option<&NSView>) -> NSSize;

        #[unsafe(method(convertRect:fromView:))]
        #[unsafe(method_family = none)]
        pub fn convertRect_fromView(&self, rect: NSRect, view: Option<&NSView>) -> NSRect;

        #[unsafe(method(convertRect:toView:))]
        #[unsafe(method_family = none)]
        pub fn convertRect_toView(&self, rect: NSRect, view: Option<&NSView>) -> NSRect;

        #[unsafe(method(backingAlignedRect:options:))]
        #[unsafe(method_family = none)]
        pub fn backingAlignedRect_options(
            &self,
            rect: NSRect,
            options: NSAlignmentOptions,
        ) -> NSRect;

        #[unsafe(method(centerScanRect:))]
        #[unsafe(method_family = none)]
        pub fn centerScanRect(&self, rect: NSRect) -> NSRect;

        #[unsafe(method(convertPointToBacking:))]
        #[unsafe(method_family = none)]
        pub fn convertPointToBacking(&self, point: NSPoint) -> NSPoint;

        #[unsafe(method(convertPointFromBacking:))]
        #[unsafe(method_family = none)]
        pub fn convertPointFromBacking(&self, point: NSPoint) -> NSPoint;

        #[unsafe(method(convertSizeToBacking:))]
        #[unsafe(method_family = none)]
        pub fn convertSizeToBacking(&self, size: NSSize) -> NSSize;

        #[unsafe(method(convertSizeFromBacking:))]
        #[unsafe(method_family = none)]
        pub fn convertSizeFromBacking(&self, size: NSSize) -> NSSize;

        #[unsafe(method(convertRectToBacking:))]
        #[unsafe(method_family = none)]
        pub fn convertRectToBacking(&self, rect: NSRect) -> NSRect;

        #[unsafe(method(convertRectFromBacking:))]
        #[unsafe(method_family = none)]
        pub fn convertRectFromBacking(&self, rect: NSRect) -> NSRect;

        #[unsafe(method(convertPointToLayer:))]
        #[unsafe(method_family = none)]
        pub fn convertPointToLayer(&self, point: NSPoint) -> NSPoint;

        #[unsafe(method(convertPointFromLayer:))]
        #[unsafe(method_family = none)]
        pub fn convertPointFromLayer(&self, point: NSPoint) -> NSPoint;

        #[unsafe(method(convertSizeToLayer:))]
        #[unsafe(method_family = none)]
        pub fn convertSizeToLayer(&self, size: NSSize) -> NSSize;

        #[unsafe(method(convertSizeFromLayer:))]
        #[unsafe(method_family = none)]
        pub fn convertSizeFromLayer(&self, size: NSSize) -> NSSize;

        #[unsafe(method(convertRectToLayer:))]
        #[unsafe(method_family = none)]
        pub fn convertRectToLayer(&self, rect: NSRect) -> NSRect;

        #[unsafe(method(convertRectFromLayer:))]
        #[unsafe(method_family = none)]
        pub fn convertRectFromLayer(&self, rect: NSRect) -> NSRect;

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

        /// Setter for [`canDrawConcurrently`][Self::canDrawConcurrently].
        #[unsafe(method(setCanDrawConcurrently:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCanDrawConcurrently(&self, can_draw_concurrently: bool);

        #[deprecated = "If a view needs display, -drawRect: or -updateLayer will be called automatically when the view is able to draw.  To check whether a view is in a window, call -window.  To check whether a view is hidden, call -isHiddenOrHasHiddenAncestor."]
        #[unsafe(method(canDraw))]
        #[unsafe(method_family = none)]
        pub fn canDraw(&self) -> bool;

        #[unsafe(method(setNeedsDisplayInRect:))]
        #[unsafe(method_family = none)]
        pub fn setNeedsDisplayInRect(&self, invalid_rect: NSRect);

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

        /// Setter for [`needsDisplay`][Self::needsDisplay].
        #[unsafe(method(setNeedsDisplay:))]
        #[unsafe(method_family = none)]
        pub fn setNeedsDisplay(&self, needs_display: bool);

        #[deprecated = "To draw, subclass NSView and implement -drawRect:; AppKit's automatic deferred display mechanism will call -drawRect: as necessary to display the view."]
        #[unsafe(method(lockFocus))]
        #[unsafe(method_family = none)]
        pub fn lockFocus(&self);

        #[deprecated = "To draw, subclass NSView and implement -drawRect:; AppKit's automatic deferred display mechanism will call -drawRect: as necessary to display the view."]
        #[unsafe(method(unlockFocus))]
        #[unsafe(method_family = none)]
        pub fn unlockFocus(&self);

        #[deprecated = "To draw, subclass NSView and implement -drawRect:; AppKit's automatic deferred display mechanism will call -drawRect: as necessary to display the view."]
        #[unsafe(method(lockFocusIfCanDraw))]
        #[unsafe(method_family = none)]
        pub fn lockFocusIfCanDraw(&self) -> bool;

        #[cfg(feature = "NSGraphicsContext")]
        #[deprecated = "Use -[NSView displayRectIgnoringOpacity:inContext:] to draw a view subtree into a graphics context."]
        #[unsafe(method(lockFocusIfCanDrawInContext:))]
        #[unsafe(method_family = none)]
        pub fn lockFocusIfCanDrawInContext(&self, context: &NSGraphicsContext) -> bool;

        #[unsafe(method(focusView))]
        #[unsafe(method_family = none)]
        pub fn focusView(mtm: MainThreadMarker) -> Option<Retained<NSView>>;

        /// The portion of the view that isn’t clipped by its superviews.
        ///
        /// Visibility, as reflected by this property, doesn’t account for whether other view or window objects overlap the current view or whether the current view is installed in a window at all. This value of this property is `NSZeroRect` if the current view is effectively hidden.
        ///
        /// During a printing operation, the visible rectangle is further clipped to the page being imaged.
        #[unsafe(method(visibleRect))]
        #[unsafe(method_family = none)]
        pub fn visibleRect(&self) -> NSRect;

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

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

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

        #[unsafe(method(displayRect:))]
        #[unsafe(method_family = none)]
        pub fn displayRect(&self, rect: NSRect);

        #[unsafe(method(displayIfNeededInRect:))]
        #[unsafe(method_family = none)]
        pub fn displayIfNeededInRect(&self, rect: NSRect);

        #[unsafe(method(displayRectIgnoringOpacity:))]
        #[unsafe(method_family = none)]
        pub fn displayRectIgnoringOpacity(&self, rect: NSRect);

        #[unsafe(method(displayIfNeededInRectIgnoringOpacity:))]
        #[unsafe(method_family = none)]
        pub fn displayIfNeededInRectIgnoringOpacity(&self, rect: NSRect);

        #[unsafe(method(drawRect:))]
        #[unsafe(method_family = none)]
        pub fn drawRect(&self, dirty_rect: NSRect);

        #[cfg(feature = "NSGraphicsContext")]
        #[unsafe(method(displayRectIgnoringOpacity:inContext:))]
        #[unsafe(method_family = none)]
        pub fn displayRectIgnoringOpacity_inContext(
            &self,
            rect: NSRect,
            context: &NSGraphicsContext,
        );

        #[cfg(all(feature = "NSBitmapImageRep", feature = "NSImageRep"))]
        #[unsafe(method(bitmapImageRepForCachingDisplayInRect:))]
        #[unsafe(method_family = none)]
        pub fn bitmapImageRepForCachingDisplayInRect(
            &self,
            rect: NSRect,
        ) -> Option<Retained<NSBitmapImageRep>>;

        #[cfg(all(feature = "NSBitmapImageRep", feature = "NSImageRep"))]
        #[unsafe(method(cacheDisplayInRect:toBitmapImageRep:))]
        #[unsafe(method_family = none)]
        pub fn cacheDisplayInRect_toBitmapImageRep(
            &self,
            rect: NSRect,
            bitmap_image_rep: &NSBitmapImageRep,
        );

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

        #[unsafe(method(scrollPoint:))]
        #[unsafe(method_family = none)]
        pub fn scrollPoint(&self, point: NSPoint);

        #[unsafe(method(scrollRectToVisible:))]
        #[unsafe(method_family = none)]
        pub fn scrollRectToVisible(&self, rect: NSRect) -> bool;

        #[cfg(feature = "NSEvent")]
        #[unsafe(method(autoscroll:))]
        #[unsafe(method_family = none)]
        pub fn autoscroll(&self, event: &NSEvent) -> bool;

        #[unsafe(method(adjustScroll:))]
        #[unsafe(method_family = none)]
        pub fn adjustScroll(&self, new_visible: NSRect) -> NSRect;

        #[deprecated = "Use NSScrollView to achieve scrolling views."]
        #[unsafe(method(scrollRect:by:))]
        #[unsafe(method_family = none)]
        pub fn scrollRect_by(&self, rect: NSRect, delta: NSSize);

        #[unsafe(method(translateRectsNeedingDisplayInRect:by:))]
        #[unsafe(method_family = none)]
        pub fn translateRectsNeedingDisplayInRect_by(&self, clip_rect: NSRect, delta: NSSize);

        #[unsafe(method(hitTest:))]
        #[unsafe(method_family = none)]
        pub fn hitTest(&self, point: NSPoint) -> Option<Retained<NSView>>;

        #[unsafe(method(mouse:inRect:))]
        #[unsafe(method_family = none)]
        pub fn mouse_inRect(&self, point: NSPoint, rect: NSRect) -> bool;

        #[unsafe(method(viewWithTag:))]
        #[unsafe(method_family = none)]
        pub fn viewWithTag(&self, tag: NSInteger) -> Option<Retained<NSView>>;

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

        #[cfg(feature = "NSEvent")]
        #[unsafe(method(performKeyEquivalent:))]
        #[unsafe(method_family = none)]
        pub fn performKeyEquivalent(&self, event: &NSEvent) -> bool;

        #[cfg(feature = "NSEvent")]
        #[unsafe(method(acceptsFirstMouse:))]
        #[unsafe(method_family = none)]
        pub fn acceptsFirstMouse(&self, event: Option<&NSEvent>) -> bool;

        #[cfg(feature = "NSEvent")]
        #[unsafe(method(shouldDelayWindowOrderingForEvent:))]
        #[unsafe(method_family = none)]
        pub fn shouldDelayWindowOrderingForEvent(&self, event: &NSEvent) -> bool;

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

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

        #[deprecated = "Use allowedTouchTypes instead"]
        #[unsafe(method(acceptsTouchEvents))]
        #[unsafe(method_family = none)]
        pub fn acceptsTouchEvents(&self) -> bool;

        /// Setter for [`acceptsTouchEvents`][Self::acceptsTouchEvents].
        #[deprecated = "Use allowedTouchTypes instead"]
        #[unsafe(method(setAcceptsTouchEvents:))]
        #[unsafe(method_family = none)]
        pub fn setAcceptsTouchEvents(&self, accepts_touch_events: bool);

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

        /// Setter for [`wantsRestingTouches`][Self::wantsRestingTouches].
        #[unsafe(method(setWantsRestingTouches:))]
        #[unsafe(method_family = none)]
        pub fn setWantsRestingTouches(&self, wants_resting_touches: bool);

        #[cfg(feature = "objc2-quartz-core")]
        #[cfg(target_vendor = "apple")]
        #[unsafe(method(makeBackingLayer))]
        #[unsafe(method_family = none)]
        pub fn makeBackingLayer(&self) -> Retained<CALayer>;

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

        /// Setter for [`layerContentsRedrawPolicy`][Self::layerContentsRedrawPolicy].
        #[unsafe(method(setLayerContentsRedrawPolicy:))]
        #[unsafe(method_family = none)]
        pub fn setLayerContentsRedrawPolicy(
            &self,
            layer_contents_redraw_policy: NSViewLayerContentsRedrawPolicy,
        );

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

        /// Setter for [`layerContentsPlacement`][Self::layerContentsPlacement].
        #[unsafe(method(setLayerContentsPlacement:))]
        #[unsafe(method_family = none)]
        pub fn setLayerContentsPlacement(
            &self,
            layer_contents_placement: NSViewLayerContentsPlacement,
        );

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

        /// Setter for [`wantsLayer`][Self::wantsLayer].
        #[unsafe(method(setWantsLayer:))]
        #[unsafe(method_family = none)]
        pub fn setWantsLayer(&self, wants_layer: bool);

        #[cfg(feature = "objc2-quartz-core")]
        #[cfg(target_vendor = "apple")]
        #[unsafe(method(layer))]
        #[unsafe(method_family = none)]
        pub fn layer(&self) -> Option<Retained<CALayer>>;

        #[cfg(feature = "objc2-quartz-core")]
        #[cfg(target_vendor = "apple")]
        /// Setter for [`layer`][Self::layer].
        #[unsafe(method(setLayer:))]
        #[unsafe(method_family = none)]
        pub fn setLayer(&self, layer: Option<&CALayer>);

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

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

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

        /// Setter for [`canDrawSubviewsIntoLayer`][Self::canDrawSubviewsIntoLayer].
        #[unsafe(method(setCanDrawSubviewsIntoLayer:))]
        #[unsafe(method_family = none)]
        pub fn setCanDrawSubviewsIntoLayer(&self, can_draw_subviews_into_layer: bool);

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

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

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

        /// Setter for [`needsLayout`][Self::needsLayout].
        #[unsafe(method(setNeedsLayout:))]
        #[unsafe(method_family = none)]
        pub fn setNeedsLayout(&self, needs_layout: bool);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(alphaValue))]
        #[unsafe(method_family = none)]
        pub fn alphaValue(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`alphaValue`][Self::alphaValue].
        #[unsafe(method(setAlphaValue:))]
        #[unsafe(method_family = none)]
        pub fn setAlphaValue(&self, alpha_value: CGFloat);

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

        /// Setter for [`layerUsesCoreImageFilters`][Self::layerUsesCoreImageFilters].
        #[unsafe(method(setLayerUsesCoreImageFilters:))]
        #[unsafe(method_family = none)]
        pub fn setLayerUsesCoreImageFilters(&self, layer_uses_core_image_filters: bool);

        #[cfg(feature = "objc2-core-image")]
        #[cfg(target_vendor = "apple")]
        #[unsafe(method(backgroundFilters))]
        #[unsafe(method_family = none)]
        pub fn backgroundFilters(&self) -> Retained<NSArray<CIFilter>>;

        #[cfg(feature = "objc2-core-image")]
        #[cfg(target_vendor = "apple")]
        /// Setter for [`backgroundFilters`][Self::backgroundFilters].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setBackgroundFilters:))]
        #[unsafe(method_family = none)]
        pub fn setBackgroundFilters(&self, background_filters: &NSArray<CIFilter>);

        #[cfg(feature = "objc2-core-image")]
        #[cfg(target_vendor = "apple")]
        #[unsafe(method(compositingFilter))]
        #[unsafe(method_family = none)]
        pub fn compositingFilter(&self) -> Option<Retained<CIFilter>>;

        #[cfg(feature = "objc2-core-image")]
        #[cfg(target_vendor = "apple")]
        /// Setter for [`compositingFilter`][Self::compositingFilter].
        #[unsafe(method(setCompositingFilter:))]
        #[unsafe(method_family = none)]
        pub fn setCompositingFilter(&self, compositing_filter: Option<&CIFilter>);

        #[cfg(feature = "objc2-core-image")]
        #[cfg(target_vendor = "apple")]
        #[unsafe(method(contentFilters))]
        #[unsafe(method_family = none)]
        pub fn contentFilters(&self) -> Retained<NSArray<CIFilter>>;

        #[cfg(feature = "objc2-core-image")]
        #[cfg(target_vendor = "apple")]
        /// Setter for [`contentFilters`][Self::contentFilters].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setContentFilters:))]
        #[unsafe(method_family = none)]
        pub fn setContentFilters(&self, content_filters: &NSArray<CIFilter>);

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

        #[cfg(feature = "NSShadow")]
        /// Setter for [`shadow`][Self::shadow].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setShadow:))]
        #[unsafe(method_family = none)]
        pub fn setShadow(&self, shadow: Option<&NSShadow>);

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

        /// Setter for [`clipsToBounds`][Self::clipsToBounds].
        #[unsafe(method(setClipsToBounds:))]
        #[unsafe(method_family = none)]
        pub fn setClipsToBounds(&self, clips_to_bounds: bool);

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

        /// Setter for [`postsBoundsChangedNotifications`][Self::postsBoundsChangedNotifications].
        #[unsafe(method(setPostsBoundsChangedNotifications:))]
        #[unsafe(method_family = none)]
        pub fn setPostsBoundsChangedNotifications(&self, posts_bounds_changed_notifications: bool);

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

        #[cfg(all(feature = "NSEvent", feature = "NSMenu"))]
        #[unsafe(method(menuForEvent:))]
        #[unsafe(method_family = none)]
        pub fn menuForEvent(&self, event: &NSEvent) -> Option<Retained<NSMenu>>;

        #[cfg(feature = "NSMenu")]
        #[unsafe(method(defaultMenu))]
        #[unsafe(method_family = none)]
        pub fn defaultMenu(mtm: MainThreadMarker) -> Option<Retained<NSMenu>>;

        #[cfg(all(feature = "NSEvent", feature = "NSMenu"))]
        /// A contextual menu is being opened from the receiving view.
        /// The view should update any visual state in response — such as making a selection.
        ///
        /// Parameter `menu`: The contextual menu that is being opened on the view
        ///
        /// Parameter `event`: The event that caused the menu to open.
        #[unsafe(method(willOpenMenu:withEvent:))]
        #[unsafe(method_family = none)]
        pub fn willOpenMenu_withEvent(&self, menu: &NSMenu, event: &NSEvent);

        #[cfg(all(feature = "NSEvent", feature = "NSMenu"))]
        /// A contextual menu shown from the receiving view has been closed. This is only called if the menu had been opened and the view previously received
        /// `-willOpenMenu:withEvent:.`The view should update any visual state in response — such as removing a temporary selection.
        ///
        /// Parameter `menu`: The contextual menu that was open on the view
        ///
        /// Parameter `event`: The event that caused the menu to close. This may be nil if there is no specific event that triggered the closing.
        #[unsafe(method(didCloseMenu:withEvent:))]
        #[unsafe(method_family = none)]
        pub fn didCloseMenu_withEvent(&self, menu: &NSMenu, event: Option<&NSEvent>);

        #[unsafe(method(toolTip))]
        #[unsafe(method_family = none)]
        pub fn toolTip(&self) -> Option<Retained<NSString>>;

        /// Setter for [`toolTip`][Self::toolTip].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setToolTip:))]
        #[unsafe(method_family = none)]
        pub fn setToolTip(&self, tool_tip: Option<&NSString>);

        /// # Safety
        ///
        /// - `owner` should be of the correct type.
        /// - `data` must be a valid pointer or null.
        #[unsafe(method(addToolTipRect:owner:userData:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addToolTipRect_owner_userData(
            &self,
            rect: NSRect,
            owner: &AnyObject,
            data: *mut c_void,
        ) -> NSToolTipTag;

        #[unsafe(method(removeToolTip:))]
        #[unsafe(method_family = none)]
        pub fn removeToolTip(&self, tag: NSToolTipTag);

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

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

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

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

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

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

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

        #[unsafe(method(rectForSmartMagnificationAtPoint:inRect:))]
        #[unsafe(method_family = none)]
        pub fn rectForSmartMagnificationAtPoint_inRect(
            &self,
            location: NSPoint,
            visible_rect: NSRect,
        ) -> NSRect;

        #[cfg(feature = "NSUserInterfaceLayout")]
        #[unsafe(method(userInterfaceLayoutDirection))]
        #[unsafe(method_family = none)]
        pub fn userInterfaceLayoutDirection(&self) -> NSUserInterfaceLayoutDirection;

        #[cfg(feature = "NSUserInterfaceLayout")]
        /// Setter for [`userInterfaceLayoutDirection`][Self::userInterfaceLayoutDirection].
        #[unsafe(method(setUserInterfaceLayoutDirection:))]
        #[unsafe(method_family = none)]
        pub fn setUserInterfaceLayoutDirection(
            &self,
            user_interface_layout_direction: NSUserInterfaceLayoutDirection,
        );

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

        #[unsafe(method(isCompatibleWithResponsiveScrolling))]
        #[unsafe(method_family = none)]
        pub fn isCompatibleWithResponsiveScrolling(mtm: MainThreadMarker) -> bool;

        #[unsafe(method(prepareContentInRect:))]
        #[unsafe(method_family = none)]
        pub fn prepareContentInRect(&self, rect: NSRect);

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

        /// Setter for [`preparedContentRect`][Self::preparedContentRect].
        #[unsafe(method(setPreparedContentRect:))]
        #[unsafe(method_family = none)]
        pub fn setPreparedContentRect(&self, prepared_content_rect: NSRect);

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

        /// Override point for reacting to the effective appearance of the receiver changing. At this point `effectiveAppearance` property reflects the new appearance.
        #[unsafe(method(viewDidChangeEffectiveAppearance))]
        #[unsafe(method_family = none)]
        pub fn viewDidChangeEffectiveAppearance(&self);
    );
}

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

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

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsviewlayercontentscaledelegate?language=objc)
    pub unsafe trait NSViewLayerContentScaleDelegate: NSObjectProtocol {
        #[cfg(all(
            feature = "NSResponder",
            feature = "NSWindow",
            feature = "objc2-core-foundation",
            feature = "objc2-quartz-core"
        ))]
        #[cfg(target_vendor = "apple")]
        #[optional]
        #[unsafe(method(layer:shouldInheritContentsScale:fromWindow:))]
        #[unsafe(method_family = none)]
        fn layer_shouldInheritContentsScale_fromWindow(
            &self,
            layer: &CALayer,
            new_scale: CGFloat,
            window: &NSWindow,
        ) -> bool;
    }
);

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsviewtooltipowner?language=objc)
    pub unsafe trait NSViewToolTipOwner: NSObjectProtocol + MainThreadOnly {
        #[cfg(feature = "NSResponder")]
        /// # Safety
        ///
        /// `data` must be a valid pointer or null.
        #[unsafe(method(view:stringForToolTip:point:userData:))]
        #[unsafe(method_family = none)]
        unsafe fn view_stringForToolTip_point_userData(
            &self,
            view: &NSView,
            tag: NSToolTipTag,
            point: NSPoint,
            data: *mut c_void,
        ) -> Retained<NSString>;
    }
);

extern_protocol!(
    /// A protocol to request information from NSView subclasses about the selected content in the view.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsviewcontentselectioninfo?language=objc)
    pub unsafe trait NSViewContentSelectionInfo: NSObjectProtocol {
        #[optional]
        #[unsafe(method(selectionAnchorRect))]
        #[unsafe(method_family = none)]
        fn selectionAnchorRect(&self) -> NSRect;
    }
);

/// NSKeyboardUI.
#[cfg(feature = "NSResponder")]
impl NSView {
    extern_methods!(
        /// # Safety
        ///
        /// This is not retained internally, you must ensure the object is still alive.
        #[unsafe(method(nextKeyView))]
        #[unsafe(method_family = none)]
        pub unsafe fn nextKeyView(&self) -> Option<Retained<NSView>>;

        /// Setter for [`nextKeyView`][Self::nextKeyView].
        ///
        /// # Safety
        ///
        /// This is unretained, you must ensure the object is kept alive while in use.
        #[unsafe(method(setNextKeyView:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setNextKeyView(&self, next_key_view: Option<&NSView>);

        /// # Safety
        ///
        /// This is not retained internally, you must ensure the object is still alive.
        #[unsafe(method(previousKeyView))]
        #[unsafe(method_family = none)]
        pub unsafe fn previousKeyView(&self) -> Option<Retained<NSView>>;

        /// # Safety
        ///
        /// This is not retained internally, you must ensure the object is still alive.
        #[unsafe(method(nextValidKeyView))]
        #[unsafe(method_family = none)]
        pub unsafe fn nextValidKeyView(&self) -> Option<Retained<NSView>>;

        /// # Safety
        ///
        /// This is not retained internally, you must ensure the object is still alive.
        #[unsafe(method(previousValidKeyView))]
        #[unsafe(method_family = none)]
        pub unsafe fn previousValidKeyView(&self) -> Option<Retained<NSView>>;

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

        #[unsafe(method(setKeyboardFocusRingNeedsDisplayInRect:))]
        #[unsafe(method_family = none)]
        pub fn setKeyboardFocusRingNeedsDisplayInRect(&self, rect: NSRect);

        #[cfg(feature = "NSGraphics")]
        #[unsafe(method(focusRingType))]
        #[unsafe(method_family = none)]
        pub fn focusRingType(&self) -> NSFocusRingType;

        #[cfg(feature = "NSGraphics")]
        /// Setter for [`focusRingType`][Self::focusRingType].
        #[unsafe(method(setFocusRingType:))]
        #[unsafe(method_family = none)]
        pub fn setFocusRingType(&self, focus_ring_type: NSFocusRingType);

        #[cfg(feature = "NSGraphics")]
        #[unsafe(method(defaultFocusRingType))]
        #[unsafe(method_family = none)]
        pub fn defaultFocusRingType(mtm: MainThreadMarker) -> NSFocusRingType;

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

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

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

/// NSPrinting.
#[cfg(feature = "NSResponder")]
impl NSView {
    extern_methods!(
        #[cfg(feature = "NSPasteboard")]
        #[unsafe(method(writeEPSInsideRect:toPasteboard:))]
        #[unsafe(method_family = none)]
        pub fn writeEPSInsideRect_toPasteboard(&self, rect: NSRect, pasteboard: &NSPasteboard);

        #[unsafe(method(dataWithEPSInsideRect:))]
        #[unsafe(method_family = none)]
        pub fn dataWithEPSInsideRect(&self, rect: NSRect) -> Retained<NSData>;

        #[cfg(feature = "NSPasteboard")]
        #[unsafe(method(writePDFInsideRect:toPasteboard:))]
        #[unsafe(method_family = none)]
        pub fn writePDFInsideRect_toPasteboard(&self, rect: NSRect, pasteboard: &NSPasteboard);

        #[unsafe(method(dataWithPDFInsideRect:))]
        #[unsafe(method_family = none)]
        pub fn dataWithPDFInsideRect(&self, rect: NSRect) -> Retained<NSData>;

        /// # Safety
        ///
        /// `sender` should be of the correct type.
        #[unsafe(method(print:))]
        #[unsafe(method_family = none)]
        pub unsafe fn print(&self, sender: Option<&AnyObject>);

        /// # Safety
        ///
        /// `range` must be a valid pointer.
        #[unsafe(method(knowsPageRange:))]
        #[unsafe(method_family = none)]
        pub unsafe fn knowsPageRange(&self, range: NSRangePointer) -> bool;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(heightAdjustLimit))]
        #[unsafe(method_family = none)]
        pub fn heightAdjustLimit(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(widthAdjustLimit))]
        #[unsafe(method_family = none)]
        pub fn widthAdjustLimit(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// # Safety
        ///
        /// `new_right` must be a valid pointer.
        #[unsafe(method(adjustPageWidthNew:left:right:limit:))]
        #[unsafe(method_family = none)]
        pub unsafe fn adjustPageWidthNew_left_right_limit(
            &self,
            new_right: NonNull<CGFloat>,
            old_left: CGFloat,
            old_right: CGFloat,
            right_limit: CGFloat,
        );

        #[cfg(feature = "objc2-core-foundation")]
        /// # Safety
        ///
        /// `new_bottom` must be a valid pointer.
        #[unsafe(method(adjustPageHeightNew:top:bottom:limit:))]
        #[unsafe(method_family = none)]
        pub unsafe fn adjustPageHeightNew_top_bottom_limit(
            &self,
            new_bottom: NonNull<CGFloat>,
            old_top: CGFloat,
            old_bottom: CGFloat,
            bottom_limit: CGFloat,
        );

        #[unsafe(method(rectForPage:))]
        #[unsafe(method_family = none)]
        pub fn rectForPage(&self, page: NSInteger) -> NSRect;

        #[unsafe(method(locationOfPrintRect:))]
        #[unsafe(method_family = none)]
        pub fn locationOfPrintRect(&self, rect: NSRect) -> NSPoint;

        #[unsafe(method(drawPageBorderWithSize:))]
        #[unsafe(method_family = none)]
        pub fn drawPageBorderWithSize(&self, border_size: NSSize);

        #[unsafe(method(pageHeader))]
        #[unsafe(method_family = none)]
        pub fn pageHeader(&self) -> Retained<NSAttributedString>;

        #[unsafe(method(pageFooter))]
        #[unsafe(method_family = none)]
        pub fn pageFooter(&self) -> Retained<NSAttributedString>;

        /// * This method is obsolete.  It will never be invoked from within AppKit, and NSView's implementation of it does nothing. **
        #[deprecated = "This is never invoked and the NSView implementation does nothing"]
        #[unsafe(method(drawSheetBorderWithSize:))]
        #[unsafe(method_family = none)]
        pub fn drawSheetBorderWithSize(&self, border_size: NSSize);

        #[unsafe(method(printJobTitle))]
        #[unsafe(method_family = none)]
        pub fn printJobTitle(&self) -> Retained<NSString>;

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

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

        #[unsafe(method(beginPageInRect:atPlacement:))]
        #[unsafe(method_family = none)]
        pub fn beginPageInRect_atPlacement(&self, rect: NSRect, location: NSPoint);

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

/// NSDrag.
#[cfg(feature = "NSResponder")]
impl NSView {
    extern_methods!(
        #[cfg(all(
            feature = "NSDragging",
            feature = "NSDraggingItem",
            feature = "NSDraggingSession",
            feature = "NSEvent"
        ))]
        #[unsafe(method(beginDraggingSessionWithItems:event:source:))]
        #[unsafe(method_family = none)]
        pub fn beginDraggingSessionWithItems_event_source(
            &self,
            items: &NSArray<NSDraggingItem>,
            event: &NSEvent,
            source: &ProtocolObject<dyn NSDraggingSource>,
        ) -> Retained<NSDraggingSession>;

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

        #[cfg(feature = "NSPasteboard")]
        #[unsafe(method(registerForDraggedTypes:))]
        #[unsafe(method_family = none)]
        pub fn registerForDraggedTypes(&self, new_types: &NSArray<NSPasteboardType>);

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

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

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

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

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

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

/// NSFullScreenMode.
#[cfg(feature = "NSResponder")]
impl NSView {
    extern_methods!(
        #[cfg(feature = "NSScreen")]
        /// # Safety
        ///
        /// `options` generic should be of the correct type.
        #[unsafe(method(enterFullScreenMode:withOptions:))]
        #[unsafe(method_family = none)]
        pub unsafe fn enterFullScreenMode_withOptions(
            &self,
            screen: &NSScreen,
            options: Option<&NSDictionary<NSViewFullScreenModeOptionKey, AnyObject>>,
        ) -> bool;

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

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

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

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

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

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

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

/// NSDefinition.
#[cfg(feature = "NSResponder")]
impl NSView {
    extern_methods!(
        #[unsafe(method(showDefinitionForAttributedString:atPoint:))]
        #[unsafe(method_family = none)]
        pub fn showDefinitionForAttributedString_atPoint(
            &self,
            attr_string: Option<&NSAttributedString>,
            text_baseline_origin: NSPoint,
        );

        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// `options` generic should be of the correct type.
        #[unsafe(method(showDefinitionForAttributedString:range:options:baselineOriginProvider:))]
        #[unsafe(method_family = none)]
        pub unsafe fn showDefinitionForAttributedString_range_options_baselineOriginProvider(
            &self,
            attr_string: Option<&NSAttributedString>,
            target_range: NSRange,
            options: Option<&NSDictionary<NSDefinitionOptionKey, AnyObject>>,
            origin_provider: Option<&block2::DynBlock<dyn Fn(NSRange) -> NSPoint>>,
        );
    );
}

/// NSFindIndicator.
#[cfg(feature = "NSResponder")]
impl NSView {
    extern_methods!(
        #[unsafe(method(isDrawingFindIndicator))]
        #[unsafe(method_family = none)]
        pub fn isDrawingFindIndicator(&self) -> bool;
    );
}

/// NSGestureRecognizer.
#[cfg(feature = "NSResponder")]
impl NSView {
    extern_methods!(
        #[cfg(feature = "NSGestureRecognizer")]
        #[unsafe(method(gestureRecognizers))]
        #[unsafe(method_family = none)]
        pub fn gestureRecognizers(&self) -> Retained<NSArray<NSGestureRecognizer>>;

        #[cfg(feature = "NSGestureRecognizer")]
        /// Setter for [`gestureRecognizers`][Self::gestureRecognizers].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setGestureRecognizers:))]
        #[unsafe(method_family = none)]
        pub fn setGestureRecognizers(&self, gesture_recognizers: &NSArray<NSGestureRecognizer>);

        #[cfg(feature = "NSGestureRecognizer")]
        #[unsafe(method(addGestureRecognizer:))]
        #[unsafe(method_family = none)]
        pub fn addGestureRecognizer(&self, gesture_recognizer: &NSGestureRecognizer);

        #[cfg(feature = "NSGestureRecognizer")]
        #[unsafe(method(removeGestureRecognizer:))]
        #[unsafe(method_family = none)]
        pub fn removeGestureRecognizer(&self, gesture_recognizer: &NSGestureRecognizer);
    );
}

/// NSTouchBar.
#[cfg(feature = "NSResponder")]
impl NSView {
    extern_methods!(
        #[cfg(feature = "NSTouch")]
        #[unsafe(method(allowedTouchTypes))]
        #[unsafe(method_family = none)]
        pub fn allowedTouchTypes(&self) -> NSTouchTypeMask;

        #[cfg(feature = "NSTouch")]
        /// Setter for [`allowedTouchTypes`][Self::allowedTouchTypes].
        #[unsafe(method(setAllowedTouchTypes:))]
        #[unsafe(method_family = none)]
        pub fn setAllowedTouchTypes(&self, allowed_touch_types: NSTouchTypeMask);
    );
}

/// NSSafeAreas.
#[cfg(feature = "NSResponder")]
impl NSView {
    extern_methods!(
        #[unsafe(method(safeAreaInsets))]
        #[unsafe(method_family = none)]
        pub fn safeAreaInsets(&self) -> NSEdgeInsets;

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

        /// Setter for [`additionalSafeAreaInsets`][Self::additionalSafeAreaInsets].
        #[unsafe(method(setAdditionalSafeAreaInsets:))]
        #[unsafe(method_family = none)]
        pub fn setAdditionalSafeAreaInsets(&self, additional_safe_area_insets: NSEdgeInsets);

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

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

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

/// NSCompactControlSizeMetrics.
#[cfg(feature = "NSResponder")]
impl NSView {
    extern_methods!(
        /// When this property is true, any NSControls in the view or its descendants will be sized with compact
        /// metrics compatible with macOS 15 and earlier.
        /// Defaults to false
        #[unsafe(method(prefersCompactControlSizeMetrics))]
        #[unsafe(method_family = none)]
        pub fn prefersCompactControlSizeMetrics(&self) -> bool;

        /// Setter for [`prefersCompactControlSizeMetrics`][Self::prefersCompactControlSizeMetrics].
        #[unsafe(method(setPrefersCompactControlSizeMetrics:))]
        #[unsafe(method_family = none)]
        pub fn setPrefersCompactControlSizeMetrics(
            &self,
            prefers_compact_control_size_metrics: bool,
        );
    );
}

/// NSTrackingArea.
#[cfg(feature = "NSResponder")]
impl NSView {
    extern_methods!(
        #[cfg(feature = "NSTrackingArea")]
        #[unsafe(method(addTrackingArea:))]
        #[unsafe(method_family = none)]
        pub fn addTrackingArea(&self, tracking_area: &NSTrackingArea);

        #[cfg(feature = "NSTrackingArea")]
        #[unsafe(method(removeTrackingArea:))]
        #[unsafe(method_family = none)]
        pub fn removeTrackingArea(&self, tracking_area: &NSTrackingArea);

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

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

        #[cfg(feature = "NSCursor")]
        #[unsafe(method(addCursorRect:cursor:))]
        #[unsafe(method_family = none)]
        pub fn addCursorRect_cursor(&self, rect: NSRect, object: &NSCursor);

        #[cfg(feature = "NSCursor")]
        #[unsafe(method(removeCursorRect:cursor:))]
        #[unsafe(method_family = none)]
        pub fn removeCursorRect_cursor(&self, rect: NSRect, object: &NSCursor);

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

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

        /// # Safety
        ///
        /// - `owner` should be of the correct type.
        /// - `data` must be a valid pointer or null.
        #[unsafe(method(addTrackingRect:owner:userData:assumeInside:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addTrackingRect_owner_userData_assumeInside(
            &self,
            rect: NSRect,
            owner: &AnyObject,
            data: *mut c_void,
            flag: bool,
        ) -> NSTrackingRectTag;

        #[unsafe(method(removeTrackingRect:))]
        #[unsafe(method_family = none)]
        pub fn removeTrackingRect(&self, tag: NSTrackingRectTag);
    );
}

/// NSDisplayLink.
#[cfg(feature = "NSResponder")]
impl NSView {
    extern_methods!(
        #[cfg(feature = "objc2-quartz-core")]
        #[cfg(target_vendor = "apple")]
        /// # Safety
        ///
        /// - `target` should be of the correct type.
        /// - `selector` must be a valid selector.
        #[unsafe(method(displayLinkWithTarget:selector:))]
        #[unsafe(method_family = none)]
        pub unsafe fn displayLinkWithTarget_selector(
            &self,
            target: &AnyObject,
            selector: Sel,
        ) -> Retained<CADisplayLink>;
    );
}

/// NSDeprecated.
#[cfg(feature = "NSResponder")]
impl NSView {
    extern_methods!(
        #[cfg(all(feature = "NSEvent", feature = "NSImage", feature = "NSPasteboard"))]
        /// # Safety
        ///
        /// `source_obj` should be of the correct type.
        #[deprecated = "Use -beginDraggingSessionWithItems:event:source: instead"]
        #[unsafe(method(dragImage:at:offset:event:pasteboard:source:slideBack:))]
        #[unsafe(method_family = none)]
        pub unsafe fn dragImage_at_offset_event_pasteboard_source_slideBack(
            &self,
            image: &NSImage,
            view_location: NSPoint,
            initial_offset: NSSize,
            event: &NSEvent,
            pboard: &NSPasteboard,
            source_obj: &AnyObject,
            slide_flag: bool,
        );

        #[cfg(feature = "NSEvent")]
        #[deprecated = "Use -beginDraggingSessionWithItems:event:source: instead"]
        #[unsafe(method(dragFile:fromRect:slideBack:event:))]
        #[unsafe(method_family = none)]
        pub fn dragFile_fromRect_slideBack_event(
            &self,
            filename: &NSString,
            rect: NSRect,
            flag: bool,
            event: &NSEvent,
        ) -> bool;

        #[cfg(feature = "NSEvent")]
        /// # Safety
        ///
        /// `source_object` should be of the correct type.
        #[deprecated = "Use -beginDraggingSessionWithItems:event:source: with an NSFilePromiseProvider instead"]
        #[unsafe(method(dragPromisedFilesOfTypes:fromRect:source:slideBack:event:))]
        #[unsafe(method_family = none)]
        pub unsafe fn dragPromisedFilesOfTypes_fromRect_source_slideBack_event(
            &self,
            type_array: &NSArray<NSString>,
            rect: NSRect,
            source_object: &AnyObject,
            flag: bool,
            event: &NSEvent,
        ) -> bool;

        #[deprecated]
        #[unsafe(method(convertPointToBase:))]
        #[unsafe(method_family = none)]
        pub fn convertPointToBase(&self, point: NSPoint) -> NSPoint;

        #[deprecated]
        #[unsafe(method(convertPointFromBase:))]
        #[unsafe(method_family = none)]
        pub fn convertPointFromBase(&self, point: NSPoint) -> NSPoint;

        #[deprecated]
        #[unsafe(method(convertSizeToBase:))]
        #[unsafe(method_family = none)]
        pub fn convertSizeToBase(&self, size: NSSize) -> NSSize;

        #[deprecated]
        #[unsafe(method(convertSizeFromBase:))]
        #[unsafe(method_family = none)]
        pub fn convertSizeFromBase(&self, size: NSSize) -> NSSize;

        #[deprecated]
        #[unsafe(method(convertRectToBase:))]
        #[unsafe(method_family = none)]
        pub fn convertRectToBase(&self, rect: NSRect) -> NSRect;

        #[deprecated]
        #[unsafe(method(convertRectFromBase:))]
        #[unsafe(method_family = none)]
        pub fn convertRectFromBase(&self, rect: NSRect) -> NSRect;

        #[deprecated = "This has always returned NO and had no effect on macOS"]
        #[unsafe(method(performMnemonic:))]
        #[unsafe(method_family = none)]
        pub fn performMnemonic(&self, string: &NSString) -> bool;

        #[deprecated = "This method no longer does anything"]
        #[unsafe(method(shouldDrawColor))]
        #[unsafe(method_family = none)]
        pub fn shouldDrawColor(&self) -> bool;

        #[deprecated]
        #[unsafe(method(gState))]
        #[unsafe(method_family = none)]
        pub fn gState(&self) -> NSInteger;

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

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

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

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

        #[cfg(feature = "NSWritingToolsCoordinator")]
        /// Setter for [`writingToolsCoordinator`][Self::writingToolsCoordinator].
        #[unsafe(method(setWritingToolsCoordinator:))]
        #[unsafe(method_family = none)]
        pub fn setWritingToolsCoordinator(
            &self,
            writing_tools_coordinator: Option<&NSWritingToolsCoordinator>,
        );
    );
}

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

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

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

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsviewglobalframedidchangenotification?language=objc)
    #[deprecated = "Use NSOpenGLView instead."]
    pub static NSViewGlobalFrameDidChangeNotification: &'static NSNotificationName;
}

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