If you're targeting Lion you can subclass IKImageBrowserView
and override the draggingSession:sourceOperationMaskForDraggingContext:
NSDraggingSource protocol method. To prevent drags outside of your application just return NSDragOperationNone
if the context is NSDraggingContextOutsideApplication
. Otherwise, return the dragging operations that you're interested in. This way you can disallow drags to the desktop, Finder, etc. but still permit drags within your application's image browser view.
- (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;
}
}