-
Notifications
You must be signed in to change notification settings - Fork 70
/
Copy pathDropBox.m
76 lines (62 loc) · 1.83 KB
/
DropBox.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//
// DropBox.m
// APIScanner
//
// Created by Andrew Schenk on 9/13/10.
// Copyright 2010 Chimp Studios. All rights reserved.
//
#import "DropBox.h"
#import "MainVC.h"
@implementation DropBox
@synthesize delegate;
- (id)initWithFrame:(NSRect)frame {
self = [super initWithFrame:frame];
if (self) {
// Initialization code here.
[self registerForDraggedTypes:[NSArray arrayWithObjects:NSFilenamesPboardType, nil]];
}
return self;
}
-(void)drawRect:(NSRect)dirtyRect
{
}
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender {
NSPasteboard *pboard;
NSDragOperation sourceDragMask;
sourceDragMask = [sender draggingSourceOperationMask];
pboard = [sender draggingPasteboard];
if ( [[pboard types] containsObject:NSFilenamesPboardType] ) {
if (sourceDragMask & NSDragOperationLink) {
return NSDragOperationLink;
} else if (sourceDragMask & NSDragOperationCopy) {
return NSDragOperationCopy;
}
}
return NSDragOperationNone;
}
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender {
NSPasteboard *pboard;
NSDragOperation sourceDragMask;
sourceDragMask = [sender draggingSourceOperationMask];
pboard = [sender draggingPasteboard];
if ( [[pboard types] containsObject:NSFilenamesPboardType] ) {
NSArray *files = [pboard propertyListForType:NSFilenamesPboardType];
//NSLog(@"box. %@", [files description]);
[delegate didReceiveDraggedFiles:files];
// Depending on the dragging source and modifier keys,
// the file data may be copied or linked
/*
if (sourceDragMask & NSDragOperationLink) {
[self addLinkToFiles:files];
} else {
[self addDataFromFiles:files];
}
*/
}
return YES;
}
-(void)dealloc {
[delegate release];
[super dealloc];
}
@end