Salome HOME
Check selection for sketcher
[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 class Config_WidgetAPI;
10 class ModuleBase_ModelWidget;
11
12 /**
13 * Interface to a module
14 */
15 class ModuleBase_IModule: public QObject
16 {
17 public:
18   /// Reads description of features from XML file 
19   virtual void createFeatures() = 0;
20
21   /// Called on creation of menu item in desktop
22   virtual void featureCreated(QAction*) = 0;
23
24   /// Creates an operation and send it to loop
25   /// \param theCmdId the operation name
26   virtual void launchOperation(const QString& theCmdId) = 0;
27
28   /// Called when it is necessary to update a command state (enable or disable it)
29   //virtual bool isFeatureEnabled(const QString& theCmdId) const = 0;
30
31   /// Creates custom widgets for property panel
32   virtual QWidget* createWidgetByType(const std::string& theType, QWidget* theParent, 
33     Config_WidgetAPI* theWidgetApi, QList<ModuleBase_ModelWidget*>& theModelWidgets)
34   {
35     return 0;
36   }
37
38   virtual ~ModuleBase_IModule() {};
39 };
40
41 //! This function must return a new module instance.
42 extern "C"
43 {
44 typedef ModuleBase_IModule* (*CREATE_FUNC)(XGUI_Workshop*);
45 }
46
47 #define CREATE_MODULE "createModule"
48
49 #endif //ModuleBase_IModule