Source code of Windows XP (NT5)
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.

262 lines
6.3 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1996-1999 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // AtlBasePropSheet.h
  7. //
  8. // Implementation File:
  9. // AtlBasePropSheet.cpp.
  10. //
  11. // Description:
  12. // Definition of the CBasePropertySheetWindow and CBasePropertySheetImpl
  13. // classes.
  14. //
  15. // Author:
  16. // David Potter (davidp) February 26, 1998
  17. //
  18. // Revision History:
  19. //
  20. // Notes:
  21. //
  22. /////////////////////////////////////////////////////////////////////////////
  23. #ifndef __ATLBASEPROPSHEET_H_
  24. #define __ATLBASEPROPSHEET_H_
  25. // Required because of class names longer than 16 characters in lists.
  26. #pragma warning( disable : 4786 ) // identifier was truncated to '255' characters in the browser information
  27. /////////////////////////////////////////////////////////////////////////////
  28. // Forward Class Declarations
  29. /////////////////////////////////////////////////////////////////////////////
  30. class CBasePropertySheetWindow;
  31. template < class T, class TBase > class CBasePropertySheetImpl;
  32. /////////////////////////////////////////////////////////////////////////////
  33. // External Class Declarations
  34. /////////////////////////////////////////////////////////////////////////////
  35. class CClusterObject;
  36. /////////////////////////////////////////////////////////////////////////////
  37. // Include Files
  38. /////////////////////////////////////////////////////////////////////////////
  39. #ifndef __ATLBASESHEET_H_
  40. #include "AtlBaseSheet.h" // for CBaseSheetWindow;
  41. #endif
  42. #ifndef __ATLBASEPROPPAGE_H_
  43. #include "AtlBasePropPage.h" // for CPropertyPageList
  44. #endif
  45. /////////////////////////////////////////////////////////////////////////////
  46. // Type Definitions
  47. /////////////////////////////////////////////////////////////////////////////
  48. /////////////////////////////////////////////////////////////////////////////
  49. //++
  50. //
  51. // class CBasePropertySheetWindow
  52. //
  53. // Description:
  54. // Base standard property sheet window.
  55. //
  56. // Inheritance:
  57. // CBasePropertySheetWindow
  58. // CBaseSheetWindow
  59. // CPropertySheetWindow
  60. //
  61. //--
  62. /////////////////////////////////////////////////////////////////////////////
  63. class CBasePropertySheetWindow : public CBaseSheetWindow
  64. {
  65. typedef CBaseSheetWindow baseClass;
  66. friend class CBasePropertyPageWindow;
  67. public:
  68. //
  69. // Construction
  70. //
  71. // Standard constructor
  72. CBasePropertySheetWindow( HWND hWnd = NULL )
  73. : baseClass( hWnd )
  74. , m_plppPages( NULL )
  75. , m_pcoObjectToExtend( NULL )
  76. {
  77. } //*** CBasePropertySheetWindow()
  78. // Destructor
  79. ~CBasePropertySheetWindow( void );
  80. // Initialize the sheet
  81. BOOL BInit( void );
  82. protected:
  83. CPropertyPageList * m_plppPages; // List of pages in the sheet.
  84. CClusterObject * m_pcoObjectToExtend; // Cluster object to extend.
  85. public:
  86. // Access list of pages in the sheet
  87. CPropertyPageList * PlppPages( void )
  88. {
  89. ATLASSERT( m_plppPages != NULL );
  90. return m_plppPages;
  91. } //*** PlppPages()
  92. // Access the cluster object to extend
  93. CClusterObject * PcoObjectToExtend( void ) { return m_pcoObjectToExtend; }
  94. // Set the object to extend
  95. void SetObjectToExtend( IN CClusterObject * pco )
  96. {
  97. ATLASSERT( pco != NULL );
  98. m_pcoObjectToExtend = pco;
  99. } //*** SetObjectToExtend()
  100. public:
  101. // Add a page (required to get to base class method)
  102. void AddPage( HPROPSHEETPAGE hPage )
  103. {
  104. baseClass::AddPage( hPage );
  105. } //*** AddPage( hPage )
  106. // Add a page (required to get to base class method)
  107. BOOL AddPage( LPCPROPSHEETPAGE pPage )
  108. {
  109. return baseClass::AddPage( pPage );
  110. } //*** AddPage( pPage )
  111. // Add a page to sheet
  112. BOOL BAddPage( IN CBasePropertyPageWindow * ppp );
  113. public:
  114. //
  115. // Overrides of abstract methods.
  116. //
  117. // Add extension pages to the sheet
  118. virtual void AddExtensionPages( IN HFONT hfont, IN HICON hicon );
  119. // Add a page (called by extension)
  120. virtual HRESULT HrAddExtensionPage( IN CBasePageWindow * ppage );
  121. public:
  122. //
  123. // Message handler functions.
  124. //
  125. // Handler for PSCB_INITIALIZED
  126. void OnSheetInitialized( void );
  127. // Implementation
  128. protected:
  129. // Prepare to add exension pages to the sheet
  130. void PrepareToAddExtensionPages( CDynamicPropertyPageList & rldpp );
  131. // Complete the process of adding extension pages
  132. void CompleteAddingExtensionPages( CDynamicPropertyPageList & rldpp );
  133. // Remove all extension pages from the property sheet
  134. void RemoveAllExtensionPages( void );
  135. }; //*** class CBasePropertySheetWindow
  136. /////////////////////////////////////////////////////////////////////////////
  137. //++
  138. //
  139. // class CBasePropertySheetImpl
  140. //
  141. // Description:
  142. // Base standard property sheet implementation.
  143. //
  144. // Inheritance:
  145. // CBasePropertySheetImpl< T, TBase >
  146. // CBaseSheetImpl< T, TBase >
  147. // CPropertySheetImpl< T, TBase >
  148. // <TBase>
  149. // ...
  150. // CBasePropertySheetWindow
  151. // CBaseSheetWindow
  152. // CPropertySheetWindow
  153. //
  154. //--
  155. /////////////////////////////////////////////////////////////////////////////
  156. template < class T, class TBase = CBasePropertySheetWindow >
  157. class CBasePropertySheetImpl : public CBaseSheetImpl< T, TBase >
  158. {
  159. typedef CBasePropertySheetImpl< T, TBase > thisClass;
  160. typedef CBaseSheetImpl< T, TBase > baseClass;
  161. public:
  162. //
  163. // Construction
  164. //
  165. // Standard constructor
  166. CBasePropertySheetImpl(
  167. IN LPCTSTR lpszTitle = NULL,
  168. IN UINT uStartPage = 0
  169. )
  170. : baseClass( lpszTitle, uStartPage )
  171. {
  172. // Set the pointer in the base window class to our prop sheet header.
  173. m_ppsh = &m_psh;
  174. } //*** CBasePropertySheetWindow( lpszTitle )
  175. // Constructor taking a resource ID for the title
  176. CBasePropertySheetImpl(
  177. IN UINT nIDTitle,
  178. IN UINT uStartPage = 0
  179. )
  180. : baseClass( NULL, uStartPage )
  181. {
  182. m_strTitle.LoadString( nIDTitle );
  183. m_psh.pszCaption = m_strTitle;
  184. // Set the pointer in the base window class to our prop sheet header.
  185. m_ppsh = &m_psh;
  186. } //*** CBasePropertySheetImpl( nIDTitle )
  187. public:
  188. //
  189. // Message map.
  190. //
  191. // BEGIN_MSG_MAP( thisClass )
  192. // CHAIN_MSG_MAP( baseClass );
  193. // END_MSG_MAP()
  194. //
  195. // Message handler functions.
  196. //
  197. // Implementation
  198. protected:
  199. CString m_strTitle; // Used to support resource IDs for the title.
  200. public:
  201. const CString & StrTitle( void ) const { return m_strTitle; }
  202. void SetTitle( LPCTSTR lpszText, UINT nStyle = 0 )
  203. {
  204. baseClass::SetTitle( lpszText, nStyle );
  205. m_strTitle = lpszText;
  206. } //*** SetTitle()
  207. }; //*** class CBasePropertySheetImpl
  208. /////////////////////////////////////////////////////////////////////////////
  209. #endif // __ATLBASEPROPSHEET_H_