Merge branch 'fix_interspacing'
[GitX.git] / PBQLOutlineView.m
blobc9b2d3137b47085aecfabccc374b19d845ccaecf
1 //
2 //  PBQLOutlineView.m
3 //  GitX
4 //
5 //  Created by Pieter de Bie on 6/17/08.
6 //  Copyright 2008 __MyCompanyName__. All rights reserved.
7 //
9 #import "PBQLOutlineView.h"
12 @implementation PBQLOutlineView
14 - initWithCoder: (NSCoder *) coder
16         id a = [super initWithCoder:coder];
17         [a setDataSource: a];
18         [a registerForDraggedTypes: [NSArray arrayWithObject:NSFilesPromisePboardType]];
19         return a;
22 /* Needed to drag outside application */
23 - (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL) local
25         return NSDragOperationCopy;
28 - (void) keyDown: (NSEvent *) event
30         if ([[event characters] isEqualToString:@" "]) {
31                 [controller toggleQuickView:self];
32                 return;
33         }
35         [super keyDown:event];
38 - (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray *)items toPasteboard:(NSPasteboard *) pb
40         NSMutableArray* fileNames = [NSMutableArray array];
41         for (id tree in items)
42                 [fileNames addObject: [[[tree representedObject] path] pathExtension]];
44         [pb declareTypes:[NSArray arrayWithObject:NSFilesPromisePboardType] owner:self];
45     [pb setPropertyList:fileNames forType:NSFilesPromisePboardType];
47         return YES;
50 - (NSArray *)outlineView:(NSOutlineView *)outlineView namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination forDraggedItems:(NSArray *)items
52         NSMutableArray* fileNames = [NSMutableArray array];
53         for (id obj in items) {
54                 PBGitTree* tree = [obj representedObject];
55                 [fileNames addObject: [tree path]];
56                 [tree saveToFolder:[dropDestination path]];
57         }
58         return fileNames;
61 /* Implemented to satisfy datasourcee protocol */
62 - (BOOL) outlineView: (NSOutlineView *)ov
63          isItemExpandable: (id)item { return NO; }
65 - (int)  outlineView: (NSOutlineView *)ov
66          numberOfChildrenOfItem:(id)item { return 0; }
68 - (id)   outlineView: (NSOutlineView *)ov
69          child:(int)index
70          ofItem:(id)item { return nil; }
72 - (id)   outlineView: (NSOutlineView *)ov
73          objectValueForTableColumn:(NSTableColumn*)col
74          byItem:(id)item { return nil; }
75 @end