]> git.saurik.com Git - wxWidgets.git/blame - demos/bombs/bombs.h
fix almost all deprecation warnings
[wxWidgets.git] / demos / bombs / bombs.h
CommitLineData
025e88c5
JS
1///////////////////////////////////////////////////////////////////////////////
2// Name: bombs.h
3// Purpose: Bombs game
4// Author: P. Foggia 1996
c8059953 5// Modified by: Wlodzimierz Skiba (ABX) since 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
c8059953
WS
48 void OnNewGame(wxCommandEvent& event);
49 void OnEasyGame(wxCommandEvent& event);
50 void OnMediumGame(wxCommandEvent& event);
51 void OnHardGame(wxCommandEvent& event);
0c65afdb 52
43c3922b
WS
53 void OnEasyCorner(wxCommandEvent& event);
54
0c65afdb
DS
55 void OnExit(wxCommandEvent& event);
56
57 void OnAbout(wxCommandEvent& event);
58
59 BombsGame *m_game;
43c3922b
WS
60 bool m_easyCorner;
61 int m_lastLevel;
0c65afdb
DS
62
63 // Subwindows for reference within the program.
64 BombsCanvas *m_canvas;
65
66 DECLARE_EVENT_TABLE()
025e88c5
JS
67};
68
0c65afdb
DS
69// App specific menu identifiers
70enum
025e88c5 71{
c8059953 72 bombsID_LEVEL = wxID_HIGHEST,
0c65afdb
DS
73 bombsID_EASY,
74 bombsID_MEDIUM,
43c3922b
WS
75 bombsID_HARD,
76 bombsID_EASYCORNER
025e88c5
JS
77};
78
0c65afdb
DS
79class BombsCanvas : public wxPanel
80{
81public:
82
83 // Constructor and destructor
84
85 BombsCanvas(wxFrame *parent, BombsGame *game);
86
87 void UpdateGridSize();
88
89 wxSize GetGridSizeInPixels() const;
90
d3c7fc99 91 virtual ~BombsCanvas();
0c65afdb
DS
92
93private:
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};
025e88c5
JS
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
0c65afdb 119 * BombsCanvas::x_cell and y_cell
025e88c5
JS
120 */
121
0c65afdb
DS
122#ifdef __WXWINCE__
123#define BOMBS_FONT wxFont(12, wxSWISS, wxNORMAL, wxNORMAL)
124#else
025e88c5 125#define BOMBS_FONT wxFont(14, wxROMAN, wxNORMAL, wxNORMAL)
0c65afdb 126#endif
025e88c5 127
0c65afdb 128#endif // #ifndef _WX_DEMOS_BOMBS_BOMBS_H_
025e88c5 129