Up

# NSEvent

### Authors

Scott Christley (`scottc@net-community.com`)
Ovidiu Predescu (`ovidiu@net-community.com`)
Felipe A. Rodriguez (`far@ix.netcom.com`)

> The event class

Copyright: (C) 1996 Free Software Foundation, Inc.

# Software documentation for the NSEvent class

## NSEvent : NSObject

> Declared in:
>   AppKit/NSEvent.h

> Conforms to:
>   NSCoding
>   NSCopying

Availability: OpenStep
Description forthcoming.

Instance Variables
Method summary

- +doubleClickInterval
- +enterExitEventWithType:location:modifierFlags:timestamp:windowNumber:context:eventNumber:trackingNumber:userData:
- +eventWithEventRef:
- +isMouseCoalescingEnabled
- +keyEventWithType:location:modifierFlags:timestamp:windowNumber:context:characters:charactersIgnoringModifiers:isARepeat:keyCode:
- +keyRepeatDelay
- +keyRepeatInterval
- +modifierFlags
- +mouseEventWithType:location:modifierFlags:timestamp:windowNumber:context:eventNumber:clickCount:pressure:
- +mouseEventWithType:location:modifierFlags:timestamp:windowNumber:context:eventNumber:clickCount:pressure:buttonNumber:deltaX:deltaY:deltaZ:
- +mouseLocation
- +otherEventWithType:location:modifierFlags:timestamp:windowNumber:context:subtype:data1:data2:
- +pressedMouseButtons
- +setMouseCoalescingEnabled:
- +startPeriodicEventsAfterDelay:withPeriod:
- +stopPeriodicEvents
- -absoluteX
- -absoluteY
- -absoluteZ
- -associatedEventsMask
- -buttonMask
- -buttonNumber
- -capabilityMask
- -characters
- -charactersIgnoringModifiers
- -clickCount
- -context
- -data1
- -data2
- -deltaX
- -deltaY
- -deltaZ
- -deviceID
- -eventNumber
- -eventRef
- -isARepeat
- -isEnteringProximity
- -keyCode
- -locationInWindow
- -modifierFlags
- -momentumPhase
- -phase
- -pointingDeviceID
- -pointingDeviceSerialNumber
- -pointingDeviceType
- -pressure
- -rotation
- -subtype
- -systemTabletID
- -tabletID
- -tangentialPressure
- -tilt
- -timestamp
- -trackingNumber
- -type
- -uniqueID
- -userData
- -vendorDefined
- -vendorID
- -vendorPointingDeviceType
- -window
- -windowNumber

### doubleClickInterval

+ (NSTimeInterval) doubleClickInterval;
Availability: MacOS-X 10.6.0
Description forthcoming.

### enterExitEventWithType: location: modifierFlags: timestamp: windowNumber: context: eventNumber: trackingNumber: userData:

+ (NSEvent*) enterExitEventWithType: (NSEventType)type location: (NSPoint)location modifierFlags: (NSUInteger)flags timestamp: (NSTimeInterval)time windowNumber: (NSInteger)windowNum context: (NSGraphicsContext*)context eventNumber: (NSInteger)eventNum trackingNumber: (NSInteger)trackingNum userData: (void*)userData;
Availability: OpenStep
Description forthcoming.

### eventWithEventRef:

+ (NSEvent*) eventWithEventRef: (const void*)eventRef;
Availability: MacOS-X 10.5.0
Description forthcoming.

### isMouseCoalescingEnabled

+ (BOOL) isMouseCoalescingEnabled;
Availability: MacOS-X 10.5.0
Description forthcoming.

### keyEventWithType: location: modifierFlags: timestamp: windowNumber: context: characters: charactersIgnoringModifiers: isARepeat: keyCode:

+ (NSEvent*) keyEventWithType: (NSEventType)type location: (NSPoint)location modifierFlags: (NSUInteger)flags timestamp: (NSTimeInterval)time windowNumber: (NSInteger)windowNum context: (NSGraphicsContext*)context characters: (NSString*)keys charactersIgnoringModifiers: (NSString*)ukeys isARepeat: (BOOL)repeatKey keyCode: (unsigned short)code;
Availability: OpenStep
Description forthcoming.

