|
|
@@ -24,20 +24,7 @@ |
|
|
|
|
|
|
|
} // namespace juce
|
|
|
|
|
|
|
|
@interface NSDraggingSourceHelper : NSObject <NSDraggingSource>
|
|
|
|
{
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation NSDraggingSourceHelper
|
|
|
|
|
|
|
|
-(NSDragOperation) draggingSession: (NSDraggingSession *)session sourceOperationMaskForDraggingContext: (NSDraggingContext)context
|
|
|
|
{
|
|
|
|
juce::ignoreUnused (session, context);
|
|
|
|
return NSDragOperationCopy;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
|
|
|
#include "../../juce_core/native/juce_osx_ObjCHelpers.h"
|
|
|
|
|
|
|
|
namespace juce {
|
|
|
|
|
|
|
@@ -250,6 +237,26 @@ bool DragAndDropContainer::performExternalDragDropOfText (const String& text) |
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
class NSDraggingSourceHelper : public ObjCClass <NSObject <NSDraggingSource>>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NSDraggingSourceHelper()
|
|
|
|
: ObjCClass <NSObject <NSDraggingSource>> ("JUCENSDraggingSourceHelper_")
|
|
|
|
{
|
|
|
|
addMethod (@selector (draggingSession:sourceOperationMaskForDraggingContext:), sourceOperationMaskForDraggingContext, "c@:@@");
|
|
|
|
|
|
|
|
registerClass();
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
static NSDragOperation sourceOperationMaskForDraggingContext (id, SEL, NSDraggingSession*, NSDraggingContext)
|
|
|
|
{
|
|
|
|
return NSDragOperationCopy;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static NSDraggingSourceHelper draggingSourceHelper;
|
|
|
|
|
|
|
|
bool DragAndDropContainer::performExternalDragDropOfFiles (const StringArray& files, bool /*canMoveFiles*/)
|
|
|
|
{
|
|
|
|
if (files.isEmpty())
|
|
|
@@ -279,7 +286,7 @@ bool DragAndDropContainer::performExternalDragDropOfFiles (const StringArray& fi |
|
|
|
[dragItem release];
|
|
|
|
}
|
|
|
|
|
|
|
|
auto* helper = [[NSDraggingSourceHelper alloc] autorelease];
|
|
|
|
auto* helper = [draggingSourceHelper.createInstance() autorelease];
|
|
|
|
|
|
|
|
if (! [view beginDraggingSessionWithItems: dragItems
|
|
|
|
event: event
|
|
|
|