My application allows dragging to both the main window and to a Status item.
- If I drag a file from Stacks to my window, it works perfectly.
- If I drag a file from Finder to my window, it works perfectly.
- If I drag a file from Finder to my status item, it works perfectly.
- If I drag a file from Stack to my status item, it doesn't work.
Both window and status item use the exact same drag and drop handling code.
The funny thing is that when a file is dragged from Stacks onto the status item, the cursor changes as expected because the - (NSDragOperation)draggingEntered:(id )sender { NSPasteboard *pboard; NSDragOperation sourceDragMask; method is called as expected.
When the file is dropped, however, the - (BOOL)performDragOperation:(id )sender { NSPasteboard *pboard; NSDragOperation sourceDragMask; method is NOT called.
Here is the implementation of the first method:
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender {
NSPasteboard *pboard;
NSDragOperation sourceDragMask;
sourceDragMask = [sender draggingSourceOperationMask];
pboard = [sender draggingPasteboard];
if ( [[pboard types] containsObject:NSColorPboardType] ) {
if (sourceDragMask & NSDragOperationGeneric) {
return NSDragOperationGeneric;
}
}
if ( [[pboard types] containsObject:NSFilenamesPboardType] ) {
if (sourceDragMask & NSDragOperationLink) {
return NSDragOperationLink;
} else if (sourceDragMask & NSDragOperationCopy) {
return NSDragOperationCopy;
}
}
return NSDragOperationNone;
}
Thanks!