You copied the Doc URL to your clipboard.

The MxPluginCallBack

If the plugin developer inserts a menu item or a script command for a plugin, the developer must also provide a callback function to be called when this menu or script command is activated. This function must contain the behavior for this plugin.

The MxPluginCallBack is the interface for such callback functions for main menu plugin entries and for plugin script commands.

To create such a callback:

  1. Derive a user class from MxPluginCallBack
  2. Implement the pluginCallback() function. This is a pure virtual function.

    class  MxPluginCallBack {
    public:
        virtual bool pluginCallback(void) = 0;
    };

    This could be implemented, for example, as:

    class myCallback: public MxPluginCallBack 
    {
    public:
        myCallback(MxPlugin *_pluginP);
        ~myCallback();
        virtual bool pluginCallback(void);
        void printHierarchyModule(CASIModule *module, int deep);
    private:
        MxPlugin *pluginP;
    };
    
    myCallback::myCallback(MxPlugin *_pluginP)
    {
        pluginP = _pluginP;
    }
    
    bool myCallback::pluginCallback(void)
    {
        //Get the pointer to the CADI interface 
        MxSimAPI *eslapi = getMxSimAPI();
        CASIModule *top = dynamic_cast<CASIModule
            *>(eslapi->getTopComponent());
        //Print out the component hierarchy starting from the top component 
        pluginP->message("Hierarchy :");
        …
    }
  3. Provide the pointer to an object of this new class to the insertMenuItem or insertBatchModeCommand function.

Was this page helpful? Yes No