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 "AIEmoticonPreviewController.h"
18 #import "AIEmoticonPack.h"
19 #import "AIEmoticon.h"
21 @implementation AIEmoticonPreviewController
23 - (NSView *) previewView
30 [tableView setIntercellSpacing:NSMakeSize(1.0f, 3.0f)];
31 [tableView setHeaderView:nil];
33 NSTableColumn * column = [[NSTableColumn alloc] initWithIdentifier:@"Emoticon"];
34 [column setMaxWidth:32.0f];
35 [column setMinWidth:32.0f];
36 [column setDataCell:[[[NSImageCell alloc]init]autorelease]];
37 [tableView addTableColumn:column];
40 column = [[NSTableColumn alloc] initWithIdentifier:@"Text Equivalent"];
41 [tableView addTableColumn:column];
45 - (BOOL)tableView:(NSTableView *)aTableView shouldSelectRow:(int)rowIndex
50 - (void) setXtra:(AIXtraInfo *)xtraInfo
52 [emoticons autorelease];
53 emoticons = [[[AIEmoticonPack emoticonPackFromPath:[xtraInfo path]] emoticons] retain];
54 [tableView reloadData];
55 [tableView sizeToFit];
58 - (int)numberOfRowsInTableView:(NSTableView *)aTableView
60 return [emoticons count];
63 - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
65 AIEmoticon * emoticon = [emoticons objectAtIndex:rowIndex];
66 if([[aTableColumn identifier] isEqualToString:@"Emoticon"])
67 return [emoticon image];
69 return [[emoticon textEquivalents] componentsJoinedByString:@", "];