Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

181 lines
4.7 KiB

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