home *** CD-ROM | disk | FTP | other *** search
- /*
- Company: Sensaura
- Copyright: (C) 1998
-
- File Name: window.h
- File Description: Header file for definition of Window class
- Author: Adam Philp
- Version: 1.01.000
- Last Update: 01-DEC-98
-
- Target Compiler: Microsoft Visual C++ Version 5.0
- */
-
- #ifndef __window_h // Sentry, use file only if it's not already included
- #define __window_h
-
- /////////////////////// Forward class declarations ////////////////////////////////////////////////
-
- class Application;
-
- /////////////////////// Type definitions //////////////////////////////////////////////////////////
-
- typedef struct tagWindowAttr
- {
- DWORD dwExStyle;
- DWORD dwStyle;
- int X;
- int Y;
- int W;
- int H;
- HMENU hMenu;
- HICON hIcon;
- }
- WindowAttr;
-
- typedef enum tagWindowListPlacement
- {
- WL_FRONT,
- WL_BEFORE,
- WL_AFTER,
- WL_BACK
- }
- WindowListPlacement;
-
- /////////////////////// Class declarations ////////////////////////////////////////////////////////
-
- /*
- Class: Window
- Description: Class encapsulating a standard MS-Windows window
- */
-
- class Window
- {
- public: // Public constructor and destructor
- Window(Window*, LPCSTR, Application*);
- virtual ~Window();
-
- public: // Public member functions
- Application* GetApplication() const { return m_pApp; }
- int GetClassName(LPSTR, int) const;
- virtual LPSTR GetClassName() const;
- WNDPROC GetThunk() const { return m_Thunk; }
- virtual void GetWindowClass(WNDCLASS&) const;
-
- void SetDefaultProc(WNDPROC proc) { m_DefaultProc = proc; }
-
- virtual bool Create();
- virtual bool ShowWindow(int);
- virtual void Paint(HDC, RECT&, bool) {}
-
- virtual LRESULT EvCommand(UINT, HWND, UINT);
- virtual bool IdleAction(long);
- 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; }
-
- public: // Public data members
- HWND m_hWnd;
- WindowAttr m_Attr;
-
- protected: // Protected member functions
- virtual bool Register();
- virtual void DestroyWindow(int ret = 0);
- virtual void CloseWindow(int ret = 0);
-
- virtual LRESULT WindowProc(UINT, WPARAM, LPARAM);
-
- void EvPaint();
- void EvClose();
- void EvDestroy();
-
- protected: // Protected data members
- Application* m_pApp;
- Window* m_pParent;
- WNDPROC m_DefaultProc;
- WNDPROC m_Thunk; // Thunk that loads 'this' into registers
-
- private: // Private member functions
- void InstallWindowProc();
- static LRESULT CALLBACK StdWndProc(HWND, UINT, WPARAM, LPARAM);
-
- private: // Private data members
- LPSTR m_pCaption;
- };
-
- #endif // End of sentry __window_h
-