Diffstat (limited to 'noncore/games/minesweep/minefield.h') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/games/minesweep/minefield.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/noncore/games/minesweep/minefield.h b/noncore/games/minesweep/minefield.h index 1349c35..e243d77 100644 --- a/noncore/games/minesweep/minefield.h +++ b/noncore/games/minesweep/minefield.h | |||
@@ -1,68 +1,71 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef MINEFIELD_H | 20 | #ifndef MINEFIELD_H |
21 | #define MINEFIELD_H | 21 | #define MINEFIELD_H |
22 | 22 | ||
23 | #include <qscrollview.h> | 23 | #include <qscrollview.h> |
24 | 24 | ||
25 | class Mine; | 25 | class Mine; |
26 | class Config; | 26 | class Config; |
27 | 27 | ||
28 | class MineField : public QScrollView | 28 | class MineField : public QScrollView |
29 | { | 29 | { |
30 | Q_OBJECT | 30 | Q_OBJECT |
31 | public: | 31 | public: |
32 | MineField( QWidget* parent = 0, const char* name = 0 ); | 32 | MineField( QWidget* parent = 0, const char* name = 0 ); |
33 | ~MineField(); | 33 | ~MineField(); |
34 | 34 | ||
35 | enum State { Waiting, Playing, GameOver }; | 35 | enum State { Waiting, Playing, GameOver }; |
36 | 36 | ||
37 | State state() const { return stat; } | 37 | State state() const { return stat; } |
38 | 38 | ||
39 | void readConfig(Config&); | 39 | void readConfig(Config&); |
40 | void writeConfig(Config&) const; | 40 | void writeConfig(Config&) const; |
41 | 41 | ||
42 | int level() const { return lev; } | 42 | int level() const { return lev; } |
43 | 43 | ||
44 | void setAvailableRect( const QRect & ); | 44 | void setAvailableRect( const QRect & ); |
45 | |||
46 | QSize sizeHint() const; | ||
47 | |||
45 | public slots: | 48 | public slots: |
46 | void setup( int level ); | 49 | void setup( int level ); |
47 | 50 | ||
48 | void showMines(); | 51 | void showMines(); |
49 | 52 | ||
50 | signals: | 53 | signals: |
51 | void gameOver( bool won ); | 54 | void gameOver( bool won ); |
52 | void gameStarted(); | 55 | void gameStarted(); |
53 | void mineCount( int ); | 56 | void mineCount( int ); |
54 | 57 | ||
55 | protected: | 58 | protected: |
56 | 59 | ||
57 | void contentsMousePressEvent( QMouseEvent* ); | 60 | void contentsMousePressEvent( QMouseEvent* ); |
58 | void contentsMouseReleaseEvent( QMouseEvent* ); | 61 | void contentsMouseReleaseEvent( QMouseEvent* ); |
59 | void keyPressEvent( QKeyEvent* ); | 62 | void keyPressEvent( QKeyEvent* ); |
60 | void keyReleaseEvent( QKeyEvent* ); | 63 | void keyReleaseEvent( QKeyEvent* ); |
61 | void drawContents( QPainter * p, int clipx, int clipy, int clipw, int cliph ); | 64 | void drawContents( QPainter * p, int clipx, int clipy, int clipw, int cliph ); |
62 | 65 | ||
63 | int getHint( int row, int col ); | 66 | int getHint( int row, int col ); |
64 | void setHint( int r, int c ); | 67 | void setHint( int r, int c ); |
65 | void updateMine( int row, int col ); | 68 | void updateMine( int row, int col ); |
66 | void paletteChange( const QPalette & ); | 69 | void paletteChange( const QPalette & ); |
67 | void updateCell( int r, int c ); | 70 | void updateCell( int r, int c ); |
68 | bool onBoard( int r, int c ) const { return r >= 0 && r < numRows && c >= 0 && c < numCols; } | 71 | bool onBoard( int r, int c ) const { return r >= 0 && r < numRows && c >= 0 && c < numCols; } |