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
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSTrackingAreaOptions(pub NSUInteger);
impl NSTrackingAreaOptions {
    pub const NSTrackingMouseEnteredAndExited: Self = Self(0x01);
    pub const NSTrackingMouseMoved: Self = Self(0x02);
    pub const NSTrackingCursorUpdate: Self = Self(0x04);
    pub const NSTrackingActiveWhenFirstResponder: Self = Self(0x10);
    pub const NSTrackingActiveInKeyWindow: Self = Self(0x20);
    pub const NSTrackingActiveInActiveApp: Self = Self(0x40);
    pub const NSTrackingActiveAlways: Self = Self(0x80);
    pub const NSTrackingAssumeInside: Self = Self(0x100);
    pub const NSTrackingInVisibleRect: Self = Self(0x200);
    pub const NSTrackingEnabledDuringMouseDrag: Self = Self(0x400);
}

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

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

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSTrackingArea;

    unsafe impl ClassType for NSTrackingArea {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl NSCoding for NSTrackingArea {}

unsafe impl NSCopying for NSTrackingArea {}

unsafe impl NSObjectProtocol for NSTrackingArea {}

extern_methods!(
    unsafe impl NSTrackingArea {
        #[method_id(@__retain_semantics Init initWithRect:options:owner:userInfo:)]
        pub unsafe fn initWithRect_options_owner_userInfo(
            this: Allocated<Self>,
            rect: NSRect,
            options: NSTrackingAreaOptions,
            owner: Option<&AnyObject>,
            user_info: Option<&NSDictionary<AnyObject, AnyObject>>,
        ) -> Id<Self>;

        #[method(rect)]
        pub unsafe fn rect(&self) -> NSRect;

        #[method(options)]
        pub unsafe fn options(&self) -> NSTrackingAreaOptions;

        #[method_id(@__retain_semantics Other owner)]
        pub unsafe fn owner(&self) -> Option<Id<AnyObject>>;

        #[method_id(@__retain_semantics Other userInfo)]
        pub unsafe fn userInfo(&self) -> Option<Id<NSDictionary<AnyObject, AnyObject>>>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl NSTrackingArea {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Id<Self>;
    }
);