Share

AcadToolImpl

Class Hierarchy

IAcadStockTool
IAcadTool
IAcadTool2
IAcadToolContextMenu
IAcadToolFlyoutShape
IOPMPropertyDialog
IOPMPropertyExtension
    AcadToolImpl

C++

template <class TT,class T,const CLSID* pclsid,LPCWSTR szToolName,LPCWSTR szToolImage,const IID* piid = &__uuidof(T),const GUID* plibid = &CAtlModule::m_libid>
class AcadToolImpl : public CComObjectRootEx<CComSingleThreadModel>, public IDispatchImpl<T, piid, plibid, 1, 0>, public IAcadTool, public IAcadTool2, public IAcadStockTool, public IDropTarget, public IPropertyUnspecified, public IPerPropertyDisplayImpl<AcadToolImpl<TT,T,pclsid,szToolName,szToolImage,piid,plibid> >, public IOPMPropertyExtension, public IAcadToolContextMenu, public IPerPropertyBrowsing, public IOPMPropertyDialog, public IAcadToolFlyoutShape;

File

AcadToolImpl.h

Description

The AcadToolImpl class handles general AutoCAD Tool functionality by parsing the tool's type information at runtime to discover details about the custom interface. This information is used to persist the tool via XML (ATC files), support the default property inspector for the tool properties, handle drag/drop notifications, and support for Color and Layer property controls . At the same time, the developer is free to override any functionality handled by this class by implementing the necessary virtual functions.

Remarks

This implementation class will automatically support properties of all VARIANT types supported in the property inspector. While the Color property is marshalled across as a VT_DISPATCH, this sample persists the color as a LONG since XML can't represent interface pointers. This is handled in this class' version of Load/SavePropertyValue.

If you define properties in your tool interface of less frequently used types (e.g. a GUID), you may need to override the Load/SavePropertyValue() method to convert to and from string to support them yourself. If IXMLDOMAttributePtr::get_value(the method used internally to persist your properties) can't persist the types, you will need to convert them to string or other type and persist them manually either with the Load/SavePropertyValue() or directly overriding Load() and Save() from the base class.

Links

AcadToolImpl Data Members, AcadToolImpl Methods

Was this information helpful?