1 #ifndef ModuleBase_IModule_H
\r
2 #define ModuleBase_IModule_H
\r
4 #include "ModuleBase.h"
\r
5 #include "ModuleBase_IWorkshop.h"
\r
7 #include <ModelAPI_Feature.h>
\r
18 class Config_WidgetAPI;
\r
19 class ModuleBase_ModelWidget;
\r
20 class ModuleBase_Operation;
\r
21 class ModuleBase_IWorkshop;
\r
24 * Interface to a module
\r
26 class MODULEBASE_EXPORT ModuleBase_IModule : public QObject
\r
31 ModuleBase_IModule(ModuleBase_IWorkshop* theParent);
\r
33 virtual ~ModuleBase_IModule() {}
\r
35 /// Reads description of features from XML file
\r
36 virtual void createFeatures();
\r
38 /// Called on creation of menu item in desktop
\r
39 virtual void actionCreated(QAction*);
\r
41 /// Called when user selects feature for editing
\r
42 virtual void editFeature(FeaturePtr theFeature);
\r
44 /// Creates an operation and send it to loop
\r
45 /// \param theCmdId the operation name
\r
46 virtual void launchOperation(const QString& theCmdId);
\r
48 /// Called when it is necessary to update a command state (enable or disable it)
\r
49 //virtual bool isFeatureEnabled(const QString& theCmdId) const = 0;
\r
51 /// Creates custom widgets for property panel
\r
52 virtual QWidget* createWidgetByType(const std::string& theType, QWidget* theParent,
\r
53 Config_WidgetAPI* theWidgetApi, std::string theParentId,
\r
54 QList<ModuleBase_ModelWidget*>& theModelWidgets)
\r
59 ModuleBase_IWorkshop* workshop() const { return myWorkshop; }
\r
61 /// Call back forlast tuning of property panel before operation performance
\r
62 /// It is called as on clearing of property panel as on filling with new widgets
\r
63 virtual void propertyPanelDefined(ModuleBase_Operation* theOperation) {}
\r
66 void onFeatureTriggered();
\r
69 /// SLOT, that is called after the operation is started. Connect on the focus activated signal
\r
70 virtual void onOperationStarted(ModuleBase_Operation* theOperation) {}
\r
72 /// SLOT, that is called after the operation is stopped. Switched off the modfications performed
\r
73 /// by the operation start
\r
74 virtual void onOperationStopped(ModuleBase_Operation* theOperation) {}
\r
76 virtual void onOperationResumed(ModuleBase_Operation* theOperation) {}
\r
78 virtual void onOperationComitted(ModuleBase_Operation* theOperation) {}
\r
80 virtual void onOperationAborted(ModuleBase_Operation* theOperation) {}
\r
83 /// Called on selection changed event
\r
84 virtual void onSelectionChanged() {}
\r
86 /// SLOT, that is called by mouse press in the viewer.
\r
87 /// The mouse released point is sent to the current operation to be processed.
\r
88 /// \param theEvent the mouse event
\r
89 //virtual void onMousePressed(QMouseEvent* theEvent) {}
\r
91 /// SLOT, that is called by mouse release in the viewer.
\r
92 /// The mouse released point is sent to the current operation to be processed.
\r
93 /// \param theEvent the mouse event
\r
94 //virtual void onMouseReleased(QMouseEvent* theEvent) {}
\r
96 /// SLOT, that is called by mouse move in the viewer.
\r
97 /// The mouse moved point is sent to the current operation to be processed.
\r
98 /// \param theEvent the mouse event
\r
99 //virtual void onMouseMoved(QMouseEvent* theEvent) {}
\r
101 /// SLOT, that is called by the mouse double click in the viewer.
\r
102 /// \param theEvent the mouse event
\r
103 //virtual void onMouseDoubleClick(QMouseEvent* theEvent) {}
\r
105 /// SLOT, that is called by the key in the viewer is clicked.
\r
106 /// \param theEvent the mouse event
\r
107 //virtual void onKeyRelease(QKeyEvent* theEvent) {}
\r
110 /// Sends the operation for launching
\r
111 /// \param theOperation the operation
\r
112 void sendOperation(ModuleBase_Operation* theOperation);
\r
114 /// Creates a new operation
\r
115 /// \param theCmdId the operation name
\r
116 /// \param theFeatureKind a kind of feature to get the feature xml description
\r
117 virtual ModuleBase_Operation* createOperation(const std::string& theFeatureId);
\r
119 /// Register validators for this module
\r
120 virtual void registerValidators() {}
\r
122 /// Returns new instance of operation object (used in createOperation for customization)
\r
123 virtual ModuleBase_Operation* getNewOperation(const std::string& theFeatureId);
\r
127 ModuleBase_IWorkshop* myWorkshop;
\r
128 std::map<std::string, std::string> myFeaturesInFiles;
\r
133 //! This function must return a new module instance.
\r
135 typedef ModuleBase_IModule* (*CREATE_FUNC)(ModuleBase_IWorkshop*);
\r
138 #define CREATE_MODULE "createModule"
\r
140 #endif //ModuleBase_IModule
\r