Leaked source code of windows server 2003
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.

131 lines
3.6 KiB

  1. //____________________________________________________________________________
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996 - 1999
  5. //
  6. // File: ScopImag.h
  7. //
  8. // Contents:
  9. //
  10. // Classes:
  11. //
  12. // Functions:
  13. //
  14. // History: 10/4/1996 RaviR Created
  15. //____________________________________________________________________________
  16. //
  17. #ifndef _SCOPIMAG_H_
  18. #define _SCOPIMAG_H_
  19. typedef WORD SNAPINID;
  20. typedef CMap<DWORD, DWORD&, DWORD, DWORD&> CSIIconIdToILIndexMap;
  21. class CSPImageCache
  22. {
  23. public:
  24. // Constructor
  25. CSPImageCache();
  26. // Attributes
  27. WTL::CImageList* GetImageList() { return &m_il; }
  28. // Operations
  29. // Image manipulation.
  30. HRESULT SetIcon(SNAPINID sid, HICON hIcon, LONG nLoc);
  31. HRESULT SetImageStrip(SNAPINID sid, HBITMAP hBMapSm,
  32. LONG nStartLoc, COLORREF cMask, int nEntries);
  33. SC ScMapSnapinIndexToScopeIndex (SNAPINID sid, int nSnapinIndex, int& nScopeIndex);
  34. SC ScMapScopeIndexToSnapinIndex (SNAPINID sid, int nScopeIndex, int& nSnapinIndex);
  35. // Reference counting
  36. void AddRef();
  37. void Release();
  38. // Implementation
  39. private:
  40. CSIIconIdToILIndexMap m_map;
  41. WTL::CImageList m_il;
  42. ULONG m_cRef;
  43. // Destructor - called only by Release
  44. ~CSPImageCache();
  45. }; // class CSPImageCache
  46. class CSnapInImageList : public IImageListPrivate
  47. {
  48. public:
  49. // Constructor & Destructor
  50. CSnapInImageList(CSPImageCache *pSPImageCache, REFGUID refGuidSnapIn);
  51. ~CSnapInImageList();
  52. // Interfaces
  53. // IUnknown methods
  54. STDMETHOD(QueryInterface) (REFIID riid, LPVOID FAR* ppvObj);
  55. STDMETHOD_(ULONG,AddRef) (void);
  56. STDMETHOD_(ULONG,Release) (void);
  57. // IImageListPrivate methods
  58. STDMETHOD(ImageListSetIcon)(PLONG_PTR pIcon, LONG nLoc);
  59. STDMETHOD(ImageListSetStrip)(PLONG_PTR pBMapSm, PLONG_PTR pBMapLg,
  60. LONG nStartLoc, COLORREF cMask);
  61. STDMETHOD(MapRsltImage)(COMPONENTID id, int nSnapinIndex, int *pnConsoleIndex);
  62. STDMETHOD(UnmapRsltImage)(COMPONENTID id, int nConsoleIndex, int *pnSnapinIndex);
  63. STDMETHOD(GetImageList)(BOOL bLargeImageList, HIMAGELIST *phImageList)
  64. {
  65. // Not needed now, GetImageList is implemented for NodeInitObject.
  66. return E_NOTIMPL;
  67. }
  68. // Implementation
  69. private:
  70. CSPImageCache * m_pSPImageCache;
  71. ULONG m_ulRefs;
  72. SNAPINID m_snapInId;
  73. }; // class CSnapInImageList
  74. ///////////////////////////////////////////////////////////////////////////////
  75. ///////////////////////////////////////////////////////////////////////////////
  76. ///////////////////////////////////////////////////////////////////////////////
  77. ///////////////////////////////////////////////////////////////////////////////
  78. ////////////// INLINES ///////////////////////////
  79. ///////////////////////////////////////////////////////////////////////////////
  80. ///////////////////////////////////////////////////////////////////////////////
  81. ///////////////////////////////////////////////////////////////////////////////
  82. ///////////////////////////////////////////////////////////////////////////////
  83. //_____________________________________________________________________________
  84. //
  85. // Inlines for class: CSPImageCache
  86. //_____________________________________________________________________________
  87. //
  88. inline void CSPImageCache::AddRef()
  89. {
  90. ++m_cRef;
  91. }
  92. inline void CSPImageCache::Release()
  93. {
  94. ASSERT(m_cRef >= 1);
  95. --m_cRef;
  96. if (m_cRef == 0)
  97. delete this;
  98. }
  99. #endif // _SCOPIMAG_H_