Schemadef.h
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:4k
源码类别:

模拟服务器

开发平台:

C/C++

  1. //-----------------------------------------------------------------
  2. //   SchemaDef.h - defines needed to build a Theme Manager schema
  3. //                file
  4. //-----------------------------------------------------------------
  5. #ifndef SCHEMA_STRINGS           // FIRST PASS of this hdr file
  6. //-----------------------------------------------------------------
  7. #ifndef SCHEMADEF_H
  8. #define SCHEMADEF_H
  9. //-----------------------------------------------------------------
  10. #define SCHEMADEF_VERSION   1    // defines the exported func(s) implemented
  11. //-----------------------------------------------------------------
  12. struct TMPROPINFO
  13. {
  14.     LPCWSTR pszName;
  15.     SHORT sEnumVal;
  16.     BYTE bPrimVal;
  17. };
  18. //-----------------------------------------------------------------
  19. struct TMSCHEMAINFO
  20. {
  21.     DWORD dwSize;               // size of this struct
  22.     int iSchemaDefVersion;      // version number from this file
  23.     int iThemeMgrVersion;       // version number from "thschema.h"
  24.     int iPropCount;             // # of entries in prop table
  25.     const struct TMPROPINFO *pPropTable;       // ptr to prop table 
  26. };
  27. //---------------------------------------------------------------------------
  28. #define BEGIN_TM_SCHEMA(name)               
  29. #define BEGIN_TM_PROPS()                    enum PropValues { DummyProp = 49,
  30. #define BEGIN_TM_ENUM(name)                 enum name {
  31. #define BEGIN_TM_CLASS_PARTS(name)          enum name##PARTS { name##PartFiller0,
  32. #define BEGIN_TM_PART_STATES(name)          enum name##STATES { name##StateFiller0,
  33. #define TM_PROP(val, prefix, name, primval) prefix##_##name = val, 
  34. #define TM_ENUM(val, prefix, name)          prefix##_##name = val,
  35. #define TM_PART(val, prefix, name)          prefix##_##name = val, 
  36. #define TM_STATE(val, prefix, name)         prefix##_##name = val, 
  37. #define END_TM_CLASS_PARTS()                };
  38. #define END_TM_PART_STATES()                };
  39. #define END_TM_PROPS()                      };
  40. #define END_TM_ENUM()                       };
  41. #define END_TM_SCHEMA(name)
  42. //---------------------------------------------------------------------------
  43. #endif      // SCHEMADEF_H
  44. //---------------------------------------------------------------------------
  45. #else                   // SECOND PASS of this hdr file
  46. //---------------------------------------------------------------------------
  47. #undef BEGIN_TM_SCHEMA
  48. #undef BEGIN_TM_PROPS
  49. #undef BEGIN_TM_ENUM
  50. #undef BEGIN_TM_CLASS_PARTS
  51. #undef BEGIN_TM_PART_STATES
  52. #undef TM_PROP
  53. #undef TM_PART
  54. #undef TM_STATE
  55. #undef TM_ENUM
  56. #undef END_TM_CLASS_PARTS
  57. #undef END_TM_PART_STATES
  58. #undef END_TM_PROPS
  59. #undef END_TM_ENUM
  60. #undef END_TM_SCHEMA
  61. //---------------------------------------------------------------------------
  62. #define BEGIN_TM_SCHEMA(name)              static const TMPROPINFO name[] = {
  63. #define BEGIN_TM_PROPS()   
  64. #define BEGIN_TM_ENUM(name)                 {L#name, TMT_ENUMDEF, TMT_ENUMDEF},
  65. #define BEGIN_TM_CLASS_PARTS(name)          {L#name L"PARTS", TMT_ENUMDEF, TMT_ENUMDEF},
  66. #define BEGIN_TM_PART_STATES(name)          {L#name L"STATES", TMT_ENUMDEF, TMT_ENUMDEF},
  67. #define TM_PROP(val, prefix, name, primval) {L#name, prefix##_##name, TMT_##primval},
  68. #define TM_PART(val, prefix, name)          {L#name, prefix##_##name, TMT_ENUMVAL},
  69. #define TM_STATE(val, prefix, name)         {L#name, prefix##_##name, TMT_ENUMVAL},
  70. #define TM_ENUM(val, prefix, name)          {L#name, prefix##_##name, TMT_ENUMVAL},
  71. #define END_TM_CLASS_PARTS() 
  72. #define END_TM_PART_STATES() 
  73. #define END_TM_PROPS() 
  74. #define END_TM_ENUM()
  75. #define END_TM_SCHEMA(name)                };  
  76.     static const TMSCHEMAINFO *GetSchemaInfo() 
  77.     {  
  78.         static TMSCHEMAINFO si = {sizeof(si)};  
  79.         si.iSchemaDefVersion = SCHEMADEF_VERSION; 
  80.         si.iThemeMgrVersion = THEMEMGR_VERSION; 
  81.         si.iPropCount = sizeof(name)/sizeof(name[0]); 
  82.         si.pPropTable = name; 
  83.         
  84.         return &si; 
  85.     }
  86. //-----------------------------------------------------------------
  87. #endif
  88. //-----------------------------------------------------------------