fr_CA sparkle nibs
[adiumx.git] / Source / AIEmoticonPreviewController.m
blob9557e3b3a9e87a98698e5cac7fb056d09805c9ad
1 /* 
2 * Adium is the legal property of its developers, whose names are listed in the copyright file included
3  * with this source distribution.
4  * 
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.
8  * 
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.
12  * 
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.
15  */
17 #import "AIEmoticonPreviewController.h"
18 #import "AIEmoticonPack.h"
19 #import "AIEmoticon.h"
21 @implementation AIEmoticonPreviewController
23 - (NSView *) previewView
25         return tableView;
28 - (void) awakeFromNib
29 {       
30         [tableView setIntercellSpacing:NSMakeSize(1.0f, 3.0f)];
31         [tableView setHeaderView:nil];
32         
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];
38         [column release];
39         
40         column = [[NSTableColumn alloc] initWithIdentifier:@"Text Equivalent"];
41         [tableView addTableColumn:column];
42         [column release];
45 - (BOOL)tableView:(NSTableView *)aTableView shouldSelectRow:(int)rowIndex
47         return NO;
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];
68         else
69                 return [[emoticon textEquivalents] componentsJoinedByString:@", "];
72 @end