• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Drag&Drop image to file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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 setData:[[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.

  • Follow-Ups:
    • Re: Drag&Drop image to file
      • From: j o a r <email@hidden>
  • Prev by Date: From 256M to 768M and still paging a lot
  • Next by Date: Re: Drag&Drop image to file
  • Previous by thread: Re: Screen saver with shared contexts
  • Next by thread: Re: Drag&Drop image to file
  • Index(es):
    • Date
    • Thread