Added [copyWithZone:], [mouseLocation] and dummy implemntation of

[deltaX], [deltaY] and [deltaZ].


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@10633 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2001-08-01 22:46:57 +00:00
parent 4153511677
commit c5d2a33f21

View file

@ -409,6 +409,14 @@ static Class eventClass;
/*
* Getting Mouse Event Information
*/
+ (NSPoint)mouseLocation
{
float x, y;
PSmouselocation(&x, &y);
return NSMakePoint(x, y);
}
- (int) clickCount
{
/* Make sure it is one of the right event types */
@ -495,6 +503,36 @@ static Class eventClass;
return event_data.misc.sub_type;;
}
/*
* Scroll event data
*/
- (float)deltaX
{
if (event_type != NSScrollWheel)
[NSException raise: NSInvalidArgumentException
format: @"deltaX requested for invalid event type"];
// FIXME
return 0.0;
}
- (float)deltaY
{
if (event_type != NSScrollWheel)
[NSException raise: NSInvalidArgumentException
format: @"deltaY requested for invalid event type"];
// FIXME
return 0.0;
}
- (float)deltaZ
{
if (event_type != NSScrollWheel)
[NSException raise: NSInvalidArgumentException
format: @"deltaZ requested for invalid event type"];
// FIXME
return 0.0;
}
/*
* NSCoding protocol
*/
@ -605,6 +643,25 @@ static Class eventClass;
return self;
}
/*
* Copying protocol
*/
- (id) copyWithZone: (NSZone*)zone
{
NSEvent *e = (NSEvent*)NSCopyObject (self, 0, zone);
if ((event_type == NSKeyUp) || (event_type == NSKeyDown))
{
event_data.key.char_keys = [event_data.key.char_keys copyWithZone: zone];
event_data.key.unmodified_keys = [event_data.key.unmodified_keys copyWithZone: zone];
}
else if (event_type == NSCursorUpdate)
event_data.tracking.user_data = [event_data.tracking.user_data copyWithZone: zone];
return e;
}
- (NSString*) description
{
const char* eventTypes[] = {