opmimp.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. //
  2. //////////////////////////////////////////////////////////////////////////////
  3. //
  4. // Copyright 2015 Autodesk, Inc. All rights reserved.
  5. //
  6. // Use of this software is subject to the terms of the Autodesk license
  7. // agreement provided at the time of installation or download, or which
  8. // otherwise accompanies this software in either electronic or hard copy form.
  9. //
  10. //////////////////////////////////////////////////////////////////////////////
  11. //
  12. #ifndef _OPMIMP_H
  13. #define _OPMIMP_H
  14. //prevent the MS header "use_ansi.h" from outputing
  15. //its linker directives, we expect clients to specify
  16. //what flavor (debug/release) of the C++ runtime they want to
  17. //link against.
  18. #pragma push_macro("_USE_ANSI_CPP")
  19. #define _USE_ANSI_CPP
  20. #include <vector>
  21. #pragma pop_macro("_USE_ANSI_CPP")
  22. #include <comdef.h>
  23. #include "AdAChar.h"
  24. #include "Acpi.h"
  25. #include <category.h>
  26. #pragma pack (push, 8)
  27. struct ACAD_OPMPROPMAP_ENTRY
  28. {
  29. UINT nDescID; //Alternate property name
  30. DISPID dispid; //ID of the property
  31. PROPCAT catid; //categoryID
  32. UINT nCatNameID; //category Name
  33. UINT nElementStrID; //expanded property name list (for pts, ex.)
  34. UINT nPredefinedStrID; //IPerPropertyBrowsing enumeration strings
  35. const ACHAR * predefinedValues; //IPerPropertyBrowsing enumeration values
  36. unsigned short grouping; //expanded property name grouping
  37. bool editable; //show property override
  38. const CLSID* pclsidOther; //CLSID for Other.. combo item dlg (not used)
  39. const CLSID* pclsidPropPage; //IPerPropertyBrowsing dialog CLSID
  40. const IID* piidDispatch; //dispatch pointer for property
  41. LPCOLESTR szEllipsesTxt; //IPerPropertyBrowsing display string
  42. };
  43. #define BEGIN_OPMPROP_MAP() \
  44. static ACAD_OPMPROPMAP_ENTRY* GetOPMPropertyMap() \
  45. { \
  46. static ACAD_OPMPROPMAP_ENTRY pPropMap[] = \
  47. {
  48. // DescriptionID, dispID, catagoryID, catagoryNameID, elements string list ID (semi-colon separator), predefined strings ID (semi-colon separator), predefined values, grouping, editable property, other, proppage
  49. #define OPMPROP_ENTRY(nDesID, dpid, ctid, ctNameID, elementsID, predefID, vals, grp, editable, other, clsid, ellipsesTxt) \
  50. {nDesID, dpid, ctid, ctNameID, elementsID, predefID, vals, grp, editable, &other, &clsid, &IID_IDispatch, OLESTR(ellipsesTxt)},
  51. #define OPMPROP_CAT_ENTRY(nDesID, dpid, ctid, ctNameID) \
  52. {nDesID, dpid, ctid, ctNameID, 0, 0, _ACRX_T(""), 0, 1, &IID_NULL, &IID_NULL, &IID_IDispatch, OLESTR("")},
  53. #define OPMPROP_DESC_ENTRY(nDesID, dpid) \
  54. {nDesID, dpid, -2, 0, 0, 0, _ACRX_T(""), 0, 1, &IID_NULL, &IID_NULL, &IID_IDispatch, OLESTR("")},
  55. #define OPMPROP_PREDEFINED_ENTRY(nDesID, dpid, predefID, values, other) \
  56. {nDesID, dpid, -2, 0, 0, predefID, values, 0, 1, &other, &IID_NULL, &IID_IDispatch, OLESTR("")},
  57. #define OPMPROP_ELEMENT_ENTRY(dpid, ctid, ctNameID, elementsID, grouping) \
  58. {0, dpid, ctid, ctNameID, elementsID, 0, _ACRX_T(""), grouping, 1, &IID_NULL, &IID_NULL, &IID_IDispatch, OLESTR("")},
  59. #define OPMPROP_PAGE(nDesID, dpid, ctid, ctNameID, clsid) \
  60. {nDesID, dpid, ctid, ctNameID, 0, 0, _ACRX_T(""), 0, 1, &IID_NULL, &clsid, &IID_IDispatch, OLESTR("")},
  61. #define END_OPMPROP_MAP() \
  62. {0, 0, 0, 0, 0, 0, NULL, 0, 0, NULL, NULL, &IID_NULL, NULL} \
  63. }; \
  64. return pPropMap; \
  65. }
  66. typedef BOOL (*BUTTONPROC)(IAcPiCommandButton* pButton, VARIANT Objects);
  67. typedef int PROPCAT;
  68. struct PER_PROP_DISP_ENTRY
  69. {
  70. DISPID m_dispid;
  71. const ACHAR * m_ProgID;
  72. const ACHAR * m_lpLeftIconRes;
  73. UINT m_nLeftIconType;
  74. const ACHAR * m_lpEllipsisBmpRes;
  75. UINT m_nEllipsisBmpType;
  76. COLORREF m_TextColor;
  77. bool m_bFullView;
  78. DWORD m_dwIntegralHeight;
  79. long m_nWeight;
  80. };
  81. // use this #define for the textcolor item in PROP_DISP_ENTRY in order to use the
  82. // default UI label color in the UI; any other value for textcolor is treated
  83. // as a COLORREF
  84. #ifndef PROP_TEXTCOLOR_DEFAULT
  85. #define PROP_TEXTCOLOR_DEFAULT 0x80000008
  86. #endif // PROP_TEXTCOLOR_DEFAULT
  87. #define BEGIN_PERPROPDISPLAY_MAP() \
  88. static PER_PROP_DISP_ENTRY* GetPerPropDisplayArray() \
  89. { \
  90. static PER_PROP_DISP_ENTRY pPerPropDisplayArray[] = \
  91. {
  92. #define PROP_DISP_ENTRY(dispid, progid, lpLeftIconRes, lpLeftIconType, \
  93. lpEllipsisBmpRes, lpEllipsisBmpType, textcolor, \
  94. bFullView, dwIntegralHeight, nWeight) \
  95. {dispid, progid, lpLeftIconRes, lpLeftIconType, lpEllipsisBmpRes, \
  96. lpEllipsisBmpType, textcolor, bFullView, \
  97. dwIntegralHeight, nWeight}, \
  98. #define END_PERPROPDISPLAY_MAP() \
  99. {-1, NULL, NULL, PICTYPE_UNINITIALIZED, NULL, PICTYPE_UNINITIALIZED, PROP_TEXTCOLOR_DEFAULT, false, -1, -1} \
  100. }; \
  101. return pPerPropDisplayArray; \
  102. }
  103. struct CATCMDBTN_ENTRY
  104. {
  105. PROPCAT m_CatID;
  106. UINT m_nBtnNameId;
  107. const ACHAR * m_lpEnBtnBmpRes;
  108. UINT m_nEnBtnBmpType;
  109. const ACHAR * m_lpDisBtnBmpRes;
  110. UINT m_nDisBtnBmpType;
  111. long m_nStyle;
  112. BUTTONPROC m_pfnBtnProc;
  113. };
  114. #define BEGIN_CATCMDBTN_MAP() \
  115. static CATCMDBTN_ENTRY * GetCmdBtnArray() \
  116. { \
  117. static CATCMDBTN_ENTRY pCatCmdBtnArray[] = \
  118. {
  119. #define CATCMDBTN_MAP_ENTRY(nId, NameId, \
  120. lpEnBtnBmpRes, lpEnBtnBmpType, lpDisBtnBmpRes, lpDisBtnBmpType, \
  121. nStyle, pfnBtnProc) \
  122. {nId, NameId, lpEnBtnBmpRes, lpEnBtnBmpType, lpDisBtnBmpRes, lpDisBtnBmpType, nStyle, pfnBtnProc},
  123. #define END_CATCMDBTN_MAP() \
  124. {-1, 0, NULL, PICTYPE_UNINITIALIZED, NULL, PICTYPE_UNINITIALIZED, NULL, NULL} \
  125. }; \
  126. return pCatCmdBtnArray; \
  127. }
  128. struct CMDBTN_ENTRY
  129. {
  130. UINT m_nBtnNameId;
  131. const ACHAR * m_lpEnBtnBmpRes;
  132. UINT m_nEnBtnBmpType;
  133. const ACHAR * m_lpDisBtnBmpRes;
  134. UINT m_nDisBtnBmpType;
  135. long m_nStyle;
  136. BUTTONPROC m_pfnBtnProc; //?
  137. };
  138. #define BEGIN_CMDBTN_MAP() \
  139. static CMDBTN_ENTRY * GetPropCmdBtnArray() \
  140. { \
  141. static CMDBTN_ENTRY pCmdBtnArray[] = \
  142. {
  143. #define CMDBTN_MAP_ENTRY(NameId, lpEnBtnBmpRes, lpEnBtnBmpType, \
  144. lpDisBtnBmpRes, lpDisBtnBmpType, nStyle, pfnBtnProc) \
  145. {NameId, lpEnBtnBmpRes, lpEnBtnBmpType, lpDisBtnBmpRes, lpDisBtnBmpType, nStyle, pfnBtnProc},
  146. #define END_CMDBTN_MAP() \
  147. {0, NULL, PICTYPE_UNINITIALIZED, NULL, PICTYPE_UNINITIALIZED, NULL, NULL} \
  148. }; \
  149. return pCmdBtnArray; \
  150. }
  151. struct CATEGORY_ENTRY
  152. {
  153. PROPCAT m_CatID;
  154. UINT m_nNameId;
  155. UINT m_nDescId;
  156. PROPCAT m_ParentCatID;
  157. long m_nWeight;
  158. };
  159. #define BEGIN_CAT_MAP() \
  160. static CATEGORY_ENTRY* GetCatArray() \
  161. { \
  162. static CATEGORY_ENTRY pCatArray[] = \
  163. {
  164. #define CATEGORY_MAP_ENTRY(nId, NameId, DescId, nParentId, nWeight) \
  165. {nId, NameId, DescId, nParentId, nWeight},
  166. #define END_CAT_MAP() \
  167. {-1, 0, 0, -1, -1} \
  168. }; \
  169. return pCatArray; \
  170. }
  171. typedef std::vector<PER_PROP_DISP_ENTRY> PROP_DISP_VECTOR;
  172. typedef std::vector<CATCMDBTN_ENTRY> CATCMDBTN_VECTOR;
  173. typedef std::vector<CATEGORY_ENTRY> CATEGORY_VECTOR;
  174. typedef std::vector<CMDBTN_ENTRY> CMDBTN_VECTOR;
  175. #pragma pack (pop)
  176. #include "opmdrvr.h"
  177. #endif // _OPMIMP_H