00001 #ifndef WinApp_H_ 00002 #define WinApp_H_ 00003 00004 //#define WINDOWS_LEAN_AND_MEAN 00005 //#include<Windows.h> 00006 #include"Handle.h" 00007 00008 namespace FemViewer { 00009 namespace Win { 00010 00011 void printError(LPTSTR lpszFunction); 00012 /* Forwward declaretion */ 00013 class WinGL; 00014 class DialogWindow; 00015 // Main class of the application 00016 class MainApp : public Handle<HWND> 00017 { 00018 public: 00019 static volatile bool m_bRun; 00020 static MainApp * GetInstance(); 00021 BOOL IsInit() { return ::IsWindow(static_cast<Handle<HWND> >(*GetInstance())); } 00022 BOOL Init(int argc,char** argv); 00023 void ShutDown(); 00024 int Run(); 00025 static void SetStatusBarInfo(HWND hwndSB, int part, unsigned style, char *fmt, ...); 00026 00027 ~MainApp(); 00028 BOOL Create(); 00029 void Update(); 00030 void Destroy(); 00031 WinGL*& GetWindowGL(); 00032 HWND& GetStatusBar(); 00033 DialogWindow*& GetChildDlg(); 00034 protected: 00035 static MainApp m_application; 00036 HINSTANCE m_hInstance; 00037 HWND m_hStatusBar; 00038 WNDCLASSEX m_wndClassEx; 00039 WinGL* m_pMainWnd; 00040 DialogWindow* m_pChildDialog; 00041 private: 00042 MainApp(); 00043 MainApp(const MainApp& rhs); 00044 MainApp& operator=(const MainApp& rhs); 00045 }; 00046 00047 inline WinGL*& MainApp::GetWindowGL() 00048 { 00049 return m_pMainWnd; 00050 } 00051 00052 inline HWND& MainApp::GetStatusBar() 00053 { 00054 return m_hStatusBar; 00055 } 00056 00057 inline DialogWindow*& MainApp::GetChildDlg() 00058 { 00059 return m_pChildDialog; 00060 } 00061 00062 00063 } // endnamespace Win 00064 00065 typedef Win::MainApp AppEngine; 00066 00067 } // end namespace FemViewer 00068 #endif