Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSFilePromisePboardType



...
// 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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >NSFilePromisePboardType (From: Fredrik Olsson <email@hidden>)
 >Re: NSFilePromisePboardType (From: Nick Zitzmann <email@hidden>)
 >Re: NSFilePromisePboardType (From: The Karl Adam <email@hidden>)
 >Re: NSFilePromisePboardType (From: The Karl Adam <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.