#pragma .h #import <IconKit/iconkit.h>

#import <Foundation/NSString.h>

#import <AppKit/AppKit.h>

#import "FileList.h"
#import "File.h"

@implementation FileList:IKList
{

}


- (void)copyToPasteboard: (NSPasteboard *) pboard
{
    NSMutableArray *p = [NSMutableArray array];
    int		   i, count;

    for(i = 0, count = [self count]; i < count; i++) {
        [p addObject:[[self objectAtIndex:i] path]];
    }
    [super copyToPasteboard:pboard];
    [pboard addTypes:[NSArray arrayWithObject:NSFilenamesPboardType] owner:nil];
    [pboard setPropertyList:p forType:NSFilenamesPboardType];
}

+ readFromPasteboard: (NSPasteboard *) pboard
{
    id fileList = nil;
    if ((fileList = [super readFromPasteboard: pboard]) == nil && [pboard availableTypeFromArray:[NSArray arrayWithObject:NSFilenamesPboardType]] != NULL) {
        id a = [pboard propertyListForType:NSFilenamesPboardType];
        if([a isKindOfClass:[NSArray class]]) {
            int i, count = [a count];
            fileList = [[self alloc] initCount:[a count]];
            for(i = 0; i < count; i++) {
                [fileList addObject:[File fileForPath:[a objectAtIndex:i]]];
            }
       }
    }
    return fileList;
}


@end