objc2_app_kit/generated/
NSEvent.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-graphics")]
9#[cfg(target_vendor = "apple")]
10use objc2_core_graphics::*;
11use objc2_foundation::*;
12
13use crate::*;
14
15/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nseventtype?language=objc)
16// NS_ENUM
17#[repr(transparent)]
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
19pub struct NSEventType(pub NSUInteger);
20impl NSEventType {
21    #[doc(alias = "NSEventTypeLeftMouseDown")]
22    pub const LeftMouseDown: Self = Self(1);
23    #[doc(alias = "NSEventTypeLeftMouseUp")]
24    pub const LeftMouseUp: Self = Self(2);
25    #[doc(alias = "NSEventTypeRightMouseDown")]
26    pub const RightMouseDown: Self = Self(3);
27    #[doc(alias = "NSEventTypeRightMouseUp")]
28    pub const RightMouseUp: Self = Self(4);
29    #[doc(alias = "NSEventTypeMouseMoved")]
30    pub const MouseMoved: Self = Self(5);
31    #[doc(alias = "NSEventTypeLeftMouseDragged")]
32    pub const LeftMouseDragged: Self = Self(6);
33    #[doc(alias = "NSEventTypeRightMouseDragged")]
34    pub const RightMouseDragged: Self = Self(7);
35    #[doc(alias = "NSEventTypeMouseEntered")]
36    pub const MouseEntered: Self = Self(8);
37    #[doc(alias = "NSEventTypeMouseExited")]
38    pub const MouseExited: Self = Self(9);
39    #[doc(alias = "NSEventTypeKeyDown")]
40    pub const KeyDown: Self = Self(10);
41    #[doc(alias = "NSEventTypeKeyUp")]
42    pub const KeyUp: Self = Self(11);
43    #[doc(alias = "NSEventTypeFlagsChanged")]
44    pub const FlagsChanged: Self = Self(12);
45    #[doc(alias = "NSEventTypeAppKitDefined")]
46    pub const AppKitDefined: Self = Self(13);
47    #[doc(alias = "NSEventTypeSystemDefined")]
48    pub const SystemDefined: Self = Self(14);
49    #[doc(alias = "NSEventTypeApplicationDefined")]
50    pub const ApplicationDefined: Self = Self(15);
51    #[doc(alias = "NSEventTypePeriodic")]
52    pub const Periodic: Self = Self(16);
53    #[doc(alias = "NSEventTypeCursorUpdate")]
54    pub const CursorUpdate: Self = Self(17);
55    #[doc(alias = "NSEventTypeScrollWheel")]
56    pub const ScrollWheel: Self = Self(22);
57    #[doc(alias = "NSEventTypeTabletPoint")]
58    pub const TabletPoint: Self = Self(23);
59    #[doc(alias = "NSEventTypeTabletProximity")]
60    pub const TabletProximity: Self = Self(24);
61    #[doc(alias = "NSEventTypeOtherMouseDown")]
62    pub const OtherMouseDown: Self = Self(25);
63    #[doc(alias = "NSEventTypeOtherMouseUp")]
64    pub const OtherMouseUp: Self = Self(26);
65    #[doc(alias = "NSEventTypeOtherMouseDragged")]
66    pub const OtherMouseDragged: Self = Self(27);
67    #[doc(alias = "NSEventTypeGesture")]
68    pub const Gesture: Self = Self(29);
69    #[doc(alias = "NSEventTypeMagnify")]
70    pub const Magnify: Self = Self(30);
71    #[doc(alias = "NSEventTypeSwipe")]
72    pub const Swipe: Self = Self(31);
73    #[doc(alias = "NSEventTypeRotate")]
74    pub const Rotate: Self = Self(18);
75    #[doc(alias = "NSEventTypeBeginGesture")]
76    pub const BeginGesture: Self = Self(19);
77    #[doc(alias = "NSEventTypeEndGesture")]
78    pub const EndGesture: Self = Self(20);
79    #[doc(alias = "NSEventTypeSmartMagnify")]
80    pub const SmartMagnify: Self = Self(32);
81    #[doc(alias = "NSEventTypeQuickLook")]
82    pub const QuickLook: Self = Self(33);
83    #[doc(alias = "NSEventTypePressure")]
84    pub const Pressure: Self = Self(34);
85    #[doc(alias = "NSEventTypeDirectTouch")]
86    pub const DirectTouch: Self = Self(37);
87    #[doc(alias = "NSEventTypeChangeMode")]
88    pub const ChangeMode: Self = Self(38);
89}
90
91unsafe impl Encode for NSEventType {
92    const ENCODING: Encoding = NSUInteger::ENCODING;
93}
94
95unsafe impl RefEncode for NSEventType {
96    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
97}
98
99/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsleftmousedown?language=objc)
100pub static NSLeftMouseDown: NSEventType = NSEventType(NSEventType::LeftMouseDown.0);
101
102/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsleftmouseup?language=objc)
103pub static NSLeftMouseUp: NSEventType = NSEventType(NSEventType::LeftMouseUp.0);
104
105/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsrightmousedown?language=objc)
106pub static NSRightMouseDown: NSEventType = NSEventType(NSEventType::RightMouseDown.0);
107
108/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsrightmouseup?language=objc)
109pub static NSRightMouseUp: NSEventType = NSEventType(NSEventType::RightMouseUp.0);
110
111/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsmousemoved?language=objc)
112pub static NSMouseMoved: NSEventType = NSEventType(NSEventType::MouseMoved.0);
113
114/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsleftmousedragged?language=objc)
115pub static NSLeftMouseDragged: NSEventType = NSEventType(NSEventType::LeftMouseDragged.0);
116
117/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsrightmousedragged?language=objc)
118pub static NSRightMouseDragged: NSEventType = NSEventType(NSEventType::RightMouseDragged.0);
119
120/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsmouseentered?language=objc)
121pub static NSMouseEntered: NSEventType = NSEventType(NSEventType::MouseEntered.0);
122
123/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsmouseexited?language=objc)
124pub static NSMouseExited: NSEventType = NSEventType(NSEventType::MouseExited.0);
125
126/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nskeydown?language=objc)
127pub static NSKeyDown: NSEventType = NSEventType(NSEventType::KeyDown.0);
128
129/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nskeyup?language=objc)
130pub static NSKeyUp: NSEventType = NSEventType(NSEventType::KeyUp.0);
131
132/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsflagschanged?language=objc)
133pub static NSFlagsChanged: NSEventType = NSEventType(NSEventType::FlagsChanged.0);
134
135/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitdefined?language=objc)
136pub static NSAppKitDefined: NSEventType = NSEventType(NSEventType::AppKitDefined.0);
137
138/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssystemdefined?language=objc)
139pub static NSSystemDefined: NSEventType = NSEventType(NSEventType::SystemDefined.0);
140
141/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationdefined?language=objc)
142pub static NSApplicationDefined: NSEventType = NSEventType(NSEventType::ApplicationDefined.0);
143
144/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsperiodic?language=objc)
145pub static NSPeriodic: NSEventType = NSEventType(NSEventType::Periodic.0);
146
147/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscursorupdate?language=objc)
148pub static NSCursorUpdate: NSEventType = NSEventType(NSEventType::CursorUpdate.0);
149
150/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsscrollwheel?language=objc)
151pub static NSScrollWheel: NSEventType = NSEventType(NSEventType::ScrollWheel.0);
152
153/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstabletpoint?language=objc)
154pub static NSTabletPoint: NSEventType = NSEventType(NSEventType::TabletPoint.0);
155
156/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstabletproximity?language=objc)
157pub static NSTabletProximity: NSEventType = NSEventType(NSEventType::TabletProximity.0);
158
159/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsothermousedown?language=objc)
160pub static NSOtherMouseDown: NSEventType = NSEventType(NSEventType::OtherMouseDown.0);
161
162/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsothermouseup?language=objc)
163pub static NSOtherMouseUp: NSEventType = NSEventType(NSEventType::OtherMouseUp.0);
164
165/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsothermousedragged?language=objc)
166pub static NSOtherMouseDragged: NSEventType = NSEventType(NSEventType::OtherMouseDragged.0);
167
168/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nseventmask?language=objc)
169// NS_OPTIONS
170#[repr(transparent)]
171#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
172pub struct NSEventMask(pub c_ulonglong);
173bitflags::bitflags! {
174    impl NSEventMask: c_ulonglong {
175        #[doc(alias = "NSEventMaskLeftMouseDown")]
176        const LeftMouseDown = 1<<NSEventType::LeftMouseDown.0;
177        #[doc(alias = "NSEventMaskLeftMouseUp")]
178        const LeftMouseUp = 1<<NSEventType::LeftMouseUp.0;
179        #[doc(alias = "NSEventMaskRightMouseDown")]
180        const RightMouseDown = 1<<NSEventType::RightMouseDown.0;
181        #[doc(alias = "NSEventMaskRightMouseUp")]
182        const RightMouseUp = 1<<NSEventType::RightMouseUp.0;
183        #[doc(alias = "NSEventMaskMouseMoved")]
184        const MouseMoved = 1<<NSEventType::MouseMoved.0;
185        #[doc(alias = "NSEventMaskLeftMouseDragged")]
186        const LeftMouseDragged = 1<<NSEventType::LeftMouseDragged.0;
187        #[doc(alias = "NSEventMaskRightMouseDragged")]
188        const RightMouseDragged = 1<<NSEventType::RightMouseDragged.0;
189        #[doc(alias = "NSEventMaskMouseEntered")]
190        const MouseEntered = 1<<NSEventType::MouseEntered.0;
191        #[doc(alias = "NSEventMaskMouseExited")]
192        const MouseExited = 1<<NSEventType::MouseExited.0;
193        #[doc(alias = "NSEventMaskKeyDown")]
194        const KeyDown = 1<<NSEventType::KeyDown.0;
195        #[doc(alias = "NSEventMaskKeyUp")]
196        const KeyUp = 1<<NSEventType::KeyUp.0;
197        #[doc(alias = "NSEventMaskFlagsChanged")]
198        const FlagsChanged = 1<<NSEventType::FlagsChanged.0;
199        #[doc(alias = "NSEventMaskAppKitDefined")]
200        const AppKitDefined = 1<<NSEventType::AppKitDefined.0;
201        #[doc(alias = "NSEventMaskSystemDefined")]
202        const SystemDefined = 1<<NSEventType::SystemDefined.0;
203        #[doc(alias = "NSEventMaskApplicationDefined")]
204        const ApplicationDefined = 1<<NSEventType::ApplicationDefined.0;
205        #[doc(alias = "NSEventMaskPeriodic")]
206        const Periodic = 1<<NSEventType::Periodic.0;
207        #[doc(alias = "NSEventMaskCursorUpdate")]
208        const CursorUpdate = 1<<NSEventType::CursorUpdate.0;
209        #[doc(alias = "NSEventMaskScrollWheel")]
210        const ScrollWheel = 1<<NSEventType::ScrollWheel.0;
211        #[doc(alias = "NSEventMaskTabletPoint")]
212        const TabletPoint = 1<<NSEventType::TabletPoint.0;
213        #[doc(alias = "NSEventMaskTabletProximity")]
214        const TabletProximity = 1<<NSEventType::TabletProximity.0;
215        #[doc(alias = "NSEventMaskOtherMouseDown")]
216        const OtherMouseDown = 1<<NSEventType::OtherMouseDown.0;
217        #[doc(alias = "NSEventMaskOtherMouseUp")]
218        const OtherMouseUp = 1<<NSEventType::OtherMouseUp.0;
219        #[doc(alias = "NSEventMaskOtherMouseDragged")]
220        const OtherMouseDragged = 1<<NSEventType::OtherMouseDragged.0;
221        #[doc(alias = "NSEventMaskGesture")]
222        const Gesture = 1<<NSEventType::Gesture.0;
223        #[doc(alias = "NSEventMaskMagnify")]
224        const Magnify = 1<<NSEventType::Magnify.0;
225        #[doc(alias = "NSEventMaskSwipe")]
226        const Swipe = 1<<NSEventType::Swipe.0;
227        #[doc(alias = "NSEventMaskRotate")]
228        const Rotate = 1<<NSEventType::Rotate.0;
229        #[doc(alias = "NSEventMaskBeginGesture")]
230        const BeginGesture = 1<<NSEventType::BeginGesture.0;
231        #[doc(alias = "NSEventMaskEndGesture")]
232        const EndGesture = 1<<NSEventType::EndGesture.0;
233        #[doc(alias = "NSEventMaskSmartMagnify")]
234        const SmartMagnify = 1<<NSEventType::SmartMagnify.0;
235        #[doc(alias = "NSEventMaskPressure")]
236        const Pressure = 1<<NSEventType::Pressure.0;
237        #[doc(alias = "NSEventMaskDirectTouch")]
238        const DirectTouch = 1<<NSEventType::DirectTouch.0;
239        #[doc(alias = "NSEventMaskChangeMode")]
240        const ChangeMode = 1<<NSEventType::ChangeMode.0;
241        #[doc(alias = "NSEventMaskAny")]
242        const Any = NSUIntegerMax as _;
243    }
244}
245
246unsafe impl Encode for NSEventMask {
247    const ENCODING: Encoding = c_ulonglong::ENCODING;
248}
249
250unsafe impl RefEncode for NSEventMask {
251    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
252}
253
254/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsleftmousedownmask?language=objc)
255pub static NSLeftMouseDownMask: NSEventMask = NSEventMask(NSEventMask::LeftMouseDown.0);
256
257/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsleftmouseupmask?language=objc)
258pub static NSLeftMouseUpMask: NSEventMask = NSEventMask(NSEventMask::LeftMouseUp.0);
259
260/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsrightmousedownmask?language=objc)
261pub static NSRightMouseDownMask: NSEventMask = NSEventMask(NSEventMask::RightMouseDown.0);
262
263/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsrightmouseupmask?language=objc)
264pub static NSRightMouseUpMask: NSEventMask = NSEventMask(NSEventMask::RightMouseUp.0);
265
266/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsmousemovedmask?language=objc)
267pub static NSMouseMovedMask: NSEventMask = NSEventMask(NSEventMask::MouseMoved.0);
268
269/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsleftmousedraggedmask?language=objc)
270pub static NSLeftMouseDraggedMask: NSEventMask = NSEventMask(NSEventMask::LeftMouseDragged.0);
271
272/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsrightmousedraggedmask?language=objc)
273pub static NSRightMouseDraggedMask: NSEventMask = NSEventMask(NSEventMask::RightMouseDragged.0);
274
275/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsmouseenteredmask?language=objc)
276pub static NSMouseEnteredMask: NSEventMask = NSEventMask(NSEventMask::MouseEntered.0);
277
278/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsmouseexitedmask?language=objc)
279pub static NSMouseExitedMask: NSEventMask = NSEventMask(NSEventMask::MouseExited.0);
280
281/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nskeydownmask?language=objc)
282pub static NSKeyDownMask: NSEventMask = NSEventMask(NSEventMask::KeyDown.0);
283
284/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nskeyupmask?language=objc)
285pub static NSKeyUpMask: NSEventMask = NSEventMask(NSEventMask::KeyUp.0);
286
287/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsflagschangedmask?language=objc)
288pub static NSFlagsChangedMask: NSEventMask = NSEventMask(NSEventMask::FlagsChanged.0);
289
290/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsappkitdefinedmask?language=objc)
291pub static NSAppKitDefinedMask: NSEventMask = NSEventMask(NSEventMask::AppKitDefined.0);
292
293/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssystemdefinedmask?language=objc)
294pub static NSSystemDefinedMask: NSEventMask = NSEventMask(NSEventMask::SystemDefined.0);
295
296/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationdefinedmask?language=objc)
297pub static NSApplicationDefinedMask: NSEventMask = NSEventMask(NSEventMask::ApplicationDefined.0);
298
299/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsperiodicmask?language=objc)
300pub static NSPeriodicMask: NSEventMask = NSEventMask(NSEventMask::Periodic.0);
301
302/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscursorupdatemask?language=objc)
303pub static NSCursorUpdateMask: NSEventMask = NSEventMask(NSEventMask::CursorUpdate.0);
304
305/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsscrollwheelmask?language=objc)
306pub static NSScrollWheelMask: NSEventMask = NSEventMask(NSEventMask::ScrollWheel.0);
307
308/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstabletpointmask?language=objc)
309pub static NSTabletPointMask: NSEventMask = NSEventMask(NSEventMask::TabletPoint.0);
310
311/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstabletproximitymask?language=objc)
312pub static NSTabletProximityMask: NSEventMask = NSEventMask(NSEventMask::TabletProximity.0);
313
314/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsothermousedownmask?language=objc)
315pub static NSOtherMouseDownMask: NSEventMask = NSEventMask(NSEventMask::OtherMouseDown.0);
316
317/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsothermouseupmask?language=objc)
318pub static NSOtherMouseUpMask: NSEventMask = NSEventMask(NSEventMask::OtherMouseUp.0);
319
320/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsothermousedraggedmask?language=objc)
321pub static NSOtherMouseDraggedMask: NSEventMask = NSEventMask(NSEventMask::OtherMouseDragged.0);
322
323/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsanyeventmask?language=objc)
324pub static NSAnyEventMask: NSEventMask = NSEventMask(NSUIntegerMax as _);
325
326// TODO: pub fn NSEventMaskFromType(r#type: NSEventType,) -> NSEventMask;
327
328/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nseventmodifierflags?language=objc)
329// NS_OPTIONS
330#[repr(transparent)]
331#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
332pub struct NSEventModifierFlags(pub NSUInteger);
333bitflags::bitflags! {
334    impl NSEventModifierFlags: NSUInteger {
335        #[doc(alias = "NSEventModifierFlagCapsLock")]
336        const CapsLock = 1<<16;
337        #[doc(alias = "NSEventModifierFlagShift")]
338        const Shift = 1<<17;
339        #[doc(alias = "NSEventModifierFlagControl")]
340        const Control = 1<<18;
341        #[doc(alias = "NSEventModifierFlagOption")]
342        const Option = 1<<19;
343        #[doc(alias = "NSEventModifierFlagCommand")]
344        const Command = 1<<20;
345        #[doc(alias = "NSEventModifierFlagNumericPad")]
346        const NumericPad = 1<<21;
347        #[doc(alias = "NSEventModifierFlagHelp")]
348        const Help = 1<<22;
349        #[doc(alias = "NSEventModifierFlagFunction")]
350        const Function = 1<<23;
351        #[doc(alias = "NSEventModifierFlagDeviceIndependentFlagsMask")]
352        const DeviceIndependentFlagsMask = 0xffff0000;
353    }
354}
355
356unsafe impl Encode for NSEventModifierFlags {
357    const ENCODING: Encoding = NSUInteger::ENCODING;
358}
359
360unsafe impl RefEncode for NSEventModifierFlags {
361    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
362}
363
364/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsalphashiftkeymask?language=objc)
365pub static NSAlphaShiftKeyMask: NSEventModifierFlags =
366    NSEventModifierFlags(NSEventModifierFlags::CapsLock.0);
367
368/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsshiftkeymask?language=objc)
369pub static NSShiftKeyMask: NSEventModifierFlags =
370    NSEventModifierFlags(NSEventModifierFlags::Shift.0);
371
372/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscontrolkeymask?language=objc)
373pub static NSControlKeyMask: NSEventModifierFlags =
374    NSEventModifierFlags(NSEventModifierFlags::Control.0);
375
376/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsalternatekeymask?language=objc)
377pub static NSAlternateKeyMask: NSEventModifierFlags =
378    NSEventModifierFlags(NSEventModifierFlags::Option.0);
379
380/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscommandkeymask?language=objc)
381pub static NSCommandKeyMask: NSEventModifierFlags =
382    NSEventModifierFlags(NSEventModifierFlags::Command.0);
383
384/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsnumericpadkeymask?language=objc)
385pub static NSNumericPadKeyMask: NSEventModifierFlags =
386    NSEventModifierFlags(NSEventModifierFlags::NumericPad.0);
387
388/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nshelpkeymask?language=objc)
389pub static NSHelpKeyMask: NSEventModifierFlags = NSEventModifierFlags(NSEventModifierFlags::Help.0);
390
391/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfunctionkeymask?language=objc)
392pub static NSFunctionKeyMask: NSEventModifierFlags =
393    NSEventModifierFlags(NSEventModifierFlags::Function.0);
394
395/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdeviceindependentmodifierflagsmask?language=objc)
396pub static NSDeviceIndependentModifierFlagsMask: NSEventModifierFlags =
397    NSEventModifierFlags(NSEventModifierFlags::DeviceIndependentFlagsMask.0);
398
399/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspointingdevicetype?language=objc)
400// NS_ENUM
401#[repr(transparent)]
402#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
403pub struct NSPointingDeviceType(pub NSUInteger);
404impl NSPointingDeviceType {
405    #[doc(alias = "NSPointingDeviceTypeUnknown")]
406    pub const Unknown: Self = Self(0);
407    #[doc(alias = "NSPointingDeviceTypePen")]
408    pub const Pen: Self = Self(1);
409    #[doc(alias = "NSPointingDeviceTypeCursor")]
410    pub const Cursor: Self = Self(2);
411    #[doc(alias = "NSPointingDeviceTypeEraser")]
412    pub const Eraser: Self = Self(3);
413}
414
415unsafe impl Encode for NSPointingDeviceType {
416    const ENCODING: Encoding = NSUInteger::ENCODING;
417}
418
419unsafe impl RefEncode for NSPointingDeviceType {
420    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
421}
422
423/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsunknownpointingdevice?language=objc)
424pub static NSUnknownPointingDevice: NSPointingDeviceType =
425    NSPointingDeviceType(NSPointingDeviceType::Unknown.0);
426
427/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspenpointingdevice?language=objc)
428pub static NSPenPointingDevice: NSPointingDeviceType =
429    NSPointingDeviceType(NSPointingDeviceType::Pen.0);
430
431/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscursorpointingdevice?language=objc)
432pub static NSCursorPointingDevice: NSPointingDeviceType =
433    NSPointingDeviceType(NSPointingDeviceType::Cursor.0);
434
435/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nseraserpointingdevice?language=objc)
436pub static NSEraserPointingDevice: NSPointingDeviceType =
437    NSPointingDeviceType(NSPointingDeviceType::Eraser.0);
438
439/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nseventbuttonmask?language=objc)
440// NS_OPTIONS
441#[repr(transparent)]
442#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
443pub struct NSEventButtonMask(pub NSUInteger);
444bitflags::bitflags! {
445    impl NSEventButtonMask: NSUInteger {
446        #[doc(alias = "NSEventButtonMaskPenTip")]
447        const PenTip = 1;
448        #[doc(alias = "NSEventButtonMaskPenLowerSide")]
449        const PenLowerSide = 2;
450        #[doc(alias = "NSEventButtonMaskPenUpperSide")]
451        const PenUpperSide = 4;
452    }
453}
454
455unsafe impl Encode for NSEventButtonMask {
456    const ENCODING: Encoding = NSUInteger::ENCODING;
457}
458
459unsafe impl RefEncode for NSEventButtonMask {
460    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
461}
462
463/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspentipmask?language=objc)
464pub static NSPenTipMask: NSEventButtonMask = NSEventButtonMask(NSEventButtonMask::PenTip.0);
465
466/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspenlowersidemask?language=objc)
467pub static NSPenLowerSideMask: NSEventButtonMask =
468    NSEventButtonMask(NSEventButtonMask::PenLowerSide.0);
469
470/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspenuppersidemask?language=objc)
471pub static NSPenUpperSideMask: NSEventButtonMask =
472    NSEventButtonMask(NSEventButtonMask::PenUpperSide.0);
473
474/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nseventphase?language=objc)
475// NS_OPTIONS
476#[repr(transparent)]
477#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
478pub struct NSEventPhase(pub NSUInteger);
479bitflags::bitflags! {
480    impl NSEventPhase: NSUInteger {
481        #[doc(alias = "NSEventPhaseNone")]
482        const None = 0;
483        #[doc(alias = "NSEventPhaseBegan")]
484        const Began = 0x1<<0;
485        #[doc(alias = "NSEventPhaseStationary")]
486        const Stationary = 0x1<<1;
487        #[doc(alias = "NSEventPhaseChanged")]
488        const Changed = 0x1<<2;
489        #[doc(alias = "NSEventPhaseEnded")]
490        const Ended = 0x1<<3;
491        #[doc(alias = "NSEventPhaseCancelled")]
492        const Cancelled = 0x1<<4;
493        #[doc(alias = "NSEventPhaseMayBegin")]
494        const MayBegin = 0x1<<5;
495    }
496}
497
498unsafe impl Encode for NSEventPhase {
499    const ENCODING: Encoding = NSUInteger::ENCODING;
500}
501
502unsafe impl RefEncode for NSEventPhase {
503    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
504}
505
506/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nseventgestureaxis?language=objc)
507// NS_ENUM
508#[repr(transparent)]
509#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
510pub struct NSEventGestureAxis(pub NSInteger);
511impl NSEventGestureAxis {
512    #[doc(alias = "NSEventGestureAxisNone")]
513    pub const None: Self = Self(0);
514    #[doc(alias = "NSEventGestureAxisHorizontal")]
515    pub const Horizontal: Self = Self(1);
516    #[doc(alias = "NSEventGestureAxisVertical")]
517    pub const Vertical: Self = Self(2);
518}
519
520unsafe impl Encode for NSEventGestureAxis {
521    const ENCODING: Encoding = NSInteger::ENCODING;
522}
523
524unsafe impl RefEncode for NSEventGestureAxis {
525    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
526}
527
528/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nseventswipetrackingoptions?language=objc)
529// NS_OPTIONS
530#[repr(transparent)]
531#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
532pub struct NSEventSwipeTrackingOptions(pub NSUInteger);
533bitflags::bitflags! {
534    impl NSEventSwipeTrackingOptions: NSUInteger {
535        #[doc(alias = "NSEventSwipeTrackingLockDirection")]
536        const LockDirection = 0x1<<0;
537        #[doc(alias = "NSEventSwipeTrackingClampGestureAmount")]
538        const ClampGestureAmount = 0x1<<1;
539    }
540}
541
542unsafe impl Encode for NSEventSwipeTrackingOptions {
543    const ENCODING: Encoding = NSUInteger::ENCODING;
544}
545
546unsafe impl RefEncode for NSEventSwipeTrackingOptions {
547    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
548}
549
550/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nseventsubtype?language=objc)
551// NS_ENUM
552#[repr(transparent)]
553#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
554pub struct NSEventSubtype(pub c_short);
555impl NSEventSubtype {
556    #[doc(alias = "NSEventSubtypeWindowExposed")]
557    pub const WindowExposed: Self = Self(0);
558    #[doc(alias = "NSEventSubtypeApplicationActivated")]
559    pub const ApplicationActivated: Self = Self(1);
560    #[doc(alias = "NSEventSubtypeApplicationDeactivated")]
561    pub const ApplicationDeactivated: Self = Self(2);
562    #[doc(alias = "NSEventSubtypeWindowMoved")]
563    pub const WindowMoved: Self = Self(4);
564    #[doc(alias = "NSEventSubtypeScreenChanged")]
565    pub const ScreenChanged: Self = Self(8);
566    #[doc(alias = "NSEventSubtypePowerOff")]
567    pub const PowerOff: Self = Self(1);
568    #[doc(alias = "NSEventSubtypeMouseEvent")]
569    pub const MouseEvent: Self = Self(0);
570    #[doc(alias = "NSEventSubtypeTabletPoint")]
571    pub const TabletPoint: Self = Self(1);
572    #[doc(alias = "NSEventSubtypeTabletProximity")]
573    pub const TabletProximity: Self = Self(2);
574    #[doc(alias = "NSEventSubtypeTouch")]
575    pub const Touch: Self = Self(3);
576}
577
578unsafe impl Encode for NSEventSubtype {
579    const ENCODING: Encoding = c_short::ENCODING;
580}
581
582unsafe impl RefEncode for NSEventSubtype {
583    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
584}
585
586/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nswindowexposedeventtype?language=objc)
587pub static NSWindowExposedEventType: NSEventSubtype =
588    NSEventSubtype(NSEventSubtype::WindowExposed.0);
589
590/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationactivatedeventtype?language=objc)
591pub static NSApplicationActivatedEventType: NSEventSubtype =
592    NSEventSubtype(NSEventSubtype::ApplicationActivated.0);
593
594/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationdeactivatedeventtype?language=objc)
595pub static NSApplicationDeactivatedEventType: NSEventSubtype =
596    NSEventSubtype(NSEventSubtype::ApplicationDeactivated.0);
597
598/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nswindowmovedeventtype?language=objc)
599pub static NSWindowMovedEventType: NSEventSubtype = NSEventSubtype(NSEventSubtype::WindowMoved.0);
600
601/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsscreenchangedeventtype?language=objc)
602pub static NSScreenChangedEventType: NSEventSubtype =
603    NSEventSubtype(NSEventSubtype::ScreenChanged.0);
604
605/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsawteventtype?language=objc)
606pub static NSAWTEventType: NSEventSubtype = NSEventSubtype(16);
607
608/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspoweroffeventtype?language=objc)
609pub static NSPowerOffEventType: NSEventSubtype = NSEventSubtype(NSEventSubtype::PowerOff.0);
610
611/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsmouseeventsubtype?language=objc)
612pub static NSMouseEventSubtype: NSEventSubtype = NSEventSubtype(NSEventSubtype::MouseEvent.0);
613
614/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstabletpointeventsubtype?language=objc)
615pub static NSTabletPointEventSubtype: NSEventSubtype =
616    NSEventSubtype(NSEventSubtype::TabletPoint.0);
617
618/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstabletproximityeventsubtype?language=objc)
619pub static NSTabletProximityEventSubtype: NSEventSubtype =
620    NSEventSubtype(NSEventSubtype::TabletProximity.0);
621
622/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstoucheventsubtype?language=objc)
623pub static NSTouchEventSubtype: NSEventSubtype = NSEventSubtype(NSEventSubtype::Touch.0);
624
625/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspressurebehavior?language=objc)
626// NS_ENUM
627#[repr(transparent)]
628#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
629pub struct NSPressureBehavior(pub NSInteger);
630impl NSPressureBehavior {
631    #[doc(alias = "NSPressureBehaviorUnknown")]
632    pub const Unknown: Self = Self(-1);
633    #[doc(alias = "NSPressureBehaviorPrimaryDefault")]
634    pub const PrimaryDefault: Self = Self(0);
635    #[doc(alias = "NSPressureBehaviorPrimaryClick")]
636    pub const PrimaryClick: Self = Self(1);
637    #[doc(alias = "NSPressureBehaviorPrimaryGeneric")]
638    pub const PrimaryGeneric: Self = Self(2);
639    #[doc(alias = "NSPressureBehaviorPrimaryAccelerator")]
640    pub const PrimaryAccelerator: Self = Self(3);
641    #[doc(alias = "NSPressureBehaviorPrimaryDeepClick")]
642    pub const PrimaryDeepClick: Self = Self(5);
643    #[doc(alias = "NSPressureBehaviorPrimaryDeepDrag")]
644    pub const PrimaryDeepDrag: Self = Self(6);
645}
646
647unsafe impl Encode for NSPressureBehavior {
648    const ENCODING: Encoding = NSInteger::ENCODING;
649}
650
651unsafe impl RefEncode for NSPressureBehavior {
652    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
653}
654
655extern_class!(
656    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsevent?language=objc)
657    #[unsafe(super(NSObject))]
658    #[derive(Debug, PartialEq, Eq, Hash)]
659    pub struct NSEvent;
660);
661
662unsafe impl NSCoding for NSEvent {}
663
664unsafe impl NSCopying for NSEvent {}
665
666unsafe impl CopyingHelper for NSEvent {
667    type Result = Self;
668}
669
670unsafe impl NSObjectProtocol for NSEvent {}
671
672impl NSEvent {
673    extern_methods!(
674        #[unsafe(method(type))]
675        #[unsafe(method_family = none)]
676        pub unsafe fn r#type(&self) -> NSEventType;
677
678        #[unsafe(method(modifierFlags))]
679        #[unsafe(method_family = none)]
680        pub unsafe fn modifierFlags(&self) -> NSEventModifierFlags;
681
682        #[unsafe(method(timestamp))]
683        #[unsafe(method_family = none)]
684        pub unsafe fn timestamp(&self) -> NSTimeInterval;
685
686        #[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
687        #[unsafe(method(window))]
688        #[unsafe(method_family = none)]
689        pub unsafe fn window(&self, mtm: MainThreadMarker) -> Option<Retained<NSWindow>>;
690
691        #[unsafe(method(windowNumber))]
692        #[unsafe(method_family = none)]
693        pub unsafe fn windowNumber(&self) -> NSInteger;
694
695        #[cfg(feature = "NSGraphicsContext")]
696        #[deprecated = "This method always returns nil. If you need access to the current drawing context, use [NSGraphicsContext currentContext] inside of a draw operation."]
697        #[unsafe(method(context))]
698        #[unsafe(method_family = none)]
699        pub unsafe fn context(&self) -> Option<Retained<NSGraphicsContext>>;
700
701        #[unsafe(method(clickCount))]
702        #[unsafe(method_family = none)]
703        pub unsafe fn clickCount(&self) -> NSInteger;
704
705        #[unsafe(method(buttonNumber))]
706        #[unsafe(method_family = none)]
707        pub unsafe fn buttonNumber(&self) -> NSInteger;
708
709        #[unsafe(method(eventNumber))]
710        #[unsafe(method_family = none)]
711        pub unsafe fn eventNumber(&self) -> NSInteger;
712
713        #[unsafe(method(pressure))]
714        #[unsafe(method_family = none)]
715        pub unsafe fn pressure(&self) -> c_float;
716
717        #[unsafe(method(locationInWindow))]
718        #[unsafe(method_family = none)]
719        pub unsafe fn locationInWindow(&self) -> NSPoint;
720
721        #[cfg(feature = "objc2-core-foundation")]
722        #[unsafe(method(deltaX))]
723        #[unsafe(method_family = none)]
724        pub unsafe fn deltaX(&self) -> CGFloat;
725
726        #[cfg(feature = "objc2-core-foundation")]
727        #[unsafe(method(deltaY))]
728        #[unsafe(method_family = none)]
729        pub unsafe fn deltaY(&self) -> CGFloat;
730
731        #[cfg(feature = "objc2-core-foundation")]
732        #[unsafe(method(deltaZ))]
733        #[unsafe(method_family = none)]
734        pub unsafe fn deltaZ(&self) -> CGFloat;
735
736        #[unsafe(method(hasPreciseScrollingDeltas))]
737        #[unsafe(method_family = none)]
738        pub unsafe fn hasPreciseScrollingDeltas(&self) -> bool;
739
740        #[cfg(feature = "objc2-core-foundation")]
741        #[unsafe(method(scrollingDeltaX))]
742        #[unsafe(method_family = none)]
743        pub unsafe fn scrollingDeltaX(&self) -> CGFloat;
744
745        #[cfg(feature = "objc2-core-foundation")]
746        #[unsafe(method(scrollingDeltaY))]
747        #[unsafe(method_family = none)]
748        pub unsafe fn scrollingDeltaY(&self) -> CGFloat;
749
750        #[unsafe(method(momentumPhase))]
751        #[unsafe(method_family = none)]
752        pub unsafe fn momentumPhase(&self) -> NSEventPhase;
753
754        #[unsafe(method(isDirectionInvertedFromDevice))]
755        #[unsafe(method_family = none)]
756        pub unsafe fn isDirectionInvertedFromDevice(&self) -> bool;
757
758        #[unsafe(method(characters))]
759        #[unsafe(method_family = none)]
760        pub unsafe fn characters(&self) -> Option<Retained<NSString>>;
761
762        #[unsafe(method(charactersIgnoringModifiers))]
763        #[unsafe(method_family = none)]
764        pub unsafe fn charactersIgnoringModifiers(&self) -> Option<Retained<NSString>>;
765
766        #[unsafe(method(charactersByApplyingModifiers:))]
767        #[unsafe(method_family = none)]
768        pub unsafe fn charactersByApplyingModifiers(
769            &self,
770            modifiers: NSEventModifierFlags,
771        ) -> Option<Retained<NSString>>;
772
773        #[unsafe(method(isARepeat))]
774        #[unsafe(method_family = none)]
775        pub unsafe fn isARepeat(&self) -> bool;
776
777        #[unsafe(method(keyCode))]
778        #[unsafe(method_family = none)]
779        pub unsafe fn keyCode(&self) -> c_ushort;
780
781        #[unsafe(method(trackingNumber))]
782        #[unsafe(method_family = none)]
783        pub unsafe fn trackingNumber(&self) -> NSInteger;
784
785        #[unsafe(method(userData))]
786        #[unsafe(method_family = none)]
787        pub unsafe fn userData(&self) -> *mut c_void;
788
789        #[cfg(feature = "NSTrackingArea")]
790        #[unsafe(method(trackingArea))]
791        #[unsafe(method_family = none)]
792        pub unsafe fn trackingArea(&self) -> Option<Retained<NSTrackingArea>>;
793
794        #[unsafe(method(subtype))]
795        #[unsafe(method_family = none)]
796        pub unsafe fn subtype(&self) -> NSEventSubtype;
797
798        #[unsafe(method(data1))]
799        #[unsafe(method_family = none)]
800        pub unsafe fn data1(&self) -> NSInteger;
801
802        #[unsafe(method(data2))]
803        #[unsafe(method_family = none)]
804        pub unsafe fn data2(&self) -> NSInteger;
805
806        #[unsafe(method(eventRef))]
807        #[unsafe(method_family = none)]
808        pub unsafe fn eventRef(&self) -> *const c_void;
809
810        #[unsafe(method(eventWithEventRef:))]
811        #[unsafe(method_family = none)]
812        pub unsafe fn eventWithEventRef(event_ref: NonNull<c_void>) -> Option<Retained<NSEvent>>;
813
814        #[cfg(feature = "objc2-core-graphics")]
815        #[cfg(target_vendor = "apple")]
816        #[unsafe(method(CGEvent))]
817        #[unsafe(method_family = none)]
818        pub unsafe fn CGEvent(&self) -> Option<Retained<CGEvent>>;
819
820        #[cfg(feature = "objc2-core-graphics")]
821        #[cfg(target_vendor = "apple")]
822        #[unsafe(method(eventWithCGEvent:))]
823        #[unsafe(method_family = none)]
824        pub unsafe fn eventWithCGEvent(cg_event: &CGEvent) -> Option<Retained<NSEvent>>;
825
826        #[unsafe(method(isMouseCoalescingEnabled))]
827        #[unsafe(method_family = none)]
828        pub unsafe fn isMouseCoalescingEnabled() -> bool;
829
830        /// Setter for [`isMouseCoalescingEnabled`][Self::isMouseCoalescingEnabled].
831        #[unsafe(method(setMouseCoalescingEnabled:))]
832        #[unsafe(method_family = none)]
833        pub unsafe fn setMouseCoalescingEnabled(mouse_coalescing_enabled: bool);
834
835        #[cfg(feature = "objc2-core-foundation")]
836        #[unsafe(method(magnification))]
837        #[unsafe(method_family = none)]
838        pub unsafe fn magnification(&self) -> CGFloat;
839
840        #[unsafe(method(deviceID))]
841        #[unsafe(method_family = none)]
842        pub unsafe fn deviceID(&self) -> NSUInteger;
843
844        #[unsafe(method(rotation))]
845        #[unsafe(method_family = none)]
846        pub unsafe fn rotation(&self) -> c_float;
847
848        #[unsafe(method(absoluteX))]
849        #[unsafe(method_family = none)]
850        pub unsafe fn absoluteX(&self) -> NSInteger;
851
852        #[unsafe(method(absoluteY))]
853        #[unsafe(method_family = none)]
854        pub unsafe fn absoluteY(&self) -> NSInteger;
855
856        #[unsafe(method(absoluteZ))]
857        #[unsafe(method_family = none)]
858        pub unsafe fn absoluteZ(&self) -> NSInteger;
859
860        #[unsafe(method(buttonMask))]
861        #[unsafe(method_family = none)]
862        pub unsafe fn buttonMask(&self) -> NSEventButtonMask;
863
864        #[unsafe(method(tilt))]
865        #[unsafe(method_family = none)]
866        pub unsafe fn tilt(&self) -> NSPoint;
867
868        #[unsafe(method(tangentialPressure))]
869        #[unsafe(method_family = none)]
870        pub unsafe fn tangentialPressure(&self) -> c_float;
871
872        #[unsafe(method(vendorDefined))]
873        #[unsafe(method_family = none)]
874        pub unsafe fn vendorDefined(&self) -> Retained<AnyObject>;
875
876        #[unsafe(method(vendorID))]
877        #[unsafe(method_family = none)]
878        pub unsafe fn vendorID(&self) -> NSUInteger;
879
880        #[unsafe(method(tabletID))]
881        #[unsafe(method_family = none)]
882        pub unsafe fn tabletID(&self) -> NSUInteger;
883
884        #[unsafe(method(pointingDeviceID))]
885        #[unsafe(method_family = none)]
886        pub unsafe fn pointingDeviceID(&self) -> NSUInteger;
887
888        #[unsafe(method(systemTabletID))]
889        #[unsafe(method_family = none)]
890        pub unsafe fn systemTabletID(&self) -> NSUInteger;
891
892        #[unsafe(method(vendorPointingDeviceType))]
893        #[unsafe(method_family = none)]
894        pub unsafe fn vendorPointingDeviceType(&self) -> NSUInteger;
895
896        #[unsafe(method(pointingDeviceSerialNumber))]
897        #[unsafe(method_family = none)]
898        pub unsafe fn pointingDeviceSerialNumber(&self) -> NSUInteger;
899
900        #[unsafe(method(uniqueID))]
901        #[unsafe(method_family = none)]
902        pub unsafe fn uniqueID(&self) -> c_ulonglong;
903
904        #[unsafe(method(capabilityMask))]
905        #[unsafe(method_family = none)]
906        pub unsafe fn capabilityMask(&self) -> NSUInteger;
907
908        #[unsafe(method(pointingDeviceType))]
909        #[unsafe(method_family = none)]
910        pub unsafe fn pointingDeviceType(&self) -> NSPointingDeviceType;
911
912        #[unsafe(method(isEnteringProximity))]
913        #[unsafe(method_family = none)]
914        pub unsafe fn isEnteringProximity(&self) -> bool;
915
916        #[cfg(all(feature = "NSResponder", feature = "NSTouch", feature = "NSView"))]
917        #[unsafe(method(touchesMatchingPhase:inView:))]
918        #[unsafe(method_family = none)]
919        pub unsafe fn touchesMatchingPhase_inView(
920            &self,
921            phase: NSTouchPhase,
922            view: Option<&NSView>,
923        ) -> Retained<NSSet<NSTouch>>;
924
925        #[cfg(feature = "NSTouch")]
926        #[unsafe(method(allTouches))]
927        #[unsafe(method_family = none)]
928        pub unsafe fn allTouches(&self) -> Retained<NSSet<NSTouch>>;
929
930        #[cfg(all(feature = "NSResponder", feature = "NSTouch", feature = "NSView"))]
931        #[unsafe(method(touchesForView:))]
932        #[unsafe(method_family = none)]
933        pub unsafe fn touchesForView(&self, view: &NSView) -> Retained<NSSet<NSTouch>>;
934
935        #[cfg(feature = "NSTouch")]
936        #[unsafe(method(coalescedTouchesForTouch:))]
937        #[unsafe(method_family = none)]
938        pub unsafe fn coalescedTouchesForTouch(
939            &self,
940            touch: &NSTouch,
941        ) -> Retained<NSArray<NSTouch>>;
942
943        #[unsafe(method(phase))]
944        #[unsafe(method_family = none)]
945        pub unsafe fn phase(&self) -> NSEventPhase;
946
947        #[unsafe(method(stage))]
948        #[unsafe(method_family = none)]
949        pub unsafe fn stage(&self) -> NSInteger;
950
951        #[cfg(feature = "objc2-core-foundation")]
952        #[unsafe(method(stageTransition))]
953        #[unsafe(method_family = none)]
954        pub unsafe fn stageTransition(&self) -> CGFloat;
955
956        #[unsafe(method(associatedEventsMask))]
957        #[unsafe(method_family = none)]
958        pub unsafe fn associatedEventsMask(&self) -> NSEventMask;
959
960        #[unsafe(method(pressureBehavior))]
961        #[unsafe(method_family = none)]
962        pub unsafe fn pressureBehavior(&self) -> NSPressureBehavior;
963
964        #[unsafe(method(isSwipeTrackingFromScrollEventsEnabled))]
965        #[unsafe(method_family = none)]
966        pub unsafe fn isSwipeTrackingFromScrollEventsEnabled() -> bool;
967
968        #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
969        #[unsafe(method(trackSwipeEventWithOptions:dampenAmountThresholdMin:max:usingHandler:))]
970        #[unsafe(method_family = none)]
971        pub unsafe fn trackSwipeEventWithOptions_dampenAmountThresholdMin_max_usingHandler(
972            &self,
973            options: NSEventSwipeTrackingOptions,
974            min_dampen_threshold: CGFloat,
975            max_dampen_threshold: CGFloat,
976            tracking_handler: &block2::Block<dyn Fn(CGFloat, NSEventPhase, Bool, NonNull<Bool>)>,
977        );
978
979        #[unsafe(method(startPeriodicEventsAfterDelay:withPeriod:))]
980        #[unsafe(method_family = none)]
981        pub unsafe fn startPeriodicEventsAfterDelay_withPeriod(
982            delay: NSTimeInterval,
983            period: NSTimeInterval,
984        );
985
986        #[unsafe(method(stopPeriodicEvents))]
987        #[unsafe(method_family = none)]
988        pub unsafe fn stopPeriodicEvents();
989
990        #[cfg(feature = "NSGraphicsContext")]
991        #[unsafe(method(mouseEventWithType:location:modifierFlags:timestamp:windowNumber:context:eventNumber:clickCount:pressure:))]
992        #[unsafe(method_family = none)]
993        pub unsafe fn mouseEventWithType_location_modifierFlags_timestamp_windowNumber_context_eventNumber_clickCount_pressure(
994            r#type: NSEventType,
995            location: NSPoint,
996            flags: NSEventModifierFlags,
997            time: NSTimeInterval,
998            w_num: NSInteger,
999            unused_pass_nil: Option<&NSGraphicsContext>,
1000            e_num: NSInteger,
1001            c_num: NSInteger,
1002            pressure: c_float,
1003        ) -> Option<Retained<NSEvent>>;
1004
1005        #[cfg(feature = "NSGraphicsContext")]
1006        #[unsafe(method(keyEventWithType:location:modifierFlags:timestamp:windowNumber:context:characters:charactersIgnoringModifiers:isARepeat:keyCode:))]
1007        #[unsafe(method_family = none)]
1008        pub unsafe fn keyEventWithType_location_modifierFlags_timestamp_windowNumber_context_characters_charactersIgnoringModifiers_isARepeat_keyCode(
1009            r#type: NSEventType,
1010            location: NSPoint,
1011            flags: NSEventModifierFlags,
1012            time: NSTimeInterval,
1013            w_num: NSInteger,
1014            unused_pass_nil: Option<&NSGraphicsContext>,
1015            keys: &NSString,
1016            ukeys: &NSString,
1017            flag: bool,
1018            code: c_ushort,
1019        ) -> Option<Retained<NSEvent>>;
1020
1021        #[cfg(feature = "NSGraphicsContext")]
1022        #[unsafe(method(enterExitEventWithType:location:modifierFlags:timestamp:windowNumber:context:eventNumber:trackingNumber:userData:))]
1023        #[unsafe(method_family = none)]
1024        pub unsafe fn enterExitEventWithType_location_modifierFlags_timestamp_windowNumber_context_eventNumber_trackingNumber_userData(
1025            r#type: NSEventType,
1026            location: NSPoint,
1027            flags: NSEventModifierFlags,
1028            time: NSTimeInterval,
1029            w_num: NSInteger,
1030            unused_pass_nil: Option<&NSGraphicsContext>,
1031            e_num: NSInteger,
1032            t_num: NSInteger,
1033            data: *mut c_void,
1034        ) -> Option<Retained<NSEvent>>;
1035
1036        #[cfg(feature = "NSGraphicsContext")]
1037        #[unsafe(method(otherEventWithType:location:modifierFlags:timestamp:windowNumber:context:subtype:data1:data2:))]
1038        #[unsafe(method_family = none)]
1039        pub unsafe fn otherEventWithType_location_modifierFlags_timestamp_windowNumber_context_subtype_data1_data2(
1040            r#type: NSEventType,
1041            location: NSPoint,
1042            flags: NSEventModifierFlags,
1043            time: NSTimeInterval,
1044            w_num: NSInteger,
1045            unused_pass_nil: Option<&NSGraphicsContext>,
1046            subtype: c_short,
1047            d1: NSInteger,
1048            d2: NSInteger,
1049        ) -> Option<Retained<NSEvent>>;
1050
1051        #[unsafe(method(mouseLocation))]
1052        #[unsafe(method_family = none)]
1053        pub unsafe fn mouseLocation() -> NSPoint;
1054
1055        #[unsafe(method(modifierFlags))]
1056        #[unsafe(method_family = none)]
1057        pub unsafe fn modifierFlags_class() -> NSEventModifierFlags;
1058
1059        #[unsafe(method(pressedMouseButtons))]
1060        #[unsafe(method_family = none)]
1061        pub unsafe fn pressedMouseButtons() -> NSUInteger;
1062
1063        #[unsafe(method(doubleClickInterval))]
1064        #[unsafe(method_family = none)]
1065        pub unsafe fn doubleClickInterval() -> NSTimeInterval;
1066
1067        #[unsafe(method(keyRepeatDelay))]
1068        #[unsafe(method_family = none)]
1069        pub unsafe fn keyRepeatDelay() -> NSTimeInterval;
1070
1071        #[unsafe(method(keyRepeatInterval))]
1072        #[unsafe(method_family = none)]
1073        pub unsafe fn keyRepeatInterval() -> NSTimeInterval;
1074
1075        #[cfg(feature = "block2")]
1076        #[unsafe(method(addGlobalMonitorForEventsMatchingMask:handler:))]
1077        #[unsafe(method_family = none)]
1078        pub unsafe fn addGlobalMonitorForEventsMatchingMask_handler(
1079            mask: NSEventMask,
1080            block: &block2::Block<dyn Fn(NonNull<NSEvent>)>,
1081        ) -> Option<Retained<AnyObject>>;
1082
1083        #[cfg(feature = "block2")]
1084        #[unsafe(method(addLocalMonitorForEventsMatchingMask:handler:))]
1085        #[unsafe(method_family = none)]
1086        pub unsafe fn addLocalMonitorForEventsMatchingMask_handler(
1087            mask: NSEventMask,
1088            block: &block2::Block<dyn Fn(NonNull<NSEvent>) -> *mut NSEvent>,
1089        ) -> Option<Retained<AnyObject>>;
1090
1091        #[unsafe(method(removeMonitor:))]
1092        #[unsafe(method_family = none)]
1093        pub unsafe fn removeMonitor(event_monitor: &AnyObject);
1094    );
1095}
1096
1097/// Methods declared on superclass `NSObject`.
1098impl NSEvent {
1099    extern_methods!(
1100        #[unsafe(method(init))]
1101        #[unsafe(method_family = init)]
1102        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1103
1104        #[unsafe(method(new))]
1105        #[unsafe(method_family = new)]
1106        pub unsafe fn new() -> Retained<Self>;
1107    );
1108}
1109
1110/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsuparrowfunctionkey?language=objc)
1111pub const NSUpArrowFunctionKey: c_uint = 0xF700;
1112/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdownarrowfunctionkey?language=objc)
1113pub const NSDownArrowFunctionKey: c_uint = 0xF701;
1114/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsleftarrowfunctionkey?language=objc)
1115pub const NSLeftArrowFunctionKey: c_uint = 0xF702;
1116/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsrightarrowfunctionkey?language=objc)
1117pub const NSRightArrowFunctionKey: c_uint = 0xF703;
1118/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf1functionkey?language=objc)
1119pub const NSF1FunctionKey: c_uint = 0xF704;
1120/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf2functionkey?language=objc)
1121pub const NSF2FunctionKey: c_uint = 0xF705;
1122/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf3functionkey?language=objc)
1123pub const NSF3FunctionKey: c_uint = 0xF706;
1124/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf4functionkey?language=objc)
1125pub const NSF4FunctionKey: c_uint = 0xF707;
1126/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf5functionkey?language=objc)
1127pub const NSF5FunctionKey: c_uint = 0xF708;
1128/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf6functionkey?language=objc)
1129pub const NSF6FunctionKey: c_uint = 0xF709;
1130/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf7functionkey?language=objc)
1131pub const NSF7FunctionKey: c_uint = 0xF70A;
1132/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf8functionkey?language=objc)
1133pub const NSF8FunctionKey: c_uint = 0xF70B;
1134/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf9functionkey?language=objc)
1135pub const NSF9FunctionKey: c_uint = 0xF70C;
1136/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf10functionkey?language=objc)
1137pub const NSF10FunctionKey: c_uint = 0xF70D;
1138/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf11functionkey?language=objc)
1139pub const NSF11FunctionKey: c_uint = 0xF70E;
1140/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf12functionkey?language=objc)
1141pub const NSF12FunctionKey: c_uint = 0xF70F;
1142/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf13functionkey?language=objc)
1143pub const NSF13FunctionKey: c_uint = 0xF710;
1144/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf14functionkey?language=objc)
1145pub const NSF14FunctionKey: c_uint = 0xF711;
1146/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf15functionkey?language=objc)
1147pub const NSF15FunctionKey: c_uint = 0xF712;
1148/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf16functionkey?language=objc)
1149pub const NSF16FunctionKey: c_uint = 0xF713;
1150/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf17functionkey?language=objc)
1151pub const NSF17FunctionKey: c_uint = 0xF714;
1152/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf18functionkey?language=objc)
1153pub const NSF18FunctionKey: c_uint = 0xF715;
1154/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf19functionkey?language=objc)
1155pub const NSF19FunctionKey: c_uint = 0xF716;
1156/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf20functionkey?language=objc)
1157pub const NSF20FunctionKey: c_uint = 0xF717;
1158/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf21functionkey?language=objc)
1159pub const NSF21FunctionKey: c_uint = 0xF718;
1160/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf22functionkey?language=objc)
1161pub const NSF22FunctionKey: c_uint = 0xF719;
1162/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf23functionkey?language=objc)
1163pub const NSF23FunctionKey: c_uint = 0xF71A;
1164/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf24functionkey?language=objc)
1165pub const NSF24FunctionKey: c_uint = 0xF71B;
1166/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf25functionkey?language=objc)
1167pub const NSF25FunctionKey: c_uint = 0xF71C;
1168/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf26functionkey?language=objc)
1169pub const NSF26FunctionKey: c_uint = 0xF71D;
1170/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf27functionkey?language=objc)
1171pub const NSF27FunctionKey: c_uint = 0xF71E;
1172/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf28functionkey?language=objc)
1173pub const NSF28FunctionKey: c_uint = 0xF71F;
1174/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf29functionkey?language=objc)
1175pub const NSF29FunctionKey: c_uint = 0xF720;
1176/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf30functionkey?language=objc)
1177pub const NSF30FunctionKey: c_uint = 0xF721;
1178/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf31functionkey?language=objc)
1179pub const NSF31FunctionKey: c_uint = 0xF722;
1180/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf32functionkey?language=objc)
1181pub const NSF32FunctionKey: c_uint = 0xF723;
1182/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf33functionkey?language=objc)
1183pub const NSF33FunctionKey: c_uint = 0xF724;
1184/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf34functionkey?language=objc)
1185pub const NSF34FunctionKey: c_uint = 0xF725;
1186/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf35functionkey?language=objc)
1187pub const NSF35FunctionKey: c_uint = 0xF726;
1188/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsinsertfunctionkey?language=objc)
1189pub const NSInsertFunctionKey: c_uint = 0xF727;
1190/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdeletefunctionkey?language=objc)
1191pub const NSDeleteFunctionKey: c_uint = 0xF728;
1192/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nshomefunctionkey?language=objc)
1193pub const NSHomeFunctionKey: c_uint = 0xF729;
1194/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsbeginfunctionkey?language=objc)
1195pub const NSBeginFunctionKey: c_uint = 0xF72A;
1196/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsendfunctionkey?language=objc)
1197pub const NSEndFunctionKey: c_uint = 0xF72B;
1198/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspageupfunctionkey?language=objc)
1199pub const NSPageUpFunctionKey: c_uint = 0xF72C;
1200/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspagedownfunctionkey?language=objc)
1201pub const NSPageDownFunctionKey: c_uint = 0xF72D;
1202/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsprintscreenfunctionkey?language=objc)
1203pub const NSPrintScreenFunctionKey: c_uint = 0xF72E;
1204/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsscrolllockfunctionkey?language=objc)
1205pub const NSScrollLockFunctionKey: c_uint = 0xF72F;
1206/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspausefunctionkey?language=objc)
1207pub const NSPauseFunctionKey: c_uint = 0xF730;
1208/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssysreqfunctionkey?language=objc)
1209pub const NSSysReqFunctionKey: c_uint = 0xF731;
1210/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsbreakfunctionkey?language=objc)
1211pub const NSBreakFunctionKey: c_uint = 0xF732;
1212/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsresetfunctionkey?language=objc)
1213pub const NSResetFunctionKey: c_uint = 0xF733;
1214/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsstopfunctionkey?language=objc)
1215pub const NSStopFunctionKey: c_uint = 0xF734;
1216/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsmenufunctionkey?language=objc)
1217pub const NSMenuFunctionKey: c_uint = 0xF735;
1218/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsuserfunctionkey?language=objc)
1219pub const NSUserFunctionKey: c_uint = 0xF736;
1220/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssystemfunctionkey?language=objc)
1221pub const NSSystemFunctionKey: c_uint = 0xF737;
1222/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsprintfunctionkey?language=objc)
1223pub const NSPrintFunctionKey: c_uint = 0xF738;
1224/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsclearlinefunctionkey?language=objc)
1225pub const NSClearLineFunctionKey: c_uint = 0xF739;
1226/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscleardisplayfunctionkey?language=objc)
1227pub const NSClearDisplayFunctionKey: c_uint = 0xF73A;
1228/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsinsertlinefunctionkey?language=objc)
1229pub const NSInsertLineFunctionKey: c_uint = 0xF73B;
1230/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdeletelinefunctionkey?language=objc)
1231pub const NSDeleteLineFunctionKey: c_uint = 0xF73C;
1232/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsinsertcharfunctionkey?language=objc)
1233pub const NSInsertCharFunctionKey: c_uint = 0xF73D;
1234/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdeletecharfunctionkey?language=objc)
1235pub const NSDeleteCharFunctionKey: c_uint = 0xF73E;
1236/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsprevfunctionkey?language=objc)
1237pub const NSPrevFunctionKey: c_uint = 0xF73F;
1238/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsnextfunctionkey?language=objc)
1239pub const NSNextFunctionKey: c_uint = 0xF740;
1240/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsselectfunctionkey?language=objc)
1241pub const NSSelectFunctionKey: c_uint = 0xF741;
1242/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsexecutefunctionkey?language=objc)
1243pub const NSExecuteFunctionKey: c_uint = 0xF742;
1244/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsundofunctionkey?language=objc)
1245pub const NSUndoFunctionKey: c_uint = 0xF743;
1246/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsredofunctionkey?language=objc)
1247pub const NSRedoFunctionKey: c_uint = 0xF744;
1248/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfindfunctionkey?language=objc)
1249pub const NSFindFunctionKey: c_uint = 0xF745;
1250/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nshelpfunctionkey?language=objc)
1251pub const NSHelpFunctionKey: c_uint = 0xF746;
1252/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsmodeswitchfunctionkey?language=objc)
1253pub const NSModeSwitchFunctionKey: c_uint = 0xF747;