Develop and Download Open Source Software

Browse Subversion Repository

Annotation of /XspfManager/XspfMListViewController.m

Parent Directory Parent Directory | Revision Log Revision Log


Revision 192 - (hide annotations) (download)
Sun Jan 3 08:00:54 2010 UTC (14 years, 3 months ago) by masaki
File size: 1726 byte(s)
[Fix] 選択状態を維持するように修正。
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 masaki 192 #import "XspfManager.h"
12 masaki 21
13 masaki 192
14 masaki 21 @implementation XspfMListViewController
15    
16 masaki 24 - (id)init
17     {
18     [super initWithNibName:@"ListView" bundle:nil];
19    
20     return self;
21     }
22    
23 masaki 32 - (void)awakeFromNib
24     {
25     [tableView setDoubleAction:@selector(openXspf:)];
26 masaki 111 [tableView registerForDraggedTypes:[NSArray arrayWithObjects:NSFilenamesPboardType, nil]];
27 masaki 32 }
28    
29 masaki 111
30 masaki 192 - (void)tableView:(NSTableView *)table sortDescriptorsDidChange:(NSArray *)oldDescriptors
31     {
32     id controller = [self representedObject];
33     [controller willChangeValueForKey:@"selectionIndexes"];
34     [controller didChangeValueForKey:@"selectionIndexes"];
35     }
36    
37    
38 masaki 111 - (NSDragOperation)tableView:(NSTableView*)table
39     validateDrop:(id <NSDraggingInfo>)info
40     proposedRow:(NSInteger)row
41     proposedDropOperation:(NSTableViewDropOperation)dropOperation
42     {
43     id pb = [info draggingPasteboard];
44     id plist = [pb propertyListForType:NSFilenamesPboardType];
45    
46     NSWorkspace *ws = [NSWorkspace sharedWorkspace];
47     NSError *error = nil;
48     for(NSString *filePath in plist) {
49     NSString *type = [ws typeOfFile:filePath error:&error];
50     if(![ws type:type conformsToType:@"com.masakih.xspf"]) {
51     return NSDragOperationNone;
52     }
53     }
54     [table setDropRow:row dropOperation:NSTableViewDropAbove];
55    
56     return NSDragOperationCopy;
57     }
58    
59     - (BOOL)tableView:(NSTableView*)table
60     acceptDrop:(id <NSDraggingInfo>)info
61     row:(NSInteger)row
62     dropOperation:(NSTableViewDropOperation)dropOperation
63     {
64     id pb = [info draggingPasteboard];
65     id plist = [pb propertyListForType:NSFilenamesPboardType];
66    
67 masaki 184 [[NSApp delegate] registerFilePaths:plist];
68 masaki 111
69     return YES;
70     }
71    
72 masaki 21 @end

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