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
326impl NSEventMask {
327    // TODO: pub fn NSEventMaskFromType(r#type: NSEventType,) -> NSEventMask;
328}
329
330/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nseventmodifierflags?language=objc)
331// NS_OPTIONS
332#[repr(transparent)]
333#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
334pub struct NSEventModifierFlags(pub NSUInteger);
335bitflags::bitflags! {
336    impl NSEventModifierFlags: NSUInteger {
337        #[doc(alias = "NSEventModifierFlagCapsLock")]
338        const CapsLock = 1<<16;
339        #[doc(alias = "NSEventModifierFlagShift")]
340        const Shift = 1<<17;
341        #[doc(alias = "NSEventModifierFlagControl")]
342        const Control = 1<<18;
343        #[doc(alias = "NSEventModifierFlagOption")]
344        const Option = 1<<19;
345        #[doc(alias = "NSEventModifierFlagCommand")]
346        const Command = 1<<20;
347        #[doc(alias = "NSEventModifierFlagNumericPad")]
348        const NumericPad = 1<<21;
349        #[doc(alias = "NSEventModifierFlagHelp")]
350        const Help = 1<<22;
351        #[doc(alias = "NSEventModifierFlagFunction")]
352        const Function = 1<<23;
353        #[doc(alias = "NSEventModifierFlagDeviceIndependentFlagsMask")]
354        const DeviceIndependentFlagsMask = 0xffff0000;
355    }
356}
357
358unsafe impl Encode for NSEventModifierFlags {
359    const ENCODING: Encoding = NSUInteger::ENCODING;
360}
361
362unsafe impl RefEncode for NSEventModifierFlags {
363    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
364}
365
366/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsalphashiftkeymask?language=objc)
367pub static NSAlphaShiftKeyMask: NSEventModifierFlags =
368    NSEventModifierFlags(NSEventModifierFlags::CapsLock.0);
369
370/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsshiftkeymask?language=objc)
371pub static NSShiftKeyMask: NSEventModifierFlags =
372    NSEventModifierFlags(NSEventModifierFlags::Shift.0);
373
374/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscontrolkeymask?language=objc)
375pub static NSControlKeyMask: NSEventModifierFlags =
376    NSEventModifierFlags(NSEventModifierFlags::Control.0);
377
378/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsalternatekeymask?language=objc)
379pub static NSAlternateKeyMask: NSEventModifierFlags =
380    NSEventModifierFlags(NSEventModifierFlags::Option.0);
381
382/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscommandkeymask?language=objc)
383pub static NSCommandKeyMask: NSEventModifierFlags =
384    NSEventModifierFlags(NSEventModifierFlags::Command.0);
385
386/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsnumericpadkeymask?language=objc)
387pub static NSNumericPadKeyMask: NSEventModifierFlags =
388    NSEventModifierFlags(NSEventModifierFlags::NumericPad.0);
389
390/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nshelpkeymask?language=objc)
391pub static NSHelpKeyMask: NSEventModifierFlags = NSEventModifierFlags(NSEventModifierFlags::Help.0);
392
393/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfunctionkeymask?language=objc)
394pub static NSFunctionKeyMask: NSEventModifierFlags =
395    NSEventModifierFlags(NSEventModifierFlags::Function.0);
396
397/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdeviceindependentmodifierflagsmask?language=objc)
398pub static NSDeviceIndependentModifierFlagsMask: NSEventModifierFlags =
399    NSEventModifierFlags(NSEventModifierFlags::DeviceIndependentFlagsMask.0);
400
401/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspointingdevicetype?language=objc)
402// NS_ENUM
403#[repr(transparent)]
404#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
405pub struct NSPointingDeviceType(pub NSUInteger);
406impl NSPointingDeviceType {
407    #[doc(alias = "NSPointingDeviceTypeUnknown")]
408    pub const Unknown: Self = Self(0);
409    #[doc(alias = "NSPointingDeviceTypePen")]
410    pub const Pen: Self = Self(1);
411    #[doc(alias = "NSPointingDeviceTypeCursor")]
412    pub const Cursor: Self = Self(2);
413    #[doc(alias = "NSPointingDeviceTypeEraser")]
414    pub const Eraser: Self = Self(3);
415}
416
417unsafe impl Encode for NSPointingDeviceType {
418    const ENCODING: Encoding = NSUInteger::ENCODING;
419}
420
421unsafe impl RefEncode for NSPointingDeviceType {
422    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
423}
424
425/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsunknownpointingdevice?language=objc)
426pub static NSUnknownPointingDevice: NSPointingDeviceType =
427    NSPointingDeviceType(NSPointingDeviceType::Unknown.0);
428
429/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspenpointingdevice?language=objc)
430pub static NSPenPointingDevice: NSPointingDeviceType =
431    NSPointingDeviceType(NSPointingDeviceType::Pen.0);
432
433/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscursorpointingdevice?language=objc)
434pub static NSCursorPointingDevice: NSPointingDeviceType =
435    NSPointingDeviceType(NSPointingDeviceType::Cursor.0);
436
437/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nseraserpointingdevice?language=objc)
438pub static NSEraserPointingDevice: NSPointingDeviceType =
439    NSPointingDeviceType(NSPointingDeviceType::Eraser.0);
440
441/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nseventbuttonmask?language=objc)
442// NS_OPTIONS
443#[repr(transparent)]
444#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
445pub struct NSEventButtonMask(pub NSUInteger);
446bitflags::bitflags! {
447    impl NSEventButtonMask: NSUInteger {
448        #[doc(alias = "NSEventButtonMaskPenTip")]
449        const PenTip = 1;
450        #[doc(alias = "NSEventButtonMaskPenLowerSide")]
451        const PenLowerSide = 2;
452        #[doc(alias = "NSEventButtonMaskPenUpperSide")]
453        const PenUpperSide = 4;
454    }
455}
456
457unsafe impl Encode for NSEventButtonMask {
458    const ENCODING: Encoding = NSUInteger::ENCODING;
459}
460
461unsafe impl RefEncode for NSEventButtonMask {
462    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
463}
464
465/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspentipmask?language=objc)
466pub static NSPenTipMask: NSEventButtonMask = NSEventButtonMask(NSEventButtonMask::PenTip.0);
467
468/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspenlowersidemask?language=objc)
469pub static NSPenLowerSideMask: NSEventButtonMask =
470    NSEventButtonMask(NSEventButtonMask::PenLowerSide.0);
471
472/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspenuppersidemask?language=objc)
473pub static NSPenUpperSideMask: NSEventButtonMask =
474    NSEventButtonMask(NSEventButtonMask::PenUpperSide.0);
475
476/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nseventphase?language=objc)
477// NS_OPTIONS
478#[repr(transparent)]
479#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
480pub struct NSEventPhase(pub NSUInteger);
481bitflags::bitflags! {
482    impl NSEventPhase: NSUInteger {
483        #[doc(alias = "NSEventPhaseNone")]
484        const None = 0;
485        #[doc(alias = "NSEventPhaseBegan")]
486        const Began = 0x1<<0;
487        #[doc(alias = "NSEventPhaseStationary")]
488        const Stationary = 0x1<<1;
489        #[doc(alias = "NSEventPhaseChanged")]
490        const Changed = 0x1<<2;
491        #[doc(alias = "NSEventPhaseEnded")]
492        const Ended = 0x1<<3;
493        #[doc(alias = "NSEventPhaseCancelled")]
494        const Cancelled = 0x1<<4;
495        #[doc(alias = "NSEventPhaseMayBegin")]
496        const MayBegin = 0x1<<5;
497    }
498}
499
500unsafe impl Encode for NSEventPhase {
501    const ENCODING: Encoding = NSUInteger::ENCODING;
502}
503
504unsafe impl RefEncode for NSEventPhase {
505    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
506}
507
508/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nseventgestureaxis?language=objc)
509// NS_ENUM
510#[repr(transparent)]
511#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
512pub struct NSEventGestureAxis(pub NSInteger);
513impl NSEventGestureAxis {
514    #[doc(alias = "NSEventGestureAxisNone")]
515    pub const None: Self = Self(0);
516    #[doc(alias = "NSEventGestureAxisHorizontal")]
517    pub const Horizontal: Self = Self(1);
518    #[doc(alias = "NSEventGestureAxisVertical")]
519    pub const Vertical: Self = Self(2);
520}
521
522unsafe impl Encode for NSEventGestureAxis {
523    const ENCODING: Encoding = NSInteger::ENCODING;
524}
525
526unsafe impl RefEncode for NSEventGestureAxis {
527    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
528}
529
530/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nseventswipetrackingoptions?language=objc)
531// NS_OPTIONS
532#[repr(transparent)]
533#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
534pub struct NSEventSwipeTrackingOptions(pub NSUInteger);
535bitflags::bitflags! {
536    impl NSEventSwipeTrackingOptions: NSUInteger {
537        #[doc(alias = "NSEventSwipeTrackingLockDirection")]
538        const LockDirection = 0x1<<0;
539        #[doc(alias = "NSEventSwipeTrackingClampGestureAmount")]
540        const ClampGestureAmount = 0x1<<1;
541    }
542}
543
544unsafe impl Encode for NSEventSwipeTrackingOptions {
545    const ENCODING: Encoding = NSUInteger::ENCODING;
546}
547
548unsafe impl RefEncode for NSEventSwipeTrackingOptions {
549    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
550}
551
552/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nseventsubtype?language=objc)
553// NS_ENUM
554#[repr(transparent)]
555#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
556pub struct NSEventSubtype(pub c_short);
557impl NSEventSubtype {
558    #[doc(alias = "NSEventSubtypeWindowExposed")]
559    pub const WindowExposed: Self = Self(0);
560    #[doc(alias = "NSEventSubtypeApplicationActivated")]
561    pub const ApplicationActivated: Self = Self(1);
562    #[doc(alias = "NSEventSubtypeApplicationDeactivated")]
563    pub const ApplicationDeactivated: Self = Self(2);
564    #[doc(alias = "NSEventSubtypeWindowMoved")]
565    pub const WindowMoved: Self = Self(4);
566    #[doc(alias = "NSEventSubtypeScreenChanged")]
567    pub const ScreenChanged: Self = Self(8);
568    #[doc(alias = "NSEventSubtypePowerOff")]
569    pub const PowerOff: Self = Self(1);
570    #[doc(alias = "NSEventSubtypeMouseEvent")]
571    pub const MouseEvent: Self = Self(0);
572    #[doc(alias = "NSEventSubtypeTabletPoint")]
573    pub const TabletPoint: Self = Self(1);
574    #[doc(alias = "NSEventSubtypeTabletProximity")]
575    pub const TabletProximity: Self = Self(2);
576    #[doc(alias = "NSEventSubtypeTouch")]
577    pub const Touch: Self = Self(3);
578}
579
580unsafe impl Encode for NSEventSubtype {
581    const ENCODING: Encoding = c_short::ENCODING;
582}
583
584unsafe impl RefEncode for NSEventSubtype {
585    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
586}
587
588/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nswindowexposedeventtype?language=objc)
589pub static NSWindowExposedEventType: NSEventSubtype =
590    NSEventSubtype(NSEventSubtype::WindowExposed.0);
591
592/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationactivatedeventtype?language=objc)
593pub static NSApplicationActivatedEventType: NSEventSubtype =
594    NSEventSubtype(NSEventSubtype::ApplicationActivated.0);
595
596/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsapplicationdeactivatedeventtype?language=objc)
597pub static NSApplicationDeactivatedEventType: NSEventSubtype =
598    NSEventSubtype(NSEventSubtype::ApplicationDeactivated.0);
599
600/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nswindowmovedeventtype?language=objc)
601pub static NSWindowMovedEventType: NSEventSubtype = NSEventSubtype(NSEventSubtype::WindowMoved.0);
602
603/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsscreenchangedeventtype?language=objc)
604pub static NSScreenChangedEventType: NSEventSubtype =
605    NSEventSubtype(NSEventSubtype::ScreenChanged.0);
606
607/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsawteventtype?language=objc)
608pub static NSAWTEventType: NSEventSubtype = NSEventSubtype(16);
609
610/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspoweroffeventtype?language=objc)
611pub static NSPowerOffEventType: NSEventSubtype = NSEventSubtype(NSEventSubtype::PowerOff.0);
612
613/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsmouseeventsubtype?language=objc)
614pub static NSMouseEventSubtype: NSEventSubtype = NSEventSubtype(NSEventSubtype::MouseEvent.0);
615
616/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstabletpointeventsubtype?language=objc)
617pub static NSTabletPointEventSubtype: NSEventSubtype =
618    NSEventSubtype(NSEventSubtype::TabletPoint.0);
619
620/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstabletproximityeventsubtype?language=objc)
621pub static NSTabletProximityEventSubtype: NSEventSubtype =
622    NSEventSubtype(NSEventSubtype::TabletProximity.0);
623
624/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstoucheventsubtype?language=objc)
625pub static NSTouchEventSubtype: NSEventSubtype = NSEventSubtype(NSEventSubtype::Touch.0);
626
627/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspressurebehavior?language=objc)
628// NS_ENUM
629#[repr(transparent)]
630#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
631pub struct NSPressureBehavior(pub NSInteger);
632impl NSPressureBehavior {
633    #[doc(alias = "NSPressureBehaviorUnknown")]
634    pub const Unknown: Self = Self(-1);
635    #[doc(alias = "NSPressureBehaviorPrimaryDefault")]
636    pub const PrimaryDefault: Self = Self(0);
637    #[doc(alias = "NSPressureBehaviorPrimaryClick")]
638    pub const PrimaryClick: Self = Self(1);
639    #[doc(alias = "NSPressureBehaviorPrimaryGeneric")]
640    pub const PrimaryGeneric: Self = Self(2);
641    #[doc(alias = "NSPressureBehaviorPrimaryAccelerator")]
642    pub const PrimaryAccelerator: Self = Self(3);
643    #[doc(alias = "NSPressureBehaviorPrimaryDeepClick")]
644    pub const PrimaryDeepClick: Self = Self(5);
645    #[doc(alias = "NSPressureBehaviorPrimaryDeepDrag")]
646    pub const PrimaryDeepDrag: Self = Self(6);
647}
648
649unsafe impl Encode for NSPressureBehavior {
650    const ENCODING: Encoding = NSInteger::ENCODING;
651}
652
653unsafe impl RefEncode for NSPressureBehavior {
654    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
655}
656
657extern_class!(
658    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsevent?language=objc)
659    #[unsafe(super(NSObject))]
660    #[derive(Debug, PartialEq, Eq, Hash)]
661    pub struct NSEvent;
662);
663
664extern_conformance!(
665    unsafe impl NSCoding for NSEvent {}
666);
667
668extern_conformance!(
669    unsafe impl NSCopying for NSEvent {}
670);
671
672unsafe impl CopyingHelper for NSEvent {
673    type Result = Self;
674}
675
676extern_conformance!(
677    unsafe impl NSObjectProtocol for NSEvent {}
678);
679
680impl NSEvent {
681    extern_methods!(
682        #[unsafe(method(type))]
683        #[unsafe(method_family = none)]
684        pub unsafe fn r#type(&self) -> NSEventType;
685
686        #[unsafe(method(modifierFlags))]
687        #[unsafe(method_family = none)]
688        pub unsafe fn modifierFlags(&self) -> NSEventModifierFlags;
689
690        #[unsafe(method(timestamp))]
691        #[unsafe(method_family = none)]
692        pub unsafe fn timestamp(&self) -> NSTimeInterval;
693
694        #[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
695        #[unsafe(method(window))]
696        #[unsafe(method_family = none)]
697        pub unsafe fn window(&self, mtm: MainThreadMarker) -> Option<Retained<NSWindow>>;
698
699        #[unsafe(method(windowNumber))]
700        #[unsafe(method_family = none)]
701        pub unsafe fn windowNumber(&self) -> NSInteger;
702
703        #[cfg(feature = "NSGraphicsContext")]
704        #[deprecated = "This method always returns nil. If you need access to the current drawing context, use [NSGraphicsContext currentContext] inside of a draw operation."]
705        #[unsafe(method(context))]
706        #[unsafe(method_family = none)]
707        pub unsafe fn context(&self) -> Option<Retained<NSGraphicsContext>>;
708
709        #[unsafe(method(clickCount))]
710        #[unsafe(method_family = none)]
711        pub unsafe fn clickCount(&self) -> NSInteger;
712
713        #[unsafe(method(buttonNumber))]
714        #[unsafe(method_family = none)]
715        pub unsafe fn buttonNumber(&self) -> NSInteger;
716
717        #[unsafe(method(eventNumber))]
718        #[unsafe(method_family = none)]
719        pub unsafe fn eventNumber(&self) -> NSInteger;
720
721        #[unsafe(method(pressure))]
722        #[unsafe(method_family = none)]
723        pub unsafe fn pressure(&self) -> c_float;
724
725        #[unsafe(method(locationInWindow))]
726        #[unsafe(method_family = none)]
727        pub unsafe fn locationInWindow(&self) -> NSPoint;
728
729        #[cfg(feature = "objc2-core-foundation")]
730        #[unsafe(method(deltaX))]
731        #[unsafe(method_family = none)]
732        pub unsafe fn deltaX(&self) -> CGFloat;
733
734        #[cfg(feature = "objc2-core-foundation")]
735        #[unsafe(method(deltaY))]
736        #[unsafe(method_family = none)]
737        pub unsafe fn deltaY(&self) -> CGFloat;
738
739        #[cfg(feature = "objc2-core-foundation")]
740        #[unsafe(method(deltaZ))]
741        #[unsafe(method_family = none)]
742        pub unsafe fn deltaZ(&self) -> CGFloat;
743
744        #[unsafe(method(hasPreciseScrollingDeltas))]
745        #[unsafe(method_family = none)]
746        pub unsafe fn hasPreciseScrollingDeltas(&self) -> bool;
747
748        #[cfg(feature = "objc2-core-foundation")]
749        #[unsafe(method(scrollingDeltaX))]
750        #[unsafe(method_family = none)]
751        pub unsafe fn scrollingDeltaX(&self) -> CGFloat;
752
753        #[cfg(feature = "objc2-core-foundation")]
754        #[unsafe(method(scrollingDeltaY))]
755        #[unsafe(method_family = none)]
756        pub unsafe fn scrollingDeltaY(&self) -> CGFloat;
757
758        #[unsafe(method(momentumPhase))]
759        #[unsafe(method_family = none)]
760        pub unsafe fn momentumPhase(&self) -> NSEventPhase;
761
762        #[unsafe(method(isDirectionInvertedFromDevice))]
763        #[unsafe(method_family = none)]
764        pub unsafe fn isDirectionInvertedFromDevice(&self) -> bool;
765
766        #[unsafe(method(characters))]
767        #[unsafe(method_family = none)]
768        pub unsafe fn characters(&self) -> Option<Retained<NSString>>;
769
770        #[unsafe(method(charactersIgnoringModifiers))]
771        #[unsafe(method_family = none)]
772        pub unsafe fn charactersIgnoringModifiers(&self) -> Option<Retained<NSString>>;
773
774        #[unsafe(method(charactersByApplyingModifiers:))]
775        #[unsafe(method_family = none)]
776        pub unsafe fn charactersByApplyingModifiers(
777            &self,
778            modifiers: NSEventModifierFlags,
779        ) -> Option<Retained<NSString>>;
780
781        #[unsafe(method(isARepeat))]
782        #[unsafe(method_family = none)]
783        pub unsafe fn isARepeat(&self) -> bool;
784
785        #[unsafe(method(keyCode))]
786        #[unsafe(method_family = none)]
787        pub unsafe fn keyCode(&self) -> c_ushort;
788
789        #[unsafe(method(trackingNumber))]
790        #[unsafe(method_family = none)]
791        pub unsafe fn trackingNumber(&self) -> NSInteger;
792
793        #[unsafe(method(userData))]
794        #[unsafe(method_family = none)]
795        pub unsafe fn userData(&self) -> *mut c_void;
796
797        #[cfg(feature = "NSTrackingArea")]
798        #[unsafe(method(trackingArea))]
799        #[unsafe(method_family = none)]
800        pub unsafe fn trackingArea(&self) -> Option<Retained<NSTrackingArea>>;
801
802        #[unsafe(method(subtype))]
803        #[unsafe(method_family = none)]
804        pub unsafe fn subtype(&self) -> NSEventSubtype;
805
806        #[unsafe(method(data1))]
807        #[unsafe(method_family = none)]
808        pub unsafe fn data1(&self) -> NSInteger;
809
810        #[unsafe(method(data2))]
811        #[unsafe(method_family = none)]
812        pub unsafe fn data2(&self) -> NSInteger;
813
814        #[unsafe(method(eventRef))]
815        #[unsafe(method_family = none)]
816        pub unsafe fn eventRef(&self) -> *const c_void;
817
818        #[unsafe(method(eventWithEventRef:))]
819        #[unsafe(method_family = none)]
820        pub unsafe fn eventWithEventRef(event_ref: NonNull<c_void>) -> Option<Retained<NSEvent>>;
821
822        #[cfg(feature = "objc2-core-graphics")]
823        #[cfg(target_vendor = "apple")]
824        #[unsafe(method(CGEvent))]
825        #[unsafe(method_family = none)]
826        pub unsafe fn CGEvent(&self) -> Option<Retained<CGEvent>>;
827
828        #[cfg(feature = "objc2-core-graphics")]
829        #[cfg(target_vendor = "apple")]
830        #[unsafe(method(eventWithCGEvent:))]
831        #[unsafe(method_family = none)]
832        pub unsafe fn eventWithCGEvent(cg_event: &CGEvent) -> Option<Retained<NSEvent>>;
833
834        #[unsafe(method(isMouseCoalescingEnabled))]
835        #[unsafe(method_family = none)]
836        pub unsafe fn isMouseCoalescingEnabled() -> bool;
837
838        /// Setter for [`isMouseCoalescingEnabled`][Self::isMouseCoalescingEnabled].
839        #[unsafe(method(setMouseCoalescingEnabled:))]
840        #[unsafe(method_family = none)]
841        pub unsafe fn setMouseCoalescingEnabled(mouse_coalescing_enabled: bool);
842
843        #[cfg(feature = "objc2-core-foundation")]
844        #[unsafe(method(magnification))]
845        #[unsafe(method_family = none)]
846        pub unsafe fn magnification(&self) -> CGFloat;
847
848        #[unsafe(method(deviceID))]
849        #[unsafe(method_family = none)]
850        pub unsafe fn deviceID(&self) -> NSUInteger;
851
852        #[unsafe(method(rotation))]
853        #[unsafe(method_family = none)]
854        pub unsafe fn rotation(&self) -> c_float;
855
856        #[unsafe(method(absoluteX))]
857        #[unsafe(method_family = none)]
858        pub unsafe fn absoluteX(&self) -> NSInteger;
859
860        #[unsafe(method(absoluteY))]
861        #[unsafe(method_family = none)]
862        pub unsafe fn absoluteY(&self) -> NSInteger;
863
864        #[unsafe(method(absoluteZ))]
865        #[unsafe(method_family = none)]
866        pub unsafe fn absoluteZ(&self) -> NSInteger;
867
868        #[unsafe(method(buttonMask))]
869        #[unsafe(method_family = none)]
870        pub unsafe fn buttonMask(&self) -> NSEventButtonMask;
871
872        #[unsafe(method(tilt))]
873        #[unsafe(method_family = none)]
874        pub unsafe fn tilt(&self) -> NSPoint;
875
876        #[unsafe(method(tangentialPressure))]
877        #[unsafe(method_family = none)]
878        pub unsafe fn tangentialPressure(&self) -> c_float;
879
880        #[unsafe(method(vendorDefined))]
881        #[unsafe(method_family = none)]
882        pub unsafe fn vendorDefined(&self) -> Retained<AnyObject>;
883
884        #[unsafe(method(vendorID))]
885        #[unsafe(method_family = none)]
886        pub unsafe fn vendorID(&self) -> NSUInteger;
887
888        #[unsafe(method(tabletID))]
889        #[unsafe(method_family = none)]
890        pub unsafe fn tabletID(&self) -> NSUInteger;
891
892        #[unsafe(method(pointingDeviceID))]
893        #[unsafe(method_family = none)]
894        pub unsafe fn pointingDeviceID(&self) -> NSUInteger;
895
896        #[unsafe(method(systemTabletID))]
897        #[unsafe(method_family = none)]
898        pub unsafe fn systemTabletID(&self) -> NSUInteger;
899
900        #[unsafe(method(vendorPointingDeviceType))]
901        #[unsafe(method_family = none)]
902        pub unsafe fn vendorPointingDeviceType(&self) -> NSUInteger;
903
904        #[unsafe(method(pointingDeviceSerialNumber))]
905        #[unsafe(method_family = none)]
906        pub unsafe fn pointingDeviceSerialNumber(&self) -> NSUInteger;
907
908        #[unsafe(method(uniqueID))]
909        #[unsafe(method_family = none)]
910        pub unsafe fn uniqueID(&self) -> c_ulonglong;
911
912        #[unsafe(method(capabilityMask))]
913        #[unsafe(method_family = none)]
914        pub unsafe fn capabilityMask(&self) -> NSUInteger;
915
916        #[unsafe(method(pointingDeviceType))]
917        #[unsafe(method_family = none)]
918        pub unsafe fn pointingDeviceType(&self) -> NSPointingDeviceType;
919
920        #[unsafe(method(isEnteringProximity))]
921        #[unsafe(method_family = none)]
922        pub unsafe fn isEnteringProximity(&self) -> bool;
923
924        #[cfg(all(feature = "NSResponder", feature = "NSTouch", feature = "NSView"))]
925        #[unsafe(method(touchesMatchingPhase:inView:))]
926        #[unsafe(method_family = none)]
927        pub unsafe fn touchesMatchingPhase_inView(
928            &self,
929            phase: NSTouchPhase,
930            view: Option<&NSView>,
931        ) -> Retained<NSSet<NSTouch>>;
932
933        #[cfg(feature = "NSTouch")]
934        #[unsafe(method(allTouches))]
935        #[unsafe(method_family = none)]
936        pub unsafe fn allTouches(&self) -> Retained<NSSet<NSTouch>>;
937
938        #[cfg(all(feature = "NSResponder", feature = "NSTouch", feature = "NSView"))]
939        #[unsafe(method(touchesForView:))]
940        #[unsafe(method_family = none)]
941        pub unsafe fn touchesForView(&self, view: &NSView) -> Retained<NSSet<NSTouch>>;
942
943        #[cfg(feature = "NSTouch")]
944        #[unsafe(method(coalescedTouchesForTouch:))]
945        #[unsafe(method_family = none)]
946        pub unsafe fn coalescedTouchesForTouch(
947            &self,
948            touch: &NSTouch,
949        ) -> Retained<NSArray<NSTouch>>;
950
951        #[unsafe(method(phase))]
952        #[unsafe(method_family = none)]
953        pub unsafe fn phase(&self) -> NSEventPhase;
954
955        #[unsafe(method(stage))]
956        #[unsafe(method_family = none)]
957        pub unsafe fn stage(&self) -> NSInteger;
958
959        #[cfg(feature = "objc2-core-foundation")]
960        #[unsafe(method(stageTransition))]
961        #[unsafe(method_family = none)]
962        pub unsafe fn stageTransition(&self) -> CGFloat;
963
964        #[unsafe(method(associatedEventsMask))]
965        #[unsafe(method_family = none)]
966        pub unsafe fn associatedEventsMask(&self) -> NSEventMask;
967
968        #[unsafe(method(pressureBehavior))]
969        #[unsafe(method_family = none)]
970        pub unsafe fn pressureBehavior(&self) -> NSPressureBehavior;
971
972        #[unsafe(method(isSwipeTrackingFromScrollEventsEnabled))]
973        #[unsafe(method_family = none)]
974        pub unsafe fn isSwipeTrackingFromScrollEventsEnabled() -> bool;
975
976        #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
977        #[unsafe(method(trackSwipeEventWithOptions:dampenAmountThresholdMin:max:usingHandler:))]
978        #[unsafe(method_family = none)]
979        pub unsafe fn trackSwipeEventWithOptions_dampenAmountThresholdMin_max_usingHandler(
980            &self,
981            options: NSEventSwipeTrackingOptions,
982            min_dampen_threshold: CGFloat,
983            max_dampen_threshold: CGFloat,
984            tracking_handler: &block2::DynBlock<dyn Fn(CGFloat, NSEventPhase, Bool, NonNull<Bool>)>,
985        );
986
987        #[unsafe(method(startPeriodicEventsAfterDelay:withPeriod:))]
988        #[unsafe(method_family = none)]
989        pub unsafe fn startPeriodicEventsAfterDelay_withPeriod(
990            delay: NSTimeInterval,
991            period: NSTimeInterval,
992        );
993
994        #[unsafe(method(stopPeriodicEvents))]
995        #[unsafe(method_family = none)]
996        pub unsafe fn stopPeriodicEvents();
997
998        #[cfg(feature = "NSGraphicsContext")]
999        #[unsafe(method(mouseEventWithType:location:modifierFlags:timestamp:windowNumber:context:eventNumber:clickCount:pressure:))]
1000        #[unsafe(method_family = none)]
1001        pub unsafe fn mouseEventWithType_location_modifierFlags_timestamp_windowNumber_context_eventNumber_clickCount_pressure(
1002            r#type: NSEventType,
1003            location: NSPoint,
1004            flags: NSEventModifierFlags,
1005            time: NSTimeInterval,
1006            w_num: NSInteger,
1007            unused_pass_nil: Option<&NSGraphicsContext>,
1008            e_num: NSInteger,
1009            c_num: NSInteger,
1010            pressure: c_float,
1011        ) -> Option<Retained<NSEvent>>;
1012
1013        #[cfg(feature = "NSGraphicsContext")]
1014        #[unsafe(method(keyEventWithType:location:modifierFlags:timestamp:windowNumber:context:characters:charactersIgnoringModifiers:isARepeat:keyCode:))]
1015        #[unsafe(method_family = none)]
1016        pub unsafe fn keyEventWithType_location_modifierFlags_timestamp_windowNumber_context_characters_charactersIgnoringModifiers_isARepeat_keyCode(
1017            r#type: NSEventType,
1018            location: NSPoint,
1019            flags: NSEventModifierFlags,
1020            time: NSTimeInterval,
1021            w_num: NSInteger,
1022            unused_pass_nil: Option<&NSGraphicsContext>,
1023            keys: &NSString,
1024            ukeys: &NSString,
1025            flag: bool,
1026            code: c_ushort,
1027        ) -> Option<Retained<NSEvent>>;
1028
1029        #[cfg(feature = "NSGraphicsContext")]
1030        #[unsafe(method(enterExitEventWithType:location:modifierFlags:timestamp:windowNumber:context:eventNumber:trackingNumber:userData:))]
1031        #[unsafe(method_family = none)]
1032        pub unsafe fn enterExitEventWithType_location_modifierFlags_timestamp_windowNumber_context_eventNumber_trackingNumber_userData(
1033            r#type: NSEventType,
1034            location: NSPoint,
1035            flags: NSEventModifierFlags,
1036            time: NSTimeInterval,
1037            w_num: NSInteger,
1038            unused_pass_nil: Option<&NSGraphicsContext>,
1039            e_num: NSInteger,
1040            t_num: NSInteger,
1041            data: *mut c_void,
1042        ) -> Option<Retained<NSEvent>>;
1043
1044        #[cfg(feature = "NSGraphicsContext")]
1045        #[unsafe(method(otherEventWithType:location:modifierFlags:timestamp:windowNumber:context:subtype:data1:data2:))]
1046        #[unsafe(method_family = none)]
1047        pub unsafe fn otherEventWithType_location_modifierFlags_timestamp_windowNumber_context_subtype_data1_data2(
1048            r#type: NSEventType,
1049            location: NSPoint,
1050            flags: NSEventModifierFlags,
1051            time: NSTimeInterval,
1052            w_num: NSInteger,
1053            unused_pass_nil: Option<&NSGraphicsContext>,
1054            subtype: c_short,
1055            d1: NSInteger,
1056            d2: NSInteger,
1057        ) -> Option<Retained<NSEvent>>;
1058
1059        #[unsafe(method(mouseLocation))]
1060        #[unsafe(method_family = none)]
1061        pub unsafe fn mouseLocation() -> NSPoint;
1062
1063        #[unsafe(method(modifierFlags))]
1064        #[unsafe(method_family = none)]
1065        pub unsafe fn modifierFlags_class() -> NSEventModifierFlags;
1066
1067        #[unsafe(method(pressedMouseButtons))]
1068        #[unsafe(method_family = none)]
1069        pub unsafe fn pressedMouseButtons() -> NSUInteger;
1070
1071        #[unsafe(method(doubleClickInterval))]
1072        #[unsafe(method_family = none)]
1073        pub unsafe fn doubleClickInterval() -> NSTimeInterval;
1074
1075        #[unsafe(method(keyRepeatDelay))]
1076        #[unsafe(method_family = none)]
1077        pub unsafe fn keyRepeatDelay() -> NSTimeInterval;
1078
1079        #[unsafe(method(keyRepeatInterval))]
1080        #[unsafe(method_family = none)]
1081        pub unsafe fn keyRepeatInterval() -> NSTimeInterval;
1082
1083        #[cfg(feature = "block2")]
1084        #[unsafe(method(addGlobalMonitorForEventsMatchingMask:handler:))]
1085        #[unsafe(method_family = none)]
1086        pub unsafe fn addGlobalMonitorForEventsMatchingMask_handler(
1087            mask: NSEventMask,
1088            block: &block2::DynBlock<dyn Fn(NonNull<NSEvent>)>,
1089        ) -> Option<Retained<AnyObject>>;
1090
1091        #[cfg(feature = "block2")]
1092        #[unsafe(method(addLocalMonitorForEventsMatchingMask:handler:))]
1093        #[unsafe(method_family = none)]
1094        pub unsafe fn addLocalMonitorForEventsMatchingMask_handler(
1095            mask: NSEventMask,
1096            block: &block2::DynBlock<dyn Fn(NonNull<NSEvent>) -> *mut NSEvent>,
1097        ) -> Option<Retained<AnyObject>>;
1098
1099        #[unsafe(method(removeMonitor:))]
1100        #[unsafe(method_family = none)]
1101        pub unsafe fn removeMonitor(event_monitor: &AnyObject);
1102    );
1103}
1104
1105/// Methods declared on superclass `NSObject`.
1106impl NSEvent {
1107    extern_methods!(
1108        #[unsafe(method(init))]
1109        #[unsafe(method_family = init)]
1110        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1111
1112        #[unsafe(method(new))]
1113        #[unsafe(method_family = new)]
1114        pub unsafe fn new() -> Retained<Self>;
1115    );
1116}
1117
1118/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsuparrowfunctionkey?language=objc)
1119pub const NSUpArrowFunctionKey: c_uint = 0xF700;
1120/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdownarrowfunctionkey?language=objc)
1121pub const NSDownArrowFunctionKey: c_uint = 0xF701;
1122/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsleftarrowfunctionkey?language=objc)
1123pub const NSLeftArrowFunctionKey: c_uint = 0xF702;
1124/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsrightarrowfunctionkey?language=objc)
1125pub const NSRightArrowFunctionKey: c_uint = 0xF703;
1126/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf1functionkey?language=objc)
1127pub const NSF1FunctionKey: c_uint = 0xF704;
1128/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf2functionkey?language=objc)
1129pub const NSF2FunctionKey: c_uint = 0xF705;
1130/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf3functionkey?language=objc)
1131pub const NSF3FunctionKey: c_uint = 0xF706;
1132/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf4functionkey?language=objc)
1133pub const NSF4FunctionKey: c_uint = 0xF707;
1134/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf5functionkey?language=objc)
1135pub const NSF5FunctionKey: c_uint = 0xF708;
1136/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf6functionkey?language=objc)
1137pub const NSF6FunctionKey: c_uint = 0xF709;
1138/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf7functionkey?language=objc)
1139pub const NSF7FunctionKey: c_uint = 0xF70A;
1140/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf8functionkey?language=objc)
1141pub const NSF8FunctionKey: c_uint = 0xF70B;
1142/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf9functionkey?language=objc)
1143pub const NSF9FunctionKey: c_uint = 0xF70C;
1144/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf10functionkey?language=objc)
1145pub const NSF10FunctionKey: c_uint = 0xF70D;
1146/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf11functionkey?language=objc)
1147pub const NSF11FunctionKey: c_uint = 0xF70E;
1148/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf12functionkey?language=objc)
1149pub const NSF12FunctionKey: c_uint = 0xF70F;
1150/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf13functionkey?language=objc)
1151pub const NSF13FunctionKey: c_uint = 0xF710;
1152/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf14functionkey?language=objc)
1153pub const NSF14FunctionKey: c_uint = 0xF711;
1154/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf15functionkey?language=objc)
1155pub const NSF15FunctionKey: c_uint = 0xF712;
1156/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf16functionkey?language=objc)
1157pub const NSF16FunctionKey: c_uint = 0xF713;
1158/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf17functionkey?language=objc)
1159pub const NSF17FunctionKey: c_uint = 0xF714;
1160/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf18functionkey?language=objc)
1161pub const NSF18FunctionKey: c_uint = 0xF715;
1162/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf19functionkey?language=objc)
1163pub const NSF19FunctionKey: c_uint = 0xF716;
1164/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf20functionkey?language=objc)
1165pub const NSF20FunctionKey: c_uint = 0xF717;
1166/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf21functionkey?language=objc)
1167pub const NSF21FunctionKey: c_uint = 0xF718;
1168/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf22functionkey?language=objc)
1169pub const NSF22FunctionKey: c_uint = 0xF719;
1170/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf23functionkey?language=objc)
1171pub const NSF23FunctionKey: c_uint = 0xF71A;
1172/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf24functionkey?language=objc)
1173pub const NSF24FunctionKey: c_uint = 0xF71B;
1174/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf25functionkey?language=objc)
1175pub const NSF25FunctionKey: c_uint = 0xF71C;
1176/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf26functionkey?language=objc)
1177pub const NSF26FunctionKey: c_uint = 0xF71D;
1178/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf27functionkey?language=objc)
1179pub const NSF27FunctionKey: c_uint = 0xF71E;
1180/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf28functionkey?language=objc)
1181pub const NSF28FunctionKey: c_uint = 0xF71F;
1182/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf29functionkey?language=objc)
1183pub const NSF29FunctionKey: c_uint = 0xF720;
1184/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf30functionkey?language=objc)
1185pub const NSF30FunctionKey: c_uint = 0xF721;
1186/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf31functionkey?language=objc)
1187pub const NSF31FunctionKey: c_uint = 0xF722;
1188/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf32functionkey?language=objc)
1189pub const NSF32FunctionKey: c_uint = 0xF723;
1190/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf33functionkey?language=objc)
1191pub const NSF33FunctionKey: c_uint = 0xF724;
1192/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf34functionkey?language=objc)
1193pub const NSF34FunctionKey: c_uint = 0xF725;
1194/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsf35functionkey?language=objc)
1195pub const NSF35FunctionKey: c_uint = 0xF726;
1196/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsinsertfunctionkey?language=objc)
1197pub const NSInsertFunctionKey: c_uint = 0xF727;
1198/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdeletefunctionkey?language=objc)
1199pub const NSDeleteFunctionKey: c_uint = 0xF728;
1200/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nshomefunctionkey?language=objc)
1201pub const NSHomeFunctionKey: c_uint = 0xF729;
1202/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsbeginfunctionkey?language=objc)
1203pub const NSBeginFunctionKey: c_uint = 0xF72A;
1204/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsendfunctionkey?language=objc)
1205pub const NSEndFunctionKey: c_uint = 0xF72B;
1206/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspageupfunctionkey?language=objc)
1207pub const NSPageUpFunctionKey: c_uint = 0xF72C;
1208/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspagedownfunctionkey?language=objc)
1209pub const NSPageDownFunctionKey: c_uint = 0xF72D;
1210/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsprintscreenfunctionkey?language=objc)
1211pub const NSPrintScreenFunctionKey: c_uint = 0xF72E;
1212/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsscrolllockfunctionkey?language=objc)
1213pub const NSScrollLockFunctionKey: c_uint = 0xF72F;
1214/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspausefunctionkey?language=objc)
1215pub const NSPauseFunctionKey: c_uint = 0xF730;
1216/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssysreqfunctionkey?language=objc)
1217pub const NSSysReqFunctionKey: c_uint = 0xF731;
1218/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsbreakfunctionkey?language=objc)
1219pub const NSBreakFunctionKey: c_uint = 0xF732;
1220/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsresetfunctionkey?language=objc)
1221pub const NSResetFunctionKey: c_uint = 0xF733;
1222/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsstopfunctionkey?language=objc)
1223pub const NSStopFunctionKey: c_uint = 0xF734;
1224/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsmenufunctionkey?language=objc)
1225pub const NSMenuFunctionKey: c_uint = 0xF735;
1226/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsuserfunctionkey?language=objc)
1227pub const NSUserFunctionKey: c_uint = 0xF736;
1228/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssystemfunctionkey?language=objc)
1229pub const NSSystemFunctionKey: c_uint = 0xF737;
1230/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsprintfunctionkey?language=objc)
1231pub const NSPrintFunctionKey: c_uint = 0xF738;
1232/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsclearlinefunctionkey?language=objc)
1233pub const NSClearLineFunctionKey: c_uint = 0xF739;
1234/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscleardisplayfunctionkey?language=objc)
1235pub const NSClearDisplayFunctionKey: c_uint = 0xF73A;
1236/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsinsertlinefunctionkey?language=objc)
1237pub const NSInsertLineFunctionKey: c_uint = 0xF73B;
1238/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdeletelinefunctionkey?language=objc)
1239pub const NSDeleteLineFunctionKey: c_uint = 0xF73C;
1240/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsinsertcharfunctionkey?language=objc)
1241pub const NSInsertCharFunctionKey: c_uint = 0xF73D;
1242/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdeletecharfunctionkey?language=objc)
1243pub const NSDeleteCharFunctionKey: c_uint = 0xF73E;
1244/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsprevfunctionkey?language=objc)
1245pub const NSPrevFunctionKey: c_uint = 0xF73F;
1246/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsnextfunctionkey?language=objc)
1247pub const NSNextFunctionKey: c_uint = 0xF740;
1248/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsselectfunctionkey?language=objc)
1249pub const NSSelectFunctionKey: c_uint = 0xF741;
1250/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsexecutefunctionkey?language=objc)
1251pub const NSExecuteFunctionKey: c_uint = 0xF742;
1252/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsundofunctionkey?language=objc)
1253pub const NSUndoFunctionKey: c_uint = 0xF743;
1254/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsredofunctionkey?language=objc)
1255pub const NSRedoFunctionKey: c_uint = 0xF744;
1256/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfindfunctionkey?language=objc)
1257pub const NSFindFunctionKey: c_uint = 0xF745;
1258/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nshelpfunctionkey?language=objc)
1259pub const NSHelpFunctionKey: c_uint = 0xF746;
1260/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsmodeswitchfunctionkey?language=objc)
1261pub const NSModeSwitchFunctionKey: c_uint = 0xF747;