ftp.nice.ch/pub/next/developer/resources/classes/misckit/MiscKit.1.10.0.s.gnutar.gz#/MiscKit/Examples/IconTester/IconController.m

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

#import "IconController.h"

#define ICON_ANIM_FILE "/Net/java/Users/Developers/t641_craig/anim2.tst"

@implementation IconController


//** designated initializer
- init
{
	List	*temp;

	if (self = [super init]) {
		animator = [[MiscAppIconAnimator alloc] init];

		//** create array of images
		temp = [[List alloc] init];
		[temp addObject:[NXImage findImageNamed:"Bronto"]];
		[temp addObject:[NXImage findImageNamed:"Raptor"]];
		[temp addObject:[NXImage findImageNamed:"TriTop"]];
		[animator setImageArray:temp];

		//** create array of pattern order
		temp = [[List alloc] init];
		[temp addObject:(id)0];
		[temp addObject:(id)1];
		[temp addObject:(id)2];
		[temp addObject:(id)1];
		[temp addObject:(id)2];
		[temp addObject:(id)1];
		[temp addObject:(id)2];
		[temp addObject:(id)1];
		[temp addObject:(id)2];
		[temp addObject:(id)1];
		[temp addObject:(id)2];
		[temp addObject:(id)1];
		[temp addObject:(id)0];
		[animator setAnimationPattern:temp];

		[animator setPatternLoops:1 ];
		return self;
	}
	return nil;
}

-free
{
	if (animator)
		[animator free];
	return [super free];
}

- animate:sender
{
	[animator startAnimation:sender];
	[button setEnabled:YES];
    return self;
}

- stopAnimate:sender
{
	[animator stopAnimation];
	[button setEnabled:NO];
//	[animator displayImageAtIndex:2];
    return self;
}

- save:sender
{
	NXTypedStream *stream;

	//** open file and save data
	stream = NXOpenTypedStreamForFile(ICON_ANIM_FILE, NX_WRITEONLY);
	if (!stream)
	{
		NXRunAlertPanel("File Alert", "Write failed!", NULL, NULL, NULL);
		return nil;
	}
	NXWriteRootObject(stream, animator);	//** archive object
	NXCloseTypedStream(stream);

	return self;
}

- load:sender
{
	NXTypedStream *stream;

	//** open file and read data
	stream = NXOpenTypedStreamForFile(ICON_ANIM_FILE, NX_READONLY);
	if (!stream)
	{
		NXRunAlertPanel("File Alert", "Read failed!", NULL, NULL, NULL);
		return nil;
	}

	animator = NXReadObject(stream);		//** retrieve object
	NXCloseTypedStream(stream);
	return self;
}



@end

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