/* QuizController.h - abstract quiz controller interface for Popup.app Copyright (C) 2004 Rob Burns January,21 2004 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 _QUIZ_CONTROLLER_H_ #define _QUIZ_CONTROLLER_H_ #ifdef __APPLE__ #import #include "GNUstep.h" #else #include #include #endif #include "StackModel.h" #include "CardModel.h" @interface QuizController : NSWindowController { int quizMethod; StackModel *cardStack; CardModel *currentCard; NSMutableArray *achievementList; NSArray *filteredCards; int completed; int target; int correctCount; int wrongCount; int reps; NSSound *wrong; NSTimer *t, *clock; BOOL flipflag; // it is the subclasses responsibility to provide these objects in a // gorm file, or otherwise. it's perfectly alright for the quiz to // ommit them. when used in this class, thier existence // should always be checked for first. id progress; id clockText; id cardDisplay; } + (void) initialize; - (id) initWithStack: (StackModel *)aStack; - (void) awakeFromNib; // **************** // Property methods // **************** - (StackModel *) cardStack; - (int) quizMethod; - (void) setQuizMethod: (int)method; - (NSArray *) achievementList; // ************ // Quiz methods // ************ - (void) beginQuiz: (id)sender; - (void) drawNextCard: (id)sender; - (void) correctAnswer: (id)sender; - (void) wrongAnswer: (id)sender; - (void) clockTick: (id)sender; // ************************* // Interface related methods // ************************* - (NSString *) nibName; - (NSString *) quizName; - (void) displayCurrentCard: (id)sender; - (void) displayCorrectMessage: (id)sender; - (void) displayWrongMessage: (id)sender; - (void) displayFinishedMessage: (id)sender; - (void) displayResults: (id)sender; // ************************ // Quiz achievement methods // ************************ - (void) clearAchievementList; - (void) setCardPassedAtIndex: (int)index; - (void) setCardFailedAtIndex: (int)index; - (BOOL) isFinished; - (int) correctCount; - (int) wrongCount; // ************************************ // NSWindowController override methdods // ************************************ - (NSString *) windowTitleForDocumentDisplayName: (NSString *)displayName; - (BOOL) windowShouldClose: (id)sender; @end #endif // _QUIZ_CONTROLLER_H_