]> git.saurik.com Git - wxWidgets.git/blob - demos/bombs/bombs.h
send wxEVT_SCROLLWIN_THUMBRELEASE events
[wxWidgets.git] / demos / bombs / bombs.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: bombs.h
3 // Purpose: Bombs game
4 // Author: P. Foggia 1996
5 // Modified by:
6 // Created: 1996
7 // RCS-ID: $Id$
8 // Copyright: (c) 1996 P. Foggia
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _INC_BOMBS_H
13 #define _INC_BOMBS_H
14
15 #include "game.h"
16
17 /*
18 * Forward declarations of all top-level window classes.
19 */
20 class BombsFrameClass;
21 class AboutFrameClass;
22
23 /*
24 * Class representing the entire Application
25 */
26 class AppClass: public wxApp
27 {
28 public:
29 BombsFrameClass *BombsFrame;
30 int level;
31 BombsGame Game;
32
33 bool OnInit();
34 };
35
36 DECLARE_APP(AppClass)
37
38 class BombsCanvasClass;
39
40 class BombsFrameClass: public wxFrame
41 {
42 private:
43 protected:
44 public:
45 // Subwindows for reference within the program.
46 BombsCanvasClass *BombsCanvas;
47 wxMenuBar *menuBar;
48
49 // Constructor and destructor
50 BombsFrameClass(wxFrame *parent, const wxString& title, const wxPoint& pos, const wxSize& size, long style);
51 ~BombsFrameClass(void);
52
53 void OnCloseWindow(wxCloseEvent& event);
54 void OnExit(wxCommandEvent& event);
55 void OnRestart(wxCommandEvent& event);
56 void OnAbout(wxCommandEvent& event);
57 void OnEasy(wxCommandEvent& event);
58 void OnMedium(wxCommandEvent& event);
59 void OnDifficult(wxCommandEvent& event);
60
61 DECLARE_EVENT_TABLE()
62 };
63
64 /* Menu identifiers
65 */
66 // File
67 #define BOMBSFRAMECLASS_FILE 1
68 // E&xit
69 #define IDM_EXIT 2
70 // About...
71 #define IDM_ABOUT 3
72 // Game
73 #define BOMBSFRAMECLASS_GAME 4
74 // &Restart
75 #define IDM_RESTART 5
76 // &Easy
77 #define IDM_EASY 6
78 // &Medium
79 #define IDM_MEDIUM 7
80 // &Difficult
81 #define IDM_DIFFICULT 8
82
83 class BombsCanvasClass: public wxWindow
84 {
85 private:
86 protected:
87 public:
88 int field_width, field_height;
89 int x_cell, y_cell;
90 wxBitmap *bmp;
91 // Constructor and destructor
92 BombsCanvasClass(wxFrame *parent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0);
93 ~BombsCanvasClass(void);
94
95 void OnPaint(wxPaintEvent& event);
96 void DrawField(wxDC *, int xc1, int yc1, int xc2, int yc2);
97 void Refresh(int xc1, int yc1, int xc2, int yc2);
98 void Uncover(int x, int y);
99 void OnEvent(wxMouseEvent& event);
100 void UpdateFieldSize();
101
102 DECLARE_EVENT_TABLE()
103 };
104
105 /* Menu identifiers
106 */
107
108 /* The following sizes should probably be redefined */
109 /* dimensions of a scroll unit, in pixels */
110 #define X_UNIT 4
111 #define Y_UNIT 4
112
113 /* the dimensions of a cell, in scroll units are in
114 * BombsCanvasClass::x_cell and y_cell
115 */
116
117 #define BOMBS_FONT wxFont(14, wxROMAN, wxNORMAL, wxNORMAL)
118
119 #endif /* mutual exclusion */
120