Platform_Win32_OS.h
Go to the documentation of this file.00001 00011 #ifndef __Platform_Win32_OS_H__ 00012 #define __Platform_Win32_OS_H__ 00013 00014 // Includes 00015 #include "Platform_OS.h" 00016 #include "PlatformEventListener.h" 00017 00018 // Forward declares 00019 #define WIN32_LEAN_AND_MEAN 00020 #define VC_EXTRALEAN 00021 #undef _WIN32_WINNT 00022 #define _WIN32_WINNT 0x0400 00023 #include <windows.h> 00024 00025 // Platform_Win32_OS 00026 class Platform_Win32_OS:public Platform_OS, PlatformEventListener 00027 { 00028 00029 public: 00030 Platform_Win32_OS(HINSTANCE hInstance, const char* commandLine); 00031 00032 virtual ~Platform_Win32_OS(); 00033 00034 virtual void SetApplicationName(const char* applicationName); 00035 00036 virtual const char* GetCommandLineString(); 00037 00038 virtual const char* GetExecutablePath(); 00039 00040 virtual bool HasFocus(); 00041 00042 virtual void OsYield(); 00043 00044 virtual void DisplayAssertMessage(const char* expression, const char* message, const char* file, int line); 00045 00046 virtual void OutputDebugText(const char * formatstr, ...); 00047 00048 virtual void ReportFatalError(const char* message, const char* file, int line); 00049 00050 virtual bool ExitRequested(); 00051 00052 virtual void OnCustomEvent(const char* eventId, void* userData); 00053 00054 HWND GetWindowHandle(); 00055 00056 private: 00057 void ParseCommandLine(const char* commandLine); 00058 00059 // Windows creation 00060 bool RegisterWindowClass(HINSTANCE instance, const char* className); 00061 HWND CreateWindowInstance(HINSTANCE instance, const char* className, const char* title); 00062 00063 // Windows message handling 00064 static LRESULT CALLBACK WindowProcedure_Static(HWND window, UINT message, WPARAM wParam, LPARAM lParam); 00065 LRESULT WindowProcedure(HWND window, UINT message, WPARAM wParam, LPARAM lParam); 00066 void ProcessMessages(); 00067 00068 // Message receivers 00069 LRESULT WmSize(HWND window, UINT message, WPARAM wParam, LPARAM lParam); 00070 LRESULT WmSysCommand(HWND window, UINT message, WPARAM wParam, LPARAM lParam); 00071 LRESULT WmActivateApp(HWND window, UINT message, WPARAM wParam, LPARAM lParam); 00072 LRESULT WmClose(HWND window, UINT message, WPARAM wParam, LPARAM lParam); 00073 00074 private: 00075 char* applicationName_; 00076 char* executablePath_; 00077 char* commandLine_; 00078 HINSTANCE hInstance_; 00079 HWND windowHandle_; 00080 bool applicationHasFocus_; 00081 HCURSOR cursor_; 00082 bool exitRequested_; 00083 }; 00084 00085 00086 #endif /* __Platform_Win32_OS_H__ */
Reproduction/republishing of any material on this site without permission is strictly prohibited.
