]> git.saurik.com Git - wxWidgets.git/blame - demos/bombs/bombs.h
wxDC::GetSize() should work now in wxGTK
[wxWidgets.git] / demos / bombs / bombs.h
CommitLineData
025e88c5
JS
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 */
20class BombsFrameClass;
21class AboutFrameClass;
22
23/*
24 * Class representing the entire Application
25 */
26class AppClass: public wxApp
27{
28 public:
29 BombsFrameClass *BombsFrame;
30 int level;
31 BombsGame Game;
32
33 bool OnInit();
34};
35
36DECLARE_APP(AppClass)
37
38class BombsCanvasClass;
39
40class 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
61DECLARE_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
83class 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 OnEvent(wxMouseEvent& event);
99 void UpdateFieldSize();
100
101DECLARE_EVENT_TABLE()
102};
103
104/* Menu identifiers
105 */
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
113 * BombsCanvasClass::x_cell and y_cell
114 */
115
116#define BOMBS_FONT wxFont(14, wxROMAN, wxNORMAL, wxNORMAL)
117
118#endif /* mutual exclusion */
119