Implement dragging out of annotation table

This commit is contained in:
Matthias Neeracher 2011-08-21 16:05:28 +02:00
parent b2fed163b7
commit 531877b222

View File

@ -66,7 +66,19 @@
- (void)registerOurDragTypes
{
[annotationTable setDraggingSourceOperationMask:NSDragOperationEvery forLocal:NO];
[annotationTable setVerticalMotionCanBeginDrag:NO];
[annotationTable registerForDraggedTypes:
[NSArray arrayWithObjects:kMADragType, kUTTypeUTF8PlainText, nil]];
}
- (BOOL)tableView:(NSTableView *)tableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)pboard
{
NSArray * objects = [[annotationController arrangedObjects] objectsAtIndexes:rowIndexes];
[pboard clearContents];
[pboard writeObjects:[NSArray arrayWithObject:[MAPasteboardData pasteboardDataWithArray:objects]]];
return YES;
}
@end
@ -78,7 +90,7 @@
[tagTable setDraggingSourceOperationMask:NSDragOperationEvery forLocal:NO];
[tagTable setVerticalMotionCanBeginDrag:NO];
[tagTable registerForDraggedTypes:
[NSArray arrayWithObjects:kMADragType, NSStringPboardType, nil]];
[NSArray arrayWithObjects:kMADragType, kUTTypeUTF8PlainText, nil]];
}
- (BOOL)tableView:(NSTableView *)tableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)pboard
@ -89,4 +101,5 @@
return YES;
}
@end