Re: NSFilePromisePboardType
Re: NSFilePromisePboardType
- Subject: Re: NSFilePromisePboardType
- From: Peter Maurer <email@hidden>
- Date: Fri, 17 Dec 2004 08:35:13 +0100
...
// FINALLY!!
// Okay HFS File promises work through a bit of black magic,
// I have h4x0red into it without revealing too much of it's workings
here
// I should edit this later to maintain whatever other info was on
the pboard
if ( [[pboard types] containsObject:NSFilesPromisePboardType] ) {
NSArray *promisedTypes = [[pboard
propertyListForType:NSFilesPromisePboardType] retain];;
NSFilePromiseDragSource *aFSource = [[[NSFilePromiseDragSource
alloc] initWithSource:sourceObject] autorelease];
[pboard declareTypes:[NSArray
arrayWithObjects:NSFilesPromisePboardType, @"CorePasteboardFlavorType
0x70686673", @"CorePasteboardFlavorType 0x66737350",
@"NSPromiseContentsPboardType", nil] owner:aFSource];
// Construct the HFS Flavor for the Finder to use on Drop
PromiseHFSFlavor aFlavor;
memset( &aFlavor, 0, sizeof(aFlavor) );
if ( [promisedTypes containsObject:@"'fold'"] ) aFlavor.fileType =
'fold';
aFlavor.fileCreator = '????';
aFlavor.promisedFlavor = 'fssP';
NSData *flavorData = [NSData dataWithBytes:&aFlavor length:14];
[pboard setPropertyList:promisedTypes
forType:NSFilesPromisePboardType];
[pboard setData:flavorData forType:@"CorePasteboardFlavorType
0x70686673"];
// Cleanup
[promisedTypes release];
}
Why don't you simply use [NSOutlineView dragPromisedFilesOfTypes: ...]
and override your outline view's
-dragImage:at:offset:event:pasteboard:source:slideBack: method to add
any additional pasteboard type you might want to use?
<http://developer.apple.com/documentation/Cocoa/Conceptual/DragandDrop/
Tasks/faq.html#//apple_ref/doc/uid/20002248/BBCFIJGF>
Works fine for me, and it's a somewhat more "official" way of doing
this ;-)
Peter.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden