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

  1. /*
  2.     Company:            Sensaura
  3.     Copyright:          (C) 1998
  4.  
  5.     File Name:            window.h
  6.     File Description:    Header file for definition of Window class
  7.     Author:                Adam Philp
  8.     Version:            1.01.000
  9.     Last Update:        01-DEC-98
  10.  
  11.     Target Compiler:    Microsoft Visual C++ Version 5.0
  12. */
  13.  
  14. #ifndef __window_h                        // Sentry, use file only if it's not already included
  15. #define __window_h
  16.  
  17. ///////////////////////    Forward class declarations ////////////////////////////////////////////////
  18.  
  19. class Application;
  20.  
  21. ///////////////////////    Type definitions //////////////////////////////////////////////////////////
  22.  
  23. typedef struct tagWindowAttr 
  24. {
  25.     DWORD        dwExStyle;
  26.     DWORD        dwStyle;
  27.     int            X;
  28.     int            Y;
  29.     int            W;
  30.     int            H;
  31.     HMENU        hMenu;
  32.     HICON        hIcon;
  33. }
  34. WindowAttr;
  35.  
  36. typedef enum tagWindowListPlacement 
  37.     WL_FRONT, 
  38.     WL_BEFORE, 
  39.     WL_AFTER, 
  40.     WL_BACK 
  41. }
  42. WindowListPlacement;
  43.  
  44. ///////////////////////    Class declarations ////////////////////////////////////////////////////////
  45.  
  46. /*
  47.     Class:                Window
  48.     Description:        Class encapsulating a standard MS-Windows window
  49. */
  50.  
  51. class Window
  52. {
  53. public:                                    // Public constructor and destructor
  54.     Window(Window*, LPCSTR, Application*);
  55.     virtual ~Window();
  56.  
  57. public:                                    // Public member functions
  58.     Application*    GetApplication() const { return m_pApp; }
  59.     int                GetClassName(LPSTR, int) const;
  60.     virtual LPSTR    GetClassName() const;
  61.     WNDPROC         GetThunk() const { return m_Thunk; }
  62.     virtual void    GetWindowClass(WNDCLASS&) const;
  63.  
  64.     void            SetDefaultProc(WNDPROC proc) { m_DefaultProc = proc; }
  65.  
  66.     virtual bool    Create();
  67.     virtual bool    ShowWindow(int);
  68.     virtual void    Paint(HDC, RECT&, bool) {}
  69.  
  70.     virtual LRESULT EvCommand(UINT, HWND, UINT);
  71.     virtual bool    IdleAction(long);
  72.     int                MessageBox(LPCSTR, LPCSTR, UINT) const;
  73.  
  74.     LRESULT            PostMessage(UINT msg, WPARAM wParam = 0, LPARAM lParam = 0) 
  75.                     { return m_hWnd ? ::PostMessage(m_hWnd, msg, wParam, lParam) : 0; }
  76.     LRESULT            SendMessage(UINT msg, WPARAM wParam = 0, LPARAM lParam = 0) 
  77.                     { return m_hWnd ? ::SendMessage(m_hWnd, msg, wParam, lParam) : 0; }
  78.  
  79. public:                                    // Public data members
  80.     HWND            m_hWnd;
  81.     WindowAttr        m_Attr;
  82.  
  83. protected:                                // Protected member functions
  84.     virtual bool    Register();
  85.     virtual void    DestroyWindow(int ret = 0);
  86.     virtual void    CloseWindow(int ret = 0);
  87.  
  88.     virtual LRESULT WindowProc(UINT, WPARAM, LPARAM);
  89.  
  90.     void            EvPaint();
  91.     void            EvClose();
  92.     void            EvDestroy();
  93.  
  94. protected:                                // Protected data members
  95.     Application*    m_pApp;
  96.     Window*            m_pParent;
  97.     WNDPROC            m_DefaultProc;
  98.     WNDPROC         m_Thunk;            // Thunk that loads 'this' into registers
  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.     LPSTR            m_pCaption;
  106. };
  107.  
  108. #endif                                    // End of sentry __window_h
  109.