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.

@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)time 
                                 windowNumber:(int)wNum 
                                 context:(NSGraphicsContext*)context 
                                 subtype:(short)subtype 
                                 data1:(int)d1 
                                 data2:(int)d2;
   + (void)startPeriodicEventsAfterDelay:(NSTimeInterval)delay 
                                 withPeriod:(NSTimeInterval)period;
   + (void)stopPeriodicEvents;
                                  // Instance Methods
   - (int)buttonNumber;
   - (NSString *)characters;
   - (NSString *)charactersIgnoringModifiers;
   - (int)clickCount;
   - (NSGraphicsContext*)context;
   - (int)data1;
   - (int)data2;
   - (float)deltaX;
   - (float)deltaY;
   - (float)deltaZ;
   - (int)eventNumber;
   - (BOOL)isARepeat;
   - (unsigned short)keyCode;
   - (NSPoint)locationInWindow;
   - (unsigned int)modifierFlags;
   - (float)pressure;
   - (short)subtype;
   - (NSTimeInterval)timestamp;
   - (int)trackingNumber;
   - (NSEventType)type;
   - (void *)userData;
   - (NSWindow *)window;
   - (int)windowNumber;
                                  // Methods Implementing NSCoding
   - (void)encodeWithCoder:(NSCoder *)aCoder;
   - (id)initWithCoder:(NSCoder *)aDecoder;
                                  // Methods Implementing NSCopying
   - (id)copyWithZone:(NSZone *)zone;