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