This is SafetyStacksView.m in view mode; [Download] [Up]
/* Generated by Interface Builder */ #import "SafetyStacksView.h" #import "GameCoordinator.h" #import "SafetyView.h" #import <assert.h> @implementation SafetyStacksView + newFrame:( const NXRect * )frameRect { self = [ super newFrame:frameRect ]; safetyList = [ List new ]; coupFoureeList = [ List new ]; safetyOffset = ( NX_WIDTH( &bounds ) / NUMBER_OF_SAFETY_CARDS_IN_DECK ); coupFoureeOffset = (( NX_HEIGHT( &bounds ) - CARD_HEIGHT ) / NUMBER_OF_SAFETY_CARDS_IN_DECK ); return self; } - free { [ safetyList free ]; [ coupFoureeList free ]; return [ super free ]; } - addCard:( CardView * )aCard :sender { NXRect cardBounds; [ aCard getBounds:&cardBounds ]; if([ sender isCoupFouree:aCard ]) { [( SafetyView * )aCard setRotatedFlag:YES ]; [ aCard moveTo:3 : 3 + ([ coupFoureeList count ] * coupFoureeOffset )]; [ coupFoureeList addObject:aCard ]; } else { [ aCard moveTo:3 + ([ safetyList count ] * safetyOffset ) : ( NX_HEIGHT( &bounds ) - NX_HEIGHT( &cardBounds ) - 3 )]; [ safetyList addObject:[ aCard getBounds:&cardBounds ]]; } [ self addSubview:[ aCard setEventsEnabled:reactiveCardsFlag ]]; return [ self update ]; } - removeCard:( CardView * )aCard :sender { assert([ aCard isDescendantOf:self ]); [( SafetyView * )aCard setRotatedFlag:NO ]; [ aCard removeFromSuperview ]; if([ safetyList indexOf:aCard ] != NX_NOT_IN_LIST ) { [ safetyList removeObject:aCard ]; } else if([ coupFoureeList indexOf:aCard ] != NX_NOT_IN_LIST ) { [ coupFoureeList removeObject:aCard ]; } else { assert( 0 /* card not in safety tile view */ ); } return [ self update ]; } - sendCard:( CardView * )aCard to:anObject { assert([ aCard isDescendantOf:self ]); [ self removeCard:aCard :self ]; [ anObject addCard:aCard :self ]; return self; } - sendAllCardsTo:anObject { while([ subviews count ]) [ self sendCard:[ subviews lastObject ] to:anObject ]; return self; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.