forked from jjgod/mac-dictionary-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DUImageView.m
43 lines (33 loc) · 980 Bytes
/
DUImageView.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
//
// DUImageView.m
// DictUnifier
//
// Created by Jjgod Jiang on 3/11/10.
//
#import "DUImageView.h"
@implementation DUImageView
- (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