dynprops.h 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774
  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. //
  13. #ifndef _DYNPROPS_H
  14. #define _DYNPROPS_H
  15. #include "adesk.h"
  16. #include "AdAChar.h"
  17. #ifndef _ADESK_WINDOWS_
  18. // OS X need this definition
  19. typedef enum AcFilterablePropertyContext
  20. {
  21. acQuickPropertiesContext = 0,
  22. acTooltipContext = 1
  23. } AcFilterablePropertyContext;
  24. #else
  25. // Notify caller that dynamic property change should notify command in progress
  26. #define S_NOTIFYCMD MAKE_HRESULT(0,0,0x02)
  27. interface IPropertyManager;
  28. interface IDynamicProperty;
  29. interface IPropertyManager2;
  30. interface IDynamicProperty2;
  31. interface IPropertySource;
  32. //--------------------------
  33. // OPMPerInstancePropertySources interface
  34. // This class is implemented by AutoCAD and available through
  35. // GET_OPM_PERINSTANCE_PROPERTY_SOURCES(). Once you have the OPMPerInstancePropertySource*
  36. // you can either add your own property source via SetPropertySouceAt/AddObjectPropertySourceAt
  37. // or use existing sources via GetPropertySourceAt/GetObjectPropertySourceAt.
  38. //--------------------------
  39. class OPMPerInstancePropertySources : public AcRxObject
  40. {
  41. public:
  42. ACRX_DECLARE_MEMBERS(OPMPerInstancePropertySources);
  43. virtual ~OPMPerInstancePropertySources(){}
  44. // Add a property source into the global name->source table
  45. virtual bool SetPropertySourceAt(const BSTR* pName, IPropertySource* pSource) = 0;
  46. // Get a property source from the global name->source table.
  47. // This is a real COM object so the pointer should be released
  48. // when it is no longer needed
  49. virtual IPropertySource* GetPropertySourceAt(const BSTR* pName) = 0;
  50. // Removes a property source from the global name->source table
  51. virtual bool RemovePropertySourceAt(const BSTR* pName) = 0;
  52. // Returns an array of property source names as a SafeArray of BSTRs.
  53. // Returned variant may be VT_EMPTY if no sources are defined.
  54. virtual bool GetPropertySourceNames(VARIANT* pNames) = 0;
  55. };
  56. //--------------------------
  57. // OPMPerInstancePropertyExtension interface
  58. // This class is implemented by AutoCAD and available through
  59. // GET_OPM_PERINSTANCE_EXTENSION_PROTOCOL(). Once you have the OPMPerInstancePropertyExtension*
  60. // you can either add or remove property source names from the extension.
  61. //--------------------------
  62. class OPMPerInstancePropertyExtension : public AcRxObject
  63. {
  64. public:
  65. ACRX_DECLARE_MEMBERS(OPMPerInstancePropertyExtension);
  66. virtual ~OPMPerInstancePropertyExtension() {};
  67. // Adds a property source name
  68. virtual bool AddObjectPropertySourceName(const BSTR* pName) = 0;
  69. // Removes a property source name
  70. virtual bool RemoveObjectPropertySourceName(const BSTR* pName) = 0;
  71. // Retrieves the property source names stored on the extension object.
  72. // Returned variant may be VT_EMPTY if no sources are defined.
  73. virtual bool GetObjectPropertySourceNames(VARIANT* pNames) = 0;
  74. };
  75. //--------------------------
  76. // OPMPerInstancePropertyExtensionFactory interface
  77. // This class is implemented by AutoCAD and available through
  78. // GET_OPM_PERINSTANCE_CREATE_PROTOCOL(). Once you have the OPMPerInstancePropertyExtensionFactory*
  79. // you can access property instance extension objects by class name.
  80. //--------------------------
  81. class OPMPerInstancePropertyExtensionFactory : public AcRxObject
  82. {
  83. public:
  84. ACRX_DECLARE_MEMBERS(OPMPerInstancePropertyExtensionFactory);
  85. virtual ~OPMPerInstancePropertyExtensionFactory(){};
  86. // Retrieves the OPMPerInstancePropertyExtension instance per class. If the
  87. // extension has not been added it creates it. Note that the factory manages
  88. // the lifetime of the extension object, so callers should not delete the memory
  89. // referenced by the returned pointer.
  90. virtual OPMPerInstancePropertyExtension* CreateOPMPerInstancePropertyExtension(AcRxClass* pClass) = 0;
  91. };
  92. // This macro returns a pointer to the global OPMPerInstancePropertyExtensionFactory.
  93. #define GET_OPM_PERINSTANCE_CREATE_PROTOCOL() \
  94. OPMPerInstancePropertyExtensionFactory::cast(AcDbDatabase::desc()->queryX(OPMPerInstancePropertyExtensionFactory::desc()))
  95. // This macro returns a pointer to the global OPMPerInstancePropertySources object.
  96. #define GET_OPM_PERINSTANCE_PROPERTY_SOURCES() \
  97. OPMPerInstancePropertySources::cast(AcDbDatabase::desc()->queryX(OPMPerInstancePropertySources::desc()))
  98. //This macro is the main entry point for getting the per instance property extension
  99. //for a particular class.
  100. #define GET_OPM_PERINSTANCE_EXTENSION_PROTOCOL(pAcRxClass) \
  101. GET_OPM_PERINSTANCE_CREATE_PROTOCOL()->CreateOPMPerInstancePropertyExtension(pAcRxClass)
  102. //--------------------------
  103. // OPMPropertyExtension interface
  104. // This class is implemented by AutoCAD and available through
  105. // GET_OPMEXTENSION_PROTOCOL(). Once you have the OPMPropertyExtension*
  106. // you can either add your own property manager via SetPropertyManager
  107. // or use the one provided by us via GetPropertyManager
  108. //--------------------------
  109. class OPMPropertyExtension : public AcRxObject
  110. {
  111. public:
  112. ACRX_DECLARE_MEMBERS(OPMPropertyExtension);
  113. virtual ~OPMPropertyExtension(){}
  114. //Get the property manager for this extension, if one is not
  115. //available, it will be created. This is a real COM object so
  116. //you will need to release the IPropertyManager* when you
  117. //are done with it.
  118. virtual IPropertyManager* GetPropertyManager() = 0;
  119. //This function allows you to provide your own property manager
  120. virtual void SetPropertyManager(IPropertyManager* pPropManager) = 0;
  121. };
  122. //--------------------------
  123. // OPMPropertyExtension interface
  124. // This class is implemented by AutoCAD and available through
  125. // GET_OPMEXTENSION_CREATE_PROTOCOL. You can add property classes
  126. // by calling GET_OPMPROPERTY_MANAGER for a particular AcRxClass
  127. // to get the property manager for that class.
  128. // You can also enumerate the dynamic properties which have
  129. // been added to that class as well as its base class(es) via
  130. // GetPropertyCount and GetPropertyClassArray
  131. //--------------------------
  132. class OPMPropertyExtensionFactory: public AcRxObject
  133. {
  134. public:
  135. ACRX_DECLARE_MEMBERS(OPMPropertyExtensionFactory);
  136. virtual ~OPMPropertyExtensionFactory(){}
  137. //Retrieves the OPMPropertyExtension for the specified class, if the
  138. //extension has not been added before, it creates it. Note: the implementation
  139. //of this class manages the lifetime of OPMPropertyExtension, as such you don't
  140. //need to delete them.
  141. virtual OPMPropertyExtension* CreateOPMObjectProtocol(AcRxClass* pClass,
  142. LONG lReserved = 0) = 0;
  143. virtual OPMPropertyExtension* CreateOPMCommandProtocol(const ACHAR * pGlobalCommand,
  144. LONG lReserved = 0) = 0;
  145. //gets the property manager for a particular command that been registered
  146. //with CreateOPMCommandProtocol. Returns TRUE if successful, FALSE if no
  147. //no manager for that command exists.
  148. virtual BOOL GetOPMManager(const ACHAR * pGlobalCommand, IPropertyManager** pManager) = 0;
  149. //Retrieves the total number of IDynamicProperty classes that have been
  150. //added to this class, including properties which have been added to
  151. //base classes.
  152. virtual BOOL GetPropertyCount(AcRxClass* pClass, LONG* pPropCount) = 0;
  153. //Fills an array of CALLER ALLOCATED IDynamicPropety*s. The return value
  154. //indicates the number of IDynamicProperty pointers actually written to
  155. //the array. This *should* be the same as the value returned by
  156. //GetPropertyCount
  157. virtual LONG GetPropertyClassArray(AcRxClass* pClass,
  158. IDynamicProperty** pPropertyArray) = 0;
  159. //Retrieves the total number of IDynamicProperty*s (i.e cumulative count of
  160. //total number of IDynamicProperty*s & IDynamicProperty2*s) classes that have been
  161. //added to this class, including properties which have been added to
  162. //base classes.
  163. virtual BOOL GetPropertyCountEx(AcRxClass* pClass, LONG* pPropCount) = 0;
  164. //Fills an array of CALLER ALLOCATED IUnknown*s. The return value
  165. //indicates the number of IUnknown*s (from which either IDynamicProperty
  166. //or IDynamicProperty2 can be queried) pointers actually written to
  167. //the array. This *should* be the same as the value returned by
  168. //GetPropertyCount
  169. virtual LONG GetPropertyClassArray(AcRxClass* pClass,
  170. IUnknown** pPropertyArray) = 0;
  171. };
  172. #define GET_OPMEXTENSION_CREATE_PROTOCOL() \
  173. OPMPropertyExtensionFactory::cast(AcDbDatabase::desc()->queryX(OPMPropertyExtensionFactory::desc()))
  174. //This macro is the main entry point for getting the property manager for a
  175. //particular class. Note: This returns an IPropertyManager for the class which
  176. //must be released after it's used
  177. #define GET_OPMPROPERTY_MANAGER(pAcRxClass) \
  178. GET_OPMEXTENSION_CREATE_PROTOCOL()->CreateOPMObjectProtocol(pAcRxClass)->GetPropertyManager()
  179. //This macro allocates an OPMPropertyExtension and returns its property
  180. //manager for a given global command name. Use it to register commands
  181. //which wish to provide dynamic properties for the OPM.
  182. //Note: This returns an IPropertyManager for the class which
  183. //must be released after it's used
  184. #define GET_OPM_COMMAND_PROPERTY_MANAGER(pCommandName) \
  185. GET_OPMEXTENSION_CREATE_PROTOCOL()->CreateOPMCommandProtocol(pCommandName)->GetPropertyManager()
  186. typedef BOOL (*OPMDIALOGPROC)(void);
  187. const int MAX_OPMSTRLEN = 256;
  188. DEFINE_GUID(IID_IDynamicPropertyNotify, 0x8B384028, 0xACA8, 0x11d1, 0xA2, 0xB4, 0x08, 0x00, 0x09, 0xDC, 0x63, 0x9A);
  189. interface DECLSPEC_UUID("8B384028-ACA8-11d1-A2B4-080009DC639A")
  190. IDynamicPropertyNotify : public IUnknown
  191. {
  192. BEGIN_INTERFACE
  193. // *** IUnknown methods ****
  194. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  195. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  196. STDMETHOD_(ULONG, Release)(THIS) PURE;
  197. // *** IDynamicPropertyNotify methods ***
  198. // Call this when your property changes
  199. STDMETHOD(OnChanged)(THIS_ /*[in]*/IDynamicProperty* pDynamicProperty) PURE;
  200. // Call to get the current selection set OPM is working with, returns a SAFEARRAY
  201. // of LONGs representing the objectIDs of the set, be sure to call VariantClear to cleanup
  202. STDMETHOD(GetCurrentSelectionSet)(THIS_ /*[out*/VARIANT* pSelection) PURE;
  203. };
  204. typedef IDynamicPropertyNotify FAR* LPDYNAMICPROPERTYNOTIFY;
  205. DEFINE_GUID(IID_IDynamicPropertyNotify2, 0x975112b5, 0x5403, 0x4197, 0xaf, 0xb8, 0x90, 0xc6, 0xca, 0x73, 0xb9, 0xe1);
  206. interface DECLSPEC_UUID("975112B5-5403-4197-AFB8-90C6CA73B9E1")
  207. IDynamicPropertyNotify2 : public IUnknown
  208. {
  209. BEGIN_INTERFACE
  210. // *** IUnknown methods ****
  211. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  212. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  213. STDMETHOD_(ULONG, Release)(THIS) PURE;
  214. // *** IDynamicPropertyNotify2 methods ***
  215. // Call this when your property changes
  216. // Either IDynamicProperty or IDynamicProperty2 will be queried from
  217. // the IUnknown pointer supplied.
  218. STDMETHOD(OnChanged)(THIS_ /*[in]*/IUnknown* pDynamicProperty) PURE;
  219. // Call to get the current selection set OPM is working with, returns a SAFEARRAY
  220. // of IUnknowns representing the objects of the set, be sure to call VariantClear to cleanup
  221. STDMETHOD(GetCurrentSelectionSet)(THIS_ /*[out*/VARIANT* pSelection) PURE;
  222. };
  223. typedef IDynamicPropertyNotify2 FAR* LPDYNAMICPROPERTYNOTIFY2;
  224. //--------------------------
  225. // IDynamicProperty interface
  226. // Implement this class to create dynamic properties for the OPM
  227. // it defines the base set of property attributes as well as
  228. // the name/type/data tuples.
  229. //--------------------------
  230. // {8B384028-ACA9-11d1-A2B4-080009DC639A}
  231. DEFINE_GUID(IID_IDynamicProperty, 0x8B384028, 0xACA9, 0x11d1, 0xA2, 0xB4, 0x08, 0x00, 0x09, 0xDC, 0x63, 0x9A);
  232. interface DECLSPEC_UUID("8B384028-ACA9-11d1-A2B4-080009DC639A")
  233. IDynamicProperty : public IUnknown
  234. {
  235. BEGIN_INTERFACE
  236. // *** IUnknown methods ****
  237. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  238. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  239. STDMETHOD_(ULONG, Release)(THIS) PURE;
  240. // *** IDynamicProperty methods ***
  241. //Unique property ID
  242. STDMETHOD(GetGUID)(THIS_ /*[out]*/GUID* propGUID) PURE;
  243. // Property display name
  244. STDMETHOD(GetDisplayName)(THIS_ /*[out]*/BSTR* bstrName) PURE;
  245. // Show/Hide property in the OPM, for this object instance
  246. STDMETHOD(IsPropertyEnabled)(THIS_ /*[in]*/LONG_PTR objectID,
  247. /*[out]*/BOOL* pbEnabled) PURE;
  248. // Is property showing but disabled
  249. STDMETHOD(IsPropertyReadOnly)(THIS_ /*[out]*/BOOL* pbReadonly) PURE;
  250. // Get the property description string
  251. STDMETHOD(GetDescription)(THIS_ /*[out]*/BSTR* bstrName) PURE;
  252. // *** Basic property value information ***
  253. // OPM will typically display these in an edit field
  254. // optional: meta data representing property type name, ex. ACAD_ANGLE
  255. STDMETHOD(GetCurrentValueName)(THIS_ /*[out]*/BSTR* pbstrName) PURE;
  256. // What is the property type, ex. VT_R8
  257. STDMETHOD(GetCurrentValueType)(THIS_ /*[out]*/VARTYPE* pVarType) PURE;
  258. // Get the property value, passes the specific object we need the property
  259. // value for.
  260. STDMETHOD(GetCurrentValueData)(THIS_ /*in*/LONG_PTR objectID,
  261. /*[out]*/VARIANT* pvarData) PURE;
  262. // Set the property value, passes the specific object we want to set the
  263. // property value for
  264. STDMETHOD(SetCurrentValueData)(THIS_ /*[in]*/LONG_PTR objectID,
  265. /*[in]*/const VARIANT varData) PURE;
  266. //*** Notifications ***
  267. //OPM passes its implementation of IDynamicPropertyNotify, you
  268. //cache it and call it to inform OPM your property has changed
  269. STDMETHOD(Connect)(THIS_ /*[in]*/IDynamicPropertyNotify* pSink) PURE;
  270. STDMETHOD(Disconnect)(THIS_ ) PURE;
  271. };
  272. typedef IDynamicProperty FAR* LPDYNAMICPROPERTY;
  273. //--------------------------
  274. // IDynamicProperty2 interface
  275. // Implement this class to create dynamic properties for the PropertyPalette
  276. // it defines the base set of property attributes as well as
  277. // the name/type/data tuples.
  278. //--------------------------
  279. // {9CAF41C2-CA86-4ffb-B05A-AC43C424D076}
  280. DEFINE_GUID(IID_IDynamicProperty2, 0x9caf41c2, 0xca86, 0x4ffb, 0xb0, 0x5a, 0xac, 0x43, 0xc4, 0x24, 0xd0, 0x76);
  281. interface DECLSPEC_UUID("9CAF41C2-CA86-4ffb-B05A-AC43C424D076")
  282. IDynamicProperty2 : public IUnknown
  283. {
  284. BEGIN_INTERFACE
  285. // *** IUnknown methods ****
  286. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  287. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  288. STDMETHOD_(ULONG, Release)(THIS) PURE;
  289. // *** IDynamicProperty2 methods ***
  290. //Unique property ID
  291. STDMETHOD(GetGUID)(THIS_ /*[out]*/GUID* propGUID) PURE;
  292. // Property display name
  293. STDMETHOD(GetDisplayName)(THIS_ /*[out]*/BSTR* bstrName) PURE;
  294. // Show/Hide property in the OPM, for this object instance
  295. STDMETHOD(IsPropertyEnabled)(THIS_ /*[in]*/IUnknown *pUnk,
  296. /*[out]*/BOOL* pbEnabled) PURE;
  297. // Is property showing but disabled
  298. STDMETHOD(IsPropertyReadOnly)(THIS_ /*[out]*/BOOL* pbReadonly) PURE;
  299. // Get the property description string
  300. STDMETHOD(GetDescription)(THIS_ /*[out]*/BSTR* bstrName) PURE;
  301. // *** Basic property value information ***
  302. // OPM will typically display these in an edit field
  303. // optional: meta data representing property type name, ex. ACAD_ANGLE
  304. STDMETHOD(GetCurrentValueName)(THIS_ /*[out]*/BSTR* pbstrName) PURE;
  305. // What is the property type, ex. VT_R8
  306. STDMETHOD(GetCurrentValueType)(THIS_ /*[out]*/VARTYPE* pVarType) PURE;
  307. // Get the property value, passes the specific object we need the property
  308. // value for.
  309. STDMETHOD(GetCurrentValueData)(THIS_ /*in*/IUnknown *pUnk,
  310. /*[out]*/VARIANT* pvarData) PURE;
  311. // Set the property value, passes the specific object we want to set the
  312. // property value for
  313. STDMETHOD(SetCurrentValueData)(THIS_ /*[in]*/IUnknown *pUnk,
  314. /*[in]*/const VARIANT varData) PURE;
  315. //*** Notifications ***
  316. //OPM passes its implementation of IDynamicPropertyNotify, you
  317. //cache it and call it to inform OPM your property has changed
  318. STDMETHOD(Connect)(THIS_ /*[in]*/IDynamicPropertyNotify2* pSink) PURE;
  319. STDMETHOD(Disconnect)(THIS_ ) PURE;
  320. };
  321. typedef IDynamicProperty2 FAR* LPDYNAMICPROPERTY2;
  322. const int DISPID_DYNAMIC = -23; //majic DISPID
  323. //--------------------------
  324. // IDynamicEnumProperty interface
  325. // components can implement this interface to create an enumerated property
  326. // which will usually be displayed as a drop-down list in the OPM
  327. //--------------------------
  328. // {8B384028-ACB1-11d1-A2B4-080009DC639A}
  329. DEFINE_GUID(IID_IDynamicEnumProperty, 0x8B384028, 0xACB1, 0x11d1, 0xA2, 0xB4, 0x08, 0x00, 0x09, 0xDC, 0x63, 0x9A);
  330. interface DECLSPEC_UUID("8B384028-ACB1-11d1-A2B4-080009DC639A")
  331. IDynamicEnumProperty : public IUnknown
  332. {
  333. BEGIN_INTERFACE
  334. // *** IUnknown methods ****
  335. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  336. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  337. STDMETHOD_(ULONG, Release)(THIS) PURE;
  338. // *** IDynamicEnumProperty methods ***
  339. // *** Extended property value infomation ***
  340. // - for properties types which are enums or finite valued but dynamic
  341. // OPM will typically display these in a dropdown list
  342. // total number of values this property can have, or currently has
  343. STDMETHOD(GetNumPropertyValues)(THIS_ /*[out]*/LONG* numValues) PURE;
  344. // called for each property value, 0-based indexed to GetNumPropertyValues()
  345. STDMETHOD(GetPropValueName)(THIS_ /*in*/LONG index,
  346. /*[out]*/BSTR* valueName) PURE;
  347. // called for each property value, 0-based indexed to GetNumPropertyValues()
  348. STDMETHOD(GetPropValueData)(THIS_ /*in*/LONG index,
  349. /*[out]*/VARIANT* valueName) PURE;
  350. };
  351. typedef IDynamicEnumProperty FAR* LPDYNAMICENUMPROPERTY;
  352. //--------------------------
  353. // IDynamicDialogProperty interface
  354. // components can implement this interface to support ellipsis
  355. // button properties
  356. //--------------------------
  357. // {8B384028-ACB2-11d1-A2B4-080009DC639A}
  358. DEFINE_GUID(IID_IDynamicDialogProperty, 0x8B384028, 0xACB2, 0x11d1, 0xA2, 0xB4, 0x08, 0x00, 0x09, 0xDC, 0x63, 0x9A);
  359. interface DECLSPEC_UUID("8B384028-ACB2-11d1-A2B4-080009DC639A")
  360. IDynamicDialogProperty : public IUnknown
  361. {
  362. BEGIN_INTERFACE
  363. // *** IUnknown methods ****
  364. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  365. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  366. STDMETHOD_(ULONG, Release)(THIS) PURE;
  367. // If implemented, OPM will call the function passed back here
  368. STDMETHOD(GetCustomDialogProc)(THIS_ /*[out]*/OPMDIALOGPROC* pDialogProc) PURE;
  369. // Or, pass us the name of the VBA macro to run to edit this property
  370. STDMETHOD(GetMacroName)(THIS_ /*[out]*/BSTR* bstrName) PURE;
  371. };
  372. typedef IDynamicDialogProperty FAR* LPDYNAMICDIALOGPROPERTY;
  373. //--------------------------
  374. // IPropertyManager interface
  375. // This is the main property manager class. Use this to add your
  376. // property classes for a given type of entity. You can get this interface
  377. // using GET_AUTOMATION_PROTOCOL(pEnt)->GetPropertyManager().
  378. //--------------------------
  379. // {8B384028-ACA9-11d1-A2B4-080009DC639A}
  380. DEFINE_GUID(IID_IPropertyManager, 0x8B384028, 0xACA9, 0x11d1, 0xA2, 0xB4, 0x08, 0x00, 0x09, 0xDC, 0x63, 0x9A);
  381. interface DECLSPEC_UUID("8B384028-ACA9-11d1-A2B4-080009DC639A")
  382. IPropertyManager : public IUnknown
  383. {
  384. BEGIN_INTERFACE
  385. // *** IUnknown methods ****
  386. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  387. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  388. STDMETHOD_(ULONG, Release)(THIS) PURE;
  389. // *** IPropertyManager methods ***
  390. STDMETHOD(AddProperty)(THIS_ IDynamicProperty FAR* pProperty) PURE;
  391. STDMETHOD(RemoveProperty)(THIS_ IDynamicProperty FAR* pProperty) PURE;
  392. STDMETHOD(GetDynamicProperty)(THIS_ /*[in]*/LONG index,
  393. /*[out]*/IDynamicProperty ** pProperty) PURE;
  394. STDMETHOD(GetDynamicPropertyByName)(THIS_ /*[in]*/BSTR propName,
  395. /*[out]*/IDynamicProperty ** pProperty) PURE;
  396. STDMETHOD(GetDynamicPropertyCount)(THIS_ /*[out]*/LONG* count) PURE;
  397. //For COM Wrappers to generate dynamic property typeinfo
  398. STDMETHOD(GetDynamicClassInfo)(THIS_ /*[in]*/IUnknown* pObj,
  399. /*[out]*/ITypeInfo** pptiDynamic,
  400. /*[out]*/DWORD* dwCookie) PURE;
  401. };
  402. typedef IPropertyManager FAR* LPPROPERTYMANAGER;
  403. //--------------------------
  404. // IPropertyManager2 interface
  405. // This is the main property manager class. Use this to add your
  406. // property classes for a given type of IUnknown object.
  407. // You can get this interface using
  408. // CreateOPMIUnknownProtocol(ppUnk)->GetPropertyManager2().
  409. //--------------------------
  410. // {FABC1C70-1044-4aa0-BF8D-91FFF9052715}
  411. DEFINE_GUID(IID_IPropertyManager2, 0xfabc1c70, 0x1044, 0x4aa0, 0xbf, 0x8d, 0x91, 0xff, 0xf9, 0x5, 0x27, 0x15);
  412. interface DECLSPEC_UUID("FABC1C70-1044-4aa0-BF8D-91FFF9052715")
  413. IPropertyManager2 : public IUnknown
  414. {
  415. BEGIN_INTERFACE
  416. // *** IUnknown methods ****
  417. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  418. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  419. STDMETHOD_(ULONG, Release)(THIS) PURE;
  420. // *** IPropertyManager2 methods ***
  421. STDMETHOD(AddProperty)(THIS_ IUnknown FAR* pDynPropObj) PURE;
  422. STDMETHOD(RemoveProperty)(THIS_ IUnknown FAR* pDynPropObj) PURE;
  423. STDMETHOD(GetDynamicProperty)(THIS_ /*[in]*/LONG index,
  424. /*[out]*/IUnknown ** pDynPropObj) PURE;
  425. STDMETHOD(GetDynamicPropertyByName)(THIS_ /*[in]*/BSTR propName,
  426. /*[out]*/IUnknown ** pDynPropObj) PURE;
  427. STDMETHOD(GetDynamicPropertyCountEx)(THIS_ /*[out]*/LONG* count) PURE;
  428. //For COM Wrappers to generate dynamic property typeinfo
  429. STDMETHOD(GetDynamicClassInfo)(THIS_ /*[in]*/IUnknown* pObj,
  430. /*[out]*/ITypeInfo** pptiDynamic,
  431. /*[out]*/DWORD* dwCookie) PURE;
  432. };
  433. typedef IPropertyManager2 FAR* LPPROPERTYMANAGER2;
  434. //----------------------------------------
  435. // {61D0A8E3-C792-4956-8E96-594315B95902}
  436. DEFINE_GUID(IID_IPropertySource, 0x61d0a8e3, 0xc792, 0x4956, 0x8e, 0x96, 0x59, 0x43, 0x15, 0xb9, 0x59, 0x2);
  437. interface DECLSPEC_UUID("61D0A8E3-C792-4956-8E96-594315B95902")
  438. IPropertySource : public IUnknown
  439. {
  440. BEGIN_INTERFACE
  441. // *** IUnknown methods ****
  442. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  443. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  444. STDMETHOD_(ULONG, Release)(THIS) PURE;
  445. // *** IPropertySource methods ***
  446. // Call this when your property changes
  447. STDMETHOD(get_Name)(THIS_ /*[out, retval]*/BSTR* pName) PURE;
  448. // Call to get the current selection set OPM is working with, returns a SAFEARRAY
  449. // of LONGs representing the objectIDs of the set, be sure to call VariantClear to cleanup
  450. STDMETHOD(GetProperties)(THIS_ /*[in]*/IUnknown* pObject, /*[out, retval]*/VARIANT *pPropertyArray) PURE;
  451. };
  452. typedef IPropertySource FAR* LPPROPERTYSOURCE;
  453. //--------------------------
  454. //--------------------------
  455. // The following 4 interfaces, IFilterableProperty, IFilterablePropertySource,
  456. // IFilterableMultiplePropertySource, and IFilterableSubtypePropertySource are
  457. // all used by the property filter customization framework. In AutoCAD, the
  458. // CUI dialog allows the user to specify properties that they would
  459. // like to see with the "Quick Properties" and "Rollover tooltips" features for
  460. // each entity type.
  461. //
  462. // An entity that implementes its properties in an instance specific way,
  463. // will most likely need to implement on or more of these interfaces to attain
  464. // desired behavior.
  465. //--------------------------
  466. //--------------------------
  467. // The AcFilterablePropertyContext enum identifies whether the framework is
  468. // dealing with creating property filters for the "Quick Properties" feature or
  469. // the "Rollover Tooltips" feature.
  470. typedef DECLSPEC_UUID("a0999d56-72b5-4e7c-9c9b-a041c4274c24")
  471. enum AcFilterablePropertyContext
  472. {
  473. acQuickPropertiesContext = 0,
  474. acTooltipContext = 1
  475. } AcFilterablePropertyContext;
  476. //--------------------------
  477. // IFilterableProperty interface
  478. //
  479. // This interface can be used to specify whether a particular property should
  480. // be visible or not for property filter customization. This interface's
  481. // method is not instance dependent, but rather works at the type level.
  482. //
  483. // This interface should be implemented in cases where a property's appearance
  484. // is normally instance dependent but the entity type would like to dictate
  485. // that the property should always be or never be available in the property
  486. // filter customization user interface.
  487. //
  488. // For static properties, this interface should be implemented on the entity's
  489. // COM wrapper. For dynamic properties, this interface should be implemented on
  490. // on the implementer of the IDynamicProperty interface.
  491. //--------------------------
  492. // {c93b89f1-794a-458e-8b49-7ce8ec7f6dd8}
  493. DEFINE_GUID(IID_IFilterableProperty, 0xc93b89f1, 0x794a, 0x458e, 0x8b, 0x49, 0x7c, 0xe8, 0xec, 0x7f, 0x6d, 0xd8);
  494. interface DECLSPEC_UUID("c93b89f1-794a-458e-8b49-7ce8ec7f6dd8")
  495. IFilterableProperty : public IUnknown
  496. {
  497. BEGIN_INTERFACE
  498. // *** IUnknown methods ****
  499. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  500. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  501. STDMETHOD_(ULONG, Release)(THIS) PURE;
  502. //
  503. // *** IFilterableProperty methods ***
  504. //
  505. // The "ShowFilterableProperty" method is used to dictate whether a
  506. // property should be visible in the property filter customization user
  507. // interface. It is passed a DISPID of the property whose visibility is
  508. // being determined (which would normally be "DISPID_DYNAMIC" for dynamic
  509. // properties) and an AcFilterablePropertyContext that specifies whether
  510. // the framework is querying about appearance in the "Quick Properties"
  511. // customization user interface or for the "Rollover tooltips"
  512. // customization user interface. A boolean value indicating whether or
  513. // not the property should be shown is returned via the "pbShow"
  514. // output parameter.
  515. STDMETHOD(ShowFilterableProperty)(THIS_ /*[in]*/DISPID dispID,
  516. /*[in]*/AcFilterablePropertyContext context,
  517. /*[out]*/BOOL* pbShow) PURE;
  518. };
  519. typedef IFilterableProperty FAR* LPFILTERABLEPROPERTY;
  520. //--------------------------
  521. // IFilterablePropertySource interface
  522. //
  523. // This interface can be used to make an IPropertySource implementation
  524. // create dynamic properties for property filter customization in an
  525. // instance independent way.
  526. //
  527. // This interface should be implemented in cases where a property's creation
  528. // is normally instance dependent but the entity type would like to dictate
  529. // that the property should always be or never be available in the property filter
  530. // customization user interface. This interface's "GetFilterableProperties"
  531. // method is very much like the IPropertySource::GetProperties" method. The
  532. // difference is that the "GetFilterableProperties" method is not passed the
  533. // "IUnknown*" of an instance.
  534. //
  535. // This interface should be implemented on the implementer of the
  536. // IPropertySource interface.
  537. //--------------------------
  538. // {79bbcf7a-9b42-4c83-802f-deafc45d1b9e}
  539. DEFINE_GUID(IID_IFilterablePropertySource, 0x79bbcf7a, 0x9b42, 0x4c83, 0x80, 0x2f, 0xde, 0xaf, 0xc4, 0x5d, 0x1b, 0x9e);
  540. interface DECLSPEC_UUID("79bbcf7a-9b42-4c83-802f-deafc45d1b9e")
  541. IFilterablePropertySource : public IUnknown
  542. {
  543. BEGIN_INTERFACE
  544. // *** IUnknown methods ****
  545. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  546. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  547. STDMETHOD_(ULONG, Release)(THIS) PURE;
  548. //
  549. // *** IFilterablePropertySource methods ***
  550. //
  551. // The "GetFilterableProperties" method should create the dynamic
  552. // properties that should be included in the property filter
  553. // customization user interface for the IPropertySource implementation
  554. // that is implementing this interface. As is the case for the
  555. // IPropertySource::GetProperties" method that this method is modelled
  556. // after, the properties are returned via the "pPropertyArray" output
  557. // parameter.
  558. STDMETHOD(GetFilterableProperties)(THIS_ /*[out, retval]*/VARIANT *pPropertyArray) PURE;
  559. };
  560. typedef IFilterablePropertySource FAR* LPFILTERABLEPROPERTYSOURCE;
  561. //--------------------------
  562. // IFilterableMultiplePropertySource interface
  563. //
  564. // This interface can be used to inform the property filter customization
  565. // framework about dynamic properties that may be multiple in number, but
  566. // should be handled as a single customizable element in the customization
  567. // framework. The "Attributes" property of the "Block Reference" entity is
  568. // an example of a property like this. A particular block reference may have
  569. // no attributes, 1 attribute, or many attributes, and multiple attributes have
  570. // varying property names that are not defined by the "Block Reference" entity
  571. // type, but any "attribute" dynamic properties are all identified by the
  572. // same GUID, and are represented in the property filter customization
  573. // user interface by a single, generic item.
  574. //
  575. // This interface should be implemented on the implementer of the
  576. // IPropertySource interface that serves up the "multiple" properties.
  577. //
  578. //--------------------------
  579. // {59f3c133-c394-4606-b17f-79bed20761cf}
  580. DEFINE_GUID(IID_IFilterableMultiplePropertySource, 0x59f3c133, 0xc394, 0x4606, 0xb1, 0x7f, 0x79, 0xbe, 0xd2, 0x07, 0x61, 0xcf);
  581. interface DECLSPEC_UUID("59f3c133-c394-4606-b17f-79bed20761cf")
  582. IFilterableMultiplePropertySource : public IUnknown
  583. {
  584. BEGIN_INTERFACE
  585. // *** IUnknown methods ****
  586. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  587. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  588. STDMETHOD_(ULONG, Release)(THIS) PURE;
  589. //
  590. // *** IFilterableMultiplePropertySource methods ***
  591. //
  592. // The "GetMultipleProperties" method should create the dynamic
  593. // properties that should be included in the property filter
  594. // customization user interface for the IPropertySource implementation
  595. // that is implementing this interface. As is the case for the
  596. // IPropertySource::GetProperties" method that this method is modelled
  597. // after, the properties are returned via the "pPropertyArray" output
  598. // parameter. Any "multiple" properties returned should be just like
  599. // the actual properties they represent in terms of their GUIDs and the
  600. // categories they are contained in, but the property name of the property
  601. // returned should be the "generic" name that will appear in the property
  602. // filter customization user interface.
  603. STDMETHOD(GetMultipleProperties)(THIS_ /*[out]*/VARIANT *pPropertyArray) PURE;
  604. };
  605. typedef IFilterableMultiplePropertySource FAR* LPFILTERABLEMULTIPLEPROPERTYSOURCE;
  606. //--------------------------
  607. // IFilterableSubtypePropertySource interface
  608. //
  609. // This interface can be used to define entity "subtype"s. The property
  610. // filter customization user interface will present the "subtype"s as
  611. // children of the entity type whose IPropertySource implementer has
  612. // implemented this interface. Only a single level of "subtype"s are allowed.
  613. // The "subtype" mechanism for property filter customization does not support
  614. // full heirarchies.
  615. //
  616. // An example of an entity with "subtype"s is the "3d SOlid" entity type.
  617. // A "3d Solid" can be a primitive "subtype" like a box or a sphere, or it
  618. // may be a generic "BREP" solid. The set of subtypes defined by this
  619. // interface must be complete. That is, any instance of the entity whose
  620. // IPropertySource implementation is implementing this interface must be
  621. // identifiable as one of the "subtype"s defined.
  622. //
  623. // This interface should be implemented on the implementer of the
  624. // IPropertySource interface that serves up the dynamic properties for the
  625. // "subtype"s.
  626. //--------------------------
  627. // {79bbcf7a-9b42-4c83-802f-deafc45d1b9e}
  628. DEFINE_GUID(IID_IFilterableSubtypePropertySource, 0xa441627c, 0xd20f, 0x429f, 0x82, 0x75, 0x86, 0xb9, 0x54, 0x70, 0x29, 0xf7);
  629. interface DECLSPEC_UUID("a441627c-d20f-429f-8275-86b9547029f7")
  630. IFilterableSubtypePropertySource : public IUnknown
  631. {
  632. BEGIN_INTERFACE
  633. // *** IUnknown methods ****
  634. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID FAR* ppvObj) PURE;
  635. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
  636. STDMETHOD_(ULONG, Release)(THIS) PURE;
  637. //
  638. // *** IFilterableSubtypePropertySource methods ***
  639. //
  640. // The "GetSubtypes" method returns an array of BSTR items that identify
  641. // each subtype defined by this interface implementation via the
  642. // "pSubtypeGUIDsArray" output parameter. Each BSTR is
  643. // the string representation of a "subtype"s GUID.
  644. STDMETHOD(GetSubtypes)(THIS_ /*[out]*/VARIANT *pSubtypeGUIDsArray) PURE;
  645. // The "GetSubtypeName" returns the name of the "subtype" that's
  646. // identified by the GUID BSTR passed in via the "bstrSubtypeGUID"
  647. // parameter in a BSTR via the "bstrSubtypeName" output parameter.
  648. STDMETHOD(GetSubtypeName)(THIS_ /*[in]*/BSTR bstrSubtypeGUID,
  649. /*[out]*/BSTR* bstrSubtypeName) PURE;
  650. // The "GetSubtypeProperties" method should create the dynamic
  651. // properties for the given "subtype" whose GUID string is passed in via
  652. // the "bstrSubtypeGUID" input parameter that should be included in
  653. // the property filter customization user interface for the IPropertySource
  654. // implementation that is implementing this interface. As is the case for
  655. // the IPropertySource::GetProperties" method that this method is modelled
  656. // after, the properties are returned via the "pPropertyArray" output
  657. // parameter.
  658. STDMETHOD(GetSubtypeProperties)(THIS_ /*[in]*/BSTR bstrSubtypeGUID,
  659. /*[out]*/VARIANT *pPropertyArray) PURE;
  660. // The "GetObjectSubtype" method is used to identify the "subtype" of the
  661. // entity instance whose IUknown* is passe in via the "pObject" input
  662. // parameter. A BSTR representaion of the GUID of the subtype of the
  663. // passed instance is returned via the "bstrSubtypeGUID" output parameter.
  664. STDMETHOD(GetObjectSubtype)(THIS_ /*[in]*/IUnknown* pObject,
  665. /*[out]*/BSTR* bstrSubtypeGUID) PURE;
  666. };
  667. typedef IFilterableSubtypePropertySource FAR* LPFILTERABLESUBTYPEPROPERTYSOURCE;
  668. #endif
  669. #endif //_DYNPROPS_H