ftp.nice.ch/pub/next/developer/resources/classes/SLaNGClass.s.tar.gz#/SLaNGClass/IconCell.m

This is IconCell.m in view mode; [Download] [Up]

#import "IconCell.h"		// which imports appkit and hence NXImage.h

#define ICON_WIDTH 48
#define ICON_HEIGHT 48

@implementation IconCell

- init
	{
	id returnval=[super init];
	icon=[NXImage findImageNamed:"NXdefaulticon"];
	// we assume this is a 48x48 icon--see above
	return returnval;
	}

- drawSelf:(const NXRect*) rects:(int) rectCount
	{
	[icon composite:NX_SOVER toPoint:&coord];	
	return self;
	}

- (BOOL) hit:(NXEvent*) theEvent
	{
	NXPoint start=theEvent->location;
	NXRect temp_rect;
	
	// Load temp_rect with size and coordinates
	temp_rect.size.width=ICON_WIDTH;
	temp_rect.size.height=ICON_HEIGHT;
	temp_rect.origin=coord;

	// convert event's point into view coordinate system
	[view convertPoint:&start fromView:nil];
	return NXPointInRect(&start, &temp_rect);
	}

- mouseDown:(NXEvent*) theEvent
	{
	return [super mouseDown:theEvent];
	}

- mouseDragged:(NXEvent*) theEvent
	{
	NXPoint start=theEvent->location;
	[view convertPoint:&start fromView:nil];
	coord=start;
	return [super mouseDragged:theEvent];
	}

- mouseUp:(NXEvent*) theEvent
	{
	return [super mouseUp:theEvent];
	}



@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.