objc2_app_kit/generated/
NSTrackingArea.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstrackingareaoptions?language=objc)
10// NS_OPTIONS
11#[repr(transparent)]
12#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
13pub struct NSTrackingAreaOptions(pub NSUInteger);
14bitflags::bitflags! {
15    impl NSTrackingAreaOptions: NSUInteger {
16        #[doc(alias = "NSTrackingMouseEnteredAndExited")]
17        const MouseEnteredAndExited = 0x01;
18        #[doc(alias = "NSTrackingMouseMoved")]
19        const MouseMoved = 0x02;
20        #[doc(alias = "NSTrackingCursorUpdate")]
21        const CursorUpdate = 0x04;
22        #[doc(alias = "NSTrackingActiveWhenFirstResponder")]
23        const ActiveWhenFirstResponder = 0x10;
24        #[doc(alias = "NSTrackingActiveInKeyWindow")]
25        const ActiveInKeyWindow = 0x20;
26        #[doc(alias = "NSTrackingActiveInActiveApp")]
27        const ActiveInActiveApp = 0x40;
28        #[doc(alias = "NSTrackingActiveAlways")]
29        const ActiveAlways = 0x80;
30        #[doc(alias = "NSTrackingAssumeInside")]
31        const AssumeInside = 0x100;
32        #[doc(alias = "NSTrackingInVisibleRect")]
33        const InVisibleRect = 0x200;
34        #[doc(alias = "NSTrackingEnabledDuringMouseDrag")]
35        const EnabledDuringMouseDrag = 0x400;
36    }
37}
38
39unsafe impl Encode for NSTrackingAreaOptions {
40    const ENCODING: Encoding = NSUInteger::ENCODING;
41}
42
43unsafe impl RefEncode for NSTrackingAreaOptions {
44    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
45}
46
47extern_class!(
48    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstrackingarea?language=objc)
49    #[unsafe(super(NSObject))]
50    #[derive(Debug, PartialEq, Eq, Hash)]
51    pub struct NSTrackingArea;
52);
53
54extern_conformance!(
55    unsafe impl NSCoding for NSTrackingArea {}
56);
57
58extern_conformance!(
59    unsafe impl NSCopying for NSTrackingArea {}
60);
61
62unsafe impl CopyingHelper for NSTrackingArea {
63    type Result = Self;
64}
65
66extern_conformance!(
67    unsafe impl NSObjectProtocol for NSTrackingArea {}
68);
69
70impl NSTrackingArea {
71    extern_methods!(
72        /// # Safety
73        ///
74        /// - `owner` should be of the correct type.
75        /// - `user_info` generic should be of the correct type.
76        /// - `user_info` generic should be of the correct type.
77        #[unsafe(method(initWithRect:options:owner:userInfo:))]
78        #[unsafe(method_family = init)]
79        pub unsafe fn initWithRect_options_owner_userInfo(
80            this: Allocated<Self>,
81            rect: NSRect,
82            options: NSTrackingAreaOptions,
83            owner: Option<&AnyObject>,
84            user_info: Option<&NSDictionary<AnyObject, AnyObject>>,
85        ) -> Retained<Self>;
86
87        #[unsafe(method(rect))]
88        #[unsafe(method_family = none)]
89        pub fn rect(&self) -> NSRect;
90
91        #[unsafe(method(options))]
92        #[unsafe(method_family = none)]
93        pub fn options(&self) -> NSTrackingAreaOptions;
94
95        #[unsafe(method(owner))]
96        #[unsafe(method_family = none)]
97        pub fn owner(&self) -> Option<Retained<AnyObject>>;
98
99        #[unsafe(method(userInfo))]
100        #[unsafe(method_family = none)]
101        pub fn userInfo(&self) -> Option<Retained<NSDictionary<AnyObject, AnyObject>>>;
102    );
103}
104
105/// Methods declared on superclass `NSObject`.
106impl NSTrackingArea {
107    extern_methods!(
108        #[unsafe(method(init))]
109        #[unsafe(method_family = init)]
110        pub fn init(this: Allocated<Self>) -> Retained<Self>;
111
112        #[unsafe(method(new))]
113        #[unsafe(method_family = new)]
114        pub fn new() -> Retained<Self>;
115    );
116}
117
118impl DefaultRetained for NSTrackingArea {
119    #[inline]
120    fn default_retained() -> Retained<Self> {
121        Self::new()
122    }
123}