]> git.saurik.com Git - wxWidgets.git/blame - utils/emulator/src/emulator.h
Use the OOR typemap for wxTreeCtrls too.
[wxWidgets.git] / utils / emulator / src / emulator.h
CommitLineData
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
d1b327e1
JS
19#define wxEMULATOR_VERSION 0.1
20
3373d6bf
JS
21// Information about the emulator decorations
22class wxEmulatorInfo: public wxObject
23{
24public:
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
d1b327e1
JS
36 bool Load(const wxString& appDir);
37
38 // Emulator config filename
39 wxString m_emulatorFilename;
3373d6bf
JS
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
d1b327e1
JS
55 // The emulated device size. This is ignored
56 // if there is a background bitmap
57 wxSize m_emulatorDeviceSize;
58
3373d6bf
JS
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
72class wxEmulatorContainer;
73class wxEmulatorApp : public wxApp
74{
75public:
76 wxEmulatorApp();
77 virtual bool OnInit();
78
79 // Load the specified emulator
d1b327e1
JS
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;
3373d6bf
JS
87
88public:
d1b327e1 89
3373d6bf
JS
90 wxEmulatorInfo m_emulatorInfo;
91#ifdef __WXX11__
92 wxAdoptedWindow* m_xnestWindow;
93#else
94 wxWindow* m_xnestWindow;
95#endif
96 wxEmulatorContainer* m_containerWindow;
d1b327e1
JS
97 wxString m_appDir;
98 wxString m_displayNumber;
d27294ac 99 long m_xnestPID;
3373d6bf
JS
100};
101
102// The container for the Xnest window. The decorations
103// will be drawn on this window.
104class wxEmulatorContainer: public wxWindow
105{
106public:
107
108 wxEmulatorContainer(wxWindow* parent, wxWindowID id);
109
0470b382
JS
110 void DoResize();
111
3373d6bf
JS
112 void OnSize(wxSizeEvent& event);
113 void OnPaint(wxPaintEvent& event);
114 void OnEraseBackground(wxEraseEvent& event);
115
116DECLARE_CLASS(wxEmulatorContainer)
117DECLARE_EVENT_TABLE()
118
119};
120
121// Frame class
122class wxEmulatorFrame : public wxFrame
123{
124public:
125 // ctor(s)
126 wxEmulatorFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
127
d27294ac 128 // event handlers
3373d6bf
JS
129 void OnQuit(wxCommandEvent& event);
130 void OnAbout(wxCommandEvent& event);
d27294ac 131 void OnCloseWindow(wxCloseEvent& event);
3373d6bf
JS
132
133private:
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
143enum
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.
155int wxDetermineImageType(const wxString& filename);
156
d1b327e1
JS
157// Convert a colour to a 6-digit hex string
158wxString wxColourToHexString(const wxColour& col);
159
160// Convert 6-digit hex string to a colour
161wxColour wxHexStringToColour(const wxString& hex);
162
163// Find the absolute path where this application has been run from.
164wxString wxFindAppPath(const wxString& argv0, const wxString& cwd, const wxString& appVariableName);
165
3373d6bf
JS
166#endif
167 // _WX_EMULATOR_H_
168