ftp.nice.ch/pub/next/games/card/NeXTmille.2.0.s.tar.gz#/NeXTmille-2.0a/CardView.h

This is CardView.h in view mode; [Download] [Up]

/* Generated by Interface Builder */

#import "TagView.h"
#import	"CardImage.h"
#import	"DragCoordinator.h"
#import	<appkit/appkit.h>
#import	<zone.h>


// This is a base class from which every card is derived.

 
												// These are the physical bitmap size for each card. 
#define	CARD_WIDTH	100
#define	CARD_HEIGHT	150


												// All cards in the deck have the save top face image.
												//	This variable is assigned in this class's
												//	+initialize method and all instances of this class
												//	reference that bitmap when drawing their top face.
	extern CardImage	*topFaceBitmap;
												// All of the cards composite their face to this window
												//	to implement dragging.  
												// This variable is initialized in the class's
												//	+initialize method.
	extern Window		*compositeWindow;
												// All of the card image objects are allocated
												//	from this zone.
	extern NXZone		*cardZone;
	
	
@interface CardView:TagView
{

												// This is the bitmap used for the bottom face of the card.
												//	This variable is declared here but 
												//	always assigned in a subclass.
	CardImage			*bottomFaceBitmap;
												// When true the top face of the card is composited to
												//	the view, false indicates the bottom face.
	BOOL				showTopFaceFlag;
												// This flag indicates to the card whether it should respond
												//	to events implemented in this class or pass then along the
												//	responder chain.  Cards that are in the draw pile and your
												//	hand tile respond to events.  In all other cases the events are
												//	passed along the responder chain (this is because the draw pile
												//	and hand tile are the only cases where cards can be grabbed).
	BOOL				eventsEnabledFlag;
												// Dragging a card is implemented more in fashion with how 
												//	the appkit intended it to--although it is somewhat complex.
												// When the mouseDown:event is detected the window's event mask is
												//	altered to allow dragging.  The mouseUp: event restores it to
												//	its previous state.
												// The delta is the coordinate depth into the card--in bounds
												//	coordinates--where the mouseDown: event was first detecetd.
												//	this allows for offset adjustment when the card is being
												//	dragged (we have to specify the corner of the composite
												//	window when dragging).
	int					oldMask;
	NXPoint				cardDelta;
												// While a card is being dragged around the screen and when the
												//	card is released, this object is informed of those actions.
												// That object takes care of notifying tracking views and passing
												//	the card from this object's super view to the tracking view.
	DragCoordinator		*dragCoordinator;
}

												// The initialize method locates and creates a bitmap for
												//	the top card face such that this bitmap can be shared by
												//	all cards.
+ initialize;
												// The +new method simply modifys the instance variable 
												//	so that the top card will be displayed first.
- init;
												// Destroys the bottom card face bitmap.
- free;
												// This method controls whether subclasses of this class will
												//	respond to events (YES=respond).
												// This method is usually called by one of the stack or tile views
												//	when a card is handed to them.
- setEventsEnabled:( BOOL )flag;
												// On mouseDown: events the card is composited to the compositeWindow's
												//	content view and the window is displayed above the card's view.
												//	The play window's event mask is altered to allow dragging events to be 
												//	passed.
												// When the mouse goes up the window is moved off the screen.  If the
												//	mouseUp: event ocurred over a tracking rectangle then the card
												//	view is passed to the owner of that rectangle.  Also, then window's
												//	event mask is restored to its previous state.
												// As mouseDragged: events are received the compositeWindow is moved
												//	about the screen.
- mouseDown:( NXEvent * )theEvent;
- mouseUp:( NXEvent * )theEvent;
- mouseDragged:( NXEvent * )theEvent;
												// This object is informed of card drag movement and when the
												//	card is released.
- setDragCoordinator:( DragCoordinator * )anObject;
												// This method determines which face of the card is displayed
												//	(YES==top side).
- setShowTopFace:( BOOL )flag;


- drawSelf:( const NXRect * )rects :( int )rectCount;


@end

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