1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 23:52:26 +00:00
CLK/OSBindings/Mac/Clock Signal/ROMRequester/CSROMReceiverView.m
Thomas Harte 8de6cd3f44 Ensures that ROM files can be dragged and dropped into Swift.
Also adjusts the main window background colour, better to bridge the time between selecting a machine and it starting.
2019-07-22 17:18:31 -04:00

41 lines
989 B
Objective-C

//
// CSROMReceiverView.m
// Clock Signal
//
// Created by Thomas Harte on 22/07/2019.
// Copyright © 2019 Thomas Harte. All rights reserved.
//
#import "CSROMReceiverView.h"
@interface CSROMReceiverView () <NSDraggingDestination>
@end
@implementation CSROMReceiverView
- (void)awakeFromNib {
[super awakeFromNib];
// Accept file URLs by drag and drop.
[self registerForDraggedTypes:@[(__bridge NSString *)kUTTypeFileURL]];
}
#pragma mark - NSDraggingDestination
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender {
// Just forward the URLs.
for(NSPasteboardItem *item in [[sender draggingPasteboard] pasteboardItems]) {
NSURL *URL = [NSURL URLWithString:[item stringForType:(__bridge NSString *)kUTTypeFileURL]];
[self.delegate romReceiverView:self didReceiveFileAtURL:URL];
}
return YES;
}
- (NSDragOperation)draggingEntered:(id < NSDraggingInfo >)sender {
// The emulator will take a copy of any deposited ROM files.
return NSDragOperationCopy;
}
@end