

//	Copyright H. Giesen, University of Koblenz-Landau 1996


#import "MyBrowserCell.h"

@implementation MyBrowserCell


- init
{
	[super init];
	[self setEnabled:YES];
	return self;
}



- initTextCell:(const char *)aString
{
	[super initTextCell:aString];
	[self setEnabled:YES];
	return self;
}


- setObject:obj inFile:fileObj
{
	myObj = obj;
	myFile = fileObj;
	[self setEditable:NO];
	return self;
}


- object
{
	return myObj;
}


- fileObject
{
	return myFile;
}


//	adopted from ScrollDoodScroll


- drawInside:(const NXRect *)cellFrame inView:controlView
{
	PSsetgray(NX_LTGRAY);
	NXRectFill( cellFrame );
	[super drawInside:cellFrame inView:controlView];

	/* all drawing from now on will be in dark gray */
	PSsetgray(NX_DKGRAY);

	/* draw the two dark gray lines above and below the cell */
    if (cFlags1.state || cFlags1.highlighted) {
		NXRect rectArray[2];
		/*
		 * draw 1-pixel tall rectangles instead of lines (this is faster than
		 * PSmoveto(); PSlineto()).
		 */
		NXSetRect(&(rectArray[0]), NX_X(cellFrame), NX_Y(cellFrame),
		NX_WIDTH(cellFrame), 1.0);
		NXSetRect(&(rectArray[1]), NX_X(cellFrame), NX_MAXY(cellFrame) - 1.0,
			NX_WIDTH(cellFrame), 1.0);

		/* using NXRectFillList is faster than separate calls to NXRectFill */
		NXRectFillList(rectArray, 2);
	}

	return self;
}


- highlight:(const NXRect *)cellFrame inView:controlView lit:(BOOL)flag
{
	if (cFlags1.highlighted != flag) {
		cFlags1.highlighted = flag;
		[self drawInside:cellFrame inView:controlView];
	}
	return self;
}


@end
