]> git.saurik.com Git - wxWidgets.git/blob - utils/emulator/src/emulator.h
Added emulator utility.
[wxWidgets.git] / utils / emulator / src / emulator.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: emulator.h
3 // Purpose: wxX11-based PDA emulator classes
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 2002-03-10
7 // RCS-ID: $Id$
8 // Copyright: (c) wxWindows team
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_EMULATOR_H_
13 #define _WX_EMULATOR_H_
14
15 #ifdef __GNUG__
16 #pragma interface "emulator.h"
17 #endif
18
19 // Information about the emulator decorations
20 class wxEmulatorInfo: public wxObject
21 {
22 public:
23
24 wxEmulatorInfo() { Init(); }
25 wxEmulatorInfo(const wxEmulatorInfo& info) { Init(); Copy(info); }
26
27 void operator= (const wxEmulatorInfo& info) { Copy(info); }
28 void Copy(const wxEmulatorInfo& info);
29
30 // Initialisation
31 void Init();
32
33 // Loads bitmaps
34 bool Load();
35
36 // Emulator title
37 wxString m_emulatorTitle;
38
39 // Emulator description
40 wxString m_emulatorDescription;
41
42 // The offset from the top-left of the main emulator
43 // bitmap and the virtual screen (where Xnest is
44 // positioned)
45 wxPoint m_emulatorScreenPosition;
46
47 // The emulated screen size, e.g. 320x240
48 wxSize m_emulatorScreenSize;
49
50 // The bitmap used for drawing the main emulator
51 // decorations
52 wxBitmap m_emulatorBackgroundBitmap;
53 wxString m_emulatorBackgroundBitmapName;
54
55 // The intended background colour (for filling in
56 // areas of the window not covered by the bitmap)
57 wxColour m_emulatorBackgroundColour;
58
59 // TODO: an array of bitmaps and ids for custom buttons
60 };
61
62 // Emulator app class
63 class wxEmulatorContainer;
64 class wxEmulatorApp : public wxApp
65 {
66 public:
67 wxEmulatorApp();
68 virtual bool OnInit();
69
70 // Load the specified emulator
71 bool LoadEmulator();
72
73 public:
74 wxEmulatorInfo m_emulatorInfo;
75 #ifdef __WXX11__
76 wxAdoptedWindow* m_xnestWindow;
77 #else
78 wxWindow* m_xnestWindow;
79 #endif
80 wxEmulatorContainer* m_containerWindow;
81 };
82
83 // The container for the Xnest window. The decorations
84 // will be drawn on this window.
85 class wxEmulatorContainer: public wxWindow
86 {
87 public:
88
89 wxEmulatorContainer(wxWindow* parent, wxWindowID id);
90
91 void OnSize(wxSizeEvent& event);
92 void OnPaint(wxPaintEvent& event);
93 void OnEraseBackground(wxEraseEvent& event);
94
95 DECLARE_CLASS(wxEmulatorContainer)
96 DECLARE_EVENT_TABLE()
97
98 };
99
100 // Frame class
101 class wxEmulatorFrame : public wxFrame
102 {
103 public:
104 // ctor(s)
105 wxEmulatorFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
106
107 // event handlers (these functions should _not_ be virtual)
108 void OnQuit(wxCommandEvent& event);
109 void OnAbout(wxCommandEvent& event);
110
111 private:
112 // any class wishing to process wxWindows events must use this macro
113 DECLARE_EVENT_TABLE()
114 };
115
116 // ----------------------------------------------------------------------------
117 // constants
118 // ----------------------------------------------------------------------------
119
120 // IDs for the controls and the menu commands
121 enum
122 {
123 // menu items
124 Emulator_Quit = 1,
125
126 // it is important for the id corresponding to the "About" command to have
127 // this standard value as otherwise it won't be handled properly under Mac
128 // (where it is special and put into the "Apple" menu)
129 Emulator_About = wxID_ABOUT
130 };
131
132 // Returns the image type, or -1, determined from the extension.
133 int wxDetermineImageType(const wxString& filename);
134
135 #endif
136 // _WX_EMULATOR_H_
137