ftp.nice.ch/pub/next/science/mathematics/workbench/Workbench.3.0.s.tar.gz#/Workbench/OutputViewBox.m

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

// OutputViewBox.m
// By Judy D. Halchin, Educational Computing Services, Allegheny College.
// Copyright 1993 Allegheny College.  
// You may freely copy, distribute and reuse this code. 
// Allegheny College and the author disclaim any warranty of any kind, 
// expressed or implied, as to its fitness for any particular use.
// This work was partially supported by a Teacher Preparation grant from the 
// National Science Foundation.

#import "OutputViewBox.h"
#import "DefaultView.h"

@implementation OutputViewBox

- initFrame:(const NXRect *)frameRect
{
	NXRect viewBounds;
	
	[super initFrame:frameRect];
	 
	[contentView setAutoresizeSubviews:YES];
	[self setOffsets:0 :0];
	[self setTitlePosition:NX_NOTITLE];
	[self setBorderType:NX_LINE];
	
	[contentView getBounds:&viewBounds];
	defaultView = [[DefaultView allocFromZone:[self zone]] 
													initFrame:&viewBounds];
	[defaultView setAutosizing:NX_WIDTHSIZABLE | NX_HEIGHTSIZABLE];
	[self addSubview:defaultView];
	
	return self;
}

- insertView:view
{
	int viewIndex, subviewCount;
	id subviewList, subview;
	NXRect viewBounds;
	
	// remove the old subview and free it if it was the default view
		subviewList = [contentView subviews];
		subviewCount = [subviewList count];
		for (viewIndex = subviewCount-1; viewIndex >= 0; viewIndex--)
		{
			subview = [subviewList objectAt:viewIndex];
			[subview removeFromSuperview];
			if (subview == defaultView)
				[defaultView free];
		}
	
	// insert the new subview
		[view setAutosizing:NX_WIDTHSIZABLE | NX_HEIGHTSIZABLE];
		[contentView getBounds:&viewBounds];
		[view setFrame:&viewBounds];	
		[self addSubview:view];

	return self;
}

@end

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