Function

CGEventCreateMouseEvent

Returns a new Quartz mouse event.

Declaration

CGEventRef CGEventCreateMouseEvent(CGEventSourceRef source, CGEventType mouseType, CGPoint mouseCursorPosition, CGMouseButton mouseButton);

Parameters

source

An event source taken from another event, or NULL.

mouseType

A mouse event type. Pass one of the constants listed in CGEventType.

mouseCursorPosition

The position of the mouse cursor in global coordinates.

mouseButton

The button that’s changing state. Pass one of the constants listed in CGMouseButton. This parameter is ignored unless the mouseType parameter is kCGEventOtherMouseDown, kCGEventOtherMouseDragged, or kCGEventOtherMouseUp.

Return Value

A new mouse event, or NULL if the event could not be created. When you no longer need the event, you should release it using the function CFRelease.

See Also

Working With Events

CGEventGetTypeID

Returns the type identifier for the opaque type CGEventRef.

CGEventCreate

Returns a new Quartz event.

CGEventCreateData

Returns a flattened data representation of a Quartz event.

CGEventCreateFromData

Returns a Quartz event created from a flattened data representation of the event.

CGEventCreateKeyboardEvent

Returns a new Quartz keyboard event.

CGEventCreateScrollWheelEvent

Returns a new Quartz scrolling event.

CGEventCreateCopy

Returns a copy of an existing Quartz event.

CGEventCreateSourceFromEvent

Returns a Quartz event source created from an existing Quartz event.

CGEventSetSource

Sets the event source of a Quartz event.

CGEventGetType

Returns the event type of a Quartz event (left mouse down, for example).

CGEventSetType

Sets the event type of a Quartz event (left mouse down, for example).

CGEventGetTimestamp

Returns the timestamp of a Quartz event.

CGEventSetTimestamp

Sets the timestamp of a Quartz event.

CGEventGetLocation

Returns the location of a Quartz mouse event.

CGEventGetUnflippedLocation

Returns the location of a Quartz mouse event.

CGEventSetLocation

Sets the location of a Quartz mouse event.

CGEventGetFlags

Returns the event flags of a Quartz event.

CGEventSetFlags

Sets the event flags of a Quartz event.

CGEventKeyboardGetUnicodeString

Returns the Unicode string associated with a Quartz keyboard event.

CGEventKeyboardSetUnicodeString

Sets the Unicode string associated with a Quartz keyboard event.

CGEventGetIntegerValueField

Returns the integer value of a field in a Quartz event.

CGEventSetIntegerValueField

Sets the integer value of a field in a Quartz event.

CGEventGetDoubleValueField

Returns the floating-point value of a field in a Quartz event.

CGEventSetDoubleValueField

Sets the floating-point value of a field in a Quartz event.