From c90c389a8a8d9d8661e9772ec4144c5cf2039f23 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- libksirtet/base/field.h | 66 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 libksirtet/base/field.h (limited to 'libksirtet/base/field.h') diff --git a/libksirtet/base/field.h b/libksirtet/base/field.h new file mode 100644 index 00000000..d006a052 --- /dev/null +++ b/libksirtet/base/field.h @@ -0,0 +1,66 @@ +#ifndef BASE_FIELD_H +#define BASE_FIELD_H + +#include + +#include + +class QVBoxLayout; +class QGridLayout; +class KGameLCD; +class KGameLCDList; +class BaseBoard; +class QLabel; +class QButton; +class GTInitData; +class KCanvasRootPixmap; + +class KDE_EXPORT BaseField +{ + public: + BaseField(QWidget *widget); + virtual ~BaseField() {} + + virtual KExtHighscore::Score currentScore() const = 0; + static void gameOver(const KExtHighscore::Score &, QWidget *parent); + + virtual void setArcade(); + bool isArcade() const; + + protected: + QGridLayout *top, *lcds; + KGameLCD *showScore; + KGameLCDList *removedList, *scoreList; + BaseBoard *board; + + virtual void scoreUpdated(); + virtual void init(bool AI, bool multiplayer, bool server, bool first, + const QString &name); + virtual void start(const GTInitData &); + virtual void pause(bool pause); + virtual void stop(bool gameover); + virtual void settingsChanged(); + + private: + QWidget *_widget; + struct Flags { + bool AI, multiplayer, server, first; + }; + Flags _flags; + uint _arcadeStage; + QVBoxLayout *_boardLayout; + QLabel *_label; + QButton *_button; + KCanvasRootPixmap *_boardRootPixmap; + KExtHighscore::Score _firstScore, _lastScore; + + enum ButtonType { StartButton = 0, ResumeButton, ProceedButton, + NB_BUTTON_TYPE, NoButton = NB_BUTTON_TYPE }; + static const char *BUTTON_TEXTS[NB_BUTTON_TYPE]; + + bool hasButton() const { return _flags.server && _flags.first; } + void setMessage(const QString &label, ButtonType); + void hideMessage() { setMessage(QString::null, NB_BUTTON_TYPE); } +}; + +#endif -- cgit v1.2.1