ftp.nice.ch/pub/next/developer/resources/classes/misckit/MiscKit.1.10.0.s.gnutar.gz#/MiscKit/Examples/TreeView/Line.m

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

//		Written by Don Yacktman Copyright (c) 1994 by Don Yacktman.
//				Version 1.0.  All rights reserved.
//
//		This notice may not be removed from this source code.
//
//	This program is included in the MiscKit by permission from the author
//	and its use is governed by the MiscKit license, found in the file
//	"LICENSE.rtf" in the MiscKit distribution.  Please refer to that file
//	for a list of all applicable permissions and restrictions.
//	


#import "Line.h"

@implementation Line

- setStart:(NXPoint *)s end:(NXPoint *)e
{
	start.x = s->x;
	start.y = s->y;
	end.x = e->x;
	end.y = e->y;
	return self;
}

- render
{
	PSmoveto(start.x, start.y);
	PSlineto(end.x, end.y);
	PSstroke();
	return self;
}

- renderIfInRect:(const NXRect *)aRect
{
	NXRect tempRect = { { MIN(start.x, end.x), MIN(start.y, end.y) },
		{ MAX(ABS(start.x-end.x), 0.001), MAX(ABS(start.y-end.y), 0.001) } };
	if (NXIntersectsRect(aRect, &tempRect)) {
		[self render];
	}
	return self;
}

@end

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