/* Generated by Interface Builder */

#import "UHRectShape.h"

@implementation UHRectShape

- initFrame:(const NXRect *)frameRect;
{
	[super initFrame:frameRect];
	choice = UH_RECTANGLE;
	return self;
}

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

- drawSelf:(const NXRect *)r :(int)c
{
	NXRect rect;
	
	switch (choice)
	{
	case UH_SQUARE:
	
		if(bounds.size.width>bounds.size.height)
			NXSetRect(&rect, ((bounds.size.width-bounds.size.height)/2.0),
							0.0, bounds.size.height, bounds.size.height);
		else
			NXSetRect(&rect, 0.0, ((bounds.size.height-bounds.size.width)/2.0),
							bounds.size.width, bounds.size.width);
		break;
		
	case UH_RECTANGLE:
	default:
		rect=bounds;
		break;
	}
	if(isFilled){
		NXSetColor(fillColor);
		NXRectFill(&rect);
	}
	if (isBordered){
		NXSetColor(lineColor);
		NXFrameRectWithWidth(&rect, lineWidth);
	}
	return self;
}

@end
