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.

121 lines
4.5 KiB

  1. /*************************************************************************/
  2. /* Copyright (C) 1999 Microsoft Corporation */
  3. /* File: MSMFImg.h */
  4. /* Description: Declaration of CMSMFImg */
  5. /* Author: David Janecek */
  6. /*************************************************************************/
  7. #ifndef __MSMFIMG_H_
  8. #define __MSMFIMG_H_
  9. #include "resource.h" // main symbols
  10. #include "CBitmap.h"
  11. #include <atlctl.h>
  12. #include "CstUtils.h"
  13. #include "MSMFCntCP.h"
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CMSMFImg
  16. class ATL_NO_VTABLE CMSMFImg :
  17. public CComObjectRootEx<CComSingleThreadModel>,
  18. public CStockPropImpl<CMSMFImg, IMSMFImg, &IID_IMSMFImg, &LIBID_MSMFCNTLib>,
  19. public CComControl<CMSMFImg>,
  20. public IPersistStreamInitImpl<CMSMFImg>,
  21. public IOleControlImpl<CMSMFImg>,
  22. public IOleObjectImpl<CMSMFImg>,
  23. public IOleInPlaceActiveObjectImpl<CMSMFImg>,
  24. public IViewObjectExImpl<CMSMFImg>,
  25. public IOleInPlaceObjectWindowlessImpl<CMSMFImg>,
  26. public IPersistStorageImpl<CMSMFImg>,
  27. public IPersistPropertyBagImpl<CMSMFImg>,
  28. public IProvideClassInfo2Impl<&CLSID_MSMFImg, &DIID__MSMFImg, &LIBID_MSMFCNTLib>,
  29. public IObjectSafetyImpl<CMSMFImg, INTERFACESAFE_FOR_UNTRUSTED_CALLER| INTERFACESAFE_FOR_UNTRUSTED_DATA>,
  30. public CComCoClass<CMSMFImg, &CLSID_MSMFImg>,
  31. public CMSMFCntrlUtils<CMSMFImg>, // custom utilities we share across controls
  32. public CProxy_MSMFImg< CMSMFImg >,
  33. public IConnectionPointContainerImpl<CMSMFImg>
  34. {
  35. public:
  36. CMSMFImg();
  37. virtual ~CMSMFImg();
  38. DECLARE_REGISTRY_RESOURCEID(IDR_MSMFIMG)
  39. DECLARE_PROTECT_FINAL_CONSTRUCT()
  40. BEGIN_COM_MAP(CMSMFImg)
  41. COM_INTERFACE_ENTRY(IMSMFImg)
  42. COM_INTERFACE_ENTRY(IDispatch)
  43. COM_INTERFACE_ENTRY(IViewObjectEx)
  44. COM_INTERFACE_ENTRY(IViewObject2)
  45. COM_INTERFACE_ENTRY(IViewObject)
  46. COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
  47. COM_INTERFACE_ENTRY(IOleInPlaceObject)
  48. COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
  49. COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
  50. COM_INTERFACE_ENTRY(IOleControl)
  51. COM_INTERFACE_ENTRY(IOleObject)
  52. COM_INTERFACE_ENTRY(IPersistStreamInit)
  53. COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
  54. COM_INTERFACE_ENTRY_IMPL_IID(IID_IPersist, IPersistPropertyBag)
  55. COM_INTERFACE_ENTRY_IMPL(IPersistPropertyBag)
  56. COM_INTERFACE_ENTRY(IProvideClassInfo)
  57. COM_INTERFACE_ENTRY(IProvideClassInfo2)
  58. COM_INTERFACE_ENTRY(IObjectSafety)
  59. COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
  60. END_COM_MAP()
  61. BEGIN_PROP_MAP(CMSMFImg)
  62. PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
  63. PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
  64. PROP_ENTRY("BackColor", DISPID_BACKCOLOR, CLSID_StockColorPage)
  65. PROP_ENTRY("Windowless", 3, CLSID_NULL)
  66. PROP_ENTRY("TransparentBlitType", 4, CLSID_NULL)
  67. // Example entries
  68. // PROP_ENTRY("Property Description", dispid, clsid)
  69. // PROP_PAGE(CLSID_StockColorPage)
  70. END_PROP_MAP()
  71. BEGIN_CONNECTION_POINT_MAP(CMSMFImg)
  72. CONNECTION_POINT_ENTRY(DIID__MSMFImg)
  73. END_CONNECTION_POINT_MAP()
  74. BEGIN_MSG_MAP(CMSMFImg)
  75. CHAIN_MSG_MAP(CMSMFCntrlUtils<CMSMFImg>)
  76. MESSAGE_HANDLER(WM_DISPLAYCHANGE, OnDispChange)
  77. CHAIN_MSG_MAP(CComControl<CMSMFImg>)
  78. DEFAULT_REFLECTION_HANDLER()
  79. END_MSG_MAP()
  80. // Handler prototypes:
  81. // LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  82. // LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  83. // LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
  84. HRESULT OnDraw(ATL_DRAWINFO& di);
  85. USE_MF_OVERWRITES
  86. USE_MF_CLASSSTYLE // used to overwrite default class, so we avoid flickers
  87. LRESULT OnDispChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  88. // IViewObjectEx
  89. DECLARE_VIEW_STATUS(VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE)
  90. // IMSMFImg
  91. public:
  92. USE_MF_RESOURCEDLL
  93. USE_MF_TRANSPARENT_FLAG
  94. STDMETHOD(get_Image)(/*[out, retval]*/ BSTR *pVal);
  95. STDMETHOD(put_Image)(/*[in]*/ BSTR newVal);
  96. USE_MF_WINDOWLESS_ACTIVATION
  97. OLE_COLOR m_clrBackColor;
  98. protected: // member variables
  99. CBitmap m_BackBitmap;
  100. CComBSTR m_bstrBackFilename;
  101. protected:
  102. void Init();
  103. HRESULT PutImage(BSTR strFilename);
  104. };
  105. #endif //__MSMFIMG_H_
  106. /*************************************************************************/
  107. /* End of file: MSMFImg.h */
  108. /*************************************************************************/