Develop and Download Open Source Software

Browse Subversion Repository

Annotation of /XspfManager/XspfMListViewController.m

Parent Directory Parent Directory | Revision Log Revision Log


Revision 111 - (hide annotations) (download)
Mon Nov 23 14:04:54 2009 UTC (14 years, 4 months ago) by masaki
File size: 1470 byte(s)
[New] XspfMTableViewに対するファイルのドラックでの登録を実装。
1 masaki 21 //
2     // XspfMListViewController.m
3     // XspfManager
4     //
5     // Created by Hori,Masaki on 09/11/07.
6     // Copyright 2009 masakih. All rights reserved.
7     //
8    
9     #import "XspfMListViewController.h"
10    
11    
12     @implementation XspfMListViewController
13    
14 masaki 24 - (id)init
15     {
16     [super initWithNibName:@"ListView" bundle:nil];
17    
18     return self;
19     }
20    
21 masaki 32 - (void)awakeFromNib
22     {
23     [tableView setDoubleAction:@selector(openXspf:)];
24 masaki 111 [tableView registerForDraggedTypes:[NSArray arrayWithObjects:NSFilenamesPboardType, nil]];
25 masaki 32 }
26    
27 masaki 111
28     - (NSDragOperation)tableView:(NSTableView*)table
29     validateDrop:(id <NSDraggingInfo>)info
30     proposedRow:(NSInteger)row
31     proposedDropOperation:(NSTableViewDropOperation)dropOperation
32     {
33     id pb = [info draggingPasteboard];
34     id plist = [pb propertyListForType:NSFilenamesPboardType];
35    
36     NSWorkspace *ws = [NSWorkspace sharedWorkspace];
37     NSError *error = nil;
38     for(NSString *filePath in plist) {
39     NSString *type = [ws typeOfFile:filePath error:&error];
40     if(![ws type:type conformsToType:@"com.masakih.xspf"]) {
41     return NSDragOperationNone;
42     }
43     }
44     [table setDropRow:row dropOperation:NSTableViewDropAbove];
45    
46     return NSDragOperationCopy;
47     }
48    
49     - (BOOL)tableView:(NSTableView*)table
50     acceptDrop:(id <NSDraggingInfo>)info
51     row:(NSInteger)row
52     dropOperation:(NSTableViewDropOperation)dropOperation
53     {
54     id pb = [info draggingPasteboard];
55     id plist = [pb propertyListForType:NSFilenamesPboardType];
56    
57     [[[tableView window] windowController] registerFilePaths:plist];
58    
59     return YES;
60     }
61    
62 masaki 21 @end

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26