home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / winfe / winclose.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.9 KB  |  120 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. #ifndef __WINCLOSE_H
  20. //    Avoid include redundancy
  21. //
  22. #define __WINCLOSE_H
  23.  
  24. //    Purpose:    Provide a registry to monitor when a window is actually closed.
  25. //    Comments:    Designed to work with other protocol types, DDE, OLE, whatever.
  26. //    Revision History:
  27. //        01-19-95    created GAB
  28. //
  29.  
  30. //    Required Includes
  31. //
  32.  
  33. //    Constants
  34. //
  35.  
  36. //    Structures
  37. //
  38. class CWindowChangeRegistry    {
  39. protected:
  40.     static CPtrList m_Registry;
  41.     POSITION m_rIndex;
  42.  
  43.     CWindowChangeRegistry()    {}
  44.     ~CWindowChangeRegistry()    {
  45.         m_Registry.RemoveAt(m_rIndex);
  46.     }
  47. };
  48.  
  49. class CWindowChangeItem : public CWindowChangeRegistry    {    
  50. protected:
  51.     enum    {
  52.         m_DDE,
  53.         m_OLE
  54.     };
  55.     int m_iType;
  56.     DWORD m_dwWindowID;
  57.  
  58.     CWindowChangeItem(DWORD dwWindowID, int iType);
  59.     
  60.     virtual void WindowClosing(BOOL bExiting) = 0;
  61.     virtual void WindowSizing(DWORD dwX, DWORD dwY, DWORD dwCX, DWORD dwCY) = 0;
  62.     virtual void WindowMaximizing() = 0;
  63.     virtual void WindowMinimizing() = 0;
  64.     virtual void WindowNormalizing() = 0;
  65. public:
  66.     int GetType()    {
  67.         return(m_iType);
  68.     }
  69.     DWORD GetWindowID()    {
  70.         return(m_dwWindowID);
  71.     }
  72.  
  73.     enum    {
  74.         m_Close,
  75.         m_Size,
  76.         m_Maximize,
  77.         m_Minimize,
  78.         m_Normalize
  79.     };
  80.     static void Closing(DWORD dwWindowID);
  81.     static void Sizing(DWORD dwWindowID, DWORD dwX, DWORD dwY, DWORD dwCX, DWORD dwCY);
  82.     static void Maximizing(DWORD dwWindowID);
  83.     static void Minimizing(DWORD dwWindowID);
  84.     static void Normalizing(DWORD dwWindowID);
  85. };
  86.  
  87. class CDDEWindowChangeItem : public CWindowChangeItem    {
  88.     CString m_csServiceName;
  89.     
  90. protected:
  91.     CDDEWindowChangeItem(CString& csServiceName, DWORD dwWindowID);
  92.  
  93.     //    Must override.
  94.     void WindowClosing(BOOL bExiting);
  95.     void WindowSizing(DWORD dwX, DWORD dwY, DWORD dwCX, DWORD dwCY);
  96.     void WindowMaximizing();
  97.     void WindowMinimizing();
  98.     void WindowNormalizing();
  99.     
  100. public:
  101.     CString GetServiceName()    {
  102.         return(m_csServiceName);
  103.     }
  104.  
  105.     //    Consider these the constructor, destructor.
  106.     static BOOL DDERegister(CString &csServiceName, DWORD dwWindowID);
  107.     static BOOL DDEUnRegister(CString &csServiceName, DWORD dwWindowID);
  108. };
  109.  
  110. //    Global variables
  111. //
  112.  
  113. //    Macros
  114. //
  115.  
  116. //    Function declarations
  117. //
  118.  
  119. #endif // __WINCLOSE_H
  120.