/* Generated by Interface Builder */

#import "UHShape.h"

@implementation UHShape

+ initialize
{
	[UHShape setVersion:UHSHAPE_CURRENT_VERSION];
	return self;
}

- initFrame:(const NXRect *)frameRect
{
	[super initFrame:frameRect];
	lineWidth = 1.0;
	lineColor=NX_COLORBLACK;	
	fillColor=NX_COLORWHITE;
	isBordered = NO;
	isFilled = YES;
	tag=0;
	return self;
}

-(const char *)getInspectorClassName;
{
	return "UHShapeInspector";
}

- setLineWidth:(float)value
{
    lineWidth = value;
    return self;
}

- (float)lineWidth
{
	return lineWidth;
}

- setLineColor:(NXColor)color
{
    lineColor=color;
    return self;
}

- (NXColor)lineColor
{
	return lineColor;
}

- setFillColor:(NXColor)color
{
    fillColor=color;
    return self;
}

- (NXColor)fillColor
{
	return fillColor;
}

- setBordered:(BOOL)flag
{
	isBordered=flag;
	return self;
}

- (BOOL)isBordered
{
	return isBordered;
}

- setFilled:(BOOL)flag
{
	isFilled=flag;
	return self;
}

- (BOOL)isFilled
{
	return isFilled;
}

- setTag:(int)aTag
{
	tag = aTag;
	return self;
}

- (int)tag
{
	return tag;
}

- setChoice:(int)value
{
    choice = value;
    return self;
}

- (int)choice
{
	return choice;
}

- read:(NXTypedStream*)stream
{
	[super read:stream];
	/* If latest version...    */
	if(NXTypedStreamClassVersion(stream,"UHShape")==[UHShape version]){
		NXReadTypes(stream,"iiccf",&tag,&choice,&isBordered,&isFilled,&lineWidth);
		NXReadType(stream,"{[6s]*}", &lineColor);    
		NXReadType(stream,"{[6s]*}", &fillColor);
	}
	/* else old version...     */
	else {
		NXReadType(stream,"i", &tag);
		NXReadType(stream,"i", &choice);
		NXReadType(stream,"i", &isBordered);
		NXReadType(stream,"i", &isFilled);
		NXReadType(stream,"f", &lineWidth);
		NXReadType(stream,"{[8s]}", &lineColor);    
		NXReadType(stream,"{[8s]}", &fillColor);    
	}
	return self;
}

- write:(NXTypedStream*)stream
{
	[super write:stream];
	NXWriteTypes(stream,"iiccf",&tag,&choice,&isBordered,&isFilled,&lineWidth);
	NXWriteType(stream,"{[6s]*}", &lineColor);    
	NXWriteType(stream,"{[6s]*}", &fillColor);    
	return self;
}

@end
