]> git.saurik.com Git - wxWidgets.git/blob - demos/bombs/bombs.h
Lots of docstring fixes and additions
[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) 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 OnNewEasyGame(wxCommandEvent& event);
49 void OnNewMediumGame(wxCommandEvent& event);
50 void OnNewHardGame(wxCommandEvent& event);
51
52 void OnEasyCorner(wxCommandEvent& event);
53
54 void OnExit(wxCommandEvent& event);
55
56 void OnAbout(wxCommandEvent& event);
57
58 BombsGame *m_game;
59 bool m_easyCorner;
60 int m_lastLevel;
61
62 // Subwindows for reference within the program.
63 BombsCanvas *m_canvas;
64
65 DECLARE_EVENT_TABLE()
66 };
67
68 // App specific menu identifiers
69 enum
70 {
71 bombsID_NEWGAME = wxID_HIGHEST,
72 bombsID_EASY,
73 bombsID_MEDIUM,
74 bombsID_HARD,
75 bombsID_EASYCORNER
76 };
77
78 class BombsCanvas : public wxPanel
79 {
80 public:
81
82 // Constructor and destructor
83
84 BombsCanvas(wxFrame *parent, BombsGame *game);
85
86 void UpdateGridSize();
87
88 wxSize GetGridSizeInPixels() const;
89
90 ~BombsCanvas();
91
92 private:
93
94 void OnPaint(wxPaintEvent& event);
95 void DrawField(wxDC *, int xc1, int yc1, int xc2, int yc2);
96 void RefreshField(int xc1, int yc1, int xc2, int yc2);
97 void Uncover(int x, int y);
98 void OnMouseEvent(wxMouseEvent& event);
99 void OnChar(wxKeyEvent& event);
100
101 BombsGame *m_game;
102
103 wxBitmap *m_bmp;
104
105 // Cell size in pixels
106 int m_cellWidth;
107 int m_cellHeight;
108
109 DECLARE_EVENT_TABLE()
110 };
111
112 /* The following sizes should probably be redefined */
113 /* dimensions of a scroll unit, in pixels */
114 #define X_UNIT 4
115 #define Y_UNIT 4
116
117 /* the dimensions of a cell, in scroll units are in
118 * BombsCanvas::x_cell and y_cell
119 */
120
121 #ifdef __WXWINCE__
122 #define BOMBS_FONT wxFont(12, wxSWISS, wxNORMAL, wxNORMAL)
123 #else
124 #define BOMBS_FONT wxFont(14, wxROMAN, wxNORMAL, wxNORMAL)
125 #endif
126
127 #endif // #ifndef _WX_DEMOS_BOMBS_BOMBS_H_
128