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