Home | History | Annotate | Download | only in app
      1 //
      2 // Copyright 2005 The Android Open Source Project
      3 //
      4 // Main window declaration.
      5 //
      6 #ifndef _SIM_MAINFRAME_H
      7 #define _SIM_MAINFRAME_H
      8 
      9 #include "PhoneWindow.h"
     10 #include "DeviceWindow.h"
     11 #include "LogWindow.h"
     12 #include "ExternalRuntime.h"
     13 #include "PropertyServer.h"
     14 
     15 /*
     16  * Main window.
     17  */
     18 class MainFrame : public wxFrame {
     19 public:
     20     /* define a constructor so we can set up menus */
     21     MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size,
     22         long style);
     23     virtual ~MainFrame(void);
     24 
     25     /* called by modeless phone window dialog when it closes */
     26     void PhoneWindowClosing(int x, int y);
     27 
     28     void Vibrate(int vibrateOn) { mpPhoneWindow->Vibrate(vibrateOn); }
     29 
     30     PropertyServer* GetPropertyServer(void) { return mPropertyServerThread; }
     31 
     32 private:
     33     void ConstructMenu(void);
     34     void ConstructControls(void);
     35 
     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);
     47 
     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);
     66 
     67     wxMenu* CreateDeviceMenu(const char* defaultItemName);
     68     void SetCheckFromPref(wxCheckBox* pControl, const char* prefStr,
     69         bool defaultVal);
     70 
     71     void UpdateRuntimeExeStr(void);
     72 
     73     /* prep the phone UI; "defaultMode" may be NULL */
     74     void SetupPhoneUI(int idx, const char* defaultMode);
     75 
     76     bool CompatibleDevices(PhoneData* pData1, PhoneData* pData2);
     77 
     78     void HandleRuntimeStart(void);
     79     void HandleRuntimeStop(void);
     80     void HandleExternalRuntime(android::Pipe* reader, android::Pipe* writer);
     81 
     82     int GetSelectedDeviceIndex(void);
     83     bool IsRuntimeRunning(void);
     84     bool IsRuntimeKillable(void);
     85 
     86     void BroadcastOnionSkinUpdate(void);
     87 
     88     bool    mSimRunning;
     89     bool    mRestartRequested;
     90 
     91     enum { kHalfSecondTimerId = 1000 };
     92 
     93     wxString        mSimAssetPath;
     94 
     95     /* if we have a phone running, this points to its state */
     96     PhoneWindow*    mpPhoneWindow;
     97 
     98     /* phone window position */
     99     wxPoint         mPhoneWindowPosn;
    100 
    101     /* window that captures log output */
    102     LogWindow*      mpLogWindow;
    103 
    104     wxTimer         mTimer;
    105 
    106     /* watches for connection from runtime */
    107     ExternalRuntime* mExternalRuntimeThread;
    108 
    109     /* serve up system properties */
    110     PropertyServer*  mPropertyServerThread;
    111 
    112     DECLARE_EVENT_TABLE()
    113 };
    114 
    115 #endif // _SIM_MAINFRAME_H
    116