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
54unsafe impl NSCoding for NSTrackingArea {}
55
56unsafe impl NSCopying for NSTrackingArea {}
57
58unsafe impl CopyingHelper for NSTrackingArea {
59    type Result = Self;
60}
61
62unsafe impl NSObjectProtocol for NSTrackingArea {}
63
64impl NSTrackingArea {
65    extern_methods!(
66        #[unsafe(method(initWithRect:options:owner:userInfo:))]
67        #[unsafe(method_family = init)]
68        pub unsafe fn initWithRect_options_owner_userInfo(
69            this: Allocated<Self>,
70            rect: NSRect,
71            options: NSTrackingAreaOptions,
72            owner: Option<&AnyObject>,
73            user_info: Option<&NSDictionary<AnyObject, AnyObject>>,
74        ) -> Retained<Self>;
75
76        #[unsafe(method(rect))]
77        #[unsafe(method_family = none)]
78        pub unsafe fn rect(&self) -> NSRect;
79
80        #[unsafe(method(options))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn options(&self) -> NSTrackingAreaOptions;
83
84        #[unsafe(method(owner))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn owner(&self) -> Option<Retained<AnyObject>>;
87
88        #[unsafe(method(userInfo))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn userInfo(&self) -> Option<Retained<NSDictionary<AnyObject, AnyObject>>>;
91    );
92}
93
94/// Methods declared on superclass `NSObject`.
95impl NSTrackingArea {
96    extern_methods!(
97        #[unsafe(method(init))]
98        #[unsafe(method_family = init)]
99        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
100
101        #[unsafe(method(new))]
102        #[unsafe(method_family = new)]
103        pub unsafe fn new() -> Retained<Self>;
104    );
105}