forked from jjgod/mac-dictionary-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DUWindow.m
43 lines (33 loc) · 971 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: NSFilenamesPboardType, nil]];
}
- (NSDragOperation) draggingEntered: (id < NSDraggingInfo >) sender
{
NSPasteboard *pboard = [sender draggingPasteboard];
NSDragOperation opType = NSDragOperationNone;
if ([[pboard types] containsObject: NSFilenamesPboardType])
opType = NSDragOperationCopy;
return opType;
}
- (BOOL) performDragOperation: (id < NSDraggingInfo >) sender
{
NSPasteboard *pboard = [sender draggingPasteboard];
BOOL successful = NO;
if ([[pboard types] containsObject: NSFilenamesPboardType])
{
NSArray *files = [pboard propertyListForType: NSFilenamesPboardType];
[controller startConversion: [files objectAtIndex: 0]];
successful = NO;
}
return successful;
}
@end