This is SwapView.m in view mode; [Download] [Up]
/*-------------------------------------------------------------------------- * * You may freely copy, distribute, and reuse the code in this example. * SHL Systemhouse disclaims any warranty of any kind, expressed or * implied, as to its fitness for any particular use. * * * SwapView * * Inherits From: View * * Conforms To: none * * Declared In: SwapView.h * *------------------------------------------------------------------------*/ #import "SwapView.h" @implementation SwapView - initFrame: (const NXRect *) theFrame { [super initFrame:theFrame]; [self setAutoresizeSubviews:YES]; currentPanel = nil; currentView = nil; return self; } - currentPanel { return currentPanel; } - swap: storagePanel; { id aView; if (storagePanel != currentPanel) { aView = [currentPanel contentView]; [self swapView:[currentPanel contentView]]; [currentPanel setContentView:aView]; currentPanel = storagePanel; } return self; } - swapView: newView; { if (newView != currentView) { [currentView removeFromSuperview]; currentView = newView; [currentView setFrame:&frame]; [currentView moveTo:0.0 :0.0]; [self addSubview:currentView]; [[self window] display]; } return self; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.