If you are targeting Lion, you can subclass IKImageBrowserView and override the draggingSession:sourceOperationMaskForDraggingContext: NSDraggingSource method . To prevent drag and drop outside your application, simply return NSDragOperationNone if the context is NSDraggingContextOutsideApplication . Otherwise, return the drag and drop operations that interest you. Thus, you can prevent drag and drop to the desktop, Finder, etc., but still allow drag and drop in the application image viewer.
- (NSDragOperation)draggingSession:(NSDraggingSession *)session sourceOperationMaskForDraggingContext:(NSDraggingContext)context { [super draggingSession:session sourceOperationMaskForDraggingContext:context]; switch (context) { case NSDraggingContextOutsideApplication: return NSDragOperationNone; break; case NSDraggingContextWithinApplication: return NSDragOperationAll; break; default: return NSDragOperationAll; break; } }
source share