This is RootWindow.m in view mode; [Download] [Up]
// RootWindow.m // Subclass of Window to work in conjunction with the ReplacementWindow // class in creating poor-person's hypercard-type applications. // // Created by Ali Ozer, Nov 21, 1989 #import "RootWindow.h" #import <libc.h> #import <appkit/Application.h> #import <appkit/View.h> @implementation RootWindow - makeContentView:view { if (originalContentView == nil) { [NXApp setAutoupdate:YES]; originalContentView = [self contentView]; originalTitle = malloc(strlen([self title])+1); strcpy (originalTitle, [self title]); } newContentView = view; return self; } - replace:sender { newContentView = originalContentView; return self; } - update { if (newContentView) { id newLastWindow = [newContentView window]; if (!newLastWindow) { // Go back to original [self setTitle:originalTitle]; } else { // Else replace with new [newContentView removeFromSuperview]; [self setTitle:[newLastWindow title]]; } if (lastWindow) { // Restore previous window's content [lastWindow setContentView:[self setContentView:newContentView]]; } else { [self setContentView:newContentView]; } lastWindow = newLastWindow; newContentView = nil; [self display]; } return [super update]; } - free { if (originalTitle) free (originalTitle); return [super free]; } - write:(NXTypedStream *)stream { [super write:stream]; NXWriteObjectReference(stream, lastWindow); NXWriteObjectReference(stream, previousWindow); NXWriteObjectReference(stream, newContentView); NXWriteObjectReference(stream, originalContentView); NXWriteType(stream, "*", &originalTitle); return self; } - read:(NXTypedStream *)stream { [super read:stream]; lastWindow = NXReadObject(stream); previousWindow = NXReadObject(stream); newContentView = NXReadObject(stream); originalContentView = NXReadObject(stream); NXReadType(stream,"*",&originalTitle); return self; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.