mirror of
https://github.com/libretro/RetroArch
synced 2025-03-02 19:13:34 +00:00
(OSX) Add preliminary drag and drop code
This commit is contained in:
parent
d6d757e240
commit
cbae4af38a
@ -64,6 +64,7 @@ void *glkitview_init(void);
|
||||
|
||||
#if defined(HAVE_COCOA)
|
||||
[self setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
|
||||
[self registerForDraggedTypes:[NSArray arrayWithObjects:NSColorPboardType, NSFilenamesPboardType, nil]];
|
||||
#elif defined(HAVE_COCOATOUCH)
|
||||
self.view = (__bridge GLKView*)glkitview_init();
|
||||
|
||||
@ -96,6 +97,41 @@ void *glkitview_init(void);
|
||||
{
|
||||
}
|
||||
|
||||
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
|
||||
{
|
||||
NSDragOperation sourceDragMask = [sender draggingSourceOperationMask];
|
||||
NSPasteboard *pboard = [sender draggingPasteboard];
|
||||
|
||||
if ( [[pboard types] containsObject:NSFilenamesPboardType] )
|
||||
{
|
||||
if (sourceDragMask & NSDragOperationCopy)
|
||||
return NSDragOperationCopy;
|
||||
}
|
||||
|
||||
return NSDragOperationNone;
|
||||
}
|
||||
|
||||
- (BOOL)performDragOperation:(id<NSDraggingInfo>)sender
|
||||
{
|
||||
NSPasteboard *pboard = [sender draggingPasteboard];
|
||||
|
||||
if ( [[pboard types] containsObject:NSURLPboardType])
|
||||
{
|
||||
NSURL *fileURL = [NSURL URLFromPasteboard:pboard];
|
||||
NSString *s = [fileURL path];
|
||||
if (s != nil)
|
||||
{
|
||||
RARCH_LOG("Drop name is: %s\n", [s UTF8String]);
|
||||
}
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)draggingExited:(id <NSDraggingInfo>)sender
|
||||
{
|
||||
[self setNeedsDisplay: YES];
|
||||
}
|
||||
|
||||
#elif defined(HAVE_COCOATOUCH)
|
||||
- (void)viewDidAppear:(BOOL)animated
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user