/*

File FileList.m

Release 1.2, 7 June 1994
Copyright (C) 1994 by H. Scott Roy

This code is part of IconKit, a general toolbox for drag-and-drop applications.  IconKit is free for noncommercial use, but costs money for a commercial license.  You should have received a copy of the license agreement with this file.  If not, a copy of the license and the complete source of IconKit can be obtained from the author:

		H. Scott Roy
		2573 Stowe Ct.
		Northbrook, IL  60062-8103
		iconkit@cs.stanford.edu

For your editing convenience, this file is best viewed using an editor that automatically wraps long lines, in a fixed point font at 80 columns, with tabs every 4 spaces.

*/


/* ========================================================================== */


/*

These objects represent lists of files.  The application uses these to indicate multiple selections in the browser.

*/

#import <appkit/appkit.h>

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

@implementation FileList


/* ========================================================================== */


#define BUFSIZE		10000


/* ========================================================================== */


/*

A FileList only differs from an IconList in the way that it copies itself to the pasteboard.  Multiple filenames are separated by tabs.

*/


- copyToPasteboard: (Pasteboard *) pboard
{
	NXAtom
		pasteTypes [] = { NXFilenamePboardType, NULL };
	char
		files [BUFSIZE],
		* p;
	int
		i;
	
	p = files;
	i = [self  count];
	
	while (i--)
	{
		strcat(p, [[self  objectAt: i]  path]);
		strcat(p, "\t");
		while (*p) p++;
	}
	
	if (p > files) p--;
	*p = '\0';
	
	[super  copyToPasteboard: pboard];
	[pboard  addTypes: pasteTypes  num: 1  owner: nil];
	[pboard  writeType: NXFilenamePboardType  data: files  length: p - files];
	
	return self;
}


@end