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.

82 lines
7.8 KiB

  1. /*
  2. * snapincommon.hxx
  3. *
  4. *
  5. * Copyright (c) 1998-1999 Microsoft Corporation
  6. *
  7. * PURPOSE: Contains standard snapin declarations for every snapin. This file should be #included
  8. * by every snapin class that is derived from CBaseSnapin
  9. *
  10. * OWNER: ptousig
  11. */
  12. #define SNAPIN_DECLARE(_SNAPIN) \
  13. public: \
  14. static _SNAPIN s_snapin; \
  15. \
  16. public: \
  17. /* Info about the icons needed by the snapin - an image strip is created for each snapin class. */ \
  18. virtual LONG * Piconid(void) { return s_rgiconid; } \
  19. virtual INT CIcons(void) { return s_cIcons; } \
  20. virtual LONG * PiconidStatic(void) { return &s_iconidStatic; } \
  21. virtual WTL::CBitmap & BitmapSmall(void) { return s_bitmapSmall; } \
  22. virtual WTL::CBitmap & BitmapLarge(void) { return s_bitmapLarge; } \
  23. virtual WTL::CBitmap & BitmapStaticSmall(void) { return s_bitmapStaticSmall; } \
  24. virtual WTL::CBitmap & BitmapStaticSmallOpen(void) { return s_bitmapStaticSmallOpen; } \
  25. virtual WTL::CBitmap & BitmapStaticLarge(void) { return s_bitmapStaticLarge; } \
  26. \
  27. /* Functions that return the features of the snapin. */ \
  28. virtual SNR * Psnr(INT i=0) { return s_rgsnr + i; } \
  29. virtual INT Csnr(void) { return s_csnr; } \
  30. virtual SC ScCreateRootItem(LPDATAOBJECT lpDataObject, HSCOPEITEM item, CBaseSnapinItem **ppitem); \
  31. \
  32. private: \
  33. /* Lists of all the classes that the snapin extends */ \
  34. static SNR s_rgsnr[]; \
  35. static INT s_csnr; \
  36. \
  37. static LONG s_rgiconid[]; \
  38. static INT s_cIcons; \
  39. static WTL::CBitmap s_bitmapSmall; \
  40. static WTL::CBitmap s_bitmapLarge; \
  41. \
  42. static LONG s_iconidStatic; \
  43. static WTL::CBitmap s_bitmapStaticSmall; \
  44. static WTL::CBitmap s_bitmapStaticSmallOpen; \
  45. static WTL::CBitmap s_bitmapStaticLarge; \
  46. \
  47. static BOOL s_fInitialized;
  48. #define SNAPIN_DEFINE(_SNAPIN) \
  49. _SNAPIN _SNAPIN::s_snapin; \
  50. \
  51. INT _SNAPIN::s_csnr = CSNR(s_rgsnr); \
  52. INT _SNAPIN::s_cIcons = countof(s_rgiconid); \
  53. \
  54. WTL::CBitmap _SNAPIN::s_bitmapSmall; \
  55. WTL::CBitmap _SNAPIN::s_bitmapLarge; \
  56. \
  57. WTL::CBitmap _SNAPIN::s_bitmapStaticSmall; \
  58. WTL::CBitmap _SNAPIN::s_bitmapStaticSmallOpen; \
  59. WTL::CBitmap _SNAPIN::s_bitmapStaticLarge; \
  60. \
  61. BOOL _SNAPIN::s_fInitialized = FALSE; \
  62. \
  63. /* -----------------------------------------------------------------------------*/ \
  64. /* This is the default implementation, the snapin class must define t_itemRoot. */ \
  65. /* -----------------------------------------------------------------------------*/ \
  66. SC _SNAPIN::ScCreateRootItem(LPDATAOBJECT lpDataObject, HSCOPEITEM item, CBaseSnapinItem **ppitem) \
  67. { \
  68. SC sc; \
  69. t_itemRoot *pitem = NULL; \
  70. t_itemRoot::CreateInstance(&pitem); \
  71. \
  72. if (pitem == NULL) \
  73. return (sc = E_OUTOFMEMORY); \
  74. \
  75. *ppitem = pitem; \
  76. \
  77. return (sc = S_OK); \
  78. }