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