
/* IconView.m */

#import "IconView.h"
#import <appkit/graphics.h>
#import <dpsclient/psops.h>
#import <dpsclient/wraps.h>
#import <libc.h>
#import <strings.h>

@implementation IconView

-init
{
	[self setFlipped: YES];		/* flip so that TEXT comes out OK */
	return(self);
}

- drawSelf:(const NXRect *)rects :(int)rectCount
{
NXRect   drawRect;
NXPoint  origin;

	/* initialize a drawing rectangle */
	drawRect.origin.x = drawRect.origin.y = 0.0;
	drawRect.size.width = drawRect.size.height = 64.0;	/* Icon Size 64x64 */
	origin.x = origin.y = 8.0;

	/* draw our bezel */
	NXDrawButton(&drawRect, 0);
	NXInsetRect(&drawRect, 1.0, 1.0);
	NXDrawButton(&drawRect, 0);
	NXInsetRect(&drawRect, -1.0, -1.0);

	PSsetgray(1.0);		/* Display user name and tty in white */
	PSmoveto(9.0,21.0);
	PSshow(ttyname);
	PSmoveto(9.0,41.0);
	PSshow(username);
	PSstroke();

	PSsetgray(0.0);		/* Display user name and tty in black */
	PSmoveto(8.0,20.0);
	PSshow(ttyname);
	PSmoveto(8.0,40.0);
	PSshow(username);
	PSstroke();

	return self;
}    

#define MOVEMASK (NX_MOUSEUPMASK|NX_MOUSEDRAGGEDMASK)
- mouseDown:(NXEvent *)theEvent
{
    return self;		/* Currently, I don't do anything with mouse events */
}

- iconSetTty: (const char *) tty
{
	strcpy(ttyname, tty);	/* Set tty name */
	return(self);
}

- iconSetName: (const char *) name
{
	strcpy(username, name);	/* Set user name */
	return(self);
}

@end



