Drag&Drop image to file
Drag&Drop image to file
- Subject: Drag&Drop image to file
- From: Raphael Sebbe <email@hidden>
- Date: Wed, 19 Mar 2003 09:30:00 +0100
Hi all,
I've subclassed NSImageView to add drag capabilities. It works with
NSTIFFPboardType (I can drag it in other apps where TIFF are accepted.
Now I'd like to drag it to the Desktop so that a .tiff file gets
created (` la Stone Create !). Could anyone give me a clue ?
Thanks
Raphael
- (void)mouseDown:(NSEvent *)event
{
NSSize dragOffset = NSMakeSize(0.0, 0.0);
NSPoint point = NSMakePoint(0, 0);
NSPasteboard *pboard;
if([self image])
{
pboard = [NSPasteboard pasteboardWithName:NSDragPboard];
[pboard declareTypes:[NSArray
arrayWithObjects:NSTIFFPboardType, nil] owner:self];
[pboard set
Data:[[self image] TIFFRepresentation]
forType:NSTIFFPboardType];
[self dragImage:[self image]
at:point
offset:dragOffset
event:event
pasteboard:pboard
source:self
slideBack:YES];
}
return;
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.