objc2_app_kit/generated/
NSView.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8#[cfg(feature = "objc2-core-image")]
9#[cfg(target_vendor = "apple")]
10use objc2_core_image::*;
11use objc2_foundation::*;
12#[cfg(feature = "objc2-quartz-core")]
13#[cfg(target_vendor = "apple")]
14use objc2_quartz_core::*;
15
16use crate::*;
17
18/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsautoresizingmaskoptions?language=objc)
19// NS_OPTIONS
20#[repr(transparent)]
21#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
22pub struct NSAutoresizingMaskOptions(pub NSUInteger);
23bitflags::bitflags! {
24    impl NSAutoresizingMaskOptions: NSUInteger {
25        #[doc(alias = "NSViewNotSizable")]
26        const ViewNotSizable = 0;
27        #[doc(alias = "NSViewMinXMargin")]
28        const ViewMinXMargin = 1;
29        #[doc(alias = "NSViewWidthSizable")]
30        const ViewWidthSizable = 2;
31        #[doc(alias = "NSViewMaxXMargin")]
32        const ViewMaxXMargin = 4;
33        #[doc(alias = "NSViewMinYMargin")]
34        const ViewMinYMargin = 8;
35        #[doc(alias = "NSViewHeightSizable")]
36        const ViewHeightSizable = 16;
37        #[doc(alias = "NSViewMaxYMargin")]
38        const ViewMaxYMargin = 32;
39    }
40}
41
42unsafe impl Encode for NSAutoresizingMaskOptions {
43    const ENCODING: Encoding = NSUInteger::ENCODING;
44}
45
46unsafe impl RefEncode for NSAutoresizingMaskOptions {
47    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
48}
49
50/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsbordertype?language=objc)
51// NS_ENUM
52#[repr(transparent)]
53#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
54pub struct NSBorderType(pub NSUInteger);
55impl NSBorderType {
56    #[doc(alias = "NSNoBorder")]
57    pub const NoBorder: Self = Self(0);
58    #[doc(alias = "NSLineBorder")]
59    pub const LineBorder: Self = Self(1);
60    #[doc(alias = "NSBezelBorder")]
61    pub const BezelBorder: Self = Self(2);
62    #[doc(alias = "NSGrooveBorder")]
63    pub const GrooveBorder: Self = Self(3);
64}
65
66unsafe impl Encode for NSBorderType {
67    const ENCODING: Encoding = NSUInteger::ENCODING;
68}
69
70unsafe impl RefEncode for NSBorderType {
71    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
72}
73
74/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsviewlayercontentsredrawpolicy?language=objc)
75// NS_ENUM
76#[repr(transparent)]
77#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
78pub struct NSViewLayerContentsRedrawPolicy(pub NSInteger);
79impl NSViewLayerContentsRedrawPolicy {
80    #[doc(alias = "NSViewLayerContentsRedrawNever")]
81    pub const Never: Self = Self(0);
82    #[doc(alias = "NSViewLayerContentsRedrawOnSetNeedsDisplay")]
83    pub const OnSetNeedsDisplay: Self = Self(1);
84    #[doc(alias = "NSViewLayerContentsRedrawDuringViewResize")]
85    pub const DuringViewResize: Self = Self(2);
86    #[doc(alias = "NSViewLayerContentsRedrawBeforeViewResize")]
87    pub const BeforeViewResize: Self = Self(3);
88    #[doc(alias = "NSViewLayerContentsRedrawCrossfade")]
89    pub const Crossfade: Self = Self(4);
90}
91
92unsafe impl Encode for NSViewLayerContentsRedrawPolicy {
93    const ENCODING: Encoding = NSInteger::ENCODING;
94}
95
96unsafe impl RefEncode for NSViewLayerContentsRedrawPolicy {
97    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
98}
99
100/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsviewlayercontentsplacement?language=objc)
101// NS_ENUM
102#[repr(transparent)]
103#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
104pub struct NSViewLayerContentsPlacement(pub NSInteger);
105impl NSViewLayerContentsPlacement {
106    #[doc(alias = "NSViewLayerContentsPlacementScaleAxesIndependently")]
107    pub const ScaleAxesIndependently: Self = Self(0);
108    #[doc(alias = "NSViewLayerContentsPlacementScaleProportionallyToFit")]
109    pub const ScaleProportionallyToFit: Self = Self(1);
110    #[doc(alias = "NSViewLayerContentsPlacementScaleProportionallyToFill")]
111    pub const ScaleProportionallyToFill: Self = Self(2);
112    #[doc(alias = "NSViewLayerContentsPlacementCenter")]
113    pub const Center: Self = Self(3);
114    #[doc(alias = "NSViewLayerContentsPlacementTop")]
115    pub const Top: Self = Self(4);
116    #[doc(alias = "NSViewLayerContentsPlacementTopRight")]
117    pub const TopRight: Self = Self(5);
118    #[doc(alias = "NSViewLayerContentsPlacementRight")]
119    pub const Right: Self = Self(6);
120    #[doc(alias = "NSViewLayerContentsPlacementBottomRight")]
121    pub const BottomRight: Self = Self(7);
122    #[doc(alias = "NSViewLayerContentsPlacementBottom")]
123    pub const Bottom: Self = Self(8);
124    #[doc(alias = "NSViewLayerContentsPlacementBottomLeft")]
125    pub const BottomLeft: Self = Self(9);
126    #[doc(alias = "NSViewLayerContentsPlacementLeft")]
127    pub const Left: Self = Self(10);
128    #[doc(alias = "NSViewLayerContentsPlacementTopLeft")]
129    pub const TopLeft: Self = Self(11);
130}
131
132unsafe impl Encode for NSViewLayerContentsPlacement {
133    const ENCODING: Encoding = NSInteger::ENCODING;
134}
135
136unsafe impl RefEncode for NSViewLayerContentsPlacement {
137    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
138}
139
140/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstrackingrecttag?language=objc)
141pub type NSTrackingRectTag = NSInteger;
142
143/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstooltiptag?language=objc)
144pub type NSToolTipTag = NSInteger;
145
146extern_class!(
147    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsview?language=objc)
148    #[unsafe(super(NSResponder, NSObject))]
149    #[thread_kind = MainThreadOnly]
150    #[derive(Debug, PartialEq, Eq, Hash)]
151    #[cfg(feature = "NSResponder")]
152    pub struct NSView;
153);
154
155#[cfg(all(feature = "NSAccessibilityProtocols", feature = "NSResponder"))]
156extern_conformance!(
157    unsafe impl NSAccessibility for NSView {}
158);
159
160#[cfg(all(feature = "NSAccessibilityProtocols", feature = "NSResponder"))]
161extern_conformance!(
162    unsafe impl NSAccessibilityElementProtocol for NSView {}
163);
164
165#[cfg(all(feature = "NSAnimation", feature = "NSResponder"))]
166extern_conformance!(
167    unsafe impl NSAnimatablePropertyContainer for NSView {}
168);
169
170#[cfg(all(feature = "NSAppearance", feature = "NSResponder"))]
171extern_conformance!(
172    unsafe impl NSAppearanceCustomization for NSView {}
173);
174
175#[cfg(feature = "NSResponder")]
176extern_conformance!(
177    unsafe impl NSCoding for NSView {}
178);
179
180#[cfg(all(feature = "NSDragging", feature = "NSResponder"))]
181extern_conformance!(
182    unsafe impl NSDraggingDestination for NSView {}
183);
184
185#[cfg(feature = "NSResponder")]
186extern_conformance!(
187    unsafe impl NSObjectProtocol for NSView {}
188);
189
190#[cfg(all(feature = "NSResponder", feature = "NSUserInterfaceItemIdentification"))]
191extern_conformance!(
192    unsafe impl NSUserInterfaceItemIdentification for NSView {}
193);
194
195#[cfg(feature = "NSResponder")]
196impl NSView {
197    extern_methods!(
198        #[unsafe(method(initWithFrame:))]
199        #[unsafe(method_family = init)]
200        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
201
202        #[unsafe(method(initWithCoder:))]
203        #[unsafe(method_family = init)]
204        pub unsafe fn initWithCoder(
205            this: Allocated<Self>,
206            coder: &NSCoder,
207        ) -> Option<Retained<Self>>;
208
209        #[cfg(feature = "NSWindow")]
210        #[unsafe(method(window))]
211        #[unsafe(method_family = none)]
212        pub fn window(&self) -> Option<Retained<NSWindow>>;
213
214        #[unsafe(method(superview))]
215        #[unsafe(method_family = none)]
216        pub unsafe fn superview(&self) -> Option<Retained<NSView>>;
217
218        #[unsafe(method(subviews))]
219        #[unsafe(method_family = none)]
220        pub unsafe fn subviews(&self) -> Retained<NSArray<NSView>>;
221
222        /// Setter for [`subviews`][Self::subviews].
223        #[unsafe(method(setSubviews:))]
224        #[unsafe(method_family = none)]
225        pub unsafe fn setSubviews(&self, subviews: &NSArray<NSView>);
226
227        #[unsafe(method(isDescendantOf:))]
228        #[unsafe(method_family = none)]
229        pub unsafe fn isDescendantOf(&self, view: &NSView) -> bool;
230
231        #[unsafe(method(ancestorSharedWithView:))]
232        #[unsafe(method_family = none)]
233        pub unsafe fn ancestorSharedWithView(&self, view: &NSView) -> Option<Retained<NSView>>;
234
235        #[unsafe(method(opaqueAncestor))]
236        #[unsafe(method_family = none)]
237        pub unsafe fn opaqueAncestor(&self) -> Option<Retained<NSView>>;
238
239        #[unsafe(method(isHidden))]
240        #[unsafe(method_family = none)]
241        pub unsafe fn isHidden(&self) -> bool;
242
243        /// Setter for [`isHidden`][Self::isHidden].
244        #[unsafe(method(setHidden:))]
245        #[unsafe(method_family = none)]
246        pub fn setHidden(&self, hidden: bool);
247
248        #[unsafe(method(isHiddenOrHasHiddenAncestor))]
249        #[unsafe(method_family = none)]
250        pub unsafe fn isHiddenOrHasHiddenAncestor(&self) -> bool;
251
252        #[unsafe(method(getRectsBeingDrawn:count:))]
253        #[unsafe(method_family = none)]
254        pub unsafe fn getRectsBeingDrawn_count(
255            &self,
256            rects: *mut *const NSRect,
257            count: *mut NSInteger,
258        );
259
260        #[unsafe(method(needsToDrawRect:))]
261        #[unsafe(method_family = none)]
262        pub unsafe fn needsToDrawRect(&self, rect: NSRect) -> bool;
263
264        #[unsafe(method(wantsDefaultClipping))]
265        #[unsafe(method_family = none)]
266        pub unsafe fn wantsDefaultClipping(&self) -> bool;
267
268        #[unsafe(method(viewDidHide))]
269        #[unsafe(method_family = none)]
270        pub unsafe fn viewDidHide(&self);
271
272        #[unsafe(method(viewDidUnhide))]
273        #[unsafe(method_family = none)]
274        pub unsafe fn viewDidUnhide(&self);
275
276        #[unsafe(method(addSubview:))]
277        #[unsafe(method_family = none)]
278        pub unsafe fn addSubview(&self, view: &NSView);
279
280        #[cfg(feature = "NSGraphics")]
281        #[unsafe(method(addSubview:positioned:relativeTo:))]
282        #[unsafe(method_family = none)]
283        pub unsafe fn addSubview_positioned_relativeTo(
284            &self,
285            view: &NSView,
286            place: NSWindowOrderingMode,
287            other_view: Option<&NSView>,
288        );
289
290        #[unsafe(method(sortSubviewsUsingFunction:context:))]
291        #[unsafe(method_family = none)]
292        pub unsafe fn sortSubviewsUsingFunction_context(
293            &self,
294            compare: unsafe extern "C-unwind" fn(
295                NonNull<NSView>,
296                NonNull<NSView>,
297                *mut c_void,
298            ) -> NSComparisonResult,
299            context: *mut c_void,
300        );
301
302        #[cfg(feature = "NSWindow")]
303        #[unsafe(method(viewWillMoveToWindow:))]
304        #[unsafe(method_family = none)]
305        pub unsafe fn viewWillMoveToWindow(&self, new_window: Option<&NSWindow>);
306
307        #[unsafe(method(viewDidMoveToWindow))]
308        #[unsafe(method_family = none)]
309        pub unsafe fn viewDidMoveToWindow(&self);
310
311        #[unsafe(method(viewWillMoveToSuperview:))]
312        #[unsafe(method_family = none)]
313        pub unsafe fn viewWillMoveToSuperview(&self, new_superview: Option<&NSView>);
314
315        #[unsafe(method(viewDidMoveToSuperview))]
316        #[unsafe(method_family = none)]
317        pub unsafe fn viewDidMoveToSuperview(&self);
318
319        #[unsafe(method(didAddSubview:))]
320        #[unsafe(method_family = none)]
321        pub unsafe fn didAddSubview(&self, subview: &NSView);
322
323        #[unsafe(method(willRemoveSubview:))]
324        #[unsafe(method_family = none)]
325        pub unsafe fn willRemoveSubview(&self, subview: &NSView);
326
327        #[unsafe(method(removeFromSuperview))]
328        #[unsafe(method_family = none)]
329        pub unsafe fn removeFromSuperview(&self);
330
331        #[unsafe(method(replaceSubview:with:))]
332        #[unsafe(method_family = none)]
333        pub unsafe fn replaceSubview_with(&self, old_view: &NSView, new_view: &NSView);
334
335        #[unsafe(method(removeFromSuperviewWithoutNeedingDisplay))]
336        #[unsafe(method_family = none)]
337        pub unsafe fn removeFromSuperviewWithoutNeedingDisplay(&self);
338
339        #[unsafe(method(viewDidChangeBackingProperties))]
340        #[unsafe(method_family = none)]
341        pub unsafe fn viewDidChangeBackingProperties(&self);
342
343        #[unsafe(method(postsFrameChangedNotifications))]
344        #[unsafe(method_family = none)]
345        pub unsafe fn postsFrameChangedNotifications(&self) -> bool;
346
347        /// Setter for [`postsFrameChangedNotifications`][Self::postsFrameChangedNotifications].
348        #[unsafe(method(setPostsFrameChangedNotifications:))]
349        #[unsafe(method_family = none)]
350        pub fn setPostsFrameChangedNotifications(&self, posts_frame_changed_notifications: bool);
351
352        #[unsafe(method(resizeSubviewsWithOldSize:))]
353        #[unsafe(method_family = none)]
354        pub unsafe fn resizeSubviewsWithOldSize(&self, old_size: NSSize);
355
356        #[unsafe(method(resizeWithOldSuperviewSize:))]
357        #[unsafe(method_family = none)]
358        pub unsafe fn resizeWithOldSuperviewSize(&self, old_size: NSSize);
359
360        #[unsafe(method(autoresizesSubviews))]
361        #[unsafe(method_family = none)]
362        pub unsafe fn autoresizesSubviews(&self) -> bool;
363
364        /// Setter for [`autoresizesSubviews`][Self::autoresizesSubviews].
365        #[unsafe(method(setAutoresizesSubviews:))]
366        #[unsafe(method_family = none)]
367        pub unsafe fn setAutoresizesSubviews(&self, autoresizes_subviews: bool);
368
369        #[unsafe(method(autoresizingMask))]
370        #[unsafe(method_family = none)]
371        pub unsafe fn autoresizingMask(&self) -> NSAutoresizingMaskOptions;
372
373        /// Setter for [`autoresizingMask`][Self::autoresizingMask].
374        #[unsafe(method(setAutoresizingMask:))]
375        #[unsafe(method_family = none)]
376        pub unsafe fn setAutoresizingMask(&self, autoresizing_mask: NSAutoresizingMaskOptions);
377
378        #[unsafe(method(setFrameOrigin:))]
379        #[unsafe(method_family = none)]
380        pub unsafe fn setFrameOrigin(&self, new_origin: NSPoint);
381
382        #[unsafe(method(setFrameSize:))]
383        #[unsafe(method_family = none)]
384        pub unsafe fn setFrameSize(&self, new_size: NSSize);
385
386        #[unsafe(method(frame))]
387        #[unsafe(method_family = none)]
388        pub fn frame(&self) -> NSRect;
389
390        /// Setter for [`frame`][Self::frame].
391        #[unsafe(method(setFrame:))]
392        #[unsafe(method_family = none)]
393        pub unsafe fn setFrame(&self, frame: NSRect);
394
395        #[cfg(feature = "objc2-core-foundation")]
396        #[unsafe(method(frameRotation))]
397        #[unsafe(method_family = none)]
398        pub unsafe fn frameRotation(&self) -> CGFloat;
399
400        #[cfg(feature = "objc2-core-foundation")]
401        /// Setter for [`frameRotation`][Self::frameRotation].
402        #[unsafe(method(setFrameRotation:))]
403        #[unsafe(method_family = none)]
404        pub unsafe fn setFrameRotation(&self, frame_rotation: CGFloat);
405
406        #[cfg(feature = "objc2-core-foundation")]
407        #[unsafe(method(frameCenterRotation))]
408        #[unsafe(method_family = none)]
409        pub unsafe fn frameCenterRotation(&self) -> CGFloat;
410
411        #[cfg(feature = "objc2-core-foundation")]
412        /// Setter for [`frameCenterRotation`][Self::frameCenterRotation].
413        #[unsafe(method(setFrameCenterRotation:))]
414        #[unsafe(method_family = none)]
415        pub unsafe fn setFrameCenterRotation(&self, frame_center_rotation: CGFloat);
416
417        #[unsafe(method(setBoundsOrigin:))]
418        #[unsafe(method_family = none)]
419        pub unsafe fn setBoundsOrigin(&self, new_origin: NSPoint);
420
421        #[unsafe(method(setBoundsSize:))]
422        #[unsafe(method_family = none)]
423        pub unsafe fn setBoundsSize(&self, new_size: NSSize);
424
425        #[cfg(feature = "objc2-core-foundation")]
426        #[unsafe(method(boundsRotation))]
427        #[unsafe(method_family = none)]
428        pub unsafe fn boundsRotation(&self) -> CGFloat;
429
430        #[cfg(feature = "objc2-core-foundation")]
431        /// Setter for [`boundsRotation`][Self::boundsRotation].
432        #[unsafe(method(setBoundsRotation:))]
433        #[unsafe(method_family = none)]
434        pub unsafe fn setBoundsRotation(&self, bounds_rotation: CGFloat);
435
436        #[unsafe(method(translateOriginToPoint:))]
437        #[unsafe(method_family = none)]
438        pub unsafe fn translateOriginToPoint(&self, translation: NSPoint);
439
440        #[unsafe(method(scaleUnitSquareToSize:))]
441        #[unsafe(method_family = none)]
442        pub unsafe fn scaleUnitSquareToSize(&self, new_unit_size: NSSize);
443
444        #[cfg(feature = "objc2-core-foundation")]
445        #[unsafe(method(rotateByAngle:))]
446        #[unsafe(method_family = none)]
447        pub unsafe fn rotateByAngle(&self, angle: CGFloat);
448
449        #[unsafe(method(bounds))]
450        #[unsafe(method_family = none)]
451        pub fn bounds(&self) -> NSRect;
452
453        /// Setter for [`bounds`][Self::bounds].
454        #[unsafe(method(setBounds:))]
455        #[unsafe(method_family = none)]
456        pub unsafe fn setBounds(&self, bounds: NSRect);
457
458        #[unsafe(method(isFlipped))]
459        #[unsafe(method_family = none)]
460        pub fn isFlipped(&self) -> bool;
461
462        #[unsafe(method(isRotatedFromBase))]
463        #[unsafe(method_family = none)]
464        pub unsafe fn isRotatedFromBase(&self) -> bool;
465
466        #[unsafe(method(isRotatedOrScaledFromBase))]
467        #[unsafe(method_family = none)]
468        pub unsafe fn isRotatedOrScaledFromBase(&self) -> bool;
469
470        #[unsafe(method(isOpaque))]
471        #[unsafe(method_family = none)]
472        pub unsafe fn isOpaque(&self) -> bool;
473
474        #[unsafe(method(convertPoint:fromView:))]
475        #[unsafe(method_family = none)]
476        pub fn convertPoint_fromView(&self, point: NSPoint, view: Option<&NSView>) -> NSPoint;
477
478        #[unsafe(method(convertPoint:toView:))]
479        #[unsafe(method_family = none)]
480        pub unsafe fn convertPoint_toView(&self, point: NSPoint, view: Option<&NSView>) -> NSPoint;
481
482        #[unsafe(method(convertSize:fromView:))]
483        #[unsafe(method_family = none)]
484        pub unsafe fn convertSize_fromView(&self, size: NSSize, view: Option<&NSView>) -> NSSize;
485
486        #[unsafe(method(convertSize:toView:))]
487        #[unsafe(method_family = none)]
488        pub unsafe fn convertSize_toView(&self, size: NSSize, view: Option<&NSView>) -> NSSize;
489
490        #[unsafe(method(convertRect:fromView:))]
491        #[unsafe(method_family = none)]
492        pub unsafe fn convertRect_fromView(&self, rect: NSRect, view: Option<&NSView>) -> NSRect;
493
494        #[unsafe(method(convertRect:toView:))]
495        #[unsafe(method_family = none)]
496        pub fn convertRect_toView(&self, rect: NSRect, view: Option<&NSView>) -> NSRect;
497
498        #[unsafe(method(backingAlignedRect:options:))]
499        #[unsafe(method_family = none)]
500        pub unsafe fn backingAlignedRect_options(
501            &self,
502            rect: NSRect,
503            options: NSAlignmentOptions,
504        ) -> NSRect;
505
506        #[unsafe(method(centerScanRect:))]
507        #[unsafe(method_family = none)]
508        pub unsafe fn centerScanRect(&self, rect: NSRect) -> NSRect;
509
510        #[unsafe(method(convertPointToBacking:))]
511        #[unsafe(method_family = none)]
512        pub unsafe fn convertPointToBacking(&self, point: NSPoint) -> NSPoint;
513
514        #[unsafe(method(convertPointFromBacking:))]
515        #[unsafe(method_family = none)]
516        pub unsafe fn convertPointFromBacking(&self, point: NSPoint) -> NSPoint;
517
518        #[unsafe(method(convertSizeToBacking:))]
519        #[unsafe(method_family = none)]
520        pub unsafe fn convertSizeToBacking(&self, size: NSSize) -> NSSize;
521
522        #[unsafe(method(convertSizeFromBacking:))]
523        #[unsafe(method_family = none)]
524        pub unsafe fn convertSizeFromBacking(&self, size: NSSize) -> NSSize;
525
526        #[unsafe(method(convertRectToBacking:))]
527        #[unsafe(method_family = none)]
528        pub unsafe fn convertRectToBacking(&self, rect: NSRect) -> NSRect;
529
530        #[unsafe(method(convertRectFromBacking:))]
531        #[unsafe(method_family = none)]
532        pub unsafe fn convertRectFromBacking(&self, rect: NSRect) -> NSRect;
533
534        #[unsafe(method(convertPointToLayer:))]
535        #[unsafe(method_family = none)]
536        pub unsafe fn convertPointToLayer(&self, point: NSPoint) -> NSPoint;
537
538        #[unsafe(method(convertPointFromLayer:))]
539        #[unsafe(method_family = none)]
540        pub unsafe fn convertPointFromLayer(&self, point: NSPoint) -> NSPoint;
541
542        #[unsafe(method(convertSizeToLayer:))]
543        #[unsafe(method_family = none)]
544        pub unsafe fn convertSizeToLayer(&self, size: NSSize) -> NSSize;
545
546        #[unsafe(method(convertSizeFromLayer:))]
547        #[unsafe(method_family = none)]
548        pub unsafe fn convertSizeFromLayer(&self, size: NSSize) -> NSSize;
549
550        #[unsafe(method(convertRectToLayer:))]
551        #[unsafe(method_family = none)]
552        pub unsafe fn convertRectToLayer(&self, rect: NSRect) -> NSRect;
553
554        #[unsafe(method(convertRectFromLayer:))]
555        #[unsafe(method_family = none)]
556        pub unsafe fn convertRectFromLayer(&self, rect: NSRect) -> NSRect;
557
558        #[unsafe(method(canDrawConcurrently))]
559        #[unsafe(method_family = none)]
560        pub unsafe fn canDrawConcurrently(&self) -> bool;
561
562        /// Setter for [`canDrawConcurrently`][Self::canDrawConcurrently].
563        #[unsafe(method(setCanDrawConcurrently:))]
564        #[unsafe(method_family = none)]
565        pub unsafe fn setCanDrawConcurrently(&self, can_draw_concurrently: bool);
566
567        #[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."]
568        #[unsafe(method(canDraw))]
569        #[unsafe(method_family = none)]
570        pub unsafe fn canDraw(&self) -> bool;
571
572        #[unsafe(method(setNeedsDisplayInRect:))]
573        #[unsafe(method_family = none)]
574        pub unsafe fn setNeedsDisplayInRect(&self, invalid_rect: NSRect);
575
576        #[unsafe(method(needsDisplay))]
577        #[unsafe(method_family = none)]
578        pub unsafe fn needsDisplay(&self) -> bool;
579
580        /// Setter for [`needsDisplay`][Self::needsDisplay].
581        #[unsafe(method(setNeedsDisplay:))]
582        #[unsafe(method_family = none)]
583        pub unsafe fn setNeedsDisplay(&self, needs_display: bool);
584
585        #[deprecated = "To draw, subclass NSView and implement -drawRect:; AppKit's automatic deferred display mechanism will call -drawRect: as necessary to display the view."]
586        #[unsafe(method(lockFocus))]
587        #[unsafe(method_family = none)]
588        pub unsafe fn lockFocus(&self);
589
590        #[deprecated = "To draw, subclass NSView and implement -drawRect:; AppKit's automatic deferred display mechanism will call -drawRect: as necessary to display the view."]
591        #[unsafe(method(unlockFocus))]
592        #[unsafe(method_family = none)]
593        pub unsafe fn unlockFocus(&self);
594
595        #[deprecated = "To draw, subclass NSView and implement -drawRect:; AppKit's automatic deferred display mechanism will call -drawRect: as necessary to display the view."]
596        #[unsafe(method(lockFocusIfCanDraw))]
597        #[unsafe(method_family = none)]
598        pub unsafe fn lockFocusIfCanDraw(&self) -> bool;
599
600        #[cfg(feature = "NSGraphicsContext")]
601        #[deprecated = "Use -[NSView displayRectIgnoringOpacity:inContext:] to draw a view subtree into a graphics context."]
602        #[unsafe(method(lockFocusIfCanDrawInContext:))]
603        #[unsafe(method_family = none)]
604        pub unsafe fn lockFocusIfCanDrawInContext(&self, context: &NSGraphicsContext) -> bool;
605
606        #[unsafe(method(focusView))]
607        #[unsafe(method_family = none)]
608        pub unsafe fn focusView(mtm: MainThreadMarker) -> Option<Retained<NSView>>;
609
610        /// The portion of the view that isn’t clipped by its superviews.
611        ///
612        /// 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.
613        ///
614        /// During a printing operation, the visible rectangle is further clipped to the page being imaged.
615        #[unsafe(method(visibleRect))]
616        #[unsafe(method_family = none)]
617        pub fn visibleRect(&self) -> NSRect;
618
619        #[unsafe(method(display))]
620        #[unsafe(method_family = none)]
621        pub unsafe fn display(&self);
622
623        #[unsafe(method(displayIfNeeded))]
624        #[unsafe(method_family = none)]
625        pub unsafe fn displayIfNeeded(&self);
626
627        #[unsafe(method(displayIfNeededIgnoringOpacity))]
628        #[unsafe(method_family = none)]
629        pub unsafe fn displayIfNeededIgnoringOpacity(&self);
630
631        #[unsafe(method(displayRect:))]
632        #[unsafe(method_family = none)]
633        pub unsafe fn displayRect(&self, rect: NSRect);
634
635        #[unsafe(method(displayIfNeededInRect:))]
636        #[unsafe(method_family = none)]
637        pub unsafe fn displayIfNeededInRect(&self, rect: NSRect);
638
639        #[unsafe(method(displayRectIgnoringOpacity:))]
640        #[unsafe(method_family = none)]
641        pub unsafe fn displayRectIgnoringOpacity(&self, rect: NSRect);
642
643        #[unsafe(method(displayIfNeededInRectIgnoringOpacity:))]
644        #[unsafe(method_family = none)]
645        pub unsafe fn displayIfNeededInRectIgnoringOpacity(&self, rect: NSRect);
646
647        #[unsafe(method(drawRect:))]
648        #[unsafe(method_family = none)]
649        pub unsafe fn drawRect(&self, dirty_rect: NSRect);
650
651        #[cfg(feature = "NSGraphicsContext")]
652        #[unsafe(method(displayRectIgnoringOpacity:inContext:))]
653        #[unsafe(method_family = none)]
654        pub unsafe fn displayRectIgnoringOpacity_inContext(
655            &self,
656            rect: NSRect,
657            context: &NSGraphicsContext,
658        );
659
660        #[cfg(all(feature = "NSBitmapImageRep", feature = "NSImageRep"))]
661        #[unsafe(method(bitmapImageRepForCachingDisplayInRect:))]
662        #[unsafe(method_family = none)]
663        pub unsafe fn bitmapImageRepForCachingDisplayInRect(
664            &self,
665            rect: NSRect,
666        ) -> Option<Retained<NSBitmapImageRep>>;
667
668        #[cfg(all(feature = "NSBitmapImageRep", feature = "NSImageRep"))]
669        #[unsafe(method(cacheDisplayInRect:toBitmapImageRep:))]
670        #[unsafe(method_family = none)]
671        pub unsafe fn cacheDisplayInRect_toBitmapImageRep(
672            &self,
673            rect: NSRect,
674            bitmap_image_rep: &NSBitmapImageRep,
675        );
676
677        #[unsafe(method(viewWillDraw))]
678        #[unsafe(method_family = none)]
679        pub unsafe fn viewWillDraw(&self);
680
681        #[unsafe(method(scrollPoint:))]
682        #[unsafe(method_family = none)]
683        pub unsafe fn scrollPoint(&self, point: NSPoint);
684
685        #[unsafe(method(scrollRectToVisible:))]
686        #[unsafe(method_family = none)]
687        pub unsafe fn scrollRectToVisible(&self, rect: NSRect) -> bool;
688
689        #[cfg(feature = "NSEvent")]
690        #[unsafe(method(autoscroll:))]
691        #[unsafe(method_family = none)]
692        pub unsafe fn autoscroll(&self, event: &NSEvent) -> bool;
693
694        #[unsafe(method(adjustScroll:))]
695        #[unsafe(method_family = none)]
696        pub unsafe fn adjustScroll(&self, new_visible: NSRect) -> NSRect;
697
698        #[deprecated = "Use NSScrollView to achieve scrolling views."]
699        #[unsafe(method(scrollRect:by:))]
700        #[unsafe(method_family = none)]
701        pub unsafe fn scrollRect_by(&self, rect: NSRect, delta: NSSize);
702
703        #[unsafe(method(translateRectsNeedingDisplayInRect:by:))]
704        #[unsafe(method_family = none)]
705        pub unsafe fn translateRectsNeedingDisplayInRect_by(
706            &self,
707            clip_rect: NSRect,
708            delta: NSSize,
709        );
710
711        #[unsafe(method(hitTest:))]
712        #[unsafe(method_family = none)]
713        pub unsafe fn hitTest(&self, point: NSPoint) -> Option<Retained<NSView>>;
714
715        #[unsafe(method(mouse:inRect:))]
716        #[unsafe(method_family = none)]
717        pub unsafe fn mouse_inRect(&self, point: NSPoint, rect: NSRect) -> bool;
718
719        #[unsafe(method(viewWithTag:))]
720        #[unsafe(method_family = none)]
721        pub unsafe fn viewWithTag(&self, tag: NSInteger) -> Option<Retained<NSView>>;
722
723        #[unsafe(method(tag))]
724        #[unsafe(method_family = none)]
725        pub unsafe fn tag(&self) -> NSInteger;
726
727        #[cfg(feature = "NSEvent")]
728        #[unsafe(method(performKeyEquivalent:))]
729        #[unsafe(method_family = none)]
730        pub unsafe fn performKeyEquivalent(&self, event: &NSEvent) -> bool;
731
732        #[cfg(feature = "NSEvent")]
733        #[unsafe(method(acceptsFirstMouse:))]
734        #[unsafe(method_family = none)]
735        pub unsafe fn acceptsFirstMouse(&self, event: Option<&NSEvent>) -> bool;
736
737        #[cfg(feature = "NSEvent")]
738        #[unsafe(method(shouldDelayWindowOrderingForEvent:))]
739        #[unsafe(method_family = none)]
740        pub unsafe fn shouldDelayWindowOrderingForEvent(&self, event: &NSEvent) -> bool;
741
742        #[unsafe(method(needsPanelToBecomeKey))]
743        #[unsafe(method_family = none)]
744        pub unsafe fn needsPanelToBecomeKey(&self) -> bool;
745
746        #[unsafe(method(mouseDownCanMoveWindow))]
747        #[unsafe(method_family = none)]
748        pub unsafe fn mouseDownCanMoveWindow(&self) -> bool;
749
750        #[deprecated = "Use allowedTouchTypes instead"]
751        #[unsafe(method(acceptsTouchEvents))]
752        #[unsafe(method_family = none)]
753        pub unsafe fn acceptsTouchEvents(&self) -> bool;
754
755        /// Setter for [`acceptsTouchEvents`][Self::acceptsTouchEvents].
756        #[deprecated = "Use allowedTouchTypes instead"]
757        #[unsafe(method(setAcceptsTouchEvents:))]
758        #[unsafe(method_family = none)]
759        pub unsafe fn setAcceptsTouchEvents(&self, accepts_touch_events: bool);
760
761        #[unsafe(method(wantsRestingTouches))]
762        #[unsafe(method_family = none)]
763        pub unsafe fn wantsRestingTouches(&self) -> bool;
764
765        /// Setter for [`wantsRestingTouches`][Self::wantsRestingTouches].
766        #[unsafe(method(setWantsRestingTouches:))]
767        #[unsafe(method_family = none)]
768        pub unsafe fn setWantsRestingTouches(&self, wants_resting_touches: bool);
769
770        #[cfg(feature = "objc2-quartz-core")]
771        #[cfg(target_vendor = "apple")]
772        #[unsafe(method(makeBackingLayer))]
773        #[unsafe(method_family = none)]
774        pub unsafe fn makeBackingLayer(&self) -> Retained<CALayer>;
775
776        #[unsafe(method(layerContentsRedrawPolicy))]
777        #[unsafe(method_family = none)]
778        pub unsafe fn layerContentsRedrawPolicy(&self) -> NSViewLayerContentsRedrawPolicy;
779
780        /// Setter for [`layerContentsRedrawPolicy`][Self::layerContentsRedrawPolicy].
781        #[unsafe(method(setLayerContentsRedrawPolicy:))]
782        #[unsafe(method_family = none)]
783        pub unsafe fn setLayerContentsRedrawPolicy(
784            &self,
785            layer_contents_redraw_policy: NSViewLayerContentsRedrawPolicy,
786        );
787
788        #[unsafe(method(layerContentsPlacement))]
789        #[unsafe(method_family = none)]
790        pub unsafe fn layerContentsPlacement(&self) -> NSViewLayerContentsPlacement;
791
792        /// Setter for [`layerContentsPlacement`][Self::layerContentsPlacement].
793        #[unsafe(method(setLayerContentsPlacement:))]
794        #[unsafe(method_family = none)]
795        pub unsafe fn setLayerContentsPlacement(
796            &self,
797            layer_contents_placement: NSViewLayerContentsPlacement,
798        );
799
800        #[unsafe(method(wantsLayer))]
801        #[unsafe(method_family = none)]
802        pub unsafe fn wantsLayer(&self) -> bool;
803
804        /// Setter for [`wantsLayer`][Self::wantsLayer].
805        #[unsafe(method(setWantsLayer:))]
806        #[unsafe(method_family = none)]
807        pub fn setWantsLayer(&self, wants_layer: bool);
808
809        #[cfg(feature = "objc2-quartz-core")]
810        #[cfg(target_vendor = "apple")]
811        #[unsafe(method(layer))]
812        #[unsafe(method_family = none)]
813        pub unsafe fn layer(&self) -> Option<Retained<CALayer>>;
814
815        #[cfg(feature = "objc2-quartz-core")]
816        #[cfg(target_vendor = "apple")]
817        /// Setter for [`layer`][Self::layer].
818        #[unsafe(method(setLayer:))]
819        #[unsafe(method_family = none)]
820        pub unsafe fn setLayer(&self, layer: Option<&CALayer>);
821
822        #[unsafe(method(wantsUpdateLayer))]
823        #[unsafe(method_family = none)]
824        pub unsafe fn wantsUpdateLayer(&self) -> bool;
825
826        #[unsafe(method(updateLayer))]
827        #[unsafe(method_family = none)]
828        pub unsafe fn updateLayer(&self);
829
830        #[unsafe(method(canDrawSubviewsIntoLayer))]
831        #[unsafe(method_family = none)]
832        pub unsafe fn canDrawSubviewsIntoLayer(&self) -> bool;
833
834        /// Setter for [`canDrawSubviewsIntoLayer`][Self::canDrawSubviewsIntoLayer].
835        #[unsafe(method(setCanDrawSubviewsIntoLayer:))]
836        #[unsafe(method_family = none)]
837        pub unsafe fn setCanDrawSubviewsIntoLayer(&self, can_draw_subviews_into_layer: bool);
838
839        #[unsafe(method(layoutSubtreeIfNeeded))]
840        #[unsafe(method_family = none)]
841        pub unsafe fn layoutSubtreeIfNeeded(&self);
842
843        #[unsafe(method(layout))]
844        #[unsafe(method_family = none)]
845        pub unsafe fn layout(&self);
846
847        #[unsafe(method(needsLayout))]
848        #[unsafe(method_family = none)]
849        pub unsafe fn needsLayout(&self) -> bool;
850
851        /// Setter for [`needsLayout`][Self::needsLayout].
852        #[unsafe(method(setNeedsLayout:))]
853        #[unsafe(method_family = none)]
854        pub unsafe fn setNeedsLayout(&self, needs_layout: bool);
855
856        #[cfg(feature = "objc2-core-foundation")]
857        #[unsafe(method(alphaValue))]
858        #[unsafe(method_family = none)]
859        pub unsafe fn alphaValue(&self) -> CGFloat;
860
861        #[cfg(feature = "objc2-core-foundation")]
862        /// Setter for [`alphaValue`][Self::alphaValue].
863        #[unsafe(method(setAlphaValue:))]
864        #[unsafe(method_family = none)]
865        pub unsafe fn setAlphaValue(&self, alpha_value: CGFloat);
866
867        #[unsafe(method(layerUsesCoreImageFilters))]
868        #[unsafe(method_family = none)]
869        pub unsafe fn layerUsesCoreImageFilters(&self) -> bool;
870
871        /// Setter for [`layerUsesCoreImageFilters`][Self::layerUsesCoreImageFilters].
872        #[unsafe(method(setLayerUsesCoreImageFilters:))]
873        #[unsafe(method_family = none)]
874        pub unsafe fn setLayerUsesCoreImageFilters(&self, layer_uses_core_image_filters: bool);
875
876        #[cfg(feature = "objc2-core-image")]
877        #[cfg(target_vendor = "apple")]
878        #[unsafe(method(backgroundFilters))]
879        #[unsafe(method_family = none)]
880        pub unsafe fn backgroundFilters(&self) -> Retained<NSArray<CIFilter>>;
881
882        #[cfg(feature = "objc2-core-image")]
883        #[cfg(target_vendor = "apple")]
884        /// Setter for [`backgroundFilters`][Self::backgroundFilters].
885        #[unsafe(method(setBackgroundFilters:))]
886        #[unsafe(method_family = none)]
887        pub unsafe fn setBackgroundFilters(&self, background_filters: &NSArray<CIFilter>);
888
889        #[cfg(feature = "objc2-core-image")]
890        #[cfg(target_vendor = "apple")]
891        #[unsafe(method(compositingFilter))]
892        #[unsafe(method_family = none)]
893        pub unsafe fn compositingFilter(&self) -> Option<Retained<CIFilter>>;
894
895        #[cfg(feature = "objc2-core-image")]
896        #[cfg(target_vendor = "apple")]
897        /// Setter for [`compositingFilter`][Self::compositingFilter].
898        #[unsafe(method(setCompositingFilter:))]
899        #[unsafe(method_family = none)]
900        pub unsafe fn setCompositingFilter(&self, compositing_filter: Option<&CIFilter>);
901
902        #[cfg(feature = "objc2-core-image")]
903        #[cfg(target_vendor = "apple")]
904        #[unsafe(method(contentFilters))]
905        #[unsafe(method_family = none)]
906        pub unsafe fn contentFilters(&self) -> Retained<NSArray<CIFilter>>;
907
908        #[cfg(feature = "objc2-core-image")]
909        #[cfg(target_vendor = "apple")]
910        /// Setter for [`contentFilters`][Self::contentFilters].
911        #[unsafe(method(setContentFilters:))]
912        #[unsafe(method_family = none)]
913        pub unsafe fn setContentFilters(&self, content_filters: &NSArray<CIFilter>);
914
915        #[cfg(feature = "NSShadow")]
916        #[unsafe(method(shadow))]
917        #[unsafe(method_family = none)]
918        pub unsafe fn shadow(&self) -> Option<Retained<NSShadow>>;
919
920        #[cfg(feature = "NSShadow")]
921        /// Setter for [`shadow`][Self::shadow].
922        #[unsafe(method(setShadow:))]
923        #[unsafe(method_family = none)]
924        pub unsafe fn setShadow(&self, shadow: Option<&NSShadow>);
925
926        #[unsafe(method(clipsToBounds))]
927        #[unsafe(method_family = none)]
928        pub unsafe fn clipsToBounds(&self) -> bool;
929
930        /// Setter for [`clipsToBounds`][Self::clipsToBounds].
931        #[unsafe(method(setClipsToBounds:))]
932        #[unsafe(method_family = none)]
933        pub unsafe fn setClipsToBounds(&self, clips_to_bounds: bool);
934
935        #[unsafe(method(postsBoundsChangedNotifications))]
936        #[unsafe(method_family = none)]
937        pub unsafe fn postsBoundsChangedNotifications(&self) -> bool;
938
939        /// Setter for [`postsBoundsChangedNotifications`][Self::postsBoundsChangedNotifications].
940        #[unsafe(method(setPostsBoundsChangedNotifications:))]
941        #[unsafe(method_family = none)]
942        pub unsafe fn setPostsBoundsChangedNotifications(
943            &self,
944            posts_bounds_changed_notifications: bool,
945        );
946
947        #[cfg(feature = "NSScrollView")]
948        #[unsafe(method(enclosingScrollView))]
949        #[unsafe(method_family = none)]
950        pub unsafe fn enclosingScrollView(&self) -> Option<Retained<NSScrollView>>;
951
952        #[cfg(all(feature = "NSEvent", feature = "NSMenu"))]
953        #[unsafe(method(menuForEvent:))]
954        #[unsafe(method_family = none)]
955        pub unsafe fn menuForEvent(&self, event: &NSEvent) -> Option<Retained<NSMenu>>;
956
957        #[cfg(feature = "NSMenu")]
958        #[unsafe(method(defaultMenu))]
959        #[unsafe(method_family = none)]
960        pub unsafe fn defaultMenu(mtm: MainThreadMarker) -> Option<Retained<NSMenu>>;
961
962        #[cfg(all(feature = "NSEvent", feature = "NSMenu"))]
963        /// A contextual menu is being opened from the receiving view.
964        /// The view should update any visual state in response — such as making a selection.
965        ///
966        /// Parameter `menu`: The contextual menu that is being opened on the view
967        ///
968        /// Parameter `event`: The event that caused the menu to open.
969        #[unsafe(method(willOpenMenu:withEvent:))]
970        #[unsafe(method_family = none)]
971        pub unsafe fn willOpenMenu_withEvent(&self, menu: &NSMenu, event: &NSEvent);
972
973        #[cfg(all(feature = "NSEvent", feature = "NSMenu"))]
974        /// 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
975        /// `-willOpenMenu:withEvent:.`The view should update any visual state in response — such as removing a temporary selection.
976        ///
977        /// Parameter `menu`: The contextual menu that was open on the view
978        ///
979        /// Parameter `event`: The event that caused the menu to close. This may be nil if there is no specific event that triggered the closing.
980        #[unsafe(method(didCloseMenu:withEvent:))]
981        #[unsafe(method_family = none)]
982        pub unsafe fn didCloseMenu_withEvent(&self, menu: &NSMenu, event: Option<&NSEvent>);
983
984        #[unsafe(method(toolTip))]
985        #[unsafe(method_family = none)]
986        pub unsafe fn toolTip(&self) -> Option<Retained<NSString>>;
987
988        /// Setter for [`toolTip`][Self::toolTip].
989        #[unsafe(method(setToolTip:))]
990        #[unsafe(method_family = none)]
991        pub unsafe fn setToolTip(&self, tool_tip: Option<&NSString>);
992
993        #[unsafe(method(addToolTipRect:owner:userData:))]
994        #[unsafe(method_family = none)]
995        pub unsafe fn addToolTipRect_owner_userData(
996            &self,
997            rect: NSRect,
998            owner: &AnyObject,
999            data: *mut c_void,
1000        ) -> NSToolTipTag;
1001
1002        #[unsafe(method(removeToolTip:))]
1003        #[unsafe(method_family = none)]
1004        pub unsafe fn removeToolTip(&self, tag: NSToolTipTag);
1005
1006        #[unsafe(method(removeAllToolTips))]
1007        #[unsafe(method_family = none)]
1008        pub unsafe fn removeAllToolTips(&self);
1009
1010        #[unsafe(method(viewWillStartLiveResize))]
1011        #[unsafe(method_family = none)]
1012        pub unsafe fn viewWillStartLiveResize(&self);
1013
1014        #[unsafe(method(viewDidEndLiveResize))]
1015        #[unsafe(method_family = none)]
1016        pub unsafe fn viewDidEndLiveResize(&self);
1017
1018        #[unsafe(method(inLiveResize))]
1019        #[unsafe(method_family = none)]
1020        pub unsafe fn inLiveResize(&self) -> bool;
1021
1022        #[unsafe(method(preservesContentDuringLiveResize))]
1023        #[unsafe(method_family = none)]
1024        pub unsafe fn preservesContentDuringLiveResize(&self) -> bool;
1025
1026        #[unsafe(method(rectPreservedDuringLiveResize))]
1027        #[unsafe(method_family = none)]
1028        pub unsafe fn rectPreservedDuringLiveResize(&self) -> NSRect;
1029
1030        #[cfg(feature = "NSTextInputContext")]
1031        #[unsafe(method(inputContext))]
1032        #[unsafe(method_family = none)]
1033        pub fn inputContext(&self) -> Option<Retained<NSTextInputContext>>;
1034
1035        #[unsafe(method(rectForSmartMagnificationAtPoint:inRect:))]
1036        #[unsafe(method_family = none)]
1037        pub unsafe fn rectForSmartMagnificationAtPoint_inRect(
1038            &self,
1039            location: NSPoint,
1040            visible_rect: NSRect,
1041        ) -> NSRect;
1042
1043        #[cfg(feature = "NSUserInterfaceLayout")]
1044        #[unsafe(method(userInterfaceLayoutDirection))]
1045        #[unsafe(method_family = none)]
1046        pub unsafe fn userInterfaceLayoutDirection(&self) -> NSUserInterfaceLayoutDirection;
1047
1048        #[cfg(feature = "NSUserInterfaceLayout")]
1049        /// Setter for [`userInterfaceLayoutDirection`][Self::userInterfaceLayoutDirection].
1050        #[unsafe(method(setUserInterfaceLayoutDirection:))]
1051        #[unsafe(method_family = none)]
1052        pub unsafe fn setUserInterfaceLayoutDirection(
1053            &self,
1054            user_interface_layout_direction: NSUserInterfaceLayoutDirection,
1055        );
1056
1057        #[unsafe(method(prepareForReuse))]
1058        #[unsafe(method_family = none)]
1059        pub unsafe fn prepareForReuse(&self);
1060
1061        #[unsafe(method(isCompatibleWithResponsiveScrolling))]
1062        #[unsafe(method_family = none)]
1063        pub unsafe fn isCompatibleWithResponsiveScrolling(mtm: MainThreadMarker) -> bool;
1064
1065        #[unsafe(method(prepareContentInRect:))]
1066        #[unsafe(method_family = none)]
1067        pub unsafe fn prepareContentInRect(&self, rect: NSRect);
1068
1069        #[unsafe(method(preparedContentRect))]
1070        #[unsafe(method_family = none)]
1071        pub unsafe fn preparedContentRect(&self) -> NSRect;
1072
1073        /// Setter for [`preparedContentRect`][Self::preparedContentRect].
1074        #[unsafe(method(setPreparedContentRect:))]
1075        #[unsafe(method_family = none)]
1076        pub unsafe fn setPreparedContentRect(&self, prepared_content_rect: NSRect);
1077
1078        #[unsafe(method(allowsVibrancy))]
1079        #[unsafe(method_family = none)]
1080        pub unsafe fn allowsVibrancy(&self) -> bool;
1081
1082        /// Override point for reacting to the effective appearance of the receiver changing. At this point `effectiveAppearance` property reflects the new appearance.
1083        #[unsafe(method(viewDidChangeEffectiveAppearance))]
1084        #[unsafe(method_family = none)]
1085        pub unsafe fn viewDidChangeEffectiveAppearance(&self);
1086    );
1087}
1088
1089/// Methods declared on superclass `NSResponder`.
1090#[cfg(feature = "NSResponder")]
1091impl NSView {
1092    extern_methods!(
1093        #[unsafe(method(init))]
1094        #[unsafe(method_family = init)]
1095        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1096    );
1097}
1098
1099/// Methods declared on superclass `NSObject`.
1100#[cfg(feature = "NSResponder")]
1101impl NSView {
1102    extern_methods!(
1103        #[unsafe(method(new))]
1104        #[unsafe(method_family = new)]
1105        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
1106    );
1107}
1108
1109extern_protocol!(
1110    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsviewlayercontentscaledelegate?language=objc)
1111    pub unsafe trait NSViewLayerContentScaleDelegate: NSObjectProtocol {
1112        #[cfg(all(
1113            feature = "NSResponder",
1114            feature = "NSWindow",
1115            feature = "objc2-core-foundation",
1116            feature = "objc2-quartz-core"
1117        ))]
1118        #[cfg(target_vendor = "apple")]
1119        #[optional]
1120        #[unsafe(method(layer:shouldInheritContentsScale:fromWindow:))]
1121        #[unsafe(method_family = none)]
1122        unsafe fn layer_shouldInheritContentsScale_fromWindow(
1123            &self,
1124            layer: &CALayer,
1125            new_scale: CGFloat,
1126            window: &NSWindow,
1127        ) -> bool;
1128    }
1129);
1130
1131extern_protocol!(
1132    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsviewtooltipowner?language=objc)
1133    pub unsafe trait NSViewToolTipOwner: NSObjectProtocol + MainThreadOnly {
1134        #[cfg(feature = "NSResponder")]
1135        #[unsafe(method(view:stringForToolTip:point:userData:))]
1136        #[unsafe(method_family = none)]
1137        unsafe fn view_stringForToolTip_point_userData(
1138            &self,
1139            view: &NSView,
1140            tag: NSToolTipTag,
1141            point: NSPoint,
1142            data: *mut c_void,
1143        ) -> Retained<NSString>;
1144    }
1145);
1146
1147extern_protocol!(
1148    /// A protocol to request information from NSView subclasses about the selected content in the view.
1149    ///
1150    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsviewcontentselectioninfo?language=objc)
1151    pub unsafe trait NSViewContentSelectionInfo: NSObjectProtocol {
1152        #[optional]
1153        #[unsafe(method(selectionAnchorRect))]
1154        #[unsafe(method_family = none)]
1155        unsafe fn selectionAnchorRect(&self) -> NSRect;
1156    }
1157);
1158
1159/// NSKeyboardUI.
1160#[cfg(feature = "NSResponder")]
1161impl NSView {
1162    extern_methods!(
1163        #[unsafe(method(nextKeyView))]
1164        #[unsafe(method_family = none)]
1165        pub unsafe fn nextKeyView(&self) -> Option<Retained<NSView>>;
1166
1167        /// Setter for [`nextKeyView`][Self::nextKeyView].
1168        #[unsafe(method(setNextKeyView:))]
1169        #[unsafe(method_family = none)]
1170        pub unsafe fn setNextKeyView(&self, next_key_view: Option<&NSView>);
1171
1172        #[unsafe(method(previousKeyView))]
1173        #[unsafe(method_family = none)]
1174        pub unsafe fn previousKeyView(&self) -> Option<Retained<NSView>>;
1175
1176        #[unsafe(method(nextValidKeyView))]
1177        #[unsafe(method_family = none)]
1178        pub unsafe fn nextValidKeyView(&self) -> Option<Retained<NSView>>;
1179
1180        #[unsafe(method(previousValidKeyView))]
1181        #[unsafe(method_family = none)]
1182        pub unsafe fn previousValidKeyView(&self) -> Option<Retained<NSView>>;
1183
1184        #[unsafe(method(canBecomeKeyView))]
1185        #[unsafe(method_family = none)]
1186        pub unsafe fn canBecomeKeyView(&self) -> bool;
1187
1188        #[unsafe(method(setKeyboardFocusRingNeedsDisplayInRect:))]
1189        #[unsafe(method_family = none)]
1190        pub unsafe fn setKeyboardFocusRingNeedsDisplayInRect(&self, rect: NSRect);
1191
1192        #[cfg(feature = "NSGraphics")]
1193        #[unsafe(method(focusRingType))]
1194        #[unsafe(method_family = none)]
1195        pub unsafe fn focusRingType(&self) -> NSFocusRingType;
1196
1197        #[cfg(feature = "NSGraphics")]
1198        /// Setter for [`focusRingType`][Self::focusRingType].
1199        #[unsafe(method(setFocusRingType:))]
1200        #[unsafe(method_family = none)]
1201        pub unsafe fn setFocusRingType(&self, focus_ring_type: NSFocusRingType);
1202
1203        #[cfg(feature = "NSGraphics")]
1204        #[unsafe(method(defaultFocusRingType))]
1205        #[unsafe(method_family = none)]
1206        pub unsafe fn defaultFocusRingType(mtm: MainThreadMarker) -> NSFocusRingType;
1207
1208        #[unsafe(method(drawFocusRingMask))]
1209        #[unsafe(method_family = none)]
1210        pub unsafe fn drawFocusRingMask(&self);
1211
1212        #[unsafe(method(focusRingMaskBounds))]
1213        #[unsafe(method_family = none)]
1214        pub unsafe fn focusRingMaskBounds(&self) -> NSRect;
1215
1216        #[unsafe(method(noteFocusRingMaskChanged))]
1217        #[unsafe(method_family = none)]
1218        pub unsafe fn noteFocusRingMaskChanged(&self);
1219    );
1220}
1221
1222/// NSPrinting.
1223#[cfg(feature = "NSResponder")]
1224impl NSView {
1225    extern_methods!(
1226        #[cfg(feature = "NSPasteboard")]
1227        #[unsafe(method(writeEPSInsideRect:toPasteboard:))]
1228        #[unsafe(method_family = none)]
1229        pub unsafe fn writeEPSInsideRect_toPasteboard(
1230            &self,
1231            rect: NSRect,
1232            pasteboard: &NSPasteboard,
1233        );
1234
1235        #[unsafe(method(dataWithEPSInsideRect:))]
1236        #[unsafe(method_family = none)]
1237        pub unsafe fn dataWithEPSInsideRect(&self, rect: NSRect) -> Retained<NSData>;
1238
1239        #[cfg(feature = "NSPasteboard")]
1240        #[unsafe(method(writePDFInsideRect:toPasteboard:))]
1241        #[unsafe(method_family = none)]
1242        pub unsafe fn writePDFInsideRect_toPasteboard(
1243            &self,
1244            rect: NSRect,
1245            pasteboard: &NSPasteboard,
1246        );
1247
1248        #[unsafe(method(dataWithPDFInsideRect:))]
1249        #[unsafe(method_family = none)]
1250        pub unsafe fn dataWithPDFInsideRect(&self, rect: NSRect) -> Retained<NSData>;
1251
1252        #[unsafe(method(print:))]
1253        #[unsafe(method_family = none)]
1254        pub unsafe fn print(&self, sender: Option<&AnyObject>);
1255
1256        #[unsafe(method(knowsPageRange:))]
1257        #[unsafe(method_family = none)]
1258        pub unsafe fn knowsPageRange(&self, range: NSRangePointer) -> bool;
1259
1260        #[cfg(feature = "objc2-core-foundation")]
1261        #[unsafe(method(heightAdjustLimit))]
1262        #[unsafe(method_family = none)]
1263        pub unsafe fn heightAdjustLimit(&self) -> CGFloat;
1264
1265        #[cfg(feature = "objc2-core-foundation")]
1266        #[unsafe(method(widthAdjustLimit))]
1267        #[unsafe(method_family = none)]
1268        pub unsafe fn widthAdjustLimit(&self) -> CGFloat;
1269
1270        #[cfg(feature = "objc2-core-foundation")]
1271        #[unsafe(method(adjustPageWidthNew:left:right:limit:))]
1272        #[unsafe(method_family = none)]
1273        pub unsafe fn adjustPageWidthNew_left_right_limit(
1274            &self,
1275            new_right: NonNull<CGFloat>,
1276            old_left: CGFloat,
1277            old_right: CGFloat,
1278            right_limit: CGFloat,
1279        );
1280
1281        #[cfg(feature = "objc2-core-foundation")]
1282        #[unsafe(method(adjustPageHeightNew:top:bottom:limit:))]
1283        #[unsafe(method_family = none)]
1284        pub unsafe fn adjustPageHeightNew_top_bottom_limit(
1285            &self,
1286            new_bottom: NonNull<CGFloat>,
1287            old_top: CGFloat,
1288            old_bottom: CGFloat,
1289            bottom_limit: CGFloat,
1290        );
1291
1292        #[unsafe(method(rectForPage:))]
1293        #[unsafe(method_family = none)]
1294        pub unsafe fn rectForPage(&self, page: NSInteger) -> NSRect;
1295
1296        #[unsafe(method(locationOfPrintRect:))]
1297        #[unsafe(method_family = none)]
1298        pub unsafe fn locationOfPrintRect(&self, rect: NSRect) -> NSPoint;
1299
1300        #[unsafe(method(drawPageBorderWithSize:))]
1301        #[unsafe(method_family = none)]
1302        pub unsafe fn drawPageBorderWithSize(&self, border_size: NSSize);
1303
1304        #[unsafe(method(pageHeader))]
1305        #[unsafe(method_family = none)]
1306        pub unsafe fn pageHeader(&self) -> Retained<NSAttributedString>;
1307
1308        #[unsafe(method(pageFooter))]
1309        #[unsafe(method_family = none)]
1310        pub unsafe fn pageFooter(&self) -> Retained<NSAttributedString>;
1311
1312        /// * This method is obsolete.  It will never be invoked from within AppKit, and NSView's implementation of it does nothing. **
1313        #[deprecated = "This is never invoked and the NSView implementation does nothing"]
1314        #[unsafe(method(drawSheetBorderWithSize:))]
1315        #[unsafe(method_family = none)]
1316        pub unsafe fn drawSheetBorderWithSize(&self, border_size: NSSize);
1317
1318        #[unsafe(method(printJobTitle))]
1319        #[unsafe(method_family = none)]
1320        pub unsafe fn printJobTitle(&self) -> Retained<NSString>;
1321
1322        #[unsafe(method(beginDocument))]
1323        #[unsafe(method_family = none)]
1324        pub unsafe fn beginDocument(&self);
1325
1326        #[unsafe(method(endDocument))]
1327        #[unsafe(method_family = none)]
1328        pub unsafe fn endDocument(&self);
1329
1330        #[unsafe(method(beginPageInRect:atPlacement:))]
1331        #[unsafe(method_family = none)]
1332        pub unsafe fn beginPageInRect_atPlacement(&self, rect: NSRect, location: NSPoint);
1333
1334        #[unsafe(method(endPage))]
1335        #[unsafe(method_family = none)]
1336        pub unsafe fn endPage(&self);
1337    );
1338}
1339
1340/// NSDrag.
1341#[cfg(feature = "NSResponder")]
1342impl NSView {
1343    extern_methods!(
1344        #[cfg(all(
1345            feature = "NSDragging",
1346            feature = "NSDraggingItem",
1347            feature = "NSDraggingSession",
1348            feature = "NSEvent"
1349        ))]
1350        #[unsafe(method(beginDraggingSessionWithItems:event:source:))]
1351        #[unsafe(method_family = none)]
1352        pub unsafe fn beginDraggingSessionWithItems_event_source(
1353            &self,
1354            items: &NSArray<NSDraggingItem>,
1355            event: &NSEvent,
1356            source: &ProtocolObject<dyn NSDraggingSource>,
1357        ) -> Retained<NSDraggingSession>;
1358
1359        #[cfg(feature = "NSPasteboard")]
1360        #[unsafe(method(registeredDraggedTypes))]
1361        #[unsafe(method_family = none)]
1362        pub unsafe fn registeredDraggedTypes(&self) -> Retained<NSArray<NSPasteboardType>>;
1363
1364        #[cfg(feature = "NSPasteboard")]
1365        #[unsafe(method(registerForDraggedTypes:))]
1366        #[unsafe(method_family = none)]
1367        pub unsafe fn registerForDraggedTypes(&self, new_types: &NSArray<NSPasteboardType>);
1368
1369        #[unsafe(method(unregisterDraggedTypes))]
1370        #[unsafe(method_family = none)]
1371        pub unsafe fn unregisterDraggedTypes(&self);
1372    );
1373}
1374
1375/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsviewfullscreenmodeoptionkey?language=objc)
1376// NS_TYPED_ENUM
1377pub type NSViewFullScreenModeOptionKey = NSString;
1378
1379extern "C" {
1380    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfullscreenmodeallscreens?language=objc)
1381    pub static NSFullScreenModeAllScreens: &'static NSViewFullScreenModeOptionKey;
1382}
1383
1384extern "C" {
1385    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfullscreenmodesetting?language=objc)
1386    pub static NSFullScreenModeSetting: &'static NSViewFullScreenModeOptionKey;
1387}
1388
1389extern "C" {
1390    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfullscreenmodewindowlevel?language=objc)
1391    pub static NSFullScreenModeWindowLevel: &'static NSViewFullScreenModeOptionKey;
1392}
1393
1394extern "C" {
1395    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfullscreenmodeapplicationpresentationoptions?language=objc)
1396    pub static NSFullScreenModeApplicationPresentationOptions:
1397        &'static NSViewFullScreenModeOptionKey;
1398}
1399
1400/// NSFullScreenMode.
1401#[cfg(feature = "NSResponder")]
1402impl NSView {
1403    extern_methods!(
1404        #[cfg(feature = "NSScreen")]
1405        #[unsafe(method(enterFullScreenMode:withOptions:))]
1406        #[unsafe(method_family = none)]
1407        pub unsafe fn enterFullScreenMode_withOptions(
1408            &self,
1409            screen: &NSScreen,
1410            options: Option<&NSDictionary<NSViewFullScreenModeOptionKey, AnyObject>>,
1411        ) -> bool;
1412
1413        #[unsafe(method(exitFullScreenModeWithOptions:))]
1414        #[unsafe(method_family = none)]
1415        pub unsafe fn exitFullScreenModeWithOptions(
1416            &self,
1417            options: Option<&NSDictionary<NSViewFullScreenModeOptionKey, AnyObject>>,
1418        );
1419
1420        #[unsafe(method(isInFullScreenMode))]
1421        #[unsafe(method_family = none)]
1422        pub unsafe fn isInFullScreenMode(&self) -> bool;
1423    );
1424}
1425
1426/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdefinitionoptionkey?language=objc)
1427// NS_TYPED_ENUM
1428pub type NSDefinitionOptionKey = NSString;
1429
1430extern "C" {
1431    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdefinitionpresentationtypekey?language=objc)
1432    pub static NSDefinitionPresentationTypeKey: &'static NSDefinitionOptionKey;
1433}
1434
1435/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdefinitionpresentationtype?language=objc)
1436// NS_TYPED_ENUM
1437pub type NSDefinitionPresentationType = NSString;
1438
1439extern "C" {
1440    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdefinitionpresentationtypeoverlay?language=objc)
1441    pub static NSDefinitionPresentationTypeOverlay: &'static NSDefinitionPresentationType;
1442}
1443
1444extern "C" {
1445    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdefinitionpresentationtypedictionaryapplication?language=objc)
1446    pub static NSDefinitionPresentationTypeDictionaryApplication:
1447        &'static NSDefinitionPresentationType;
1448}
1449
1450/// NSDefinition.
1451#[cfg(feature = "NSResponder")]
1452impl NSView {
1453    extern_methods!(
1454        #[unsafe(method(showDefinitionForAttributedString:atPoint:))]
1455        #[unsafe(method_family = none)]
1456        pub unsafe fn showDefinitionForAttributedString_atPoint(
1457            &self,
1458            attr_string: Option<&NSAttributedString>,
1459            text_baseline_origin: NSPoint,
1460        );
1461
1462        #[cfg(feature = "block2")]
1463        #[unsafe(method(showDefinitionForAttributedString:range:options:baselineOriginProvider:))]
1464        #[unsafe(method_family = none)]
1465        pub unsafe fn showDefinitionForAttributedString_range_options_baselineOriginProvider(
1466            &self,
1467            attr_string: Option<&NSAttributedString>,
1468            target_range: NSRange,
1469            options: Option<&NSDictionary<NSDefinitionOptionKey, AnyObject>>,
1470            origin_provider: Option<&block2::DynBlock<dyn Fn(NSRange) -> NSPoint>>,
1471        );
1472    );
1473}
1474
1475/// NSFindIndicator.
1476#[cfg(feature = "NSResponder")]
1477impl NSView {
1478    extern_methods!(
1479        #[unsafe(method(isDrawingFindIndicator))]
1480        #[unsafe(method_family = none)]
1481        pub unsafe fn isDrawingFindIndicator(&self) -> bool;
1482    );
1483}
1484
1485/// NSGestureRecognizer.
1486#[cfg(feature = "NSResponder")]
1487impl NSView {
1488    extern_methods!(
1489        #[cfg(feature = "NSGestureRecognizer")]
1490        #[unsafe(method(gestureRecognizers))]
1491        #[unsafe(method_family = none)]
1492        pub unsafe fn gestureRecognizers(&self) -> Retained<NSArray<NSGestureRecognizer>>;
1493
1494        #[cfg(feature = "NSGestureRecognizer")]
1495        /// Setter for [`gestureRecognizers`][Self::gestureRecognizers].
1496        #[unsafe(method(setGestureRecognizers:))]
1497        #[unsafe(method_family = none)]
1498        pub unsafe fn setGestureRecognizers(
1499            &self,
1500            gesture_recognizers: &NSArray<NSGestureRecognizer>,
1501        );
1502
1503        #[cfg(feature = "NSGestureRecognizer")]
1504        #[unsafe(method(addGestureRecognizer:))]
1505        #[unsafe(method_family = none)]
1506        pub unsafe fn addGestureRecognizer(&self, gesture_recognizer: &NSGestureRecognizer);
1507
1508        #[cfg(feature = "NSGestureRecognizer")]
1509        #[unsafe(method(removeGestureRecognizer:))]
1510        #[unsafe(method_family = none)]
1511        pub unsafe fn removeGestureRecognizer(&self, gesture_recognizer: &NSGestureRecognizer);
1512    );
1513}
1514
1515/// NSTouchBar.
1516#[cfg(feature = "NSResponder")]
1517impl NSView {
1518    extern_methods!(
1519        #[cfg(feature = "NSTouch")]
1520        #[unsafe(method(allowedTouchTypes))]
1521        #[unsafe(method_family = none)]
1522        pub unsafe fn allowedTouchTypes(&self) -> NSTouchTypeMask;
1523
1524        #[cfg(feature = "NSTouch")]
1525        /// Setter for [`allowedTouchTypes`][Self::allowedTouchTypes].
1526        #[unsafe(method(setAllowedTouchTypes:))]
1527        #[unsafe(method_family = none)]
1528        pub unsafe fn setAllowedTouchTypes(&self, allowed_touch_types: NSTouchTypeMask);
1529    );
1530}
1531
1532/// NSSafeAreas.
1533#[cfg(feature = "NSResponder")]
1534impl NSView {
1535    extern_methods!(
1536        #[unsafe(method(safeAreaInsets))]
1537        #[unsafe(method_family = none)]
1538        pub unsafe fn safeAreaInsets(&self) -> NSEdgeInsets;
1539
1540        #[unsafe(method(additionalSafeAreaInsets))]
1541        #[unsafe(method_family = none)]
1542        pub unsafe fn additionalSafeAreaInsets(&self) -> NSEdgeInsets;
1543
1544        /// Setter for [`additionalSafeAreaInsets`][Self::additionalSafeAreaInsets].
1545        #[unsafe(method(setAdditionalSafeAreaInsets:))]
1546        #[unsafe(method_family = none)]
1547        pub unsafe fn setAdditionalSafeAreaInsets(&self, additional_safe_area_insets: NSEdgeInsets);
1548
1549        #[cfg(feature = "NSLayoutGuide")]
1550        #[unsafe(method(safeAreaLayoutGuide))]
1551        #[unsafe(method_family = none)]
1552        pub unsafe fn safeAreaLayoutGuide(&self) -> Retained<NSLayoutGuide>;
1553
1554        #[unsafe(method(safeAreaRect))]
1555        #[unsafe(method_family = none)]
1556        pub unsafe fn safeAreaRect(&self) -> NSRect;
1557
1558        #[cfg(feature = "NSLayoutGuide")]
1559        #[unsafe(method(layoutMarginsGuide))]
1560        #[unsafe(method_family = none)]
1561        pub unsafe fn layoutMarginsGuide(&self) -> Retained<NSLayoutGuide>;
1562    );
1563}
1564
1565/// NSTrackingArea.
1566#[cfg(feature = "NSResponder")]
1567impl NSView {
1568    extern_methods!(
1569        #[cfg(feature = "NSTrackingArea")]
1570        #[unsafe(method(addTrackingArea:))]
1571        #[unsafe(method_family = none)]
1572        pub unsafe fn addTrackingArea(&self, tracking_area: &NSTrackingArea);
1573
1574        #[cfg(feature = "NSTrackingArea")]
1575        #[unsafe(method(removeTrackingArea:))]
1576        #[unsafe(method_family = none)]
1577        pub unsafe fn removeTrackingArea(&self, tracking_area: &NSTrackingArea);
1578
1579        #[cfg(feature = "NSTrackingArea")]
1580        #[unsafe(method(trackingAreas))]
1581        #[unsafe(method_family = none)]
1582        pub unsafe fn trackingAreas(&self) -> Retained<NSArray<NSTrackingArea>>;
1583
1584        #[unsafe(method(updateTrackingAreas))]
1585        #[unsafe(method_family = none)]
1586        pub unsafe fn updateTrackingAreas(&self);
1587
1588        #[cfg(feature = "NSCursor")]
1589        #[unsafe(method(addCursorRect:cursor:))]
1590        #[unsafe(method_family = none)]
1591        pub fn addCursorRect_cursor(&self, rect: NSRect, object: &NSCursor);
1592
1593        #[cfg(feature = "NSCursor")]
1594        #[unsafe(method(removeCursorRect:cursor:))]
1595        #[unsafe(method_family = none)]
1596        pub unsafe fn removeCursorRect_cursor(&self, rect: NSRect, object: &NSCursor);
1597
1598        #[unsafe(method(discardCursorRects))]
1599        #[unsafe(method_family = none)]
1600        pub unsafe fn discardCursorRects(&self);
1601
1602        #[unsafe(method(resetCursorRects))]
1603        #[unsafe(method_family = none)]
1604        pub unsafe fn resetCursorRects(&self);
1605
1606        #[unsafe(method(addTrackingRect:owner:userData:assumeInside:))]
1607        #[unsafe(method_family = none)]
1608        pub unsafe fn addTrackingRect_owner_userData_assumeInside(
1609            &self,
1610            rect: NSRect,
1611            owner: &AnyObject,
1612            data: *mut c_void,
1613            flag: bool,
1614        ) -> NSTrackingRectTag;
1615
1616        #[unsafe(method(removeTrackingRect:))]
1617        #[unsafe(method_family = none)]
1618        pub fn removeTrackingRect(&self, tag: NSTrackingRectTag);
1619    );
1620}
1621
1622/// NSDisplayLink.
1623#[cfg(feature = "NSResponder")]
1624impl NSView {
1625    extern_methods!(
1626        #[cfg(feature = "objc2-quartz-core")]
1627        #[cfg(target_vendor = "apple")]
1628        #[unsafe(method(displayLinkWithTarget:selector:))]
1629        #[unsafe(method_family = none)]
1630        pub unsafe fn displayLinkWithTarget_selector(
1631            &self,
1632            target: &AnyObject,
1633            selector: Sel,
1634        ) -> Retained<CADisplayLink>;
1635    );
1636}
1637
1638/// NSDeprecated.
1639#[cfg(feature = "NSResponder")]
1640impl NSView {
1641    extern_methods!(
1642        #[cfg(all(feature = "NSEvent", feature = "NSImage", feature = "NSPasteboard"))]
1643        #[deprecated = "Use -beginDraggingSessionWithItems:event:source: instead"]
1644        #[unsafe(method(dragImage:at:offset:event:pasteboard:source:slideBack:))]
1645        #[unsafe(method_family = none)]
1646        pub unsafe fn dragImage_at_offset_event_pasteboard_source_slideBack(
1647            &self,
1648            image: &NSImage,
1649            view_location: NSPoint,
1650            initial_offset: NSSize,
1651            event: &NSEvent,
1652            pboard: &NSPasteboard,
1653            source_obj: &AnyObject,
1654            slide_flag: bool,
1655        );
1656
1657        #[cfg(feature = "NSEvent")]
1658        #[deprecated = "Use -beginDraggingSessionWithItems:event:source: instead"]
1659        #[unsafe(method(dragFile:fromRect:slideBack:event:))]
1660        #[unsafe(method_family = none)]
1661        pub unsafe fn dragFile_fromRect_slideBack_event(
1662            &self,
1663            filename: &NSString,
1664            rect: NSRect,
1665            flag: bool,
1666            event: &NSEvent,
1667        ) -> bool;
1668
1669        #[cfg(feature = "NSEvent")]
1670        #[deprecated = "Use -beginDraggingSessionWithItems:event:source: with an NSFilePromiseProvider instead"]
1671        #[unsafe(method(dragPromisedFilesOfTypes:fromRect:source:slideBack:event:))]
1672        #[unsafe(method_family = none)]
1673        pub unsafe fn dragPromisedFilesOfTypes_fromRect_source_slideBack_event(
1674            &self,
1675            type_array: &NSArray<NSString>,
1676            rect: NSRect,
1677            source_object: &AnyObject,
1678            flag: bool,
1679            event: &NSEvent,
1680        ) -> bool;
1681
1682        #[deprecated]
1683        #[unsafe(method(convertPointToBase:))]
1684        #[unsafe(method_family = none)]
1685        pub unsafe fn convertPointToBase(&self, point: NSPoint) -> NSPoint;
1686
1687        #[deprecated]
1688        #[unsafe(method(convertPointFromBase:))]
1689        #[unsafe(method_family = none)]
1690        pub unsafe fn convertPointFromBase(&self, point: NSPoint) -> NSPoint;
1691
1692        #[deprecated]
1693        #[unsafe(method(convertSizeToBase:))]
1694        #[unsafe(method_family = none)]
1695        pub unsafe fn convertSizeToBase(&self, size: NSSize) -> NSSize;
1696
1697        #[deprecated]
1698        #[unsafe(method(convertSizeFromBase:))]
1699        #[unsafe(method_family = none)]
1700        pub unsafe fn convertSizeFromBase(&self, size: NSSize) -> NSSize;
1701
1702        #[deprecated]
1703        #[unsafe(method(convertRectToBase:))]
1704        #[unsafe(method_family = none)]
1705        pub unsafe fn convertRectToBase(&self, rect: NSRect) -> NSRect;
1706
1707        #[deprecated]
1708        #[unsafe(method(convertRectFromBase:))]
1709        #[unsafe(method_family = none)]
1710        pub unsafe fn convertRectFromBase(&self, rect: NSRect) -> NSRect;
1711
1712        #[deprecated = "This has always returned NO and had no effect on macOS"]
1713        #[unsafe(method(performMnemonic:))]
1714        #[unsafe(method_family = none)]
1715        pub unsafe fn performMnemonic(&self, string: &NSString) -> bool;
1716
1717        #[deprecated = "This method no longer does anything"]
1718        #[unsafe(method(shouldDrawColor))]
1719        #[unsafe(method_family = none)]
1720        pub unsafe fn shouldDrawColor(&self) -> bool;
1721
1722        #[deprecated]
1723        #[unsafe(method(gState))]
1724        #[unsafe(method_family = none)]
1725        pub unsafe fn gState(&self) -> NSInteger;
1726
1727        #[deprecated]
1728        #[unsafe(method(allocateGState))]
1729        #[unsafe(method_family = none)]
1730        pub unsafe fn allocateGState(&self);
1731
1732        #[deprecated]
1733        #[unsafe(method(setUpGState))]
1734        #[unsafe(method_family = none)]
1735        pub unsafe fn setUpGState(&self);
1736
1737        #[deprecated]
1738        #[unsafe(method(renewGState))]
1739        #[unsafe(method_family = none)]
1740        pub unsafe fn renewGState(&self);
1741    );
1742}
1743
1744/// NSWritingToolsCoordinator.
1745#[cfg(feature = "NSResponder")]
1746impl NSView {
1747    extern_methods!(
1748        #[cfg(feature = "NSWritingToolsCoordinator")]
1749        #[unsafe(method(writingToolsCoordinator))]
1750        #[unsafe(method_family = none)]
1751        pub unsafe fn writingToolsCoordinator(&self)
1752            -> Option<Retained<NSWritingToolsCoordinator>>;
1753
1754        #[cfg(feature = "NSWritingToolsCoordinator")]
1755        /// Setter for [`writingToolsCoordinator`][Self::writingToolsCoordinator].
1756        #[unsafe(method(setWritingToolsCoordinator:))]
1757        #[unsafe(method_family = none)]
1758        pub unsafe fn setWritingToolsCoordinator(
1759            &self,
1760            writing_tools_coordinator: Option<&NSWritingToolsCoordinator>,
1761        );
1762    );
1763}
1764
1765extern "C" {
1766    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsviewframedidchangenotification?language=objc)
1767    pub static NSViewFrameDidChangeNotification: &'static NSNotificationName;
1768}
1769
1770extern "C" {
1771    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsviewfocusdidchangenotification?language=objc)
1772    pub static NSViewFocusDidChangeNotification: &'static NSNotificationName;
1773}
1774
1775extern "C" {
1776    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsviewboundsdidchangenotification?language=objc)
1777    pub static NSViewBoundsDidChangeNotification: &'static NSNotificationName;
1778}
1779
1780extern "C" {
1781    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsviewglobalframedidchangenotification?language=objc)
1782    pub static NSViewGlobalFrameDidChangeNotification: &'static NSNotificationName;
1783}
1784
1785extern "C" {
1786    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsviewdidupdatetrackingareasnotification?language=objc)
1787    pub static NSViewDidUpdateTrackingAreasNotification: &'static NSNotificationName;
1788}