2 // Copyright 2005 The Android Open Source Project
4 // Main window declaration.
6 #ifndef _SIM_MAINFRAME_H
7 #define _SIM_MAINFRAME_H
9 #include "PhoneWindow.h"
10 #include "DeviceWindow.h"
11 #include "LogWindow.h"
12 #include "ExternalRuntime.h"
13 #include "PropertyServer.h"
18 class MainFrame : public wxFrame {
20 /* define a constructor so we can set up menus */
21 MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
23 virtual ~MainFrame(void);
25 /* called by modeless phone window dialog when it closes */
26 void PhoneWindowClosing(int x, int y);
28 void Vibrate(int vibrateOn) { mpPhoneWindow->Vibrate(vibrateOn); }
30 PropertyServer* GetPropertyServer(void) { return mPropertyServerThread; }
33 void ConstructMenu(void);
34 void ConstructControls(void);
36 void OnClose(wxCloseEvent& event);
37 void OnTimer(wxTimerEvent& event);
38 //void OnIdle(wxIdleEvent& event);
39 void OnActivate(wxActivateEvent& event);
40 void OnButton(wxCommandEvent& event);
41 void OnComboBox(wxCommandEvent& event);
42 void OnCheckBox(wxCommandEvent& event);
43 void OnText(wxCommandEvent& event);
44 void OnTextEnter(wxCommandEvent& event);
45 void OnUserEvent(UserEvent& event);
46 void OnSliderChange(wxScrollEvent& event);
48 void OnFilePreferences(wxCommandEvent& event);
49 void OnFileExit(wxCommandEvent& event);
50 void OnUpdateSimStart(wxUpdateUIEvent& event);
51 void OnSimStart(wxCommandEvent& event);
52 void OnUpdateSimStop(wxUpdateUIEvent& event);
53 void OnSimStop(wxCommandEvent& event);
54 void OnUpdateSimReload(wxUpdateUIEvent& event);
55 void OnSimReload(wxCommandEvent& event);
56 void OnUpdateSimRestart(wxUpdateUIEvent& event);
57 void OnSimRestart(wxCommandEvent& event);
58 void OnUpdateSimKill(wxUpdateUIEvent& event);
59 void OnSimKill(wxCommandEvent& event);
60 void OnDeviceSelected(wxCommandEvent& event);
61 void OnDeviceRescan(wxCommandEvent& event);
62 void OnUpdateDebugShowLog(wxUpdateUIEvent& event);
63 void OnDebugShowLog(wxCommandEvent& event);
64 void OnHelpContents(wxCommandEvent& event);
65 void OnHelpAbout(wxCommandEvent& event);
67 wxMenu* CreateDeviceMenu(const char* defaultItemName);
68 void SetCheckFromPref(wxCheckBox* pControl, const char* prefStr,
71 void UpdateRuntimeExeStr(void);
73 /* prep the phone UI; "defaultMode" may be NULL */
74 void SetupPhoneUI(int idx, const char* defaultMode);
76 bool CompatibleDevices(PhoneData* pData1, PhoneData* pData2);
78 void HandleRuntimeStart(void);
79 void HandleRuntimeStop(void);
80 void HandleExternalRuntime(android::Pipe* reader, android::Pipe* writer);
82 int GetSelectedDeviceIndex(void);
83 bool IsRuntimeRunning(void);
84 bool IsRuntimeKillable(void);
86 void BroadcastOnionSkinUpdate(void);
89 bool mRestartRequested;
91 enum { kHalfSecondTimerId = 1000 };
93 wxString mSimAssetPath;
95 /* if we have a phone running, this points to its state */
96 PhoneWindow* mpPhoneWindow;
98 /* phone window position */
99 wxPoint mPhoneWindowPosn;
101 /* window that captures log output */
102 LogWindow* mpLogWindow;
106 /* watches for connection from runtime */
107 ExternalRuntime* mExternalRuntimeThread;
109 /* serve up system properties */
110 PropertyServer* mPropertyServerThread;
112 DECLARE_EVENT_TABLE()
115 #endif // _SIM_MAINFRAME_H