CPObjectCPEvent
@implementation CPEvent : CPObject
CPEvent
encapsulates the details of a Cappuccino keyboard or mouse event.
Method Summary | |
---|---|
+(CPEvent) | keyEventWithType:(CPEventType)anEventType location:(CGPoint)aPoint modifierFlags:(unsigned int)modifierFlags timestamp:(CPTimeInterval)aTimestamp windowNumber:(int)aWindowNumber context:(CPGraphicsContext)aGraphicsContext characters:(CPString)characters charactersIgnoringModifiers:(CPString)unmodCharacters isARepeat:(BOOL)repeatKey keyCode:(unsigned short)code Creates a new keyboard event. |
+(id) | mouseEventWithType:(CPEventType)anEventType location:(CGPoint)aPoint modifierFlags:(unsigned)modifierFlags timestamp:(CPTimeInterval)aTimestamp windowNumber:(int)aWindowNumber context:(CPGraphicsContext)aGraphicsContext eventNumber:(int)anEventNumber clickCount:(int)aClickCount pressure:(float)aPressure Creates a new mouse event. |
+(CPEvent) | otherEventWithType:(CPEventType)anEventType location:(CGPoint)aLocation modifierFlags:(unsigned)modifierFlags timestamp:(CPTimeInterval)aTimestamp windowNumber:(int)aWindowNumber context:(CPGraphicsContext)aGraphicsContext subtype:(short)aSubtype data1:(int)aData1 data2:(int)aData2 Creates a new custom event. |
+(void) | startPeriodicEventsAfterDelay:(CPTimeInterval)aDelay withPeriod:(CPTimeInterval)aPeriod Generates periodic events every aPeriod seconds. |
+(void) | stopPeriodicEvents Stops the periodic events from being generated. |
-(int) | buttonNumber Returns the button number for the mouse that generated the event. |
-(CPString) | characters Returns the characters associated with this event (keyboard only). |
-(CPString) | charactersIgnoringModifiers Returns the character ignoring any modifiers (except shift). |
-(int) | clickCount Returns the number of clicks that caused this event. |
-(float) | deltaX Returns the change in the x-axis for a mouse event. |
-(float) | deltaY Returns the change in the y-axis for a mouse event. |
-(float) | deltaZ Returns the change in the x-axis for a mouse event. |
-(BOOL) | isARepeat Returns YES if the keyboard event was caused by the key being held down. |
-(unsigned short) | keyCode Returns the key's key code. |
-(CGPoint) | locationInWindow Returns the location of the mouse (for mouse events). |
-(unsigned) | modifierFlags Returns event information as a bit mask. |
-(float) | pressure |
-(CPTimeInterval) | timestamp Returns the time the event occurred. |
-(CPEventType) | type Returns the type of event. |
-(CPWindow) | window Returns the event's associated window. |
-(int) | windowNumber The number of the window associated with the event. |
Method Detail |
---|
+(CPEvent)keyEventWithType:(CPEventType)anEventType location:(CGPoint)aPoint modifierFlags:(unsigned int)modifierFlags timestamp:(CPTimeInterval)aTimestamp windowNumber:(int)aWindowNumber context:(CPGraphicsContext)aGraphicsContext characters:(CPString)characters charactersIgnoringModifiers:(CPString)unmodCharacters isARepeat:(BOOL)repeatKey keyCode:(unsigned short)code
anEventType
- the event type. Must be one of CPKeyDown
, CPKeyUp
or CPFlagsChanged
aPoint
- the location of the cursor in the window specified by aWindowNumber
modifierFlags
- a bitwise combination of the modifiers specified in the CPEvent
globalsaTimestamp
- the time the event occurredaWindowNumber
- the number of the CPWindow
where the event occurredaGraphicsContext
- the graphics context where the event occurredcharacters
- the characters associated with the eventunmodCharacters
- the string of keys pressed without the presence of any modifiers other than ShiftrepeatKey
- YES
if this is caused by the system repeat as opposed to the user pressing the key againcode
- a number associated with the keyboard key of this eventCPInternalInconsistencyException
- if anEventType
is not a CPKeyDown
,
CPKeyUp
or CPFlagsChanged
+(id)mouseEventWithType:(CPEventType)anEventType location:(CGPoint)aPoint modifierFlags:(unsigned)modifierFlags timestamp:(CPTimeInterval)aTimestamp windowNumber:(int)aWindowNumber context:(CPGraphicsContext)aGraphicsContext eventNumber:(int)anEventNumber clickCount:(int)aClickCount pressure:(float)aPressure
anEventType
- the event typeaPoint
- the location of the cursor in the window specified by aWindowNumber
modifierFlags
- a bitwise combination of the modifiers specified in the CPEvent
globalsaTimestamp
- the time the event occurredaWindowNumber
- the number of the CPWindow
where the event occurredaGraphicsContext
- the graphics context where the event occurredanEventNumber
- a number for this eventaClickCount
- the number of clicks that caused this eventaPressure
- the amount of pressure applied to the input device (ranges from 0.0 to 1.0)CPInternalInconsistencyException
- if an invalid event type is provided+(CPEvent)otherEventWithType:(CPEventType)anEventType location:(CGPoint)aLocation modifierFlags:(unsigned)modifierFlags timestamp:(CPTimeInterval)aTimestamp windowNumber:(int)aWindowNumber context:(CPGraphicsContext)aGraphicsContext subtype:(short)aSubtype data1:(int)aData1 data2:(int)aData2
anEventType
- the event type. Must be one of CPAppKitDefined
, CPSystemDefined
, CPApplicationDefined
or CPPeriodic
aLocation
- the location of the cursor in the window specified by aWindowNumber
modifierFlags
- a bitwise combination of the modifiers specified in the CPEvent
globalsaTimestamp
- the time the event occurredaWindowNumber
- the number of the CPWindow
where the event occurredaGraphicsContext
- the graphics context where the event occurredaSubtype
- a numeric identifier to differentiate this event from other custom eventsaData1
- more data that describes the eventaData2
- even more data that describes the eventCPInternalInconsistencyException
- if an invalid event type is provided+(void)startPeriodicEventsAfterDelay:(CPTimeInterval)aDelay withPeriod:(CPTimeInterval)aPeriod
aPeriod
seconds.aDelay
- the number of seconds before the first eventaPeriod
- the length of time in seconds between successive events+(void)stopPeriodicEvents
-(int)buttonNumber
-(CPString)characters
CPInternalInconsistencyException
- if this method is called on a non-key event-(CPString)charactersIgnoringModifiers
CPInternalInconsistencyException
- if this method is called on a non-key event-(int)clickCount
-(float)deltaX
-(float)deltaY
-(float)deltaZ
-(BOOL)isARepeat
YES
if the keyboard event was caused by the key being held down.CPInternalInconsistencyException
- if this method is called on a non-key event-(unsigned short)keyCode
CPInternalInconsistencyException
- if this method is called on a non-key event-(CGPoint)locationInWindow
nil
.
If window
returns nil
, then
the mouse coordinates will be based on the screen coordinates.
Otherwise, the coordinates are relative to the window's coordinates.nil
for non-mouse events.
-(unsigned)modifierFlags
-(float)pressure
-(CPTimeInterval)timestamp
-(CPEventType)type
-(CPWindow)window
-(int)windowNumber
Created on Sat Sep 13 14:15:43 PDT 2008