ftp.nice.ch/pub/next/connectivity/protocol/GateKeeper.2.2.s.tar.gz#/GateKeeper.2.2.s/SwapLaterView.m

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

//************************************************************************
//
//	SwapLaterView.m.  
//
//		Subclass of SwapView which allows a control in the view heirarchy
//		to trigger swapping.  Unlike is ancestor class swapping is not
//		performed immediately but scheduled to occur later.
//		
//
//	This code is supplied "as is" the author's makes no warranty as to its 
//	suitability for any purpose.  This code is free and may be distributed 
//	in accordance with the terms of the:
//		
//			GNU GENERAL PUBLIC LICENSE
//			Version 2, June 1991
//			copyright (C) 1989, 1991 Free Software Foundation, Inc.
// 			675 Mass Ave, Cambridge, MA 02139, USA
//
//************************************************************************

#import "SwapLaterView.h"

@implementation SwapLaterView

//*****************************************************************************
//
// 		swaps views in and out of inspector's swapview
//
//*****************************************************************************
 
- swapIt
{
	if([self whatPanel])			
		{							// make sure this is a new view to swap in
		if(lastInspector != inspector)		
			{	 									
			if(lastInspector)						// swap Later
				[self perform:@selector(swapLater) with:self afterDelay:0 	
														cancelPrevious:YES];
			else
				{
				[self addSubview:[inspector contentView]];
				lastInspector = inspector;		// remember panel it came from 	
				[self display];
				}
			}
		}
	else
		{							// no inspector so clean up the background
		[self lockFocus];
		PSsetgray(backgroundGray);			// use the backgroundGray
		NXRectFill(&bounds);
		[self unlockFocus];
		lastInspector = (id)NULL;			// now the last inspector is NULL 
		NXPing();				// let the window server cetch up... (yawn...)
		}							

	return self;
}
//*****************************************************************************
//
// 		delayed swapping of views in the view heirarchy 
//
//*****************************************************************************

- swapLater
{
	[self replaceSubview:[lastInspector contentView] 
												with:[inspector contentView]];
	lastInspector = inspector;		// remember the panel it came from 	
	[self display];

	return self;
}


@end

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