/* StackModel.h - cardstack interface for Popup.app Copyright (C) 2003, 2004 Bjorn Gohla, Rob Burns 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., 675 Mass Ave, Cambridge, MA 02111, USA. */ #ifndef _STACKMODEL_H_ #define _STACKMODEL_H_ #ifdef __APPLE__ #import #include "GNUstep.h" #else #include #include #endif #include "CardModel.h" #include "Scheduler.h" @interface StackModel : NSObject { NSMutableArray *cards; Scheduler *scheduler; NSString *notes; NSString *frontTitle; NSString *backTitle; NSMutableArray *filteredCards; } - (void) dealloc; - (id) init; - (StackModel *) initWithDictionary: (NSMutableDictionary *)dict; - (NSDictionary *) stackFileRep; // **************** // Property methods // **************** - (NSArray *)cards; - (Scheduler *)scheduler; - (NSArray *)filteredCards; - (NSString *)notes; - (void) setNotes: (NSString *)aNote; - (NSString *)frontTitle; - (void) setFrontTitle: (NSString *)aTitle; - (NSString *) backTitle; - (void) setBackTitle: (NSString *)aTitle; - (NSString *)description; // ******************** // Quiz related methods // ******************** - (NSArray *) drawAlternatives: (int) number excluding: (NSString *)exclude; - (CardModel *) drawCardUsingAchievement: (NSArray *)achievementList method: (int)method; - (void) flipLangs; // ************** // Action methods // ************** - (void) addCard: (CardModel *)aCard atIndex: (int)index; - (void) deleteCardAtIndex: (int)index; - (void) deleteCard: (CardModel *)aCard; - (void) writeRows: (NSArray *)rows toPasteboard: (NSPasteboard *)pboard; - (void) insertData: (NSArray *)data atRow: (int)row inTableView: (NSTableView *)tableView; - (void) clearFilter; - (void) filterForItem: (NSMutableDictionary *)anItem; - (void) sortFilteredCardsBySlot; // ********************************** // NSTableDataSource Protocol methods // ********************************** - (int) numberOfRowsInTableView: (NSTableView *)aTableView; - (id) tableView: (NSTableView *)aTableView objectValueForTableColumn: (NSTableColumn *)aTableColumn row: (int)rowIndex; - (void) tableView: (NSTableView *)aTableView setObjectValue: (id)anObject forTableColumn: (NSTableColumn *)aTableColumn row: (int)rowIndex; // **************************************************** // NSTableDataSource Protocol Methods for drag and drop // **************************************************** - (BOOL) tableView: (NSTableView *)tableView writeRows: (NSArray *)rows toPasteboard: (NSPasteboard *)pboard; - (NSDragOperation) tableView: (NSTableView *)tableView validateDrop: (id)info proposedRow: (int)row proposedDropOperation: (NSTableViewDropOperation)operation; - (BOOL) tableView: (NSTableView *)tableView acceptDrop: (id)info row: (int)row dropOperation: (NSTableViewDropOperation)operation; @end #endif // _STACKMODEL_H_