home *** CD-ROM | disk | FTP | other *** search
- /*
- Company: Sensaura Ltd
- Copyright: (C) 1998, 1999
-
- File Name: mainwnd.h
- File Description: Header file for definition of MainWnd class
- Author: Adam Philp
- Last Update: 22-DEC-99
-
- Target Compiler: Microsoft Visual C++ Version 5.0
- */
-
- #ifndef __mainwnd_h // Sentry, use file only if it's not already included
- #define __mainwnd_h
-
- /////////////////////// Included files ////////////////////////////////////////////////////////////
-
- #include <dsound.h>
-
- /////////////////////// Forward class declarations ////////////////////////////////////////////////
-
- class Application;
- class BufferDlg;
- class ListenerDlg;
-
- /////////////////////// Type definitions //////////////////////////////////////////////////////////
-
- typedef struct tagBufferList // Linked list of buffer dialogs
- {
- BufferDlg* pDlg;
- struct tagBufferList* pNext;
- }
- BufferList, *BufferListEntry;
-
- /////////////////////// Class declarations ////////////////////////////////////////////////////////
-
- /*
- Class: MainWnd
- Description: Class encapsulating a standard MS-Windows window
- */
-
- class MainWnd
- {
- public: // Public constructor and destructor
- MainWnd(LPCSTR, Application*);
- virtual ~MainWnd();
-
- public: // Public member functions
- virtual LPSTR GetClassName() const;
- virtual bool Create();
- virtual void Paint(HDC, RECT&, bool);
- virtual LRESULT EvCommand(UINT, HWND, UINT);
- virtual void DestroyChild(HWND);
-
- Application* GetApplication() const { return m_pApp; }
- int GetClassName(LPSTR, int) const;
- void GetWindowClass(WNDCLASS&) const;
- WNDPROC GetThunk() const { return m_Thunk; }
- LPCSTR GetCaption() const;
- void SetDefaultProc(WNDPROC proc) { m_DefaultProc = proc; }
-
- bool ShowWindow(int);
- void Invalidate(bool bErase = true);
- int MessageBox(LPCSTR, LPCSTR, UINT) const;
-
- LRESULT PostMessage(UINT msg, WPARAM wParam = 0, LPARAM lParam = 0)
- { return m_hWnd ? ::PostMessage(m_hWnd, msg, wParam, lParam) : 0; }
- LRESULT SendMessage(UINT msg, WPARAM wParam = 0, LPARAM lParam = 0)
- { return m_hWnd ? ::SendMessage(m_hWnd, msg, wParam, lParam) : 0; }
-
- void ResetCascade();
- void CascadeWindow(HWND);
-
- public: // Public data members
- HWND m_hWnd;
-
- protected: // Protected member functions
- virtual LRESULT WindowProc(UINT, WPARAM, LPARAM);
- virtual void EvPaint();
- virtual LRESULT EvInitMenu(HMENU);
- virtual LRESULT EvEraseBkgnd(HDC);
- virtual LRESULT EvTimer(WORD);
- virtual void EvClose();
- virtual void EvDestroy();
-
- virtual void DestroyWindow(int ret = 0);
-
- bool Register();
- void CloseWindow(int ret = 0);
- bool OpenFile(LPTSTR);
- bool OpenFileDialog(LPTSTR, int*);
-
- protected: // Protected data members
- Application* m_pApp;
- WNDPROC m_DefaultProc;
- WNDPROC m_Thunk; // Thunk that loads 'this' into registers
- int m_xNextPos;
- int m_yNextPos;
-
- private: // Private member functions
- void InstallWindowProc();
- static LRESULT CALLBACK StdWndProc(HWND, UINT, WPARAM, LPARAM);
-
- private: // Private data members
- LPDIRECTSOUND m_pDirectSound;
- LPDIRECTSOUNDBUFFER m_pPrimary;
- LPDIRECTSOUND3DLISTENER m_pListener;
-
- bool m_bCanDoZoomFX;
- bool m_bZoomFX;
- HBITMAP m_hbmZoomFX;
- DWORD m_dwTimer;
- DSCAPS m_dsCaps;
-
- ListenerDlg* m_pListenerDlg;
- BufferList* m_pBufferDlgs;
- };
-
- #endif // End of sentry __mainwnd_h
-