home *** CD-ROM | disk | FTP | other *** search
- //************************************************************************
- //
- // 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
-