]> git.saurik.com Git - wxWidgets.git/blob - utils/emulator/src/emulator.h
Use the OOR typemap for wxTreeCtrls too.
[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 #define wxEMULATOR_VERSION 0.1
20
21 // Information about the emulator decorations
22 class wxEmulatorInfo: public wxObject
23 {
24 public:
25
26 wxEmulatorInfo() { Init(); }
27 wxEmulatorInfo(const wxEmulatorInfo& info) { Init(); Copy(info); }
28
29 void operator= (const wxEmulatorInfo& info) { Copy(info); }
30 void Copy(const wxEmulatorInfo& info);
31
32 // Initialisation
33 void Init();
34
35 // Loads bitmaps
36 bool Load(const wxString& appDir);
37
38 // Emulator config filename
39 wxString m_emulatorFilename;
40
41 // Emulator title
42 wxString m_emulatorTitle;
43
44 // Emulator description
45 wxString m_emulatorDescription;
46
47 // The offset from the top-left of the main emulator
48 // bitmap and the virtual screen (where Xnest is
49 // positioned)
50 wxPoint m_emulatorScreenPosition;
51
52 // The emulated screen size, e.g. 320x240
53 wxSize m_emulatorScreenSize;
54
55 // The emulated device size. This is ignored
56 // if there is a background bitmap
57 wxSize m_emulatorDeviceSize;
58
59 // The bitmap used for drawing the main emulator
60 // decorations
61 wxBitmap m_emulatorBackgroundBitmap;
62 wxString m_emulatorBackgroundBitmapName;
63
64 // The intended background colour (for filling in
65 // areas of the window not covered by the bitmap)
66 wxColour m_emulatorBackgroundColour;
67
68 // TODO: an array of bitmaps and ids for custom buttons
69 };
70
71 // Emulator app class
72 class wxEmulatorContainer;
73 class wxEmulatorApp : public wxApp
74 {
75 public:
76 wxEmulatorApp();
77 virtual bool OnInit();
78
79 // Load the specified emulator
80 bool LoadEmulator(const wxString& appDir);
81
82 // Get app dir
83 wxString GetAppDir() const { return m_appDir; }
84
85 // Prepend the current app program directory to the name
86 wxString GetFullAppPath(const wxString& filename) const;
87
88 public:
89
90 wxEmulatorInfo m_emulatorInfo;
91 #ifdef __WXX11__
92 wxAdoptedWindow* m_xnestWindow;
93 #else
94 wxWindow* m_xnestWindow;
95 #endif
96 wxEmulatorContainer* m_containerWindow;
97 wxString m_appDir;
98 wxString m_displayNumber;
99 long m_xnestPID;
100 };
101
102 // The container for the Xnest window. The decorations
103 // will be drawn on this window.
104 class wxEmulatorContainer: public wxWindow
105 {
106 public:
107
108 wxEmulatorContainer(wxWindow* parent, wxWindowID id);
109
110 void DoResize();
111
112 void OnSize(wxSizeEvent& event);
113 void OnPaint(wxPaintEvent& event);
114 void OnEraseBackground(wxEraseEvent& event);
115
116 DECLARE_CLASS(wxEmulatorContainer)
117 DECLARE_EVENT_TABLE()
118
119 };
120
121 // Frame class
122 class wxEmulatorFrame : public wxFrame
123 {
124 public:
125 // ctor(s)
126 wxEmulatorFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
127
128 // event handlers
129 void OnQuit(wxCommandEvent& event);
130 void OnAbout(wxCommandEvent& event);
131 void OnCloseWindow(wxCloseEvent& event);
132
133 private:
134 // any class wishing to process wxWindows events must use this macro
135 DECLARE_EVENT_TABLE()
136 };
137
138 // ----------------------------------------------------------------------------
139 // constants
140 // ----------------------------------------------------------------------------
141
142 // IDs for the controls and the menu commands
143 enum
144 {
145 // menu items
146 Emulator_Quit = 1,
147
148 // it is important for the id corresponding to the "About" command to have
149 // this standard value as otherwise it won't be handled properly under Mac
150 // (where it is special and put into the "Apple" menu)
151 Emulator_About = wxID_ABOUT
152 };
153
154 // Returns the image type, or -1, determined from the extension.
155 int wxDetermineImageType(const wxString& filename);
156
157 // Convert a colour to a 6-digit hex string
158 wxString wxColourToHexString(const wxColour& col);
159
160 // Convert 6-digit hex string to a colour
161 wxColour wxHexStringToColour(const wxString& hex);
162
163 // Find the absolute path where this application has been run from.
164 wxString wxFindAppPath(const wxString& argv0, const wxString& cwd, const wxString& appVariableName);
165
166 #endif
167 // _WX_EMULATOR_H_
168