### keyRepeatDelay

+ (NSTimeInterval) keyRepeatDelay;
Availability: MacOS-X 10.6.0
Description forthcoming.

### keyRepeatInterval

+ (NSTimeInterval) keyRepeatInterval;
Availability: MacOS-X 10.6.0
Description forthcoming.

### modifierFlags

+ (NSEventModifierFlags) modifierFlags;
Availability: MacOS-X 10.6.0
Description forthcoming.

### mouseEventWithType: location: modifierFlags: timestamp: windowNumber: context: eventNumber: clickCount: pressure:

+ (NSEvent*) mouseEventWithType: (NSEventType)type location: (NSPoint)location modifierFlags: (NSUInteger)flags timestamp: (NSTimeInterval)time windowNumber: (NSInteger)windowNum context: (NSGraphicsContext*)context eventNumber: (NSInteger)eventNum clickCount: (NSInteger)clickNum pressure: (float)pressureValue;
Availability: OpenStep
Description forthcoming.

### mouseEventWithType: location: modifierFlags: timestamp: windowNumber: context: eventNumber: clickCount: pressure: buttonNumber: deltaX: deltaY: deltaZ:

+ (NSEvent*) mouseEventWithType: (NSEventType)type location: (NSPoint)location modifierFlags: (NSUInteger)flags timestamp: (NSTimeInterval)time windowNumber: (NSInteger)windowNum context: (NSGraphicsContext*)context eventNumber: (NSInteger)eventNum clickCount: (NSInteger)clickNum pressure: (float)pressureValue buttonNumber: (NSInteger)buttonNum deltaX: (CGFloat)deltaX deltaY: (CGFloat)deltaY deltaZ: (CGFloat)deltaZ;
Availability: Not in OpenStep/MacOS-X
Description forthcoming.

### mouseLocation

+ (NSPoint) mouseLocation;
Availability: OpenStep
Returns the current mouse location.

### otherEventWithType: location: modifierFlags: timestamp: windowNumber: context: subtype: data1: data2:

+ (NSEvent*) otherEventWithType: (NSEventType)type location: (NSPoint)location modifierFlags: (NSUInteger)flags timestamp: (NSTimeInterval)time windowNumber: (NSInteger)windowNum context: (NSGraphicsContext*)context subtype: (short)subType data1: (NSInteger)data1 data2: (NSInteger)data2;
Availability: OpenStep
Description forthcoming.

### pressedMouseButtons

+ (NSUInteger) pressedMouseButtons;
Availability: MacOS-X 10.6.0
Description forthcoming.

### setMouseCoalescingEnabled:

+ (void) setMouseCoalescingEnabled: (BOOL)flag;
Availability: MacOS-X 10.5.0
Description forthcoming.

### startPeriodicEventsAfterDelay: withPeriod:

+ (void) startPeriodicEventsAfterDelay: (NSTimeInterval)delaySeconds withPeriod: (NSTimeInterval)periodSeconds;
Availability: OpenStep
Description forthcoming.

### stopPeriodicEvents

+ (void) stopPeriodicEvents;
Availability: OpenStep
Description forthcoming.

### absoluteX

- (NSInteger) absoluteX;
Availability: MacOS-X 10.4.0
Description forthcoming.

### absoluteY

- (NSInteger) absoluteY;
Availability: MacOS-X 10.4.0
Description forthcoming.

### absoluteZ

- (NSInteger) absoluteZ;
Availability: MacOS-X 10.4.0
Description forthcoming.

### associatedEventsMask

- (NSEventMask) associatedEventsMask;
Availability: MacOS-X 10.3.0
Description forthcoming.

### buttonMask

- (NSEventButtonMask) buttonMask;
Availability: MacOS-X 10.4.0
Description forthcoming.

### buttonNumber

