Header file: MapReactors.h.
The AcMapProjectOptionsReactor class is used to represent a project options reactor, which notifies an application when a project option is modified.
To create a specific project options reactor, subclass from AcMapProjectOptionsReactor.
Use AcMapProject::AddOptionsReactor to add an options reactor to a project and AcMapProject::RemoveOptionsReactor to remove it.
For simplicity, the following example does not show routine error checking.
class AcMyProjectOptionsReactor : public AcMapProjectOptionsReactor
{
// See MapDemoApp.cpp distributed with AutoCAD Map ObjectARX.
};
static AcMyProjectOptionsReactor *pPrefReact;
AcRx::AppRetCode acrxEntryPoint(AcRx::AppMsgCode msg, void *appId)
{
AcMapSession *mapApi = NULL ;
switch (msg)
{
case AcRx::kInitAppMsg:
acrxRegisterAppMDIAware(appId);
//register commands -- code not shown
pPrefReact = new AcMyProjectOptionsReactor();
mapApi = AcMapGetSession();
if (mapApi)
pProj->AddOptionsReactor(pPrefReact) ;
break ;
case AcRx::kUnloadAppMsg:
//remove commands -- code not shown
break ;
case AcRx::kUnloadDwgMsg:
mapApi = AcMapGetSession();
if (mapApi)
{
AcMapProject *pProj ;
if (mapApi->GetProject(pProj))
pProj->RemoveOptionsReactor(pPrefReact);
}
break ;
}
return AcRx::kRetOK;
}