Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

RainWindowThread.h

Go to the documentation of this file.
00001 #ifndef __RAINWINDOWTHREAD
00002 #define __RAINWINDOWTHREAD
00003 
00004 
00005 #include "RainDefines.h"
00006 #include "RainMessageQueue.h"
00007 #include "RainWindow.h"
00008 
00009 
00010 struct SRainWndInfo
00011 {
00012         UINT                            uWindowWidth;
00013         UINT                            uWindowHeight;
00014         HINSTANCE                       hInstance;
00015         char*                           szWindowTitle;
00016         UINT                            uMessageQueueSize;
00017 };
00018 
00019 
00020 class CRainWindowThread
00021 {
00022 public:
00023         CRainWindowThread();
00024         ~CRainWindowThread();
00025 
00026         bool Init(const SRainWndInfo* pIn);
00027 
00028 
00029         inline CRainWindow* GetWindow()
00030         {
00031                 return m_pWindow;
00032         }
00033 
00034         inline void SetWindow(CRainWindow* pWnd)
00035         {
00036                 m_pWindow=pWnd;
00037         }
00038 
00039         inline int PopMessage(SRainMessage* pMsgOut)
00040         {
00041                 return m_MessageQueue.Pop(pMsgOut);
00042         }
00043 
00044         inline bool PushMessage(const SRainMessage* pMsgIn)
00045         {
00046                 return m_MessageQueue.Push(pMsgIn);
00047         }
00048 
00049         inline void GetInfo(SRainWndInfo* pOut)
00050         {
00051                 assert(pOut);
00052                 *pOut=m_WindowInfo;
00053         }
00054 
00055 private:
00056         void Cleanup();
00057 
00058 
00059 private:
00060         CRainWindow*            m_pWindow;
00061         CRainMessageQueue       m_MessageQueue;
00062         HANDLE                          m_hThread;
00063         SRainWndInfo            m_WindowInfo;
00064 };
00065 
00066 
00067 DWORD WINAPI WindowThread(LPVOID pRainWindowThread);
00068 
00069 LRESULT CALLBACK RainMessageProc(HWND hWnd,
00070                                                           unsigned int msg,
00071                                                           WPARAM wParam, 
00072                                                           LPARAM lParam);
00073 
00074 extern CRainWindowThread*               g_pWindowThread;//for the message proc, set by WindowThread
00075 
00076 
00077 
00078 
00079 
00080 
00081 
00082 
00083 
00084 
00085 
00086 #endif

Generated on Thu May 23 17:51:00 2002 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001