• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2005 The Android Open Source Project
3 //
4 // Application class.
5 //
6 #ifndef _SIM_APPMAIN_H
7 #define _SIM_APPMAIN_H
8 
9 #include "wx/help.h"
10 #include "wx/html/helpctrl.h"
11 
12 #include "MainFrame.h"
13 #include "DeviceManager.h"
14 #include "Preferences.h"
15 
16 #include <utils/AssetManager.h>
17 
18 /* flag set from signal handler */
19 extern bool gWantToKill;
20 
21 /*
22  * Class representing the application.
23  */
24 class MyApp : public wxApp {
25 public:
MyApp(void)26     MyApp(void)
27         : mHelpController(NULL), mpMainFrame(NULL), mpAssetManager(NULL),
28           mResetPaths(false)        // configurable; reset prefs with paths
29         {}
~MyApp(void)30     ~MyApp(void)
31     {
32         delete mpAssetManager;
33         delete mHelpController;
34     }
35 
36     virtual bool OnInit(void);
37     virtual int OnExit(void);
38 
GetHelpController(void)39     wxHtmlHelpController* GetHelpController(void) const {
40         return mHelpController;
41     }
42 
GetPrefs(void)43     Preferences* GetPrefs(void)                 { return &mPrefs; }
44 
45     /* return a pointer to the main window */
GetMainFrame(void)46     wxWindow* GetMainFrame(void) { return mpMainFrame; }
47 
48     /* get a pointer to our Asset Manager */
GetAssetManager(void)49     android::AssetManager* GetAssetManager(void) { return mpAssetManager; }
50 
51     /* change the asset dir; requires re-creating Asset Manager */
52     void ChangeAssetDirectory(const wxString& dir);
53 
GetConfigFileName(void)54     const wxString& GetConfigFileName(void) const { return mConfigFile; }
55 
GetSimAssetPath()56     wxString GetSimAssetPath()                  { return mSimAssetPath; }
GetAndroidRoot()57     wxString GetAndroidRoot()                   { return mAndroidRoot; }
GetRuntimeExe()58     wxString GetRuntimeExe()                    { return mRuntimeExe; }
GetDebuggerOption()59     bool GetDebuggerOption()                    { return mDebuggerOption; }
GetDebuggerScript()60     wxString GetDebuggerScript()                { return mDebuggerScript; }
GetAutoRunApp()61     wxString GetAutoRunApp()                    { return mAutoRunApp; }
62 
Vibrate(int vibrateOn)63     void Vibrate(int vibrateOn)                 { ((MainFrame*)mpMainFrame)->Vibrate(vibrateOn); }
64 
65 private:
66     void SetDefaults();
67     bool ParseArgs(int argc, char** argv);
68     void AbsifyPath(wxString& dir);
69     bool ProcessConfigFile(void);
70     static void FindExe(const wxString& exeName, const wxString paths[],
71         const wxString& defaultPath, wxString* pOut);
72 
73     wxHtmlHelpController*   mHelpController;
74 
75     wxWindow*       mpMainFrame;
76 
77     android::AssetManager*  mpAssetManager;
78 
79     wxString        mAndroidRoot;
80     wxString        mSimAssetPath;
81     wxString        mRuntimeExe;
82 
83     /* command-line options */
84     wxString        mConfigFile;
85     bool            mResetPaths;
86     bool            mDebuggerOption;
87 	wxString		mDebuggerScript;
88     wxString        mAutoRunApp;
89 
90     Preferences     mPrefs;
91 };
92 
93 #endif // _SIM_APPMAIN_H
94