1 #ifndef ModuleBase_IModule_H
2 #define ModuleBase_IModule_H
4 #include "ModuleBase.h"
5 #include "ModuleBase_IWorkshop.h"
14 class Config_WidgetAPI;
15 class ModuleBase_ModelWidget;
16 class ModuleBase_Operation;
17 class ModuleBase_IWorkshop;
20 * Interface to a module
22 class MODULEBASE_EXPORT ModuleBase_IModule : public QObject
27 ModuleBase_IModule(ModuleBase_IWorkshop* theParent);
29 virtual ~ModuleBase_IModule() {}
31 /// Reads description of features from XML file
32 virtual void createFeatures() = 0;
34 /// Called on creation of menu item in desktop
35 virtual void featureCreated(QAction*) = 0;
37 /// Creates an operation and send it to loop
38 /// \param theCmdId the operation name
39 virtual void launchOperation(const QString& theCmdId);
41 /// Called when it is necessary to update a command state (enable or disable it)
42 //virtual bool isFeatureEnabled(const QString& theCmdId) const = 0;
44 /// Creates custom widgets for property panel
45 virtual QWidget* createWidgetByType(const std::string& theType, QWidget* theParent,
46 Config_WidgetAPI* theWidgetApi,
47 QList<ModuleBase_ModelWidget*>& theModelWidgets)
52 ModuleBase_IWorkshop* workshop() const { return myWorkshop; }
56 /// Called on selection changed event
57 virtual void onSelectionChanged() {}
59 /// SLOT, that is called by mouse press in the viewer.
\r
60 /// The mouse released point is sent to the current operation to be processed.
\r
61 /// \param theEvent the mouse event
\r
62 virtual void onMousePressed(QMouseEvent* theEvent) {}
\r
64 /// SLOT, that is called by mouse release in the viewer.
\r
65 /// The mouse released point is sent to the current operation to be processed.
\r
66 /// \param theEvent the mouse event
\r
67 virtual void onMouseReleased(QMouseEvent* theEvent) {}
\r
69 /// SLOT, that is called by mouse move in the viewer.
\r
70 /// The mouse moved point is sent to the current operation to be processed.
\r
71 /// \param theEvent the mouse event
\r
72 virtual void onMouseMoved(QMouseEvent* theEvent) {}
\r
74 /// SLOT, that is called by the mouse double click in the viewer.
\r
75 /// \param theEvent the mouse event
\r
76 virtual void onMouseDoubleClick(QMouseEvent* theEvent) {}
\r
78 /// SLOT, that is called by the key in the viewer is clicked.
\r
79 /// \param theEvent the mouse event
\r
80 virtual void onKeyRelease(QKeyEvent* theEvent) {}
\r
83 /// Sends the operation for launching
84 /// \param theOperation the operation
85 void sendOperation(ModuleBase_Operation* theOperation);
87 /// Creates a new operation
88 /// \param theCmdId the operation name
89 /// \param theFeatureKind a kind of feature to get the feature xml description
90 virtual ModuleBase_Operation* createOperation(const std::string& theCmdId,
91 const std::string& theFeatureKind = "") = 0;
96 ModuleBase_IWorkshop* myWorkshop;
100 //! This function must return a new module instance.
102 typedef ModuleBase_IModule* (*CREATE_FUNC)(ModuleBase_IWorkshop*);
105 #define CREATE_MODULE "createModule"
107 #endif //ModuleBase_IModule