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.

108 lines
3.8 KiB

  1. // IconControl.h : Declaration of the CIconControl
  2. #ifndef __ICONCONTROL_H_
  3. #define __ICONCONTROL_H_
  4. extern const CLSID CLSID_IconControl;
  5. /////////////////////////////////////////////////////////////////////////////
  6. // CIconControl
  7. class ATL_NO_VTABLE CIconControl :
  8. public CComObjectRootEx<CComSingleThreadModel>,
  9. public CComControl<CIconControl>,
  10. public IPersistStreamInitImpl<CIconControl>,
  11. public IOleControlImpl<CIconControl>,
  12. public IOleObjectImpl<CIconControl>,
  13. public IOleInPlaceActiveObjectImpl<CIconControl>,
  14. public IViewObjectExImpl<CIconControl>,
  15. public IOleInPlaceObjectWindowlessImpl<CIconControl>,
  16. public IPersistStorageImpl<CIconControl>,
  17. public ISpecifyPropertyPagesImpl<CIconControl>,
  18. public IQuickActivateImpl<CIconControl>,
  19. public IDataObjectImpl<CIconControl>,
  20. public IPersistPropertyBagImpl<CIconControl>,
  21. public IObjectSafetyImpl<CIconControl, INTERFACESAFE_FOR_UNTRUSTED_DATA>,
  22. public CComCoClass<CIconControl, &CLSID_IconControl>
  23. {
  24. public:
  25. CIconControl() : m_fImageInfoValid(false), m_fAskedForImageInfo(false), m_hIcon(NULL),
  26. m_bDisplayNotch(true), m_fLayoutRTL(false)
  27. {
  28. }
  29. virtual ~CIconControl()
  30. {
  31. if (m_hIcon)
  32. DestroyIcon(m_hIcon);
  33. }
  34. DECLARE_MMC_CONTROL_REGISTRATION(
  35. g_szMmcndmgrDll, // implementing DLL
  36. CLSID_IconControl,
  37. _T("MMC IconControl class"),
  38. _T("MMC.IconControl.1"),
  39. _T("MMC.IconControl"),
  40. LIBID_NODEMGRLib,
  41. _T("1"),
  42. _T("1.0"))
  43. DECLARE_PROTECT_FINAL_CONSTRUCT()
  44. BEGIN_COM_MAP(CIconControl)
  45. COM_INTERFACE_ENTRY(IViewObjectEx)
  46. COM_INTERFACE_ENTRY(IViewObject2)
  47. COM_INTERFACE_ENTRY(IViewObject)
  48. COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
  49. COM_INTERFACE_ENTRY(IOleInPlaceObject)
  50. COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
  51. COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
  52. COM_INTERFACE_ENTRY(IOleControl)
  53. COM_INTERFACE_ENTRY(IOleObject)
  54. COM_INTERFACE_ENTRY(IPersistPropertyBag)
  55. COM_INTERFACE_ENTRY(IPersistStreamInit)
  56. COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
  57. COM_INTERFACE_ENTRY(ISpecifyPropertyPages)
  58. COM_INTERFACE_ENTRY(IQuickActivate)
  59. COM_INTERFACE_ENTRY(IPersistStorage)
  60. COM_INTERFACE_ENTRY(IDataObject)
  61. COM_INTERFACE_ENTRY(IObjectSafety)
  62. END_COM_MAP()
  63. BEGIN_PROP_MAP(CIconControl)
  64. PROP_DATA_ENTRY("Notch", m_bDisplayNotch, VT_UI4) // the "Notch" is the quarter circle at the bottom-right of the panel
  65. // PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
  66. // PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
  67. // Example entries
  68. // PROP_ENTRY("Property Description", dispid, clsid)
  69. // PROP_PAGE(CLSID_StockColorPage)
  70. END_PROP_MAP()
  71. BEGIN_MSG_MAP(CIconControl)
  72. CHAIN_MSG_MAP(CComControl<CIconControl>)
  73. DEFAULT_REFLECTION_HANDLER()
  74. END_MSG_MAP()
  75. // Handler prototypes:
  76. // LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  77. // LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  78. // LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
  79. // IViewObjectEx
  80. DECLARE_VIEW_STATUS(VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE)
  81. public:
  82. HRESULT OnDraw(ATL_DRAWINFO& di);
  83. // Helpers
  84. private:
  85. SC ScConnectToAMCViewForImageInfo();
  86. private:
  87. HICON m_hIcon;
  88. bool m_fImageInfoValid : 1;
  89. bool m_fAskedForImageInfo : 1;
  90. UINT m_bDisplayNotch; // the "Notch" is the quarter circle at the bottom-right of the panel
  91. bool m_fLayoutRTL;
  92. };
  93. #endif //__ICONCONTROL_H_