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.

159 lines
5.0 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1999 - 1999
  6. //
  7. // File: mmcctrl.h
  8. //
  9. //--------------------------------------------------------------------------
  10. // MMCCtrl.h : Declaration of the CMMCCtrl
  11. #ifndef __MMCCTRL_H_
  12. #define __MMCCTRL_H_
  13. #include "resource.h" // main symbols
  14. #include "commctrl.h" // to prevent LVITEMW redefinition in ndmgr.h
  15. #include <ndmgr.h>
  16. /////////////////////////////////////////////////////////////////////////////
  17. // CMMCCtrl
  18. class ATL_NO_VTABLE CMMCCtrl :
  19. public CComObjectRootEx<CComSingleThreadModel>,
  20. public CComCoClass<CMMCCtrl, &CLSID_MMCCtrl>,
  21. public CComControl<CMMCCtrl>,
  22. public IDispatchImpl<IMMCCtrl, &IID_IMMCCtrl, &LIBID_CICLib>,
  23. public IProvideClassInfo2Impl<&CLSID_MMCCtrl, &IID_IMMCCtrlEvent, &LIBID_CICLib>,
  24. public IPersistStreamInitImpl<CMMCCtrl>,
  25. public IPersistStorageImpl<CMMCCtrl>,
  26. public IQuickActivateImpl<CMMCCtrl>,
  27. public IOleControlImpl<CMMCCtrl>,
  28. public IOleObjectImpl<CMMCCtrl>,
  29. public IOleInPlaceActiveObjectImpl<CMMCCtrl>,
  30. public IObjectSafetyImpl<CMMCCtrl, INTERFACESAFE_FOR_UNTRUSTED_CALLER>,
  31. public IViewObjectExImpl<CMMCCtrl>,
  32. public IOleInPlaceObjectWindowlessImpl<CMMCCtrl>,
  33. public IDataObjectImpl<CMMCCtrl>,
  34. public ISpecifyPropertyPagesImpl<CMMCCtrl>,
  35. public IConnectionPointContainerImpl<CMMCCtrl>,
  36. public IConnectionPointImpl<CMMCCtrl, &IID_IMMCCtrlEvent>
  37. {
  38. public:
  39. CMMCCtrl()
  40. {
  41. }
  42. ~CMMCCtrl()
  43. {
  44. }
  45. DECLARE_MMC_CONTROL_REGISTRATION(
  46. g_szCicDll,
  47. CLSID_MMCCtrl,
  48. _T("MMCCtrl class"),
  49. _T("MMCCtrl.MMCCtrl.1"),
  50. _T("MMCCtrl.MMCCtrl"),
  51. LIBID_CICLib,
  52. _T("1"),
  53. _T("1.0"))
  54. DECLARE_NOT_AGGREGATABLE(CMMCCtrl)
  55. BEGIN_COM_MAP(CMMCCtrl)
  56. COM_INTERFACE_ENTRY(IMMCCtrl)
  57. COM_INTERFACE_ENTRY(IDispatch)
  58. COM_INTERFACE_ENTRY(IObjectSafety)
  59. COM_INTERFACE_ENTRY_IMPL(IViewObjectEx)
  60. COM_INTERFACE_ENTRY_IMPL_IID(IID_IViewObject2, IViewObjectEx)
  61. COM_INTERFACE_ENTRY_IMPL_IID(IID_IViewObject, IViewObjectEx)
  62. COM_INTERFACE_ENTRY_IMPL(IOleInPlaceObjectWindowless)
  63. COM_INTERFACE_ENTRY_IMPL_IID(IID_IOleInPlaceObject, IOleInPlaceObjectWindowless)
  64. COM_INTERFACE_ENTRY_IMPL_IID(IID_IOleWindow, IOleInPlaceObjectWindowless)
  65. COM_INTERFACE_ENTRY_IMPL(IOleInPlaceActiveObject)
  66. COM_INTERFACE_ENTRY_IMPL(IOleControl)
  67. COM_INTERFACE_ENTRY_IMPL(IOleObject)
  68. COM_INTERFACE_ENTRY_IMPL(IQuickActivate)
  69. COM_INTERFACE_ENTRY_IMPL(IPersistStorage)
  70. COM_INTERFACE_ENTRY_IMPL(IPersistStreamInit)
  71. COM_INTERFACE_ENTRY_IMPL(ISpecifyPropertyPages)
  72. COM_INTERFACE_ENTRY_IMPL(IDataObject)
  73. COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
  74. COM_INTERFACE_ENTRY(IProvideClassInfo)
  75. COM_INTERFACE_ENTRY(IProvideClassInfo2)
  76. END_COM_MAP()
  77. BEGIN_CONNECTION_POINT_MAP(CMMCCtrl)
  78. CONNECTION_POINT_ENTRY(IID_IMMCCtrlEvent)
  79. END_CONNECTION_POINT_MAP()
  80. BEGIN_PROPERTY_MAP(CMMCCtrl)
  81. // Example entries
  82. // PROP_ENTRY("Property Description", dispid, clsid)
  83. PROP_PAGE(CLSID_StockColorPage)
  84. END_PROPERTY_MAP()
  85. BEGIN_MSG_MAP(CMMCCtrl)
  86. MESSAGE_HANDLER(WM_PAINT, OnPaint)
  87. MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
  88. MESSAGE_HANDLER(WM_KILLFOCUS, OnKillFocus)
  89. END_MSG_MAP()
  90. STDMETHOD(TranslateAccelerator)(MSG *pMsg)
  91. {
  92. CComQIPtr<IOleControlSite,&IID_IOleControlSite> spCtrlSite (m_spClientSite);
  93. if(spCtrlSite)
  94. return spCtrlSite->TranslateAccelerator (pMsg,0);
  95. return S_FALSE;
  96. }
  97. // IViewObjectEx
  98. STDMETHOD(GetViewStatus)(DWORD* pdwStatus)
  99. {
  100. ATLTRACE(_T("IViewObjectExImpl::GetViewStatus\n"));
  101. *pdwStatus = VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE;
  102. return S_OK;
  103. }
  104. STDMETHOD(GetExtent)(DWORD dwDrawAspect, SIZEL *psizel)
  105. {
  106. #ifdef DIDNT_WORK_TOO_WELL
  107. static BOOL b = FALSE;
  108. if (b == TRUE) {
  109. b = FALSE;
  110. psizel->cx = psizel->cy = 121;
  111. } else {
  112. b = TRUE;
  113. psizel->cx = psizel->cy = 120;
  114. }
  115. #else
  116. psizel->cx = psizel->cy = 250;
  117. #endif
  118. return S_OK;
  119. }
  120. // IMMCCtrl
  121. public:
  122. STDMETHOD(GetBackground )(BSTR szTaskGroup, IDispatch** retval);
  123. // STDMETHOD(GetBranding )(BSTR szTaskGroup, IDispatch** retval);
  124. STDMETHOD(GetTitle )(BSTR szTaskGroup, BSTR * retval);
  125. STDMETHOD(GetDescriptiveText)(BSTR szTaskGroup, BSTR * retval);
  126. STDMETHOD(GetFirstTask )(BSTR szTaskGroup, IDispatch** retval);
  127. STDMETHOD(GetNextTask )(IDispatch** retval);
  128. STDMETHOD(GetListPadInfo )(BSTR szGroup, IDispatch** retval);
  129. STDMETHOD(TaskNotify )(BSTR szClsid, VARIANT * pvArg, VARIANT * pvParam);
  130. HRESULT OnDraw(ATL_DRAWINFO& di);
  131. HRESULT OnDrawAdvanced(ATL_DRAWINFO& di);
  132. private: // helpers
  133. void Connect (HWND wndCurrent);
  134. void DoConnect ();
  135. void FreeDisplayData (MMC_TASK_DISPLAY_OBJECT* pdo);
  136. private:
  137. ITaskPadHostPtr m_spTaskPadHost;
  138. IEnumTASKPtr m_spEnumTASK;
  139. };
  140. #endif //__MMCCTRL_H_