]> git.saurik.com Git - wxWidgets.git/blob - demos/bombs/bombs.h
added checkbox to enable setting (or not) individual wxBitmapButton bitmaps
[wxWidgets.git] / demos / bombs / bombs.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: bombs.h
3 // Purpose: Bombs game
4 // Author: P. Foggia 1996
5 // Modified by: Wlodzimierz Skiba (ABX) since 2003
6 // Created: 1996
7 // RCS-ID: $Id$
8 // Copyright: (c) 1996 P. Foggia
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_DEMOS_BOMBS_BOMBS_H_
13 #define _WX_DEMOS_BOMBS_BOMBS_H_
14
15 #include "game.h"
16
17 class BombsFrame;
18
19 /*
20 * Class representing the entire Application
21 */
22 class BombsApp: public wxApp
23 {
24 public:
25 virtual bool OnInit();
26
27 private :
28 BombsFrame *m_frame;
29
30 BombsGame m_game;
31
32 };
33
34 DECLARE_APP(BombsApp)
35
36 class BombsCanvas;
37
38 class BombsFrame : public wxFrame
39 {
40 public:
41
42 BombsFrame(BombsGame *bombsGame);
43
44 void NewGame(int level, bool query);
45
46 private:
47
48 void OnNewGame(wxCommandEvent& event);
49 void OnEasyGame(wxCommandEvent& event);
50 void OnMediumGame(wxCommandEvent& event);
51 void OnHardGame(wxCommandEvent& event);
52
53 void OnEasyCorner(wxCommandEvent& event);
54
55 void OnExit(wxCommandEvent& event);
56
57 void OnAbout(wxCommandEvent& event);
58
59 BombsGame *m_game;
60 bool m_easyCorner;
61 int m_lastLevel;
62
63 // Subwindows for reference within the program.
64 BombsCanvas *m_canvas;
65
66 DECLARE_EVENT_TABLE()
67 };
68
69 // App specific menu identifiers
70 enum
71 {
72 bombsID_LEVEL = wxID_HIGHEST,
73 bombsID_EASY,
74 bombsID_MEDIUM,
75 bombsID_HARD,
76 bombsID_EASYCORNER
77 };
78
79 class BombsCanvas : public wxPanel
80 {
81 public:
82
83 // Constructor and destructor
84
85 BombsCanvas(wxFrame *parent, BombsGame *game);
86
87 void UpdateGridSize();
88
89 wxSize GetGridSizeInPixels() const;
90
91 ~BombsCanvas();
92
93 private:
94
95 void OnPaint(wxPaintEvent& event);
96 void DrawField(wxDC *, int xc1, int yc1, int xc2, int yc2);
97 void RefreshField(int xc1, int yc1, int xc2, int yc2);
98 void Uncover(int x, int y);
99 void OnMouseEvent(wxMouseEvent& event);
100 void OnChar(wxKeyEvent& event);
101
102 BombsGame *m_game;
103
104 wxBitmap *m_bmp;
105
106 // Cell size in pixels
107 int m_cellWidth;
108 int m_cellHeight;
109
110 DECLARE_EVENT_TABLE()
111 };
112
113 /* The following sizes should probably be redefined */
114 /* dimensions of a scroll unit, in pixels */
115 #define X_UNIT 4
116 #define Y_UNIT 4
117
118 /* the dimensions of a cell, in scroll units are in
119 * BombsCanvas::x_cell and y_cell
120 */
121
122 #ifdef __WXWINCE__
123 #define BOMBS_FONT wxFont(12, wxSWISS, wxNORMAL, wxNORMAL)
124 #else
125 #define BOMBS_FONT wxFont(14, wxROMAN, wxNORMAL, wxNORMAL)
126 #endif
127
128 #endif // #ifndef _WX_DEMOS_BOMBS_BOMBS_H_
129