O'Reilly logo

Cocoa in a Nutshell by James Duncan Davidson, Michael Beam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required