1use 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#[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 #[doc(alias = "NSEventTypeMouseCancelled")]
90 pub const MouseCancelled: Self = Self(40);
91}
92
93unsafe impl Encode for NSEventType {
94 const ENCODING: Encoding = NSUInteger::ENCODING;
95}
96
97unsafe impl RefEncode for NSEventType {
98 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
99}
100
101#[deprecated]
103pub static NSLeftMouseDown: NSEventType = NSEventType(NSEventType::LeftMouseDown.0);
104
105#[deprecated]
107pub static NSLeftMouseUp: NSEventType = NSEventType(NSEventType::LeftMouseUp.0);
108
109#[deprecated]
111pub static NSRightMouseDown: NSEventType = NSEventType(NSEventType::RightMouseDown.0);
112
113#[deprecated]
115pub static NSRightMouseUp: NSEventType = NSEventType(NSEventType::RightMouseUp.0);
116
117#[deprecated]
119pub static NSMouseMoved: NSEventType = NSEventType(NSEventType::MouseMoved.0);
120
121#[deprecated]
123pub static NSLeftMouseDragged: NSEventType = NSEventType(NSEventType::LeftMouseDragged.0);
124
125#[deprecated]
127pub static NSRightMouseDragged: NSEventType = NSEventType(NSEventType::RightMouseDragged.0);
128
129#[deprecated]
131pub static NSMouseEntered: NSEventType = NSEventType(NSEventType::MouseEntered.0);
132
133#[deprecated]
135pub static NSMouseExited: NSEventType = NSEventType(NSEventType::MouseExited.0);
136
137#[deprecated]
139pub static NSKeyDown: NSEventType = NSEventType(NSEventType::KeyDown.0);
140
141#[deprecated]
143pub static NSKeyUp: NSEventType = NSEventType(NSEventType::KeyUp.0);
144
145#[deprecated]
147pub static NSFlagsChanged: NSEventType = NSEventType(NSEventType::FlagsChanged.0);
148
149#[deprecated]
151pub static NSAppKitDefined: NSEventType = NSEventType(NSEventType::AppKitDefined.0);
152
153#[deprecated]
155pub static NSSystemDefined: NSEventType = NSEventType(NSEventType::SystemDefined.0);
156
157#[deprecated]
159pub static NSApplicationDefined: NSEventType = NSEventType(NSEventType::ApplicationDefined.0);
160
161#[deprecated]
163pub static NSPeriodic: NSEventType = NSEventType(NSEventType::Periodic.0);
164
165#[deprecated]
167pub static NSCursorUpdate: NSEventType = NSEventType(NSEventType::CursorUpdate.0);
168
169#[deprecated]
171pub static NSScrollWheel: NSEventType = NSEventType(NSEventType::ScrollWheel.0);
172
173#[deprecated]
175pub static NSTabletPoint: NSEventType = NSEventType(NSEventType::TabletPoint.0);
176
177#[deprecated]
179pub static NSTabletProximity: NSEventType = NSEventType(NSEventType::TabletProximity.0);
180
181#[deprecated]
183pub static NSOtherMouseDown: NSEventType = NSEventType(NSEventType::OtherMouseDown.0);
184
185#[deprecated]
187pub static NSOtherMouseUp: NSEventType = NSEventType(NSEventType::OtherMouseUp.0);
188
189#[deprecated]
191pub static NSOtherMouseDragged: NSEventType = NSEventType(NSEventType::OtherMouseDragged.0);
192
193#[repr(transparent)]
196#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
197pub struct NSEventMask(pub c_ulonglong);
198bitflags::bitflags! {
199 impl NSEventMask: c_ulonglong {
200 #[doc(alias = "NSEventMaskLeftMouseDown")]
201 const LeftMouseDown = 1<<NSEventType::LeftMouseDown.0;
202 #[doc(alias = "NSEventMaskLeftMouseUp")]
203 const LeftMouseUp = 1<<NSEventType::LeftMouseUp.0;
204 #[doc(alias = "NSEventMaskRightMouseDown")]
205 const RightMouseDown = 1<<NSEventType::RightMouseDown.0;
206 #[doc(alias = "NSEventMaskRightMouseUp")]
207 const RightMouseUp = 1<<NSEventType::RightMouseUp.0;
208 #[doc(alias = "NSEventMaskMouseMoved")]
209 const MouseMoved = 1<<NSEventType::MouseMoved.0;
210 #[doc(alias = "NSEventMaskLeftMouseDragged")]
211 const LeftMouseDragged = 1<<NSEventType::LeftMouseDragged.0;
212 #[doc(alias = "NSEventMaskRightMouseDragged")]
213 const RightMouseDragged = 1<<NSEventType::RightMouseDragged.0;
214 #[doc(alias = "NSEventMaskMouseEntered")]
215 const MouseEntered = 1<<NSEventType::MouseEntered.0;
216 #[doc(alias = "NSEventMaskMouseExited")]
217 const MouseExited = 1<<NSEventType::MouseExited.0;
218 #[doc(alias = "NSEventMaskKeyDown")]
219 const KeyDown = 1<<NSEventType::KeyDown.0;
220 #[doc(alias = "NSEventMaskKeyUp")]
221 const KeyUp = 1<<NSEventType::KeyUp.0;
222 #[doc(alias = "NSEventMaskFlagsChanged")]
223 const FlagsChanged = 1<<NSEventType::FlagsChanged.0;
224 #[doc(alias = "NSEventMaskAppKitDefined")]
225 const AppKitDefined = 1<<NSEventType::AppKitDefined.0;
226 #[doc(alias = "NSEventMaskSystemDefined")]
227 const SystemDefined = 1<<NSEventType::SystemDefined.0;
228 #[doc(alias = "NSEventMaskApplicationDefined")]
229 const ApplicationDefined = 1<<NSEventType::ApplicationDefined.0;
230 #[doc(alias = "NSEventMaskPeriodic")]
231 const Periodic = 1<<NSEventType::Periodic.0;
232 #[doc(alias = "NSEventMaskCursorUpdate")]
233 const CursorUpdate = 1<<NSEventType::CursorUpdate.0;
234 #[doc(alias = "NSEventMaskScrollWheel")]
235 const ScrollWheel = 1<<NSEventType::ScrollWheel.0;
236 #[doc(alias = "NSEventMaskTabletPoint")]
237 const TabletPoint = 1<<NSEventType::TabletPoint.0;
238 #[doc(alias = "NSEventMaskTabletProximity")]
239 const TabletProximity = 1<<NSEventType::TabletProximity.0;
240 #[doc(alias = "NSEventMaskOtherMouseDown")]
241 const OtherMouseDown = 1<<NSEventType::OtherMouseDown.0;
242 #[doc(alias = "NSEventMaskOtherMouseUp")]
243 const OtherMouseUp = 1<<NSEventType::OtherMouseUp.0;
244 #[doc(alias = "NSEventMaskOtherMouseDragged")]
245 const OtherMouseDragged = 1<<NSEventType::OtherMouseDragged.0;
246 #[doc(alias = "NSEventMaskGesture")]
247 const Gesture = 1<<NSEventType::Gesture.0;
248 #[doc(alias = "NSEventMaskMagnify")]
249 const Magnify = 1<<NSEventType::Magnify.0;
250 #[doc(alias = "NSEventMaskSwipe")]
251 const Swipe = 1<<NSEventType::Swipe.0;
252 #[doc(alias = "NSEventMaskRotate")]
253 const Rotate = 1<<NSEventType::Rotate.0;
254 #[doc(alias = "NSEventMaskBeginGesture")]
255 const BeginGesture = 1<<NSEventType::BeginGesture.0;
256 #[doc(alias = "NSEventMaskEndGesture")]
257 const EndGesture = 1<<NSEventType::EndGesture.0;
258 #[doc(alias = "NSEventMaskSmartMagnify")]
259 const SmartMagnify = 1<<NSEventType::SmartMagnify.0;
260 #[doc(alias = "NSEventMaskPressure")]
261 const Pressure = 1<<NSEventType::Pressure.0;
262 #[doc(alias = "NSEventMaskDirectTouch")]
263 const DirectTouch = 1<<NSEventType::DirectTouch.0;
264 #[doc(alias = "NSEventMaskChangeMode")]
265 const ChangeMode = 1<<NSEventType::ChangeMode.0;
266 #[doc(alias = "NSEventMaskMouseCancelled")]
267 const MouseCancelled = 1<<NSEventType::MouseCancelled.0;
268 #[doc(alias = "NSEventMaskAny")]
269 const Any = NSUIntegerMax as _;
270 }
271}
272
273unsafe impl Encode for NSEventMask {
274 const ENCODING: Encoding = c_ulonglong::ENCODING;
275}
276
277unsafe impl RefEncode for NSEventMask {
278 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
279}
280
281#[deprecated]
283pub static NSLeftMouseDownMask: NSEventMask = NSEventMask(NSEventMask::LeftMouseDown.0);
284
285#[deprecated]
287pub static NSLeftMouseUpMask: NSEventMask = NSEventMask(NSEventMask::LeftMouseUp.0);
288
289#[deprecated]
291pub static NSRightMouseDownMask: NSEventMask = NSEventMask(NSEventMask::RightMouseDown.0);
292
293#[deprecated]
295pub static NSRightMouseUpMask: NSEventMask = NSEventMask(NSEventMask::RightMouseUp.0);
296
297#[deprecated]
299pub static NSMouseMovedMask: NSEventMask = NSEventMask(NSEventMask::MouseMoved.0);
300
301#[deprecated]
303pub static NSLeftMouseDraggedMask: NSEventMask = NSEventMask(NSEventMask::LeftMouseDragged.0);
304
305#[deprecated]
307pub static NSRightMouseDraggedMask: NSEventMask = NSEventMask(NSEventMask::RightMouseDragged.0);
308
309#[deprecated]
311pub static NSMouseEnteredMask: NSEventMask = NSEventMask(NSEventMask::MouseEntered.0);
312
313#[deprecated]
315pub static NSMouseExitedMask: NSEventMask = NSEventMask(NSEventMask::MouseExited.0);
316
317#[deprecated]
319pub static NSKeyDownMask: NSEventMask = NSEventMask(NSEventMask::KeyDown.0);
320
321#[deprecated]
323pub static NSKeyUpMask: NSEventMask = NSEventMask(NSEventMask::KeyUp.0);
324
325#[deprecated]
327pub static NSFlagsChangedMask: NSEventMask = NSEventMask(NSEventMask::FlagsChanged.0);
328
329#[deprecated]
331pub static NSAppKitDefinedMask: NSEventMask = NSEventMask(NSEventMask::AppKitDefined.0);
332
333#[deprecated]
335pub static NSSystemDefinedMask: NSEventMask = NSEventMask(NSEventMask::SystemDefined.0);
336
337#[deprecated]
339pub static NSApplicationDefinedMask: NSEventMask = NSEventMask(NSEventMask::ApplicationDefined.0);
340
341#[deprecated]
343pub static NSPeriodicMask: NSEventMask = NSEventMask(NSEventMask::Periodic.0);
344
345#[deprecated]
347pub static NSCursorUpdateMask: NSEventMask = NSEventMask(NSEventMask::CursorUpdate.0);
348
349#[deprecated]
351pub static NSScrollWheelMask: NSEventMask = NSEventMask(NSEventMask::ScrollWheel.0);
352
353#[deprecated]
355pub static NSTabletPointMask: NSEventMask = NSEventMask(NSEventMask::TabletPoint.0);
356
357#[deprecated]
359pub static NSTabletProximityMask: NSEventMask = NSEventMask(NSEventMask::TabletProximity.0);
360
361#[deprecated]
363pub static NSOtherMouseDownMask: NSEventMask = NSEventMask(NSEventMask::OtherMouseDown.0);
364
365#[deprecated]
367pub static NSOtherMouseUpMask: NSEventMask = NSEventMask(NSEventMask::OtherMouseUp.0);
368
369#[deprecated]
371pub static NSOtherMouseDraggedMask: NSEventMask = NSEventMask(NSEventMask::OtherMouseDragged.0);
372
373#[deprecated]
375pub static NSAnyEventMask: NSEventMask = NSEventMask(NSUIntegerMax as _);
376
377impl NSEventMask {
378 }
380
381#[repr(transparent)]
384#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
385pub struct NSEventModifierFlags(pub NSUInteger);
386bitflags::bitflags! {
387 impl NSEventModifierFlags: NSUInteger {
388 #[doc(alias = "NSEventModifierFlagCapsLock")]
389 const CapsLock = 1<<16;
390 #[doc(alias = "NSEventModifierFlagShift")]
391 const Shift = 1<<17;
392 #[doc(alias = "NSEventModifierFlagControl")]
393 const Control = 1<<18;
394 #[doc(alias = "NSEventModifierFlagOption")]
395 const Option = 1<<19;
396 #[doc(alias = "NSEventModifierFlagCommand")]
397 const Command = 1<<20;
398 #[doc(alias = "NSEventModifierFlagNumericPad")]
399 const NumericPad = 1<<21;
400 #[doc(alias = "NSEventModifierFlagHelp")]
401 const Help = 1<<22;
402 #[doc(alias = "NSEventModifierFlagFunction")]
403 const Function = 1<<23;
404 #[doc(alias = "NSEventModifierFlagDeviceIndependentFlagsMask")]
405 const DeviceIndependentFlagsMask = 0xffff0000;
406 }
407}
408
409unsafe impl Encode for NSEventModifierFlags {
410 const ENCODING: Encoding = NSUInteger::ENCODING;
411}
412
413unsafe impl RefEncode for NSEventModifierFlags {
414 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
415}
416
417#[deprecated]
419pub static NSAlphaShiftKeyMask: NSEventModifierFlags =
420 NSEventModifierFlags(NSEventModifierFlags::CapsLock.0);
421
422#[deprecated]
424pub static NSShiftKeyMask: NSEventModifierFlags =
425 NSEventModifierFlags(NSEventModifierFlags::Shift.0);
426
427#[deprecated]
429pub static NSControlKeyMask: NSEventModifierFlags =
430 NSEventModifierFlags(NSEventModifierFlags::Control.0);
431
432#[deprecated]
434pub static NSAlternateKeyMask: NSEventModifierFlags =
435 NSEventModifierFlags(NSEventModifierFlags::Option.0);
436
437#[deprecated]
439pub static NSCommandKeyMask: NSEventModifierFlags =
440 NSEventModifierFlags(NSEventModifierFlags::Command.0);
441
442#[deprecated]
444pub static NSNumericPadKeyMask: NSEventModifierFlags =
445 NSEventModifierFlags(NSEventModifierFlags::NumericPad.0);
446
447#[deprecated]
449pub static NSHelpKeyMask: NSEventModifierFlags = NSEventModifierFlags(NSEventModifierFlags::Help.0);
450
451#[deprecated]
453pub static NSFunctionKeyMask: NSEventModifierFlags =
454 NSEventModifierFlags(NSEventModifierFlags::Function.0);
455
456#[deprecated]
458pub static NSDeviceIndependentModifierFlagsMask: NSEventModifierFlags =
459 NSEventModifierFlags(NSEventModifierFlags::DeviceIndependentFlagsMask.0);
460
461#[repr(transparent)]
464#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
465pub struct NSPointingDeviceType(pub NSUInteger);
466impl NSPointingDeviceType {
467 #[doc(alias = "NSPointingDeviceTypeUnknown")]
468 pub const Unknown: Self = Self(0);
469 #[doc(alias = "NSPointingDeviceTypePen")]
470 pub const Pen: Self = Self(1);
471 #[doc(alias = "NSPointingDeviceTypeCursor")]
472 pub const Cursor: Self = Self(2);
473 #[doc(alias = "NSPointingDeviceTypeEraser")]
474 pub const Eraser: Self = Self(3);
475}
476
477unsafe impl Encode for NSPointingDeviceType {
478 const ENCODING: Encoding = NSUInteger::ENCODING;
479}
480
481unsafe impl RefEncode for NSPointingDeviceType {
482 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
483}
484
485#[deprecated]
487pub static NSUnknownPointingDevice: NSPointingDeviceType =
488 NSPointingDeviceType(NSPointingDeviceType::Unknown.0);
489
490#[deprecated]
492pub static NSPenPointingDevice: NSPointingDeviceType =
493 NSPointingDeviceType(NSPointingDeviceType::Pen.0);
494
495#[deprecated]
497pub static NSCursorPointingDevice: NSPointingDeviceType =
498 NSPointingDeviceType(NSPointingDeviceType::Cursor.0);
499
500#[deprecated]
502pub static NSEraserPointingDevice: NSPointingDeviceType =
503 NSPointingDeviceType(NSPointingDeviceType::Eraser.0);
504
505#[repr(transparent)]
508#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
509pub struct NSEventButtonMask(pub NSUInteger);
510bitflags::bitflags! {
511 impl NSEventButtonMask: NSUInteger {
512 #[doc(alias = "NSEventButtonMaskPenTip")]
513 const PenTip = 1;
514 #[doc(alias = "NSEventButtonMaskPenLowerSide")]
515 const PenLowerSide = 2;
516 #[doc(alias = "NSEventButtonMaskPenUpperSide")]
517 const PenUpperSide = 4;
518 }
519}
520
521unsafe impl Encode for NSEventButtonMask {
522 const ENCODING: Encoding = NSUInteger::ENCODING;
523}
524
525unsafe impl RefEncode for NSEventButtonMask {
526 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
527}
528
529#[deprecated]
531pub static NSPenTipMask: NSEventButtonMask = NSEventButtonMask(NSEventButtonMask::PenTip.0);
532
533#[deprecated]
535pub static NSPenLowerSideMask: NSEventButtonMask =
536 NSEventButtonMask(NSEventButtonMask::PenLowerSide.0);
537
538#[deprecated]
540pub static NSPenUpperSideMask: NSEventButtonMask =
541 NSEventButtonMask(NSEventButtonMask::PenUpperSide.0);
542
543#[repr(transparent)]
546#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
547pub struct NSEventPhase(pub NSUInteger);
548bitflags::bitflags! {
549 impl NSEventPhase: NSUInteger {
550 #[doc(alias = "NSEventPhaseNone")]
551 const None = 0;
552 #[doc(alias = "NSEventPhaseBegan")]
553 const Began = 0x1<<0;
554 #[doc(alias = "NSEventPhaseStationary")]
555 const Stationary = 0x1<<1;
556 #[doc(alias = "NSEventPhaseChanged")]
557 const Changed = 0x1<<2;
558 #[doc(alias = "NSEventPhaseEnded")]
559 const Ended = 0x1<<3;
560 #[doc(alias = "NSEventPhaseCancelled")]
561 const Cancelled = 0x1<<4;
562 #[doc(alias = "NSEventPhaseMayBegin")]
563 const MayBegin = 0x1<<5;
564 }
565}
566
567unsafe impl Encode for NSEventPhase {
568 const ENCODING: Encoding = NSUInteger::ENCODING;
569}
570
571unsafe impl RefEncode for NSEventPhase {
572 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
573}
574
575#[repr(transparent)]
578#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
579pub struct NSEventGestureAxis(pub NSInteger);
580impl NSEventGestureAxis {
581 #[doc(alias = "NSEventGestureAxisNone")]
582 pub const None: Self = Self(0);
583 #[doc(alias = "NSEventGestureAxisHorizontal")]
584 pub const Horizontal: Self = Self(1);
585 #[doc(alias = "NSEventGestureAxisVertical")]
586 pub const Vertical: Self = Self(2);
587}
588
589unsafe impl Encode for NSEventGestureAxis {
590 const ENCODING: Encoding = NSInteger::ENCODING;
591}
592
593unsafe impl RefEncode for NSEventGestureAxis {
594 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
595}
596
597#[repr(transparent)]
600#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
601pub struct NSEventSwipeTrackingOptions(pub NSUInteger);
602bitflags::bitflags! {
603 impl NSEventSwipeTrackingOptions: NSUInteger {
604 #[doc(alias = "NSEventSwipeTrackingLockDirection")]
605 const LockDirection = 0x1<<0;
606 #[doc(alias = "NSEventSwipeTrackingClampGestureAmount")]
607 const ClampGestureAmount = 0x1<<1;
608 }
609}
610
611unsafe impl Encode for NSEventSwipeTrackingOptions {
612 const ENCODING: Encoding = NSUInteger::ENCODING;
613}
614
615unsafe impl RefEncode for NSEventSwipeTrackingOptions {
616 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
617}
618
619#[repr(transparent)]
622#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
623pub struct NSEventSubtype(pub c_short);
624impl NSEventSubtype {
625 #[doc(alias = "NSEventSubtypeWindowExposed")]
626 pub const WindowExposed: Self = Self(0);
627 #[doc(alias = "NSEventSubtypeApplicationActivated")]
628 pub const ApplicationActivated: Self = Self(1);
629 #[doc(alias = "NSEventSubtypeApplicationDeactivated")]
630 pub const ApplicationDeactivated: Self = Self(2);
631 #[doc(alias = "NSEventSubtypeWindowMoved")]
632 pub const WindowMoved: Self = Self(4);
633 #[doc(alias = "NSEventSubtypeScreenChanged")]
634 pub const ScreenChanged: Self = Self(8);
635 #[doc(alias = "NSEventSubtypePowerOff")]
636 pub const PowerOff: Self = Self(1);
637 #[doc(alias = "NSEventSubtypeMouseEvent")]
638 pub const MouseEvent: Self = Self(0);
639 #[doc(alias = "NSEventSubtypeTabletPoint")]
640 pub const TabletPoint: Self = Self(1);
641 #[doc(alias = "NSEventSubtypeTabletProximity")]
642 pub const TabletProximity: Self = Self(2);
643 #[doc(alias = "NSEventSubtypeTouch")]
644 pub const Touch: Self = Self(3);
645}
646
647unsafe impl Encode for NSEventSubtype {
648 const ENCODING: Encoding = c_short::ENCODING;
649}
650
651unsafe impl RefEncode for NSEventSubtype {
652 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
653}
654
655#[deprecated]
657pub static NSWindowExposedEventType: NSEventSubtype =
658 NSEventSubtype(NSEventSubtype::WindowExposed.0);
659
660#[deprecated]
662pub static NSApplicationActivatedEventType: NSEventSubtype =
663 NSEventSubtype(NSEventSubtype::ApplicationActivated.0);
664
665#[deprecated]
667pub static NSApplicationDeactivatedEventType: NSEventSubtype =
668 NSEventSubtype(NSEventSubtype::ApplicationDeactivated.0);
669
670#[deprecated]
672pub static NSWindowMovedEventType: NSEventSubtype = NSEventSubtype(NSEventSubtype::WindowMoved.0);
673
674#[deprecated]
676pub static NSScreenChangedEventType: NSEventSubtype =
677 NSEventSubtype(NSEventSubtype::ScreenChanged.0);
678
679#[deprecated = "This subtype no longer exists"]
681pub static NSAWTEventType: NSEventSubtype = NSEventSubtype(16);
682
683#[deprecated]
685pub static NSPowerOffEventType: NSEventSubtype = NSEventSubtype(NSEventSubtype::PowerOff.0);
686
687#[deprecated]
689pub static NSMouseEventSubtype: NSEventSubtype = NSEventSubtype(NSEventSubtype::MouseEvent.0);
690
691#[deprecated]
693pub static NSTabletPointEventSubtype: NSEventSubtype =
694 NSEventSubtype(NSEventSubtype::TabletPoint.0);
695
696#[deprecated]
698pub static NSTabletProximityEventSubtype: NSEventSubtype =
699 NSEventSubtype(NSEventSubtype::TabletProximity.0);
700
701#[deprecated]
703pub static NSTouchEventSubtype: NSEventSubtype = NSEventSubtype(NSEventSubtype::Touch.0);
704
705#[repr(transparent)]
708#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
709pub struct NSPressureBehavior(pub NSInteger);
710impl NSPressureBehavior {
711 #[doc(alias = "NSPressureBehaviorUnknown")]
712 pub const Unknown: Self = Self(-1);
713 #[doc(alias = "NSPressureBehaviorPrimaryDefault")]
714 pub const PrimaryDefault: Self = Self(0);
715 #[doc(alias = "NSPressureBehaviorPrimaryClick")]
716 pub const PrimaryClick: Self = Self(1);
717 #[doc(alias = "NSPressureBehaviorPrimaryGeneric")]
718 pub const PrimaryGeneric: Self = Self(2);
719 #[doc(alias = "NSPressureBehaviorPrimaryAccelerator")]
720 pub const PrimaryAccelerator: Self = Self(3);
721 #[doc(alias = "NSPressureBehaviorPrimaryDeepClick")]
722 pub const PrimaryDeepClick: Self = Self(5);
723 #[doc(alias = "NSPressureBehaviorPrimaryDeepDrag")]
724 pub const PrimaryDeepDrag: Self = Self(6);
725}
726
727unsafe impl Encode for NSPressureBehavior {
728 const ENCODING: Encoding = NSInteger::ENCODING;
729}
730
731unsafe impl RefEncode for NSPressureBehavior {
732 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
733}
734
735extern_class!(
736 #[unsafe(super(NSObject))]
738 #[derive(Debug, PartialEq, Eq, Hash)]
739 pub struct NSEvent;
740);
741
742extern_conformance!(
743 unsafe impl NSCoding for NSEvent {}
744);
745
746extern_conformance!(
747 unsafe impl NSCopying for NSEvent {}
748);
749
750unsafe impl CopyingHelper for NSEvent {
751 type Result = Self;
752}
753
754extern_conformance!(
755 unsafe impl NSObjectProtocol for NSEvent {}
756);
757
758impl NSEvent {
759 extern_methods!(
760 #[unsafe(method(type))]
761 #[unsafe(method_family = none)]
762 pub fn r#type(&self) -> NSEventType;
763
764 #[unsafe(method(modifierFlags))]
765 #[unsafe(method_family = none)]
766 pub fn modifierFlags(&self) -> NSEventModifierFlags;
767
768 #[unsafe(method(timestamp))]
769 #[unsafe(method_family = none)]
770 pub fn timestamp(&self) -> NSTimeInterval;
771
772 #[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
773 #[unsafe(method(window))]
774 #[unsafe(method_family = none)]
775 pub fn window(&self, mtm: MainThreadMarker) -> Option<Retained<NSWindow>>;
776
777 #[unsafe(method(windowNumber))]
778 #[unsafe(method_family = none)]
779 pub fn windowNumber(&self) -> NSInteger;
780
781 #[cfg(feature = "NSGraphicsContext")]
782 #[deprecated = "This method always returns nil. If you need access to the current drawing context, use [NSGraphicsContext currentContext] inside of a draw operation."]
783 #[unsafe(method(context))]
784 #[unsafe(method_family = none)]
785 pub fn context(&self) -> Option<Retained<NSGraphicsContext>>;
786
787 #[unsafe(method(clickCount))]
788 #[unsafe(method_family = none)]
789 pub fn clickCount(&self) -> NSInteger;
790
791 #[unsafe(method(buttonNumber))]
792 #[unsafe(method_family = none)]
793 pub fn buttonNumber(&self) -> NSInteger;
794
795 #[unsafe(method(eventNumber))]
796 #[unsafe(method_family = none)]
797 pub fn eventNumber(&self) -> NSInteger;
798
799 #[unsafe(method(pressure))]
800 #[unsafe(method_family = none)]
801 pub fn pressure(&self) -> c_float;
802
803 #[unsafe(method(locationInWindow))]
804 #[unsafe(method_family = none)]
805 pub fn locationInWindow(&self) -> NSPoint;
806
807 #[cfg(feature = "objc2-core-foundation")]
808 #[unsafe(method(deltaX))]
809 #[unsafe(method_family = none)]
810 pub fn deltaX(&self) -> CGFloat;
811
812 #[cfg(feature = "objc2-core-foundation")]
813 #[unsafe(method(deltaY))]
814 #[unsafe(method_family = none)]
815 pub fn deltaY(&self) -> CGFloat;
816
817 #[cfg(feature = "objc2-core-foundation")]
818 #[unsafe(method(deltaZ))]
819 #[unsafe(method_family = none)]
820 pub fn deltaZ(&self) -> CGFloat;
821
822 #[unsafe(method(hasPreciseScrollingDeltas))]
823 #[unsafe(method_family = none)]
824 pub fn hasPreciseScrollingDeltas(&self) -> bool;
825
826 #[cfg(feature = "objc2-core-foundation")]
827 #[unsafe(method(scrollingDeltaX))]
828 #[unsafe(method_family = none)]
829 pub fn scrollingDeltaX(&self) -> CGFloat;
830
831 #[cfg(feature = "objc2-core-foundation")]
832 #[unsafe(method(scrollingDeltaY))]
833 #[unsafe(method_family = none)]
834 pub fn scrollingDeltaY(&self) -> CGFloat;
835
836 #[unsafe(method(momentumPhase))]
837 #[unsafe(method_family = none)]
838 pub fn momentumPhase(&self) -> NSEventPhase;
839
840 #[unsafe(method(isDirectionInvertedFromDevice))]
841 #[unsafe(method_family = none)]
842 pub fn isDirectionInvertedFromDevice(&self) -> bool;
843
844 #[unsafe(method(characters))]
845 #[unsafe(method_family = none)]
846 pub fn characters(&self) -> Option<Retained<NSString>>;
847
848 #[unsafe(method(charactersIgnoringModifiers))]
849 #[unsafe(method_family = none)]
850 pub fn charactersIgnoringModifiers(&self) -> Option<Retained<NSString>>;
851
852 #[unsafe(method(charactersByApplyingModifiers:))]
853 #[unsafe(method_family = none)]
854 pub fn charactersByApplyingModifiers(
855 &self,
856 modifiers: NSEventModifierFlags,
857 ) -> Option<Retained<NSString>>;
858
859 #[unsafe(method(isARepeat))]
860 #[unsafe(method_family = none)]
861 pub fn isARepeat(&self) -> bool;
862
863 #[unsafe(method(keyCode))]
864 #[unsafe(method_family = none)]
865 pub fn keyCode(&self) -> c_ushort;
866
867 #[unsafe(method(trackingNumber))]
868 #[unsafe(method_family = none)]
869 pub fn trackingNumber(&self) -> NSInteger;
870
871 #[unsafe(method(userData))]
872 #[unsafe(method_family = none)]
873 pub fn userData(&self) -> *mut c_void;
874
875 #[cfg(feature = "NSTrackingArea")]
876 #[unsafe(method(trackingArea))]
877 #[unsafe(method_family = none)]
878 pub fn trackingArea(&self) -> Option<Retained<NSTrackingArea>>;
879
880 #[unsafe(method(subtype))]
881 #[unsafe(method_family = none)]
882 pub fn subtype(&self) -> NSEventSubtype;
883
884 #[unsafe(method(data1))]
885 #[unsafe(method_family = none)]
886 pub fn data1(&self) -> NSInteger;
887
888 #[unsafe(method(data2))]
889 #[unsafe(method_family = none)]
890 pub fn data2(&self) -> NSInteger;
891
892 #[unsafe(method(eventRef))]
893 #[unsafe(method_family = none)]
894 pub fn eventRef(&self) -> *const c_void;
895
896 #[unsafe(method(eventWithEventRef:))]
900 #[unsafe(method_family = none)]
901 pub unsafe fn eventWithEventRef(event_ref: NonNull<c_void>) -> Option<Retained<NSEvent>>;
902
903 #[cfg(feature = "objc2-core-graphics")]
904 #[cfg(target_vendor = "apple")]
905 #[unsafe(method(CGEvent))]
906 #[unsafe(method_family = none)]
907 pub fn CGEvent(&self) -> Option<Retained<CGEvent>>;
908
909 #[cfg(feature = "objc2-core-graphics")]
910 #[cfg(target_vendor = "apple")]
911 #[unsafe(method(eventWithCGEvent:))]
912 #[unsafe(method_family = none)]
913 pub fn eventWithCGEvent(cg_event: &CGEvent) -> Option<Retained<NSEvent>>;
914
915 #[unsafe(method(isMouseCoalescingEnabled))]
916 #[unsafe(method_family = none)]
917 pub fn isMouseCoalescingEnabled() -> bool;
918
919 #[unsafe(method(setMouseCoalescingEnabled:))]
921 #[unsafe(method_family = none)]
922 pub fn setMouseCoalescingEnabled(mouse_coalescing_enabled: bool);
923
924 #[cfg(feature = "objc2-core-foundation")]
925 #[unsafe(method(magnification))]
926 #[unsafe(method_family = none)]
927 pub fn magnification(&self) -> CGFloat;
928
929 #[unsafe(method(deviceID))]
930 #[unsafe(method_family = none)]
931 pub fn deviceID(&self) -> NSUInteger;
932
933 #[unsafe(method(rotation))]
934 #[unsafe(method_family = none)]
935 pub fn rotation(&self) -> c_float;
936
937 #[unsafe(method(absoluteX))]
938 #[unsafe(method_family = none)]
939 pub fn absoluteX(&self) -> NSInteger;
940
941 #[unsafe(method(absoluteY))]
942 #[unsafe(method_family = none)]
943 pub fn absoluteY(&self) -> NSInteger;
944
945 #[unsafe(method(absoluteZ))]
946 #[unsafe(method_family = none)]
947 pub fn absoluteZ(&self) -> NSInteger;
948
949 #[unsafe(method(buttonMask))]
950 #[unsafe(method_family = none)]
951 pub fn buttonMask(&self) -> NSEventButtonMask;
952
953 #[unsafe(method(tilt))]
954 #[unsafe(method_family = none)]
955 pub fn tilt(&self) -> NSPoint;
956
957 #[unsafe(method(tangentialPressure))]
958 #[unsafe(method_family = none)]
959 pub fn tangentialPressure(&self) -> c_float;
960
961 #[unsafe(method(vendorDefined))]
962 #[unsafe(method_family = none)]
963 pub fn vendorDefined(&self) -> Retained<AnyObject>;
964
965 #[unsafe(method(vendorID))]
966 #[unsafe(method_family = none)]
967 pub fn vendorID(&self) -> NSUInteger;
968
969 #[unsafe(method(tabletID))]
970 #[unsafe(method_family = none)]
971 pub fn tabletID(&self) -> NSUInteger;
972
973 #[unsafe(method(pointingDeviceID))]
974 #[unsafe(method_family = none)]
975 pub fn pointingDeviceID(&self) -> NSUInteger;
976
977 #[unsafe(method(systemTabletID))]
978 #[unsafe(method_family = none)]
979 pub fn systemTabletID(&self) -> NSUInteger;
980
981 #[unsafe(method(vendorPointingDeviceType))]
982 #[unsafe(method_family = none)]
983 pub fn vendorPointingDeviceType(&self) -> NSUInteger;
984
985 #[unsafe(method(pointingDeviceSerialNumber))]
986 #[unsafe(method_family = none)]
987 pub fn pointingDeviceSerialNumber(&self) -> NSUInteger;
988
989 #[unsafe(method(uniqueID))]
990 #[unsafe(method_family = none)]
991 pub fn uniqueID(&self) -> c_ulonglong;
992
993 #[unsafe(method(capabilityMask))]
994 #[unsafe(method_family = none)]
995 pub fn capabilityMask(&self) -> NSUInteger;
996
997 #[unsafe(method(pointingDeviceType))]
998 #[unsafe(method_family = none)]
999 pub fn pointingDeviceType(&self) -> NSPointingDeviceType;
1000
1001 #[unsafe(method(isEnteringProximity))]
1002 #[unsafe(method_family = none)]
1003 pub fn isEnteringProximity(&self) -> bool;
1004
1005 #[cfg(all(feature = "NSResponder", feature = "NSTouch", feature = "NSView"))]
1006 #[unsafe(method(touchesMatchingPhase:inView:))]
1007 #[unsafe(method_family = none)]
1008 pub fn touchesMatchingPhase_inView(
1009 &self,
1010 phase: NSTouchPhase,
1011 view: Option<&NSView>,
1012 ) -> Retained<NSSet<NSTouch>>;
1013
1014 #[cfg(feature = "NSTouch")]
1015 #[unsafe(method(allTouches))]
1016 #[unsafe(method_family = none)]
1017 pub fn allTouches(&self) -> Retained<NSSet<NSTouch>>;
1018
1019 #[cfg(all(feature = "NSResponder", feature = "NSTouch", feature = "NSView"))]
1020 #[unsafe(method(touchesForView:))]
1021 #[unsafe(method_family = none)]
1022 pub fn touchesForView(&self, view: &NSView) -> Retained<NSSet<NSTouch>>;
1023
1024 #[cfg(feature = "NSTouch")]
1025 #[unsafe(method(coalescedTouchesForTouch:))]
1026 #[unsafe(method_family = none)]
1027 pub fn coalescedTouchesForTouch(&self, touch: &NSTouch) -> Retained<NSArray<NSTouch>>;
1028
1029 #[unsafe(method(phase))]
1030 #[unsafe(method_family = none)]
1031 pub fn phase(&self) -> NSEventPhase;
1032
1033 #[unsafe(method(stage))]
1034 #[unsafe(method_family = none)]
1035 pub fn stage(&self) -> NSInteger;
1036
1037 #[cfg(feature = "objc2-core-foundation")]
1038 #[unsafe(method(stageTransition))]
1039 #[unsafe(method_family = none)]
1040 pub fn stageTransition(&self) -> CGFloat;
1041
1042 #[unsafe(method(associatedEventsMask))]
1043 #[unsafe(method_family = none)]
1044 pub fn associatedEventsMask(&self) -> NSEventMask;
1045
1046 #[unsafe(method(pressureBehavior))]
1047 #[unsafe(method_family = none)]
1048 pub fn pressureBehavior(&self) -> NSPressureBehavior;
1049
1050 #[unsafe(method(isSwipeTrackingFromScrollEventsEnabled))]
1051 #[unsafe(method_family = none)]
1052 pub fn isSwipeTrackingFromScrollEventsEnabled() -> bool;
1053
1054 #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
1055 #[unsafe(method(trackSwipeEventWithOptions:dampenAmountThresholdMin:max:usingHandler:))]
1056 #[unsafe(method_family = none)]
1057 pub fn trackSwipeEventWithOptions_dampenAmountThresholdMin_max_usingHandler(
1058 &self,
1059 options: NSEventSwipeTrackingOptions,
1060 min_dampen_threshold: CGFloat,
1061 max_dampen_threshold: CGFloat,
1062 tracking_handler: &block2::DynBlock<dyn Fn(CGFloat, NSEventPhase, Bool, NonNull<Bool>)>,
1063 );
1064
1065 #[unsafe(method(startPeriodicEventsAfterDelay:withPeriod:))]
1066 #[unsafe(method_family = none)]
1067 pub fn startPeriodicEventsAfterDelay_withPeriod(
1068 delay: NSTimeInterval,
1069 period: NSTimeInterval,
1070 );
1071
1072 #[unsafe(method(stopPeriodicEvents))]
1073 #[unsafe(method_family = none)]
1074 pub fn stopPeriodicEvents();
1075
1076 #[cfg(feature = "NSGraphicsContext")]
1077 #[unsafe(method(mouseEventWithType:location:modifierFlags:timestamp:windowNumber:context:eventNumber:clickCount:pressure:))]
1078 #[unsafe(method_family = none)]
1079 pub fn mouseEventWithType_location_modifierFlags_timestamp_windowNumber_context_eventNumber_clickCount_pressure(
1080 r#type: NSEventType,
1081 location: NSPoint,
1082 flags: NSEventModifierFlags,
1083 time: NSTimeInterval,
1084 w_num: NSInteger,
1085 unused_pass_nil: Option<&NSGraphicsContext>,
1086 e_num: NSInteger,
1087 c_num: NSInteger,
1088 pressure: c_float,
1089 ) -> Option<Retained<NSEvent>>;
1090
1091 #[cfg(feature = "NSGraphicsContext")]
1092 #[unsafe(method(keyEventWithType:location:modifierFlags:timestamp:windowNumber:context:characters:charactersIgnoringModifiers:isARepeat:keyCode:))]
1093 #[unsafe(method_family = none)]
1094 pub fn keyEventWithType_location_modifierFlags_timestamp_windowNumber_context_characters_charactersIgnoringModifiers_isARepeat_keyCode(
1095 r#type: NSEventType,
1096 location: NSPoint,
1097 flags: NSEventModifierFlags,
1098 time: NSTimeInterval,
1099 w_num: NSInteger,
1100 unused_pass_nil: Option<&NSGraphicsContext>,
1101 keys: &NSString,
1102 ukeys: &NSString,
1103 flag: bool,
1104 code: c_ushort,
1105 ) -> Option<Retained<NSEvent>>;
1106
1107 #[cfg(feature = "NSGraphicsContext")]
1108 #[unsafe(method(enterExitEventWithType:location:modifierFlags:timestamp:windowNumber:context:eventNumber:trackingNumber:userData:))]
1112 #[unsafe(method_family = none)]
1113 pub unsafe fn enterExitEventWithType_location_modifierFlags_timestamp_windowNumber_context_eventNumber_trackingNumber_userData(
1114 r#type: NSEventType,
1115 location: NSPoint,
1116 flags: NSEventModifierFlags,
1117 time: NSTimeInterval,
1118 w_num: NSInteger,
1119 unused_pass_nil: Option<&NSGraphicsContext>,
1120 e_num: NSInteger,
1121 t_num: NSInteger,
1122 data: *mut c_void,
1123 ) -> Option<Retained<NSEvent>>;
1124
1125 #[cfg(feature = "NSGraphicsContext")]
1126 #[unsafe(method(otherEventWithType:location:modifierFlags:timestamp:windowNumber:context:subtype:data1:data2:))]
1127 #[unsafe(method_family = none)]
1128 pub fn otherEventWithType_location_modifierFlags_timestamp_windowNumber_context_subtype_data1_data2(
1129 r#type: NSEventType,
1130 location: NSPoint,
1131 flags: NSEventModifierFlags,
1132 time: NSTimeInterval,
1133 w_num: NSInteger,
1134 unused_pass_nil: Option<&NSGraphicsContext>,
1135 subtype: c_short,
1136 d1: NSInteger,
1137 d2: NSInteger,
1138 ) -> Option<Retained<NSEvent>>;
1139
1140 #[unsafe(method(mouseLocation))]
1141 #[unsafe(method_family = none)]
1142 pub fn mouseLocation() -> NSPoint;
1143
1144 #[unsafe(method(modifierFlags))]
1145 #[unsafe(method_family = none)]
1146 pub fn modifierFlags_class() -> NSEventModifierFlags;
1147
1148 #[unsafe(method(pressedMouseButtons))]
1149 #[unsafe(method_family = none)]
1150 pub fn pressedMouseButtons() -> NSUInteger;
1151
1152 #[unsafe(method(doubleClickInterval))]
1153 #[unsafe(method_family = none)]
1154 pub fn doubleClickInterval() -> NSTimeInterval;
1155
1156 #[unsafe(method(keyRepeatDelay))]
1157 #[unsafe(method_family = none)]
1158 pub fn keyRepeatDelay() -> NSTimeInterval;
1159
1160 #[unsafe(method(keyRepeatInterval))]
1161 #[unsafe(method_family = none)]
1162 pub fn keyRepeatInterval() -> NSTimeInterval;
1163
1164 #[cfg(feature = "block2")]
1165 #[unsafe(method(addGlobalMonitorForEventsMatchingMask:handler:))]
1166 #[unsafe(method_family = none)]
1167 pub fn addGlobalMonitorForEventsMatchingMask_handler(
1168 mask: NSEventMask,
1169 block: &block2::DynBlock<dyn Fn(NonNull<NSEvent>)>,
1170 ) -> Option<Retained<AnyObject>>;
1171
1172 #[cfg(feature = "block2")]
1173 #[unsafe(method(addLocalMonitorForEventsMatchingMask:handler:))]
1177 #[unsafe(method_family = none)]
1178 pub unsafe fn addLocalMonitorForEventsMatchingMask_handler(
1179 mask: NSEventMask,
1180 block: &block2::DynBlock<dyn Fn(NonNull<NSEvent>) -> *mut NSEvent>,
1181 ) -> Option<Retained<AnyObject>>;
1182
1183 #[unsafe(method(removeMonitor:))]
1187 #[unsafe(method_family = none)]
1188 pub unsafe fn removeMonitor(event_monitor: &AnyObject);
1189 );
1190}
1191
1192impl NSEvent {
1194 extern_methods!(
1195 #[unsafe(method(init))]
1196 #[unsafe(method_family = init)]
1197 pub fn init(this: Allocated<Self>) -> Retained<Self>;
1198
1199 #[unsafe(method(new))]
1200 #[unsafe(method_family = new)]
1201 pub fn new() -> Retained<Self>;
1202 );
1203}
1204
1205impl DefaultRetained for NSEvent {
1206 #[inline]
1207 fn default_retained() -> Retained<Self> {
1208 Self::new()
1209 }
1210}
1211
1212pub const NSUpArrowFunctionKey: c_uint = 0xF700;
1214pub const NSDownArrowFunctionKey: c_uint = 0xF701;
1216pub const NSLeftArrowFunctionKey: c_uint = 0xF702;
1218pub const NSRightArrowFunctionKey: c_uint = 0xF703;
1220pub const NSF1FunctionKey: c_uint = 0xF704;
1222pub const NSF2FunctionKey: c_uint = 0xF705;
1224pub const NSF3FunctionKey: c_uint = 0xF706;
1226pub const NSF4FunctionKey: c_uint = 0xF707;
1228pub const NSF5FunctionKey: c_uint = 0xF708;
1230pub const NSF6FunctionKey: c_uint = 0xF709;
1232pub const NSF7FunctionKey: c_uint = 0xF70A;
1234pub const NSF8FunctionKey: c_uint = 0xF70B;
1236pub const NSF9FunctionKey: c_uint = 0xF70C;
1238pub const NSF10FunctionKey: c_uint = 0xF70D;
1240pub const NSF11FunctionKey: c_uint = 0xF70E;
1242pub const NSF12FunctionKey: c_uint = 0xF70F;
1244pub const NSF13FunctionKey: c_uint = 0xF710;
1246pub const NSF14FunctionKey: c_uint = 0xF711;
1248pub const NSF15FunctionKey: c_uint = 0xF712;
1250pub const NSF16FunctionKey: c_uint = 0xF713;
1252pub const NSF17FunctionKey: c_uint = 0xF714;
1254pub const NSF18FunctionKey: c_uint = 0xF715;
1256pub const NSF19FunctionKey: c_uint = 0xF716;
1258pub const NSF20FunctionKey: c_uint = 0xF717;
1260pub const NSF21FunctionKey: c_uint = 0xF718;
1262pub const NSF22FunctionKey: c_uint = 0xF719;
1264pub const NSF23FunctionKey: c_uint = 0xF71A;
1266pub const NSF24FunctionKey: c_uint = 0xF71B;
1268pub const NSF25FunctionKey: c_uint = 0xF71C;
1270pub const NSF26FunctionKey: c_uint = 0xF71D;
1272pub const NSF27FunctionKey: c_uint = 0xF71E;
1274pub const NSF28FunctionKey: c_uint = 0xF71F;
1276pub const NSF29FunctionKey: c_uint = 0xF720;
1278pub const NSF30FunctionKey: c_uint = 0xF721;
1280pub const NSF31FunctionKey: c_uint = 0xF722;
1282pub const NSF32FunctionKey: c_uint = 0xF723;
1284pub const NSF33FunctionKey: c_uint = 0xF724;
1286pub const NSF34FunctionKey: c_uint = 0xF725;
1288pub const NSF35FunctionKey: c_uint = 0xF726;
1290pub const NSInsertFunctionKey: c_uint = 0xF727;
1292pub const NSDeleteFunctionKey: c_uint = 0xF728;
1294pub const NSHomeFunctionKey: c_uint = 0xF729;
1296pub const NSBeginFunctionKey: c_uint = 0xF72A;
1298pub const NSEndFunctionKey: c_uint = 0xF72B;
1300pub const NSPageUpFunctionKey: c_uint = 0xF72C;
1302pub const NSPageDownFunctionKey: c_uint = 0xF72D;
1304pub const NSPrintScreenFunctionKey: c_uint = 0xF72E;
1306pub const NSScrollLockFunctionKey: c_uint = 0xF72F;
1308pub const NSPauseFunctionKey: c_uint = 0xF730;
1310pub const NSSysReqFunctionKey: c_uint = 0xF731;
1312pub const NSBreakFunctionKey: c_uint = 0xF732;
1314pub const NSResetFunctionKey: c_uint = 0xF733;
1316pub const NSStopFunctionKey: c_uint = 0xF734;
1318pub const NSMenuFunctionKey: c_uint = 0xF735;
1320pub const NSUserFunctionKey: c_uint = 0xF736;
1322pub const NSSystemFunctionKey: c_uint = 0xF737;
1324pub const NSPrintFunctionKey: c_uint = 0xF738;
1326pub const NSClearLineFunctionKey: c_uint = 0xF739;
1328pub const NSClearDisplayFunctionKey: c_uint = 0xF73A;
1330pub const NSInsertLineFunctionKey: c_uint = 0xF73B;
1332pub const NSDeleteLineFunctionKey: c_uint = 0xF73C;
1334pub const NSInsertCharFunctionKey: c_uint = 0xF73D;
1336pub const NSDeleteCharFunctionKey: c_uint = 0xF73E;
1338pub const NSPrevFunctionKey: c_uint = 0xF73F;
1340pub const NSNextFunctionKey: c_uint = 0xF740;
1342pub const NSSelectFunctionKey: c_uint = 0xF741;
1344pub const NSExecuteFunctionKey: c_uint = 0xF742;
1346pub const NSUndoFunctionKey: c_uint = 0xF743;
1348pub const NSRedoFunctionKey: c_uint = 0xF744;
1350pub const NSFindFunctionKey: c_uint = 0xF745;
1352pub const NSHelpFunctionKey: c_uint = 0xF746;
1354pub const NSModeSwitchFunctionKey: c_uint = 0xF747;