ftp.nice.ch/pub/next/developer/objc/appkit/DrawInIcon.NI.bs.tar.gz#/DrawInIcon/MyApp.m

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

//
// Copyright 1995 (c) Icebox Software Manufactory, Inc.  All Rights Reserved.
//


#import "MyApp.h"
#import "LineView.h"

#define BORDER  ( 2 )

@implementation MyApp

- appDidInit:sender
{
	NXRect	appIconFrame;
	NXRect	lineViewRect;

	// Get the appIcon (for later use too), and then
	// get the sucker's frame to use to get the content
	// view of the appIcon defined by its style.
	appIcon = [NXApp appIcon];
    [appIcon getFrame:&appIconFrame];
    [Window getContentRect:&lineViewRect
			forFrameRect:&appIconFrame
			style:[appIcon style]];

	// Adjust the size and width, size by the BORDER
	// and the width and height by the BORDER * 2
	NX_X(&lineViewRect) = BORDER;
	NX_Y(&lineViewRect) = BORDER;
	NX_WIDTH(&lineViewRect) -= BORDER * 2;
	NX_HEIGHT(&lineViewRect) -= BORDER * 2;

	lineView = [[LineView alloc] initFrame:&lineViewRect];
	if ( ! lineView ) {
		NXLogError("Can't alloc an instance of 'LineView' class");
		[self terminate:nil];
	}

	[[appIcon contentView] addSubview:lineView];

	// Set up the view with some an initial state that represents
	// the state of the nib file control widgets.
	///
	[lineView lineColor:[lineColorWell color]];
	[lineView backingColor:[backingColorWell color]];
	[lineView lineWidth:[widthSlider floatValue]];
	[lineView speed:[speedSlider floatValue]];
	[lineView numberOfLines:[numberOfLinesSlider intValue]];

	// Crank up the view.
	[lineView start];

	return ( self );
}


- appWillTerminate:sender
{
	[lineView stop];
	return ( self );  // Return non-nil to continue the termination.
}


// Action Methods
- lineColor:sender
{
	[lineView lineColor:[sender color]];
	return ( self );
}


- backingColor:sender
{
	[lineView backingColor:[sender color]];
	return ( self );
}


- lineWidth:sender
{
	[lineView lineWidth:[sender floatValue]];
	return ( self );
}


- speed:sender
{
	[lineView speed:[sender floatValue]];
	return ( self );
}


- numberOfLines:sender
{
	[lineView numberOfLines:[sender intValue]];
	return ( self );
}

@end

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