mirror of
https://github.com/iaddis/metalnes.git
synced 2024-06-01 19:08:14 -04:00
55 lines
1.2 KiB
Plaintext
55 lines
1.2 KiB
Plaintext
|
|
#import "MetalView.h"
|
|
|
|
@implementation MetalView
|
|
|
|
-(BOOL)acceptsFirstResponder
|
|
{
|
|
return YES;
|
|
}
|
|
|
|
- (void)keyDown:(NSEvent *)event
|
|
{
|
|
[self.eventDelegate keyDown:event];
|
|
}
|
|
|
|
- (void)keyUp:(NSEvent *)event
|
|
{
|
|
[self.eventDelegate keyUp:event];
|
|
}
|
|
|
|
|
|
- (void)registerDragDrop
|
|
{
|
|
[self registerForDraggedTypes:[NSArray arrayWithObjects:
|
|
NSPasteboardTypeFileURL, nil]];
|
|
}
|
|
|
|
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
|
|
{
|
|
NSDragOperation sourceDragMask = [sender draggingSourceOperationMask];
|
|
NSPasteboard *pboard = [sender draggingPasteboard];
|
|
|
|
if ( [[pboard types] containsObject:NSPasteboardTypeFileURL] ) {
|
|
if (sourceDragMask & NSDragOperationLink) {
|
|
return NSDragOperationLink;
|
|
} else if (sourceDragMask & NSDragOperationCopy) {
|
|
return NSDragOperationCopy;
|
|
}
|
|
}
|
|
return NSDragOperationNone;
|
|
}
|
|
|
|
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
|
|
{
|
|
NSPasteboard *pboard = [sender draggingPasteboard];
|
|
|
|
if ( [[pboard types] containsObject:NSPasteboardTypeFileURL] ) {
|
|
NSArray *files = [pboard propertyListForType:NSPasteboardTypeFileURL];
|
|
[self.eventDelegate onDragDrop:files];
|
|
}
|
|
return YES;
|
|
}
|
|
|
|
@end
|