Main Page | Class Hierarchy | Compound List | File List | Compound Members

scorekeeper.h

00001 /***************************************************************************
00002                            scorekeeper.h
00003                            -------------------
00004     copyright            : (C) 2004 by Jos van den Oever
00005     email                : jos@vandenoever.info
00006  ***************************************************************************/
00007 
00008 /***************************************************************************
00009  *                                                                         *
00010  *   This program is free software; you can redistribute it and/or modify  *
00011  *   it under the terms of the GNU General Public License as published by  *
00012  *   the Free Software Foundation; either version 2 of the License, or     *
00013  *   (at your option) any later version.                                   *
00014  *                                                                         *
00015  ***************************************************************************/
00016 #ifndef SCOREKEEPER_H
00017 #define SCOREKEEPER_H
00018 
00019 /* This very simple class display two things:
00020         - the number of the current question and, if known, the total number of
00021           questions.
00022         - the current score and, if known, the maximal score attainable.
00023 
00024    The names of the variables shouls speak for themselves.
00025    Functions for setting the background and the font are inherited from QVBox.
00026 */
00027 
00028 #include <qvbox.h>
00029 class QLabel;
00030 class ScoreKeeper : public QVBox {
00031 public:
00032         ScoreKeeper(QWidget* parent=0, const char* name=0, WFlags f=0);
00033         // set all values to 0
00034         void reset();
00035         // increase, or decrease the score
00036         void addPoints(short i);
00037         // advance one question
00038         void nextQuestion();
00039         // return the number of questions registered
00040         int getQuestions() const;
00041         // return the number of points registered
00042         int getPoints() const;
00043         // set and get the maximum number of questions
00044         void setNumQuestions(int);
00045         int getNumQuestions() const;
00046         // set and get the maximum number of points
00047         void setMaxNumPoints(int);
00048         int getMaxNumPoints() const;
00049 private:
00050         bool hasmaxquestions;
00051         bool hasmaxpoints;
00052         int numquestions, maxquestions;
00053         int numpoints, maxpoints;
00054         QLabel *questions;
00055         QLabel *points;
00056         void updateLabels();
00057 };      
00058 #endif

Generated on Thu Jan 15 23:13:57 2004 for CubeTest by doxygen 1.3.2