This is MiscTreeStyle.m in view mode; [Download] [Up]
/* MiscTreeStyle.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 "MiscTreeStyle.h" @implementation MiscTreeStyle /*"Instances of this class encapsulate style attributes common to all nodes in a tree. It is recommended to set these attributes indirectly through a MiscTreeDiagram instance which controls the tree. The style of a node is defined by attributes saved in four different classes: MiscLayoutTree, MiscDiagramTree, MiscNodeStyle and MiscTreeStyle. Every MiscDiagramTree instance holds an instance of MiscNodeStyle and the MiscTreeDiagram instance controlling the tree holds an instance of MiscTreeStyle."*/ + defaultStyle /*"Returns the default tree style."*/ { return [[[MiscTreeStyle alloc] init] autorelease]; } - init { [super init]; lineType = MiscBendLineType; bendingFactor = 0.5; shadow = YES; shadowColor = [[NSColor darkGrayColor] retain]; return self; } - (void)dealloc { [shadowColor release]; return [super dealloc]; } - (BOOL)isEqual:(id)anObject { MiscTreeStyle *co; if(!anObject) return NO; if(anObject == self) return YES; if(![anObject isKindOfClass:[self class]]) return NO; co = (MiscTreeStyle *)anObject; if([shadowColor isEqual:co->shadowColor] && lineType == co->lineType && bendingFactor == co->bendingFactor && shadow == co->shadow) return YES; else return NO; } - (MiscLineType)lineType /*"Returns the line type attribute of the receiver."*/ { return lineType; } - (void)setLineType:(MiscLineType)aLineType /*"Sets the line type attribute of the receiver."*/ { lineType = aLineType; } - (float)bendingFactor /*"Returns the bending factor attribute of the receiver."*/ { return bendingFactor; } - (void)setBendingFactor:(float)aBendingFactor /*"Sets the bending factor attribute of the receiver."*/ { bendingFactor = aBendingFactor; } - (BOOL)shadow /*"Returns the shadow attribute of the receiver."*/ { return shadow; } - (void)setShadow:(BOOL)aBool /*"Sets the shadow attribute of the receiver."*/ { shadow = aBool; } - (NSColor *)shadowColor /*"Returns the shadow color attribute of the receiver."*/ { return shadowColor; } - (void)setShadowColor:(NSColor *)aColor /*"Sets the shadow color attribute of the receiver."*/ { if(!aColor || [shadowColor isEqual:aColor]) return; [shadowColor release]; shadowColor = [aColor copyWithZone:[self zone]]; } - (void)encodeWithCoder:(NSCoder *)coder { [coder encodeObject:shadowColor]; [coder encodeValuesOfObjCTypes:"cf", &shadow, &bendingFactor]; [coder encodeValueOfObjCType:@encode(MiscLineType) at:&lineType]; } - initWithCoder:(NSCoder *)coder { shadowColor = [[coder decodeObject] copyWithZone:[self zone]]; [coder decodeValuesOfObjCTypes:"cf", &shadow, &bendingFactor]; [coder decodeValueOfObjCType:@encode(MiscLineType) at:&lineType]; return self; } - copyWithZone:(NSZone *)zone { MiscTreeStyle *theCopy; theCopy = (MiscTreeStyle *)NSCopyObject(self, 0, zone); return theCopy; } - copy { return [self copyWithZone:NSDefaultMallocZone()]; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.