Type Method

eventWithCGEvent:

Creates and returns an event object that is based on a Core Graphics type of event.

Declaration

+ (NSEvent *)eventWithCGEvent:(CGEventRef)cgEvent;

Parameters

cgEvent

A CGEventRef opaque type that represents an event.

Return Value

An autoreleased NSEvent object that is equivalent to cgEvent.

Discussion

The returned object retains the CGEventRef object (cgEvent) until it (the Objective-C object) is freed—it then releases the CGEventRef object. If no Cocoa event corresponds to the CGEventRef object, this method returns nil.

See Also

Creating Events

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

Returns a new NSEvent object describing a mouse-down, -up, -moved, or -dragged event.

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

Returns a new NSEvent object describing a tracking-rectangle or cursor-update event.

+ eventWithEventRef:

Creates an event object that is based on a Carbon type of event.