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.

204 lines
4.9 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1996-1998 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // AtlExtMenu.h
  7. //
  8. // Implementation File:
  9. // AtlExtMenu.cpp
  10. //
  11. // Description:
  12. // Definition of the Cluster Administrator extension menu classes.
  13. //
  14. // Author:
  15. // David Potter (davidp) August 28, 1996
  16. //
  17. // Revision History:
  18. //
  19. // Notes:
  20. //
  21. /////////////////////////////////////////////////////////////////////////////
  22. #ifndef __ATLEXTMENU_H_
  23. #define __ATLEXTMENU_H_
  24. // Required because of class names longer than 16 characters in lists.
  25. #pragma warning( disable : 4786 ) // identifier was truncated to '255' characters ni the browser information
  26. /////////////////////////////////////////////////////////////////////////////
  27. // Include Files
  28. /////////////////////////////////////////////////////////////////////////////
  29. /////////////////////////////////////////////////////////////////////////////
  30. // Forward Class Declarations
  31. /////////////////////////////////////////////////////////////////////////////
  32. class CCluAdmExMenuItem;
  33. /////////////////////////////////////////////////////////////////////////////
  34. // External Class Declarations
  35. /////////////////////////////////////////////////////////////////////////////
  36. interface IWEInvokeCommand;
  37. /////////////////////////////////////////////////////////////////////////////
  38. // Type Definitions
  39. /////////////////////////////////////////////////////////////////////////////
  40. typedef std::list< CCluAdmExMenuItem * > CCluAdmExMenuItemList;
  41. /////////////////////////////////////////////////////////////////////////////
  42. //++
  43. //
  44. // class CCluAdmExMenuItem
  45. //
  46. // Description:
  47. // Represents one extension DLL's menu item.
  48. //
  49. // Inheritance:
  50. // CCluAdmExMenuItem
  51. //
  52. //--
  53. /////////////////////////////////////////////////////////////////////////////
  54. class CCluAdmExMenuItem
  55. {
  56. public:
  57. //
  58. // Constructors.
  59. //
  60. // Default constructor
  61. CCluAdmExMenuItem( void )
  62. {
  63. CommonConstruct();
  64. } //*** CCluAdmExMenuItem()
  65. // Fully specified constructor
  66. CCluAdmExMenuItem(
  67. IN LPCTSTR lpszName,
  68. IN LPCTSTR lpszStatusBarText,
  69. IN ULONG nExtCommandID,
  70. IN ULONG nCommandID,
  71. IN ULONG nMenuItemID,
  72. IN ULONG uFlags,
  73. IN BOOL bMakeDefault,
  74. IN IWEInvokeCommand * piCommand
  75. )
  76. {
  77. ATLASSERT( piCommand != NULL );
  78. CommonConstruct();
  79. m_strName = lpszName;
  80. m_strStatusBarText = lpszStatusBarText;
  81. m_nExtCommandID = nExtCommandID;
  82. m_nCommandID = nCommandID;
  83. m_nMenuItemID = nMenuItemID;
  84. m_uFlags = uFlags;
  85. m_bDefault = bMakeDefault;
  86. m_piCommand = piCommand;
  87. // will throw its own exception if it fails
  88. if ( uFlags & MF_POPUP )
  89. {
  90. m_plSubMenuItems = new CCluAdmExMenuItemList;
  91. } // if: popup menu
  92. #if DBG
  93. AssertValid();
  94. #endif // DBG
  95. } //*** CCluAdmExMenuItem()
  96. virtual ~CCluAdmExMenuItem( void )
  97. {
  98. delete m_plSubMenuItems;
  99. // Nuke data so it can't be used again
  100. CommonConstruct();
  101. } //*** ~CCluAdmExMenuItem()
  102. protected:
  103. void CommonConstruct( void )
  104. {
  105. m_strName.Empty();
  106. m_strStatusBarText.Empty();
  107. m_nExtCommandID = (ULONG) -1;
  108. m_nCommandID = (ULONG) -1;
  109. m_nMenuItemID = (ULONG) -1;
  110. m_uFlags = (ULONG) -1;
  111. m_bDefault = FALSE;
  112. m_piCommand = NULL;
  113. m_plSubMenuItems = NULL;
  114. m_hmenuPopup = NULL;
  115. } //*** CommonConstruct()
  116. protected:
  117. //
  118. // Attributes.
  119. //
  120. CString m_strName;
  121. CString m_strStatusBarText;
  122. ULONG m_nExtCommandID;
  123. ULONG m_nCommandID;
  124. ULONG m_nMenuItemID;
  125. ULONG m_uFlags;
  126. BOOL m_bDefault;
  127. IWEInvokeCommand * m_piCommand;
  128. public:
  129. //
  130. // Accessor methods.
  131. //
  132. const CString & StrName( void ) const { return m_strName; }
  133. const CString & StrStatusBarText( void ) const { return m_strStatusBarText; }
  134. ULONG NExtCommandID( void ) const { return m_nExtCommandID; }
  135. ULONG NCommandID( void ) const { return m_nCommandID; }
  136. ULONG NMenuItemID( void ) const { return m_nMenuItemID; }
  137. ULONG UFlags( void ) const { return m_uFlags; }
  138. BOOL BDefault( void ) const { return m_bDefault; }
  139. IWEInvokeCommand * PiCommand( void ) { return m_piCommand; }
  140. // Operations
  141. public:
  142. void SetPopupMenuHandle( IN HMENU hmenu ) { m_hmenuPopup = hmenu; }
  143. // Implementation
  144. protected:
  145. HMENU m_hmenuPopup;
  146. CCluAdmExMenuItemList * m_plSubMenuItems;
  147. public:
  148. HMENU HmenuPopup( void ) const { return m_hmenuPopup; }
  149. CCluAdmExMenuItemList * PlSubMenuItems( void ) const { return m_plSubMenuItems; }
  150. protected:
  151. #if DBG
  152. void AssertValid( void )
  153. {
  154. if ( (m_nExtCommandID == -1)
  155. || (m_nCommandID == -1)
  156. || (m_nMenuItemID == -1)
  157. || (m_uFlags == -1)
  158. || (((m_uFlags & MF_POPUP) == 0) && (m_plSubMenuItems != NULL))
  159. || (((m_uFlags & MF_POPUP) != 0) && (m_plSubMenuItems == NULL))
  160. )
  161. {
  162. ATLASSERT( FALSE );
  163. }
  164. } //*** AssertValid()
  165. #endif // DBG
  166. }; //*** class CCluAdmExMenuItem
  167. /////////////////////////////////////////////////////////////////////////////
  168. #endif // __ATLEXTMENU_H_