Initializer

init(mouseEventSource:mouseType:mouseCursorPosition:mouseButton:)

Returns a new Quartz mouse event.

Declaration

init?(mouseEventSource source: CGEventSource?, mouseType: CGEventType, mouseCursorPosition: CGPoint, mouseButton: CGMouseButton)

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

class var typeID: CFTypeID

Returns the type identifier for the opaque type CGEventRef.

init?(source: CGEventSource?)

Returns a new Quartz event.

var data: CFData?

Returns a flattened data representation of a Quartz event.

init?(withDataAllocator: CFAllocator?, data: CFData?)

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

func copy() -> CGEvent?

Returns a copy of an existing Quartz event.

init?(event: CGEvent?)

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

func setSource(CGEventSource?)

Sets the event source of a Quartz event.

var type: CGEventType

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

var timestamp: CGEventTimestamp

Returns the timestamp of a Quartz event.

var location: CGPoint

Returns the location of a Quartz mouse event.

var unflippedLocation: CGPoint

Returns the location of a Quartz mouse event.

var flags: CGEventFlags

Returns the event flags of a Quartz event.

func keyboardSetUnicodeString(stringLength: Int, unicodeString: UnsafePointer<UniChar>?)

Sets the Unicode string associated with a Quartz keyboard event.

func getIntegerValueField(CGEventField) -> Int64

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

func setIntegerValueField(CGEventField, value: Int64)

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

func getDoubleValueField(CGEventField) -> Double

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

func setDoubleValueField(CGEventField, value: Double)

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