/* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */ /* AbiSource Application Framework * Copyright (C) 2005 Francis James Franklin * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. */ #import #import "AbiMailMan_DocumentChooser.h" @implementation AbiMailMan_DocumentChooser - (id)initWithDocumentList:(NSArray *)documentList { if (self = [super initWithWindowNibName:@"DocumentChooser"]) { m_DocumentList = documentList; [m_DocumentList retain]; m_Selection = -1; } return self; } - (void)dealloc { [m_DocumentList release]; [super dealloc]; } - (void)windowDidLoad { // } - (int)indexOfSelectedItem // or -1 if none (i.e., if the dialog is cancelled) { return m_Selection; } - (IBAction)aDocumentTable:(id)sender { // TODO - or not... don't really need this action } - (IBAction)aCancel:(id)sender { [NSApp stopModal]; } - (IBAction)aSelect:(id)sender { m_Selection = [oDocumentTable selectedRow]; [NSApp stopModal]; } /* NSTableView delegate method */ - (void)tableViewSelectionDidChange:(NSNotification *)aNotification { // TODO - or not... don't really need this action } /* NSTableDataSource methods */ - (int)numberOfRowsInTableView:(NSTableView *)aTableView { return (int) [m_DocumentList count]; } - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex { return [m_DocumentList objectAtIndex:((unsigned) rowIndex)]; } @end