
/* 
	ssClassModule.m - This is a sample shell for a NiteLite module.
	
		This implementation and the accompanying instructions are for 
		MetroTools version 1.0.x, for NiteLite version 1.0.x, and for NeXTstep 
		version 2.x.
		
		This shell is for use in creating your own MetroTools NiteLite module. 
		It provides instructions on how to implement each of the methods 
		required for a NiteLite module. See the interface file 
		'ssClassModule.h' and the document 'ToolsAPI.wn' for more instructions 
		on creating a NiteLite module.
		
		There is also a sample project to illustrate how a NiteLite module is 
		implemented.
		
	Version: 1.0 - 5/30/92
	Copyright 1992 by Metrosoft, All Rights Reserved.
*/

#import "ssClassModule.h"

@implementation ssClassModule

- initSelf:(BOOL)ifOnly
{
/* 
	This method is called from NiteLite and ssController when the module is 
	first loaded. You can do any initial setup here, if you want. 'ifOnly' is 
	set to true if you are being loaded to use your user interface (from 
	NiteLite.mTool), otherwise you are only being loaded to run the drawing 
	methods (from ssController).
*/

	return( self );
}

- doActivate:(mtClassNiteLite*)ssTool
{
/* 
	This method is called from NiteLite when you are made the active module in 
	preparation for displaying your controls. Do whatever setup and allocation 
	needed here.
*/

	return( self );
}

- doDeactivate
{
/*
	This method is called from NiteLite when another module is made the active 
	module, and you were the previously active module. Undo what was done in 
	'doActivate' here.
*/
 
	return( self );
}

- unload
{
/*
	This method is called from NiteLite and ssController when this module is 
	unloaded. deallocate any storage allocated here in the 'initSelf' method.
*/

	return( self );
}

- getSettings: (void**)data: (int*)size
{
/*
	This method is called by NiteLite to get the module's current control 
	settings. This is usually called in response to when your module calls 
	NiteLite with an 'ssModChanged' message. Allocate new storage for the 
	settings information and pass this back in 'data', and the size of it in 
	'size'. NiteLite will take control of this allocated storage, so don't 
	worry about deallocating it. NiteLite saves this information off in a 
	preferences file for your module based on whether it is foreground or 
	background. If you have no data to store for the settings, return a null 
	data pointer and zero size.
*/

	*data = 0L;
	*size = 0;
	
	return( self );
}

- setSettings: (void*)data: (int)size
{
/*
	This method is called by NiteLite and ssController to set the module's 
	control settings. You should set both your internal settings with this 
	information AND your user interface controls. This method is called when 
	you are made the active module and when the mode in NiteLite is changed 
	from foreground to background. 
	
	NOTE 1: 'data' can be passed in as null and 'size' zero. When this happens, 
	it is expected that you set up the controls and settings to default values. 
	
	NOTE 2: to be safe, you should verify that the size matches what should be 
	coming in for your data. If not, set your settings to the default values. 
	This way, you allow for changes in your data structure from version to 
	version. 
	
	NOTE 3: the 'data' pointer is owned by the controller app. Don't go 
	deallocating or reallocating it.
*/

	return( self );
}

- getControlsWindow:(Window**)theWind
{
/* 
	This method is called by NiteLite to get your module's controls. Pass the 
	window that contains the controls in 'theWind'. NiteLite will install these 
	into it's module control view. 
	
	NOTE: the window area should correspond to the module control view area of 
	NiteLite which is 248x305.
*/

	return( self );
}

- prepDraw:(BOOL)inFore
{
/*
	This method is called by NiteLite and ssController when you are about to 
	start drawing. If 'inFore' is true, you are going to be used in 
	'ScreenSaver' mode, else you are going to be running in the background. Set 
	up as much as possible needed for drawing here.
*/

	return( self );
}

- drawFrame:(View*)theView:(NXRect*)obsList:(int)nRects:(BOOL*)didDraw:
	(NXColor)backColor
{
/*
	This method is called by NiteLite and ssController to draw a 'frame' of 
	your animation. This is drawn into a buffered window, then the controller 
	app flushes it to the screen. The parameters passed in are:
		
		'theView' - the view that you are drawing into. You can get the bounds 
			from this.
		'obsList' - this is an obstruction list that you can use to determine 
			the non-rectangular boundaries of your image area. 'obsList' can be 
			null, which means that there are no obstructions. NOTE: currently, 
			'obsList' is always null. This is provided for future expanibility.
		'nRects' - the number of NXRects in obsList.
		'backColor' - this is the color of the background of your view. When 
			erasing, use this color.
	
	In 'didDraw' you pass back to the caller whether you actually did any 
	drawing. If true, the caller will then flush the buffer to the window, 
	otherwise it won't. This is useful if you are only updating based on some 
	timing parameters. Timing support is supplied by the routine 
	'currentTimeInMs()', which is available to your module when loaded. 
	
	NOTE: time is important here. Please be as effecient time-wise as possible 
	when drawing. Not only does it affect your own module's preformance, but 
	plans for future upgrades call for support of concurrently-running modules.
*/
		
	return( self );
}

- endDraw
{
/*
	This method is called when drawing is stopped. Deallocate any temporary 
	storage allocated in 'prepDraw', and do anything else needed to go dormant.
*/

	return( self );
}



@end
