public
Description: Gem Document Viewer for Mac OS X
Homepage: http://www.robinlu.com/blog/goo/
Clone URL: git://github.com/robin/goo.git
goo / GemInfoView.m
100644 47 lines (40 sloc) 0.993 kb
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
35
36
37
38
39
40
41
42
43
44
45
46
47
//
// GemInfoView.m
// goo
//
// Created by Robin Lu on 8/22/08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
 
#import "GemInfoView.h"
 
 
@implementation GemInfoView
- (id)init
{
gemInfoKeys = [NSArray arrayWithObjects:@"name", @"version", @"authors", @"homepage", nil];
[gemInfoKeys retain];
return self;
}
 
- (void)dealloc
{
[gemInfoKeys release];
[super dealloc];
}
 
- (int)numberOfRowsInTableView:(NSTableView *)aTableView
{
return [gemInfoKeys count];
}
 
- (id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn *)aTableColumn
row:(int)rowIndex
{
if ( [[aTableColumn identifier] isEqualToString:@"key"] )
return [gemInfoKeys objectAtIndex:rowIndex];
else
{
NSArray *infos = [controller arrangedObjects];
if ([controller selectionIndex] == NSNotFound)
return nil;
NSDictionary *selected = [infos objectAtIndex:[controller selectionIndex]];
return [selected objectForKey:[gemInfoKeys objectAtIndex:rowIndex]];
}
}
@end