home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / Connectivity / GateKeeper-2.1 / SwapLaterView.m < prev    next >
Encoding:
Text File  |  1996-06-24  |  2.2 KB  |  78 lines

  1. //************************************************************************
  2. //
  3. //    SwapLaterView.m.  
  4. //
  5. //        Subclass of SwapView which allows a control in the view heirarchy
  6. //        to trigger swapping.  Unlike is ancestor class swapping is not
  7. //        performed immediately but scheduled to occur later.
  8. //        
  9. //
  10. //    This code is supplied "as is" the author's makes no warranty as to its 
  11. //    suitability for any purpose.  This code is free and may be distributed 
  12. //    in accordance with the terms of the:
  13. //        
  14. //            GNU GENERAL PUBLIC LICENSE
  15. //            Version 2, June 1991
  16. //            copyright (C) 1989, 1991 Free Software Foundation, Inc.
  17. //             675 Mass Ave, Cambridge, MA 02139, USA
  18. //
  19. //************************************************************************
  20.  
  21. #import "SwapLaterView.h"
  22.  
  23. @implementation SwapLaterView
  24.  
  25. //*****************************************************************************
  26. //
  27. //         swaps views in and out of inspector's swapview
  28. //
  29. //*****************************************************************************
  30.  
  31. - swapIt
  32. {
  33.     if([self whatPanel])            
  34.         {                            // make sure this is a new view to swap in
  35.         if(lastInspector != inspector)        
  36.             {                                         
  37.             if(lastInspector)                        // swap Later
  38.                 [self perform:@selector(swapLater) with:self afterDelay:0     
  39.                                                         cancelPrevious:YES];
  40.             else
  41.                 {
  42.                 [self addSubview:[inspector contentView]];
  43.                 lastInspector = inspector;        // remember panel it came from     
  44.                 [self display];
  45.                 }
  46.             }
  47.         }
  48.     else
  49.         {                            // no inspector so clean up the background
  50.         [self lockFocus];
  51.         PSsetgray(backgroundGray);            // use the backgroundGray
  52.         NXRectFill(&bounds);
  53.         [self unlockFocus];
  54.         lastInspector = (id)NULL;            // now the last inspector is NULL 
  55.         NXPing();                // let the window server cetch up... (yawn...)
  56.         }                            
  57.  
  58.     return self;
  59. }
  60. //*****************************************************************************
  61. //
  62. //         delayed swapping of views in the view heirarchy 
  63. //
  64. //*****************************************************************************
  65.  
  66. - swapLater
  67. {
  68.     [self replaceSubview:[lastInspector contentView] 
  69.                                                 with:[inspector contentView]];
  70.     lastInspector = inspector;        // remember the panel it came from     
  71.     [self display];
  72.  
  73.     return self;
  74. }
  75.  
  76.  
  77. @end
  78.