- (NSInteger) buttonNumber;
Availability: MacOS-X 10.0.0
Returns the button number for the mouse button pressed in a mouse event. Intended primarily for the case where a mouse has three or more buttons, and you want to know which button an 'other' mouse event refers to.

### capabilityMask

- (NSUInteger) capabilityMask;
Availability: MacOS-X 10.4.0
Description forthcoming.

### characters

- (NSString*) characters;
Availability: OpenStep
Returns the string of characters for a keyboard event.
Raises an NSInternalInconsistencyException if applied to any other type of event.

### charactersIgnoringModifiers

- (NSString*) charactersIgnoringModifiers;
Availability: OpenStep
Returns the string of characters for a keyboard event, as if no modifier keys had been pressed when the keyboard event occirred.
Raises an NSInternalInconsistencyException if applied to any other type of event.

### clickCount

- (NSInteger) clickCount;
Availability: OpenStep
Return the number of clicks associated with the mouse down or up event. This method is not applicable for any event type other than a mouse down or mouse up.
Raises an NSInternalInconsistencyException if applied to any other type of event.

### context

- (NSGraphicsContext*) context;
Availability: OpenStep
Returns the graphics context for which this event was generated.

### data1

- (NSInteger) data1;
Availability: OpenStep
Returns the 'data1' item associated with the event.
Raises NSInternalInconsistencyException if the event is not of type NSAppKitDefined, NSSystemDefined, NSApplicationDefined, or NSPeriodic

### data2

- (NSInteger) data2;
Availability: OpenStep
Returns the 'data2' item associated with the event.
Raises NSInternalInconsistencyException if the event is not of type NSAppKitDefined, NSSystemDefined, NSApplicationDefined, or NSPeriodic

### deltaX

- (CGFloat) deltaX;
Availability: MacOS-X 10.0.0

Returns the movement of the mouse on the X axis.

This method is only valid for NSMouseMoved, NS*MouseDragged and NSScrollWheel events, otherwise it will return 0.

### deltaY

- (CGFloat) deltaY;
Availability: MacOS-X 10.0.0

Returns the movement of the mouse on the Y axis.

This method is only valid for NSMouseMoved, NS*MouseDragged and NSScrollWheel events, otherwise it will return 0.

### deltaZ

- (CGFloat) deltaZ;
Availability: MacOS-X 10.0.0

Returns the movement of the mouse on the Z axis.

This method is only valid for NSMouseMoved, NS*MouseDragged and NSScrollWheel events, otherwise it will return 0.

The value returned is 0.0 in most cases.

### deviceID

- (NSUInteger) deviceID;
Availability: MacOS-X 10.4.0
Description forthcoming.

### eventNumber

- (NSInteger) eventNumber;
Availability: OpenStep
Returns the event number associated with any mouse event or tracking event. Event numbers are allocated sequentially when the system creates these events.
Raises an NSInternalInconsistencyException if applied to any other type of event.

### eventRef

- (const void*) eventRef;
Availability: MacOS-X 10.5.0
Description forthcoming.

### isARepeat

- (BOOL) isARepeat;
Availability: OpenStep
Returns a flag to say if this is a keyboard repeat event.
Raises an NSInternalInconsistencyException if applied to any other type of event than an NSKeyUp or NSKeyDown.

### isEnteringProximity

- (BOOL) isEnteringProximity;
Availability: MacOS-X 10.4.0
Description forthcoming.

### keyCode

- (unsigned short) keyCode;
Availability: OpenStep
Returns the numeric key code of a keyboard event.
Raises an NSInternalInconsistencyException if applied to any other type of event than an NSKeyUp or NSKeyDown.

### locationInWindow

- (NSPoint) locationInWindow;
Availability: OpenStep
Returns the window location for which this event was generated (in the base coordinate system of the window).

### modifierFlags

- (NSEventModifierFlags) modifierFlags;
Availability: OpenStep
Returns the modifier flag bits associated with the event.

### momentumPhase

- (NSEventPhase) momentumPhase;
Availability: MacOS-X 10.7.0
Description forthcoming.

### phase

