-
Notifications
You must be signed in to change notification settings - Fork 2
/
SnippetCollectionViewDelegate.m
executable file
·34 lines (28 loc) · 1.22 KB
/
SnippetCollectionViewDelegate.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
//
// SnippetCollectionViewDelegate.m
// Snipper
//
// Created by Daniel Corn on 09.12.10.
// Copyright 2010 cundd. All rights reserved.
//
#import "SnippetCollectionViewDelegate.h"
#import "Snipper_AppDelegate.h"
@implementation SnippetCollectionViewDelegate
+(id)snippetCollectionViewDelegateWithSnippetController:(NSArrayController *)theSnippetController{
return [[self alloc] initWithSnippetController:theSnippetController];
}
-(id)initWithSnippetController:(NSArrayController *)theSnippetController{
self = [self init];
if(self){
snippetController = theSnippetController;
}
return self;
}
-(BOOL)collectionView:(NSCollectionView *)collectionView writeItemsAtIndexes:(NSIndexSet *)indexes toPasteboard:(NSPasteboard *)pasteboard{
Snippet * theSnippet = [(NSArray *)[snippetController arrangedObjects] objectAtIndex:[indexes firstIndex]];
return [(Snipper_AppDelegate *)[NSApp delegate] addSnippet:theSnippet toPasteboard:pasteboard];
}
-(NSImage *)collectionView:(NSCollectionView *)collectionView draggingImageForItemsAtIndexes:(NSIndexSet *)indexes withEvent:(NSEvent *)event offset:(NSPointPointer)dragImageOffset{
return [collectionView draggingImageForItemsAtIndexes:indexes withEvent:event offset:dragImageOffset];
}
@end