Type Method

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

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

Declaration

+ (NSEvent *)mouseEventWithType:(NSEventType)type location:(NSPoint)location modifierFlags:(NSEventModifierFlags)flags timestamp:(NSTimeInterval)time windowNumber:(NSInteger)wNum context:(NSGraphicsContext *)unusedPassNil eventNumber:(NSInteger)eNum clickCount:(NSInteger)cNum pressure:(float)pressure;

Parameters

type

One of the modifier key masks described in NSEventType, or an NSInternalInconsistencyException is raised.

location

The cursor location in the base coordinate system of the window specified by windowNum.

flags

An integer bit field containing any of the modifier key masks described in Getting Unicode Values, combined using the C bitwise OR operator.

time

The time the event occurred in seconds since system startup.

windowNum

An integer that identifies the window device associated with the event, which is associated with the NSWindow that will receive the event.

context

The display graphics context of the event.

eventNumber

An identifier for the new event. It’s normally taken from a counter for mouse events, which continually increases as the application runs.

clickNumber

The number of mouse clicks associated with the mouse event.

pressure

A value from 0.0 to 1.0 indicating the pressure applied to the input device on a mouse event, used for an appropriate device such as a graphics tablet. For devices that aren’t pressure-sensitive, the value should be either 0.0 or 1.0.

Return Value

The created NSEvent instance or nil if the instance could not be created.

See Also

Creating Events

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

+ eventWithCGEvent:

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