- (NSEventPhase) phase;
Availability: MacOS-X 10.7.0
Description forthcoming.

### pointingDeviceID

- (NSUInteger) pointingDeviceID;
Availability: MacOS-X 10.4.0
Description forthcoming.

### pointingDeviceSerialNumber

- (NSUInteger) pointingDeviceSerialNumber;
Availability: MacOS-X 10.4.0
Description forthcoming.

### pointingDeviceType

- (NSPointingDeviceType) pointingDeviceType;
Availability: MacOS-X 10.4.0
Description forthcoming.

### pressure

- (float) pressure;
Availability: OpenStep
Returns the pressure associated with a mouse event. This is a value in the range 0.0 to 1.0 and for mormal mouse events should be set to one of those extremes. This is used by pressure sensitive input devices.
Raises an NSInternalInconsistencyException if applied to any other type of event than a mouse event.

### rotation

- (float) rotation;
Availability: MacOS-X 10.4.0
Description forthcoming.

### subtype

- (short) subtype;
Availability: OpenStep
Returns the 'subtype' item associated with the event.
Raises NSInternalInconsistencyException if the event is not of type NSAppKitDefined, NSSystemDefined, NSApplicationDefined, NSPeriodic or a mouve event.

### systemTabletID

- (NSUInteger) systemTabletID;
Availability: MacOS-X 10.4.0
Description forthcoming.

### tabletID

- (NSUInteger) tabletID;
Availability: MacOS-X 10.4.0
Description forthcoming.

### tangentialPressure

- (float) tangentialPressure;
Availability: MacOS-X 10.4.0
Description forthcoming.

### tilt

- (NSPoint) tilt;
Availability: MacOS-X 10.4.0
Description forthcoming.

### timestamp

- (NSTimeInterval) timestamp;
Availability: OpenStep
Returns the time interval since system startup at which this event was generated.

### trackingNumber

- (NSInteger) trackingNumber;
Availability: OpenStep
Returns a number identifying the tracking rectangle entered or exited.
Raises an NSInternalInconsistencyException if applied to any other type of event than a mouse entered or exited event.

### type

- (NSEventType) type;
Availability: OpenStep
returns the type of this event.

### uniqueID

- (unsigned long long) uniqueID;
Availability: MacOS-X 10.4.0
Description forthcoming.

### userData

- (void*) userData;
Availability: OpenStep
Returns usder data associated with a tracking event... the data assigned to the tracking rectangle concerned when it was created..
Raises an NSInternalInconsistencyException if applied to any other type of event than a mouse entered or exited event.

### vendorDefined

- (id) vendorDefined;
Availability: MacOS-X 10.4.0
Description forthcoming.

### vendorID

- (NSUInteger) vendorID;
Availability: MacOS-X 10.4.0
Description forthcoming.

### vendorPointingDeviceType

- (NSUInteger) vendorPointingDeviceType;
Availability: MacOS-X 10.4.0
Description forthcoming.

### window

- (NSWindow*) window;
Availability: OpenStep
Returns the window for which this event was generated.
Periodic events have no associated window, and you should not call this method for those events.

### windowNumber

- (NSInteger) windowNumber;
Availability: OpenStep
Returns the window number of the window for which this event was generated.
Periodic events have no associated window, and you should not call this method for those events.

## Instance Variables for NSEvent Class

### event_context

@protected NSGraphicsContext* event_context;
Availability: OpenStep
Description forthcoming.

### event_time

@protected NSTimeInterval event_time;
Availability: OpenStep
Description forthcoming.

### event_type

@protected NSEventType event_type;
Availability: OpenStep
Description forthcoming.

### location_point

@protected NSPoint location_point;
Availability: OpenStep
Description forthcoming.

### modifier_flags

@protected NSUInteger modifier_flags;
Availability: OpenStep
Description forthcoming.

### union _MB_event_data

@protected union _MB_event_data union _MB_event_data;
Availability: OpenStep
Description forthcoming.

### window_num

@protected NSInteger window_num;
Availability: OpenStep
Description forthcoming.

Up