home *** CD-ROM | disk | FTP | other *** search
/ Game Audio Programming / GameAudioProgramming.iso / Extras / Sensaura / SDK1.0 / data1.cab / Example_Files / ZoomFX / mainwnd.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-13  |  3.4 KB  |  120 lines

  1. /*
  2.     Company:            Sensaura Ltd
  3.     Copyright:          (C) 1998, 1999
  4.  
  5.     File Name:            mainwnd.h
  6.     File Description:    Header file for definition of MainWnd class
  7.     Author:                Adam Philp
  8.     Last Update:        22-DEC-99
  9.  
  10.     Target Compiler:    Microsoft Visual C++ Version 5.0
  11. */
  12.  
  13. #ifndef __mainwnd_h                        // Sentry, use file only if it's not already included
  14. #define __mainwnd_h
  15.  
  16. ///////////////////////    Included files ////////////////////////////////////////////////////////////
  17.  
  18. #include <dsound.h>
  19.  
  20. ///////////////////////    Forward class declarations ////////////////////////////////////////////////
  21.  
  22. class Application;
  23. class BufferDlg;
  24. class ListenerDlg;
  25.  
  26. ///////////////////////    Type definitions //////////////////////////////////////////////////////////
  27.  
  28. typedef struct tagBufferList            // Linked list of buffer dialogs
  29. {
  30.     BufferDlg*                pDlg;
  31.     struct tagBufferList*    pNext;
  32. }
  33. BufferList, *BufferListEntry;
  34.  
  35. ///////////////////////    Class declarations ////////////////////////////////////////////////////////
  36.  
  37. /*
  38.     Class:                MainWnd
  39.     Description:        Class encapsulating a standard MS-Windows window
  40. */
  41.  
  42. class MainWnd
  43. {
  44. public:                                    // Public constructor and destructor
  45.     MainWnd(LPCSTR, Application*);
  46.     virtual ~MainWnd();
  47.  
  48. public:                                    // Public member functions
  49.     virtual LPSTR    GetClassName() const;
  50.     virtual bool    Create();
  51.     virtual void    Paint(HDC, RECT&, bool);
  52.     virtual LRESULT    EvCommand(UINT, HWND, UINT);
  53.     virtual void    DestroyChild(HWND);
  54.  
  55.     Application*    GetApplication() const { return m_pApp; }
  56.     int        GetClassName(LPSTR, int) const;
  57.     void    GetWindowClass(WNDCLASS&) const;
  58.     WNDPROC GetThunk() const { return m_Thunk; }
  59.     LPCSTR    GetCaption() const;
  60.     void    SetDefaultProc(WNDPROC proc) { m_DefaultProc = proc; }
  61.  
  62.     bool    ShowWindow(int);
  63.     void    Invalidate(bool bErase = true);
  64.     int        MessageBox(LPCSTR, LPCSTR, UINT) const;
  65.  
  66.     LRESULT    PostMessage(UINT msg, WPARAM wParam = 0, LPARAM lParam = 0) 
  67.                     { return m_hWnd ? ::PostMessage(m_hWnd, msg, wParam, lParam) : 0; }
  68.     LRESULT    SendMessage(UINT msg, WPARAM wParam = 0, LPARAM lParam = 0) 
  69.                     { return m_hWnd ? ::SendMessage(m_hWnd, msg, wParam, lParam) : 0; }
  70.  
  71.     void    ResetCascade();
  72.     void    CascadeWindow(HWND);
  73.  
  74. public:                                    // Public data members
  75.     HWND    m_hWnd;
  76.  
  77. protected:                                // Protected member functions
  78.     virtual LRESULT WindowProc(UINT, WPARAM, LPARAM);
  79.     virtual void    EvPaint();
  80.     virtual LRESULT    EvInitMenu(HMENU);
  81.     virtual LRESULT    EvEraseBkgnd(HDC);
  82.     virtual LRESULT EvTimer(WORD);
  83.     virtual void    EvClose();
  84.     virtual void    EvDestroy();
  85.  
  86.     virtual void    DestroyWindow(int ret = 0);
  87.  
  88.     bool    Register();
  89.     void    CloseWindow(int ret = 0);
  90.     bool    OpenFile(LPTSTR);
  91.     bool    OpenFileDialog(LPTSTR, int*);
  92.  
  93. protected:                                // Protected data members
  94.     Application*    m_pApp;
  95.     WNDPROC            m_DefaultProc;
  96.     WNDPROC         m_Thunk;            // Thunk that loads 'this' into registers
  97.     int                m_xNextPos;
  98.     int                m_yNextPos;
  99.  
  100. private:                                // Private member functions
  101.     void            InstallWindowProc();
  102.     static LRESULT CALLBACK StdWndProc(HWND, UINT, WPARAM, LPARAM);
  103.  
  104. private:                                // Private data members
  105.     LPDIRECTSOUND            m_pDirectSound;
  106.     LPDIRECTSOUNDBUFFER        m_pPrimary;
  107.     LPDIRECTSOUND3DLISTENER    m_pListener;
  108.  
  109.     bool            m_bCanDoZoomFX;
  110.     bool            m_bZoomFX;
  111.     HBITMAP            m_hbmZoomFX;
  112.     DWORD            m_dwTimer;
  113.     DSCAPS            m_dsCaps;
  114.  
  115.     ListenerDlg*    m_pListenerDlg;
  116.     BufferList*        m_pBufferDlgs;
  117. };
  118.  
  119. #endif                                    // End of sentry __mainwnd_h
  120.