-
Notifications
You must be signed in to change notification settings - Fork 1
/
QSObjectDraggedTableView.m
46 lines (39 loc) · 1.21 KB
/
QSObjectDraggedTableView.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
//
// QSObjectDraggedTableView.m
// QSEventTriggersElement
//
// Created by Patrick Robertson on 30/01/2014.
//
//
#import "QSObjectDraggedTableView.h"
#import "QSEventTriggerManager.h"
@implementation QSObjectDraggedTableView
- (void)awakeFromNib
{
[self registerForDraggedTypes:@[QSPasteboardObjectIdentifier, QSPasteboardObjectAddress, NSFilenamesPboardType, QSFilePathType, QSTextType, NSStringPboardType, NSURLPboardType, (__bridge NSString *)kUTTypeURL]];
}
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
return NSDragOperationGeneric;
}
- (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender
{
return NSDragOperationGeneric;
}
- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender
{
return YES;
}
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
NSPasteboard *draggingPboard = [sender draggingPasteboard];
QSObject *pasteboardObject = [QSObject objectWithPasteboard:draggingPboard];
for (QSObject *obj in [pasteboardObject splitObjects]) {
NSString *ident = [obj identifier];
if (![[self.arrayController arrangedObjects] containsObject:ident]) {
[self.arrayController addObject:ident];
}
}
return YES;
}
@end