Salome HOME
Disable sketch input fields unconditionally.
[modules/shaper.git] / src / ModuleBase / ModuleBase_IModule.h
index 016564178d8f7f2971b9597661091760276d2de8..75cd6e62aea767d8aea70b9a7f9e0746788ed713 100755 (executable)
@@ -29,6 +29,9 @@ class Config_WidgetAPI;
 class ModuleBase_ModelWidget;\r
 class ModuleBase_Operation;\r
 class ModuleBase_IWorkshop;\r
+class ModelAPI_Result;\r
+\r
+class Handle_AIS_InteractiveObject;\r
 \r
 /**\r
  * \ingroup GUI\r
@@ -57,10 +60,10 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject
   /// Remove default selection filters of the module from the current viewer\r
   virtual void deactivateSelectionFilters() {};\r
 \r
-  // Stores the current selection\r
+  /// Stores the current selection\r
   virtual void storeSelection() {};\r
 \r
-  // Restores the current selection\r
+  /// Restores the current selection\r
   virtual void restoreSelection() {};\r
 \r
   /// Reads description of features from XML file \r
@@ -73,10 +76,18 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject
   /// \param theFeature feature for editing\r
   virtual void editFeature(FeaturePtr theFeature);\r
 \r
+  /// Returns true if the operation can be committed. Result in default implementation is true.\r
+  /// \return boolean value\r
+  virtual bool canCommitOperation() const { return true; }\r
+\r
   /// Creates an operation and send it to loop\r
   /// \param theCmdId the operation name\r
   virtual void launchOperation(const QString& theCmdId);\r
 \r
+  /// Executes feature as a modal dialog box\r
+  /// \param theCmdId the operation name\r
+  virtual void launchModal(const QString& theCmdId);\r
+\r
   /// Realizes some functionality by an operation start\r
   /// \param theOperation a started operation\r
   virtual void operationStarted(ModuleBase_Operation* theOperation) {}\r
@@ -98,11 +109,14 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject
   /// Realizes some functionality by an operation start\r
   virtual ModuleBase_Operation* currentOperation() const = 0;\r
 \r
-  /// Add menu items for viewer into the given menu\r
-  /// \param theMenu a popup menu to be shown in the viewer\r
+  /// Add menu items for viewer into the actions map\r
   /// \param theStdActions a map of standard actions\r
+  /// \param theParent a parent widget\r
+  /// \param theMenuActions map of action/menu for the desirable index in the viewer menu\r
   /// \return true if items are added and there is no necessity to provide standard menu\r
-  virtual bool addViewerMenu(QMenu* theMenu, const QMap<QString, QAction*>& theStdActions) const\r
+  virtual bool addViewerMenu(const QMap<QString, QAction*>& theStdActions,\r
+                             QWidget* theParent,\r
+                             QMap<int, QAction*>& theMenuActions) const\r
   { return false; }\r
 \r
   /// Add menu items for object browser into the given menu\r
@@ -162,7 +176,7 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject
 \r
   /// Make some functionality after the objects are hidden in viewer\r
   /// \param theObjects a list of hidden objects\r
-  virtual void processHiddenObject(const std::list<ObjectPtr>& theObjects) {};\r
+  //virtual void processHiddenObject(const std::list<ObjectPtr>& theObjects) {};\r
 \r
   /// Returns true if selection for the object can be activate.\r
   /// By default a result or feature of the current operation can not be activated\r
@@ -183,8 +197,17 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject
   /// \param theModes a list of modes\r
   virtual void activeSelectionModes(QIntList& theModes) {}\r
 \r
+  /// Appends specific selection modes for the module to the list of types\r
+  /// \param theTypes a selection modes to be extended\r
+  virtual void customSubShapesSelectionModes(QIntList& theTypes) {}\r
+\r
+  /// Return true if the custom presentation is activated\r
+  /// \param theFlag a flag of level of customization, which means that only part of sub-elements\r
+  /// \return boolean value\r
+  virtual bool isCustomPrsActivated(const ModuleBase_CustomizeFlag& theFlag) const { return false; };\r
+\r
   /// Activate custom presentation for the object. Default realization is empty.\r
-  /// \param theObject an object instance\r
+  /// \param theFeature a feature instance\r
   /// \param theFlag a flag of level of customization, which means that only part of sub-elements\r
   /// \param theUpdateViewer the parameter whether the viewer should be update immediately\r
   virtual void activateCustomPrs(const FeaturePtr& theFeature,\r
@@ -198,7 +221,7 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject
                                    const bool theUpdateViewer) {}\r
 \r
   /// Modifies the given presentation in the custom way.\r
-  virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,\r
+  virtual bool customisePresentation(std::shared_ptr<ModelAPI_Result> theResult, AISObjectPtr thePrs,\r
                                      GeomCustomPrsPtr theCustomPrs) { return false; };\r
 \r
   /// Update the object presentable properties such as color, lines width and other\r
@@ -220,13 +243,20 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject
   /// \param theCmdId the operation name\r
   virtual ModuleBase_Operation* createOperation(const std::string& theCmdId);\r
 \r
-  /// Sends the operation for launching\r
-  /// \param theOperation the operation\r
-  virtual void sendOperation(ModuleBase_Operation* theOperation);\r
+  /// Create specific for the module presentation\r
+  /// \param theResult an object for presentation\r
+  /// \return created presentation or NULL(default value)\r
+  virtual Handle_AIS_InteractiveObject createPresentation(\r
+                           const std::shared_ptr<ModelAPI_Result>& theResult);\r
 \r
   //! Returns data object by AIS\r
   virtual ObjectPtr findPresentedObject(const AISObjectPtr& theAIS) const = 0;\r
 \r
+  //! Returns true if the presentation can be shown in shading mode\r
+  //! \param theAIS presentation to be checked\r
+  //! \return boolean value\r
+  virtual bool canBeShaded(Handle(AIS_InteractiveObject) theAIS) const;\r
+\r
   /// Update state of pop-up menu items in object browser\r
   /// \param theStdActions - a map of standard actions\r
   virtual void updateObjectBrowserMenu(const QMap<QString, QAction*>& theStdActions) {}\r
@@ -235,6 +265,11 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject
   /// \param theStdActions - a map of standard actions\r
   virtual void updateViewerMenu(const QMap<QString, QAction*>& theStdActions) {}\r
 \r
+  /// Returns true if the action should be always enabled\r
+  /// \param theActionId an action index: Accept or Accept All\r
+  /// \return boolean value\r
+  virtual bool isActionEnableStateFixed(const int theActionId) const { return false; }\r
+\r
   //! Returns the feature error if the current state of the feature in the module is not correct\r
   //! If the feature is correct, it returns an empty value\r
   //! \return string value\r
@@ -256,10 +291,6 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject
   /// \param thePreviousAttributeID an index of the previous active attribute\r
   virtual bool processEnter(const std::string& thePreviousAttributeID) { return false; };\r
 \r
-  /// Performs some GUI actions after an operation transaction is opened\r
-  /// Default realization is empty\r
-  virtual void beforeOperationStarted(ModuleBase_Operation* theOperation) {};\r
-\r
   /// Performs some GUI actions before an operation transaction is stopped\r
   /// Default realization is empty\r
   virtual void beforeOperationStopped(ModuleBase_Operation* theOperation) {};\r
@@ -309,8 +340,8 @@ protected slots:
   /// Called on selection changed event\r
   virtual void onSelectionChanged() {}\r
 \r
- protected:\r
 /// Register validators for this module\r
+protected:\r
+ /// Register validators for this module\r
   virtual void registerValidators() {}\r
 \r
   /// Register selection filters for this module\r