]>
Commit | Line | Data |
---|---|---|
3373d6bf JS |
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 | ||
0470b382 JS |
91 | void DoResize(); |
92 | ||
3373d6bf JS |
93 | void OnSize(wxSizeEvent& event); |
94 | void OnPaint(wxPaintEvent& event); | |
95 | void OnEraseBackground(wxEraseEvent& event); | |
96 | ||
97 | DECLARE_CLASS(wxEmulatorContainer) | |
98 | DECLARE_EVENT_TABLE() | |
99 | ||
100 | }; | |
101 | ||
102 | // Frame class | |
103 | class wxEmulatorFrame : public wxFrame | |
104 | { | |
105 | public: | |
106 | // ctor(s) | |
107 | wxEmulatorFrame(const wxString& title, const wxPoint& pos, const wxSize& size); | |
108 | ||
109 | // event handlers (these functions should _not_ be virtual) | |
110 | void OnQuit(wxCommandEvent& event); | |
111 | void OnAbout(wxCommandEvent& event); | |
112 | ||
113 | private: | |
114 | // any class wishing to process wxWindows events must use this macro | |
115 | DECLARE_EVENT_TABLE() | |
116 | }; | |
117 | ||
118 | // ---------------------------------------------------------------------------- | |
119 | // constants | |
120 | // ---------------------------------------------------------------------------- | |
121 | ||
122 | // IDs for the controls and the menu commands | |
123 | enum | |
124 | { | |
125 | // menu items | |
126 | Emulator_Quit = 1, | |
127 | ||
128 | // it is important for the id corresponding to the "About" command to have | |
129 | // this standard value as otherwise it won't be handled properly under Mac | |
130 | // (where it is special and put into the "Apple" menu) | |
131 | Emulator_About = wxID_ABOUT | |
132 | }; | |
133 | ||
134 | // Returns the image type, or -1, determined from the extension. | |
135 | int wxDetermineImageType(const wxString& filename); | |
136 | ||
137 | #endif | |
138 | // _WX_EMULATOR_H_ | |
139 |