
#import "STView.h"

@implementation STView

- drawSelf:(const NXRect *)rects :(int)rectCount 
{
	if (stObject)
		msgSend(stObject, symbolToOOP("drawSelf:anArg:"), cObjectToOOP(rects), intToOOP(rectCount), nil);
	return self;
}

- keyDown:(NXEvent *)theEvent
{
	if (stObject)
		msgSend(stObject, symbolToOOP(sel_getName(_cmd)), cObjectToOOP(theEvent), nil);
	return self;
}

- mouseDown:(NXEvent *)theEvent
{
	if (stObject)
		msgSend(stObject, symbolToOOP(sel_getName(_cmd)), cObjectToOOP(theEvent), nil);
	return self;
}

- (BOOL)performKeyEquivalent:(NXEvent *)theEvent
{
	if (stObject)
	{
		OOP	result = msgSend(stObject, symbolToOOP(sel_getName(_cmd)), cObjectToOOP(theEvent), nil);
		return (BOOL)OOPToChar(result);
	}
	return NO;
}

- write:(NXTypedStream *)stream
{
	if (stObject)
		msgSend(stObject, symbolToOOP(sel_getName(_cmd)), cObjectToOOP(stream), nil);
	return self;
}

- read:(NXTypedStream *)stream
{
	if (stObject)
		msgSend(stObject, symbolToOOP(sel_getName(_cmd)), cObjectToOOP(stream), nil);
	return self;
}

+ (int)forwardToSmalltalk:(SEL)aSelector
{
	if (aSelector == _cmd || 
		sel_getUid("setOOP:") == aSelector || 
		sel_getUid("oop") == aSelector)
		return 0;
	return 1;
}

- setOOP:(OOP)anOOP
{
	stObject = anOOP;
	return self;
}

- (OOP)oop
{
	return stObject;
}

@end

