summaryrefslogtreecommitdiff
path: root/noncore/games/minesweep/minefield.h
Side-by-side diff
Diffstat (limited to 'noncore/games/minesweep/minefield.h') (more/less context) (show whitespace changes)
-rw-r--r--noncore/games/minesweep/minefield.h26
1 files changed, 20 insertions, 6 deletions
diff --git a/noncore/games/minesweep/minefield.h b/noncore/games/minesweep/minefield.h
index 4ede435..1349c35 100644
--- a/noncore/games/minesweep/minefield.h
+++ b/noncore/games/minesweep/minefield.h
@@ -22,3 +22,3 @@
-#include <qtable.h>
+#include <qscrollview.h>
@@ -27,3 +27,3 @@ class Config;
-class MineField : public QTable
+class MineField : public QScrollView
{
@@ -43,2 +43,3 @@ public:
+ void setAvailableRect( const QRect & );
public slots:
@@ -54,12 +55,17 @@ signals:
protected:
- void paintFocus( QPainter*, const QRect& );
- void viewportMousePressEvent( QMouseEvent* );
- void viewportMouseReleaseEvent( QMouseEvent* );
+
+ void contentsMousePressEvent( QMouseEvent* );
+ void contentsMouseReleaseEvent( QMouseEvent* );
void keyPressEvent( QKeyEvent* );
void keyReleaseEvent( QKeyEvent* );
+ void drawContents( QPainter * p, int clipx, int clipy, int clipw, int cliph );
int getHint( int row, int col );
- void setHint( Mine* );
+ void setHint( int r, int c );
void updateMine( int row, int col );
void paletteChange( const QPalette & );
+ void updateCell( int r, int c );
+ bool onBoard( int r, int c ) const { return r >= 0 && r < numRows && c >= 0 && c < numCols; }
+ Mine *mine( int row, int col ) { return onBoard(row, col ) ? mines[row+numCols*col] : 0; }
+ const Mine *mine( int row, int col ) const { return onBoard(row, col ) ? mines[row+numCols*col] : 0; }
@@ -71,2 +77,5 @@ protected slots:
private:
+ int findCellSize();
+ void setCellSize( int );
+
State stat;
@@ -79,2 +88,4 @@ private:
int currCol;
+ int numRows, numCols;
+
int minecount;
@@ -83,3 +94,6 @@ private:
int lev;
+ QRect availableRect;
+ int cellSize;
QTimer *holdTimer;
+ Mine **mines;
};