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.

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