kwin4view.h

Go to the documentation of this file.
00001 #ifndef KWIN4_VIEW_H
00002 #define KWIN4_VIEW_H
00003 /*
00004    This file is part of the KDE games kwin4 program
00005    Copyright (c) 2006 Martin Heni <kde@heni-online.de>
00006 
00007    This library is free software; you can redistribute it and/or
00008    modify it under the terms of the GNU Library General Public
00009    License as published by the Free Software Foundation; either
00010    version 2 of the License, or (at your option) any later version.
00011 
00012    This library is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015    Library General Public License for more details.
00016 
00017    You should have received a copy of the GNU Library General Public License
00018    along with this library; see the file COPYING.LIB.  If not, write to
00019    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020    Boston, MA 02110-1301, USA.
00021 */
00022 
00023 // Qt includes
00024 #include <QWidget>
00025 #include <QGraphicsView>
00026 #include <QGraphicsScene>
00027 #include <QSize>
00028 #include <QPoint>
00029 #include <QResizeEvent>
00030 #include <QDataStream>
00031 #include <QMouseEvent>
00032 
00033 // KDE includes
00034 #include <kgameio.h>
00035 
00036 // Local includes
00037 #include "thememanager.h"
00038 
00039 // Forward declaration
00040 class DisplayIntro;
00041 class DisplayGame;
00042 class Score;
00043 
00044 
00050 class KWinGraphicsView :public QGraphicsView
00051 {
00052         Q_OBJECT
00053         
00054   public:
00059         KWinGraphicsView(QGraphicsScene* scene, QWidget* parent) : QGraphicsView(scene, parent) { };
00060             
00061   protected:
00065         void paintEvent(QPaintEvent* event);
00066 };
00067 
00068 
00072 class KWin4View : public KWinGraphicsView
00073 {
00074   Q_OBJECT
00075 
00076   public:
00084     KWin4View(QSize size, int advancePeriod, QGraphicsScene* scene, ThemeManager* theme, QWidget* parent = 0);
00085 
00088     ~KWin4View();
00089 
00092     void initGame(Score *scoreData);
00093 
00096     void endGame();  
00097 
00110     void displayMove(int x, int y, int color, int xarrow, int colorarrow, int no, bool animation);
00111 
00117     void displayStar(int x, int y, int no);
00118 
00123     void displayHint(int x, int y);
00124 
00125   signals:
00129     void signalMoveDone(int mode);
00130 
00131   public slots:  
00135     void updateAndAdvance();
00136 
00143     void mouseInput(KGameIO* input, QDataStream& stream, QMouseEvent* mouse, bool* eatevent);
00144 
00151     void keyInput(KGameIO* input, QDataStream& stream, QKeyEvent* key, bool* eatevent);
00152 
00157      void moveDone(QGraphicsItem* item, int mode);
00158 
00159   protected:
00165     void resizeEvent(QResizeEvent* e);
00166 
00167   private:
00168     // The theme manager 
00169     ThemeManager* mTheme;
00170     
00171     // The scene to plot to
00172     QGraphicsScene* mScene;
00173     
00174     // The advance period of the scene [ms]
00175     int mAdvancePeriod;
00176     
00177     // The intro display engine
00178     DisplayIntro* mIntroDisplay;
00179     
00180     // The game display engine
00181     DisplayGame* mGameDisplay;
00182     
00183     // Status of the game (running or not)
00184     bool mIsRunning;
00185 };
00186 
00187 #endif

Generated on Sun Mar 4 10:56:43 2007 for KWin4 by  doxygen 1.4.6