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.

163 lines
5.1 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 2001.
  5. //
  6. // File: spolitem.h
  7. //
  8. // Contents: WiF Policy Snapin
  9. //
  10. //
  11. // History: TaroonM
  12. // 10/30/01
  13. //
  14. //----------------------------------------------------------------------------
  15. #ifndef _SPOLITEM_H
  16. #define _SPOLITEM_H
  17. // generic column headers
  18. #define COL_NAME 0
  19. #define COL_DESCRIPTION 1
  20. #define COL_ACTIVE 2
  21. #define COL_LAST_MODIFIED 3
  22. //for rsop case
  23. #define COL_GPONAME 2
  24. #define COL_PRECEDENCE 3
  25. #define COL_OU 4
  26. class CSecPolItem :
  27. public CWirelessSnapInDataObjectImpl <CSecPolItem>,
  28. public CDataObjectImpl <CSecPolItem>,
  29. public CComObjectRoot,
  30. public CSnapObject
  31. {
  32. // ATL Maps
  33. DECLARE_NOT_AGGREGATABLE(CSecPolItem)
  34. BEGIN_COM_MAP(CSecPolItem)
  35. COM_INTERFACE_ENTRY(IDataObject)
  36. COM_INTERFACE_ENTRY(IWirelessSnapInDataObject)
  37. END_COM_MAP()
  38. public:
  39. CSecPolItem ();
  40. virtual ~CSecPolItem ();
  41. virtual void Initialize (WIRELESS_POLICY_DATA *pPolicy,CComponentDataImpl* pComponentDataImpl,CComponentImpl* pComponentImpl, BOOL bTemporaryDSObject);
  42. public:
  43. ////////////////////////////////////////////////////////////////
  44. // IWirelessSnapInDataObject interface
  45. // handle IExtendContextMenu
  46. STDMETHOD(AddMenuItems)( LPCONTEXTMENUCALLBACK piCallback,
  47. long *pInsertionAllowed );
  48. STDMETHOD(Command)( long lCommandID,
  49. IConsoleNameSpace *pNameSpace );
  50. // handle IExtendPropertySheet
  51. STDMETHOD(CreatePropertyPages)( LPPROPERTYSHEETCALLBACK lpProvider,
  52. LONG_PTR handle );
  53. STDMETHOD(QueryPagesFor)( void );
  54. // Notify helper
  55. STDMETHOD(OnPropertyChange)(LPARAM lParam, LPCONSOLE pConsole );
  56. STDMETHOD(OnRename)( LPARAM arg, LPARAM param );
  57. // Destroy helper
  58. STDMETHOD(Destroy)( void );
  59. // handle IComponent and IComponentData
  60. STDMETHOD(Notify)( MMC_NOTIFY_TYPE event,
  61. LPARAM arg,
  62. LPARAM param,
  63. BOOL bComponentData,
  64. IConsole *pConsole,
  65. IHeaderCtrl *pHeader );
  66. // IComponent Notify() helpers
  67. STDMETHOD(OnDelete)(LPARAM arg, LPARAM param ); // param == IResultData*
  68. // handle IComponent
  69. STDMETHOD(GetResultDisplayInfo)( RESULTDATAITEM *pResultDataItem );
  70. // IWirelessSnapInData
  71. STDMETHOD(GetResultData)( RESULTDATAITEM **ppResultDataItem );
  72. STDMETHOD(GetGuidForCompare)( GUID *pGuid );
  73. STDMETHOD(AdjustVerbState)(LPCONSOLEVERB pConsoleVerb);
  74. STDMETHOD(DoPropertyChangeHook)( void );
  75. ////////////////////////////////////////////////////////////////
  76. public:
  77. STDMETHOD_(const GUID*, GetDataObjectTypeGuid)() { return &cObjectTypeSecPolRes; }
  78. STDMETHOD_(const wchar_t*, GetDataStringObjectTypeGuid)() { return cszObjectTypeSecPolRes; }
  79. BOOL IsSelected() { return -1 != m_nResultSelected ? TRUE : FALSE; }
  80. // Property page helpers
  81. STDMETHOD(DisplaySecPolProperties)(CString strTitle, BOOL bWiz97On = TRUE);
  82. // IExtendControlbar helpers
  83. public:
  84. STDMETHOD_(BOOL, UpdateToolbarButton)
  85. (
  86. UINT id, // button ID
  87. BOOL bSnapObjSelected, // ==TRUE when result/scope item is selected
  88. BYTE fsState // enable/disable this button state by returning TRUE/FALSE
  89. );
  90. BEGIN_SNAPINTOOLBARID_MAP(CSecPolItem)
  91. SNAPINTOOLBARID_ENTRY(IDR_TOOLBAR_SECPOL_RESULT)
  92. END_SNAPINTOOLBARID_MAP(CSecPolItem)
  93. // Note: The following IDM_* have been defined in resource.h because they
  94. // are potential candidates for toolbar buttons. The value assigned to
  95. // each IDM_* is the value of the related IDS_MENUDESCRIPTION_* string ID.
  96. /*
  97. enum
  98. {
  99. // Identifiers for each of the commands/views to be inserted into the context menu.
  100. IDM_SETACTIVE,
  101. IDM_TASKSETACTIVE
  102. };
  103. */
  104. // Notify event handlers
  105. HRESULT OnSelect(LPARAM arg, LPARAM param, IResultData *pResultData);
  106. BOOL CheckForEnabled ();
  107. HRESULT FormatTime(time_t t, CString & str);
  108. public:
  109. // accessor functions
  110. virtual WIRELESS_POLICY_DATA* GetWirelessPolicy () {return m_pPolicy;};
  111. virtual void SetNewName( LPCTSTR pszName ) { m_strNewName = pszName; }
  112. virtual LPCTSTR GetNewName() { return (LPCTSTR)m_strNewName; }
  113. LPRESULTDATAITEM GetResultItem() { return &m_ResultItem; }
  114. STDMETHODIMP VerifyStorageConnection()
  115. {
  116. return S_OK;
  117. }
  118. protected:
  119. // helper functions
  120. void SelectResult( IResultData *pResultData );
  121. private:
  122. TCHAR* m_pDisplayInfo;
  123. int m_nResultSelected; // > -1 when valid index of selected result item
  124. BOOL m_bWiz97On;
  125. // user changed the name, it needs to be displayed, but its not committed yet. store it here.
  126. CString m_strNewName;
  127. RESULTDATAITEM m_ResultItem;
  128. bool m_bBlockDSDelete;
  129. //Bug297890, this flag is used to AdjustVerbState() to modify the context menu
  130. BOOL m_bItemSelected;
  131. PWIRELESS_POLICY_DATA m_pPolicy;
  132. BOOL m_bNewPol;
  133. HRESULT IsPolicyExist();
  134. };
  135. typedef CComObject<CSecPolItem>* LPCSECPOLITEM;
  136. #endif
  137.