moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kbruch / src / exercisecompare.h
bloba1c656c26c0696e81abf237dffbdfc63b1a8bf91
1 /***************************************************************************
2 exercisecompare.h
3 -------------------
4 begin : 2004/06/03
5 copyright : (C) 2004 by Sebastian Stein
6 email : seb.kde@hpfsc.de
7 ***************************************************************************/
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
18 #ifndef EXERCISECOMPARE_H
19 #define EXERCISECOMPARE_H
21 #define DEBUG
23 #ifdef DEBUG
24 #include <kdebug.h>
25 #endif
27 #include "exercisebase.h"
28 #include "ratio.h"
29 #include "ratiowidget.h"
31 class QGridLayout;
32 class QLabel;
33 class QPushButton;
34 class QVBoxLayout;
37 #include <qwidget.h>
39 /*! Constructs a QWidget, which shows the task to the user.
40 * The class also provides input fields, so that the user can enter the result.
41 * It also controls the interaction, so that the entered result gets checked
42 * and a new task can be generated.
43 * \author Sebastian Stein
44 * */
45 class ExerciseCompare : public ExerciseBase
47 Q_OBJECT
49 public:
50 /** constructor */
51 ExerciseCompare(QWidget * parent = 0, const char * name = 0);
53 /** destructor */
54 ~ExerciseCompare();
56 /** force the creation of a new task */
57 void forceNewTask();
59 public slots:
60 void update();
62 signals:
63 /** class emits this signal, if the task was solved correctly by the user */
64 void signalExerciseSolvedCorrect();
66 /** class emits this signal, if the task was solved not correctly by the user
67 * */
68 void signalExerciseSolvedWrong();
70 private:
71 short m_currentState;
73 RatioWidget* m_firstRatioWidget;
74 RatioWidget* m_secondRatioWidget;
75 QPushButton* m_checkButton;
76 QPushButton* m_signButton;
77 QLabel* result_label;
79 QGridLayout* baseGrid;
80 QWidget* baseWidget;
81 QVBoxLayout* realLayout;
83 ratio m_firstRatio;
84 ratio m_secondRatio;
86 enum SignButtonState
88 lessThen,
89 greaterThen
91 SignButtonState m_signButtonState;
93 void createTask();
94 void showResult();
95 void nextTask();
97 private slots:
98 void slotCheckButtonClicked();
99 void slotSignButtonClicked();
102 #endif