-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFFDropWindow.m
executable file
·47 lines (35 loc) · 1.1 KB
/
FFDropWindow.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
44
45
46
47
RCS_ID("$Id: FFDropWindow.m 209 2004-07-13 14:18:21Z ravemax $")
#import "FFDropWindow.h"
#import "FFController.h"
@implementation FFDropWindow
- (void)awakeFromNib
{
[self registerForDraggedTypes:[NSArray arrayWithObjects:NSFilenamesPboardType, nil]];
}
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
NSArray* types;
types = [[sender draggingPasteboard] types];
if ([types containsObject:NSFilenamesPboardType] && ([sender draggingSourceOperationMask] & NSDragOperationGeneric))
return NSDragOperationGeneric;
return NSDragOperationNone;
}
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
NSPasteboard* pb;
NSArray* types, *files;
pb = [sender draggingPasteboard];
types = [pb types];
if ([types containsObject:NSFilenamesPboardType]) {
files = [pb propertyListForType:NSFilenamesPboardType];
// objc_msgSend(dropObject, dropSelector, files); // Damn GCC 3.3 breaks this code
[(FFController*)dropObject filesWereDropped:files]; // Now hardwired
}
return TRUE;
}
- (void)setDropObject:(id)obj andSelector:(SEL)sel
{
dropObject = obj;
dropSelector = sel;
}
@end