-
Notifications
You must be signed in to change notification settings - Fork 178
/
DUWindow.m
43 lines (33 loc) · 979 Bytes
/
DUWindow.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//
// DUWindow.m
// DictUnifier
//
// Created by Jjgod Jiang on 3/11/10.
//
#import "DUWindow.h"
@implementation DUWindow
- (void) awakeFromNib
{
[self registerForDraggedTypes: [NSArray arrayWithObjects: NSPasteboardTypeFileURL, nil]];
}
- (NSDragOperation) draggingEntered: (id < NSDraggingInfo >) sender
{
NSPasteboard *pboard = [sender draggingPasteboard];
NSDragOperation opType = NSDragOperationNone;
if ([[pboard types] containsObject: NSPasteboardTypeFileURL])
opType = NSDragOperationCopy;
return opType;
}
- (BOOL) performDragOperation: (id < NSDraggingInfo >) sender
{
NSPasteboard *pboard = [sender draggingPasteboard];
BOOL successful = NO;
if ([[pboard types] containsObject: NSPasteboardTypeFileURL])
{
NSArray *files = [pboard propertyListForType: NSPasteboardTypeFileURL];
[controller startConversion: [files objectAtIndex: 0]];
successful = NO;
}
return successful;
}
@end