Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / ModuleBase / ModuleBase_IModule.h
1 #ifndef ModuleBase_IModule_H
2 #define ModuleBase_IModule_H
3
4 #include <QString>
5 #include <QObject>
6
7 class QAction;
8 class XGUI_Workshop;
9
10 /**
11 * Interface to a module
12 */
13 class ModuleBase_IModule: public QObject
14 {
15 public:
16   /// Reads description of features from XML file 
17   virtual void createFeatures() = 0;
18
19   /// Called on creation of menu item in desktop
20   virtual void featureCreated(QAction*) = 0;
21
22   /// Creates an operation and send it to loop
23   /// \param theCmdId the operation name
24   virtual void launchOperation(const QString& theCmdId) = 0;
25
26   /// Called when it is necessary to update a command state (enable or disable it)
27   virtual bool isFeatureEnabled(const QString& theCmdId) const = 0;
28
29   virtual ~ModuleBase_IModule() {};
30 };
31
32 //! This function must return a new module instance.
33 extern "C"
34 {
35 typedef ModuleBase_IModule* (*CREATE_FUNC)(XGUI_Workshop*);
36 }
37
38 #define CREATE_MODULE "createModule"
39
40 #endif //ModuleBase_IModule