Changing the drag image on the fly
Changing the drag image on the fly
- Subject: Changing the drag image on the fly
- From: David Riggle <email@hidden>
- Date: Thu, 08 Apr 2010 18:14:10 -0700
I'd like to change the drag image based on the drop location, the way iCal does. I found this tantalizing snippet in the WebCore code:
if (cocoaImage) {
// Dashboard wants to be able to set the drag image during dragging, but Cocoa does not allow this.
// Instead we must drop down to the CoreGraphics API.
wkSetDragImage(cocoaImage, cocoaLoc);
// Hack: We must post an event to wake up the NSDragManager, which is sitting in a nextEvent call
// up the stack from us because the CoreFoundation drag manager does not use the run loop by itself.
// This is the most innocuous event to use, per Kristen Forster.
NSEvent* ev = [NSEvent mouseEventWithType:NSMouseMoved location:NSZeroPoint
modifierFlags:0 timestamp:0 windowNumber:0 context:nil eventNumber:0 clickCount:0 pressure:0];
[NSApp postEvent:ev atStart:YES];
}
http://www.opensource.apple.com/source/WebCore/WebCore-1A543a/platform/mac/ClipboardMac.mm
I can't find the implementation to wkSetDragImage(). Does anybody know what CoreGraphics APIs are used to set the drag image?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden