home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / mfc / include / afxadv.h < prev    next >
C/C++ Source or Header  |  1998-06-16  |  5KB  |  182 lines

  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1998 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10.  
  11. // Note: This header file contains useful classes that are documented only
  12. //  in the MFC Technical Notes.  These classes may change from version to
  13. //  version, so be prepared to change your code accordingly if you utilize
  14. //  this header.  In the future, commonly used portions of this header
  15. //  may be moved and officially documented.
  16.  
  17. #ifndef __AFXADV_H__
  18. #define __AFXADV_H__
  19.  
  20. #ifndef __AFXWIN_H__
  21.     #include <afxwin.h>
  22. #endif
  23.  
  24. #ifdef _AFX_MINREBUILD
  25. #pragma component(minrebuild, off)
  26. #endif
  27. #ifndef _AFX_FULLTYPEINFO
  28. #pragma component(mintypeinfo, on)
  29. #endif
  30.  
  31. #ifdef _AFX_PACKING
  32. #pragma pack(push, _AFX_PACKING)
  33. #endif
  34.  
  35. /////////////////////////////////////////////////////////////////////////////
  36. // AFXADV - MFC Advanced Classes
  37.  
  38. // Classes declared in this file
  39.  
  40. //CObject
  41.     //CFile
  42.         //CMemFile
  43.             class CSharedFile;          // Shared memory file
  44.  
  45.     class CRecentFileList;              // used in CWinApp for MRU list
  46.     class CDockState;                   // state of docking toolbars
  47.  
  48. /////////////////////////////////////////////////////////////////////////////
  49.  
  50. #undef AFX_DATA
  51. #define AFX_DATA AFX_CORE_DATA
  52.  
  53. /////////////////////////////////////////////////////////////////////////////
  54. // Shared file support
  55.  
  56. class CSharedFile : public CMemFile
  57. {
  58.     DECLARE_DYNAMIC(CSharedFile)
  59.  
  60. public:
  61. // Constructors
  62.     CSharedFile(UINT nAllocFlags = GMEM_DDESHARE|GMEM_MOVEABLE,
  63.         UINT nGrowBytes = 4096);
  64.  
  65. // Attributes
  66.     HGLOBAL Detach();
  67.     void SetHandle(HGLOBAL hGlobalMemory, BOOL bAllowGrow = TRUE);
  68.  
  69. // Implementation
  70. public:
  71.     virtual ~CSharedFile();
  72. protected:
  73.     virtual BYTE* Alloc(DWORD nBytes);
  74.     virtual BYTE* Realloc(BYTE* lpMem, DWORD nBytes);
  75.     virtual void Free(BYTE* lpMem);
  76.  
  77.     UINT m_nAllocFlags;
  78.     HGLOBAL m_hGlobalMemory;
  79.     BOOL m_bAllowGrow;
  80. };
  81.  
  82. /////////////////////////////////////////////////////////////////////////////
  83. // CRecentFileList
  84.  
  85. #define AFX_ABBREV_FILENAME_LEN 30
  86.  
  87. class CRecentFileList
  88. {
  89. // Constructors
  90. public:
  91.     CRecentFileList(UINT nStart, LPCTSTR lpszSection,
  92.         LPCTSTR lpszEntryFormat, int nSize,
  93.         int nMaxDispLen = AFX_ABBREV_FILENAME_LEN);
  94.  
  95. // Attributes
  96.     int GetSize() const;
  97.     CString& operator[](int nIndex);
  98.  
  99. // Operations
  100.     virtual void Remove(int nIndex);
  101.     virtual void Add(LPCTSTR lpszPathName);
  102.     BOOL GetDisplayName(CString& strName, int nIndex,
  103.         LPCTSTR lpszCurDir, int nCurDir, BOOL bAtLeastName = TRUE) const;
  104.     virtual void UpdateMenu(CCmdUI* pCmdUI);
  105.     virtual void ReadList();    // reads from registry or ini file
  106.     virtual void WriteList();   // writes to registry or ini file
  107.  
  108. // Implementation
  109.     virtual ~CRecentFileList();
  110.  
  111.     int m_nSize;                // contents of the MRU list
  112.     CString* m_arrNames;
  113.     CString m_strSectionName;   // for saving
  114.     CString m_strEntryFormat;
  115.     UINT m_nStart;              // for displaying
  116.     int m_nMaxDisplayLength;
  117.     CString m_strOriginal;      // original menu item contents
  118. };
  119.  
  120. AFX_INLINE int CRecentFileList::GetSize() const
  121.     { return m_nSize; }
  122. AFX_INLINE CString& CRecentFileList::operator[](int nIndex)
  123.     { ASSERT(nIndex < m_nSize); return m_arrNames[nIndex]; }
  124.  
  125. /////////////////////////////////////////////////////////////////////////////
  126. // CDockState - used for docking serialization
  127.  
  128. class CDockState : public CObject
  129. {
  130.     DECLARE_SERIAL(CDockState)
  131.     CDockState();
  132.  
  133. public:
  134. // Attributes
  135.     CPtrArray m_arrBarInfo;
  136.  
  137. public:
  138. // Operations
  139.     void LoadState(LPCTSTR lpszProfileName);
  140.     void SaveState(LPCTSTR lpszProfileName);
  141.     void Clear(); //deletes all the barinfo's
  142.     DWORD GetVersion();
  143.  
  144. // Implementation
  145. protected:
  146.     BOOL m_bScaling;
  147.     CRect m_rectDevice;
  148.     CRect m_rectClip;
  149.     CSize m_sizeLogical;
  150.     DWORD m_dwVersion;
  151.  
  152. public:
  153.     ~CDockState();
  154.     virtual void Serialize(CArchive& ar);
  155.  
  156.     // scaling implementation
  157.     void ScalePoint(CPoint& pt);
  158.     void ScaleRectPos(CRect& rect);
  159.     CSize GetScreenSize();
  160.     void SetScreenSize(CSize& size);
  161. };
  162.  
  163. /////////////////////////////////////////////////////////////////////////////
  164.  
  165. #ifdef _AFX_PACKING
  166. #pragma pack(pop)
  167. #endif
  168.  
  169. #undef AFX_DATA
  170. #define AFX_DATA
  171.  
  172. #ifdef _AFX_MINREBUILD
  173. #pragma component(minrebuild, on)
  174. #endif
  175. #ifndef _AFX_FULLTYPEINFO
  176. #pragma component(mintypeinfo, off)
  177. #endif
  178.  
  179. #endif // __AFXADV_H__
  180.  
  181. /////////////////////////////////////////////////////////////////////////////
  182.