2 * Adium is the legal property of its developers, whose names are listed in the copyright file included
3 * with this source distribution.
5 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
6 * General Public License as published by the Free Software Foundation; either version 2 of the License,
7 * or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
10 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11 * Public License for more details.
13 * You should have received a copy of the GNU General Public License along with this program; if not,
14 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 #import "AIDockIconPreviewController.h"
18 #import <Adium/AIIconState.h>
19 #import <Adium/AIObject.h>
20 #import <Adium/AIDockControllerProtocol.h>
21 #import <AIUtilities/AIVerticallyCenteredTextCell.h>
23 @implementation AIDockIconPreviewController
25 - (NSView *) previewView
30 - (void) setXtra:(AIXtraInfo *)xtraInfo
33 [statusNames autorelease];
34 NSDictionary * pack = [[[[AIObject sharedAdiumInstance] dockController] iconPackAtPath:[xtraInfo path]] objectForKey:@"State"];
35 images = [[pack allValues] retain];
36 statusNames = [[pack allKeys] retain];
37 [tableView reloadData];
38 [tableView sizeToFit];
43 [tableView setHeaderView:nil];
44 [tableView setRowHeight:48.0f];
46 NSTableColumn * column = [[NSTableColumn alloc] initWithIdentifier:@"Dock Icon"];
47 [column setMaxWidth:48.0f];
48 [column setMinWidth:48.0f];
49 [column setDataCell:[[[NSImageCell alloc]init]autorelease]];
50 [tableView addTableColumn:column];
53 column = [[NSTableColumn alloc] initWithIdentifier:@"Status"];
54 [column setDataCell:[[[AIVerticallyCenteredTextCell alloc] init] autorelease]];
55 [tableView addTableColumn:column];
59 - (BOOL)tableView:(NSTableView *)aTableView shouldSelectRow:(int)rowIndex
64 - (int)numberOfRowsInTableView:(NSTableView *)aTableView
66 return [statusNames count];
69 - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
71 if([[aTableColumn identifier] isEqualToString:@"Dock Icon"])
72 return [[images objectAtIndex:rowIndex] image];
74 return [statusNames objectAtIndex:rowIndex];