Name

NSEvent — Mac OS X 10.0

Synopsis

This class encapsulates the data related to all events in a Cocoa application. NSEvent objects are dispatched by NSApplication to the appropriate receiver using the method sendEvent:. Both key and mouse events are represented by NSEvent. All classes that wish to respond to events must inherit from NSResponder.

image with no caption

@interface NSEvent : NSObject <NSCoding, NSCopying>
                                  // Class Methods
   + (NSEvent *)enterExitEventWithType:(NSEventType)type 
                                 location:(NSPoint)location 
                                 modifierFlags:(unsigned int)flags
                                 timestamp:(NSTimeInterval)time 
                                 windowNumber:(int)wNum
                                 context:(NSGraphicsContext*)context 
                                 eventNumber:(int)eNum 
                                 trackingNumber:(int)tNum 
                                 userData:(void *)data;
   + (NSEvent *)keyEventWithType:(NSEventType)type 
                                 location:(NSPoint)location 
                                 modifierFlags:(unsigned int)flags
                                 timestamp:(NSTimeInterval)time 
                                 windowNumber:(int)wNum 
                                 context:(NSGraphicsContext*)context
                                 characters:(NSString *)keys 
                                 charactersIgnoringModifiers:(NSString *)ukeys
   + (NSEvent *)mouseEventWithType:(NSEventType)type 
                                 location:(NSPoint)location 
                                 modifierFlags:(unsigned int)flags
                                 timestamp:(NSTimeInterval)time 
                                 windowNumber:(int)wNum 
                                 context:(NSGraphicsContext*)context 
                                 eventNumber:(int)eNum 
                                 clickCount:(int)cNum 
                                 pressure:(float)pressure;
   + (NSPoint)mouseLocation;
   + (NSEvent *)otherEventWithType:(NSEventType)type 
                                 location:(NSPoint)location 
                                 modifierFlags:(unsigned int)flags
                                 timestamp:(NSTimeInterval) ...

Get Cocoa in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.