ftp.nice.ch/Attic/openStep/developer/resources/MiscKit.2.0.5.s.gnutar.gz#/MiscKit2/Frameworks/MiscAppKit/MiscTreeDiagram.subproj/MiscConcreteShape.m

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

/*	MiscConcreteShape.m

	Copyright 1996 Uwe Hoffmann.

	This notice may not be removed from this source code.
	The use and distribution of this software is governed by the
	terms of the MiscKit license agreement.  Refer to the license
	document included with the MiscKit distribution for the terms.

	Version 2 (August 1996)
*/

#import <Foundation/Foundation.h>
#import <MiscFoundation/MiscUtilities.h>
#import <AppKit/dpsOpenStep.h>

#import "MiscConcreteShape.h"
#import "MiscUserPath.h"
#import "MiscHitPath.h"
#import "MiscTDUtils.h"


@implementation MiscConcreteShape 

- initBounds:(NSRect)aRect
{
    	hR = vR = NO;
	path = [[MiscUserPath allocWithZone:[self zone]] init];
	[self makePathWithBounds:aRect];
	return self;
}

- (void)dealloc
{
	[path release];
   	return [super dealloc];
}

- copyWithZone:(NSZone *)aZone
{
	MiscConcreteShape *theCopy;
	
	theCopy = (MiscConcreteShape *)NSCopyObject(self, 0, aZone);	
	theCopy->path = [path copyWithZone:aZone];	
	return theCopy;
}

- copy
{
	return [self copyWithZone:NSDefaultMallocZone()];
}

- (NSRect)bounds
{
	return [path bounds];
}

- (void)moveTo:(NSPoint)aPos
{
	NSRect r;
	
	r = [path bounds];
	r.origin = aPos;
	[self fillParamsWithBounds:r];
}

- (void)sizeTo:(NSSize)aSize
{
	NSRect r;
	
	r = [path bounds];
	r.size = aSize;
	[self fillParamsWithBounds:r];
}

- (void)drawOutline
{
	[path send:dps_ustroke cached:YES];
}

- (void)drawFill
{
	[path send:dps_ufill cached:YES];
}

- (void)drawShadowWithDelta:(NSPoint)aPos
{
	NSRect r;
	NSPoint original;
	
	r = [path bounds];
	original = r.origin;
	r.origin.x += aPos.x;
        r.origin.y += aPos.y;
	[self fillParamsWithBounds:r];
	[path send:dps_ufill cached:YES];
	r.origin = original;
	[self fillParamsWithBounds:r];
}

- (BOOL)hitFill:(MiscHitPath *)hitPath
{
	return [hitPath hit:dps_inufill path:path];
}

- (BOOL)hitOutline:(MiscHitPath *)hitPath
{
	return [hitPath hit:dps_inustroke path:path];
}

- initWithCoder:(NSCoder *)coder
{
	path = [[coder decodeObject] retain];
        [coder decodeValuesOfObjCTypes:"cc", &hR, &vR];
	return self;
}

- (void)encodeWithCoder:(NSCoder *)coder
{
	[coder encodeObject:path];
        [coder encodeValuesOfObjCTypes:"cc", &hR, &vR];
}


- (void)makePathWithBounds:(NSRect)aRect
{
	MiscRequiresConcreteImplementation(self, _cmd, [MiscConcreteShape class]);
	return;
}

- (void)fillParamsWithBounds:(NSRect)aRect
{
	MiscRequiresConcreteImplementation(self, _cmd, [MiscConcreteShape class]);
	return;
}

+ (NSSize)calcSizeForInnerSize:(NSSize)aSize
{
	NSSize s;
	
	s.width = s.height = 0;
	return s;
}

- (BOOL)reflectedHorizontal
{
        return hR;
}

- (BOOL)reflectedVertical
{
        return vR;
}

- (void)reflectHorizontal
{
        hR = !hR;
}

- (void)reflectVertical
{
        vR = !vR;
}

- (void)setReflectHorizontal:(BOOL)aBool
{
    	hR = aBool;
}

- (void)setReflectVertical:(BOOL)aBool
{
        vR = aBool;
}

@end

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