//GifInfo.h
#import <AppKit/AppKit.h>
@interface GifInfo : NSObject
{
unsigned int delay;
NSString *path;
NSImage *image;
}
- initWithPath:(NSString *)aPath andDelay:(unsigned int)aDelay;
- (unsigned int)delay;
- (void)setDelay:(unsigned int)aDelay;
- (NSString *)path;
- (NSImage *)image;
@end
#import "GifInfo.h"
//
// GifInfo is the "Model" in the M-V-C pattern
// We simply use instances of this object
// to represent a GIF file, it's mini-image, and it's path
//
@implementation GifInfo
- (void)getImage
{
image = [[NSImage allocWithZone:[self zone]] initWithContentsOfFile:path];
[image setDataRetained:YES];
[image setScalesWhenResized:YES];
}
- (NSImage *)image
{
return image;
}
- initWithPath:(NSString *)p andDelay:(unsigned int)aDelay;
{
[super init];
path = [p copy];
delay = aDelay;
[self getImage];
return self;
}
- copyWithZone:(NSZone *)zone
{
return [[GifInfo allocWithZone:zone] initWithPath:path andDelay:delay];
}
- (unsigned int)delay
{
return delay;
}
- (void)setDelay:(unsigned int)aDelay
{
delay = aDelay;
}
- (NSString *)path;
{
return path;
}
- (void)dealloc
{
[path release];
[image release];
[super dealloc];
}
@end
|