Salome HOME
Issue #2024: Redesign of circle and arc of circle (validate preselected object)
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetValidated.h
index 427ecf169d63547f6e0a3f226e4db00f0875d973..15583f9f0e6b435141ba02e08cfa4ea8b5ea41c8 100644 (file)
@@ -29,7 +29,6 @@ class ModuleBase_ISelection;
 class ModuleBase_WidgetSelectorStore;
 class ModelAPI_Validator;
 class Config_WidgetAPI;
-class Handle_SelectMgr_EntityOwner;
 
 //#define LIST_OF_VALID_PRS
 
@@ -68,6 +67,27 @@ class MODULEBASE_EXPORT ModuleBase_WidgetValidated : public ModuleBase_ModelWidg
   /// \return boolean value
   bool isFilterActivated() const;
 
+  /// Block the model flush of update and intialization of attribute
+  /// \param theAttribute an attribute of blocking
+  /// \param theFeature a feature
+  /// \param theToBlock flag whether the model is blocked or unblocked
+  /// \param isFlushesActived out value if model is blocked, in value if model is unblocked
+  /// to be used to restore flush state when unblocked
+  /// \param isAttributeSetInitializedBlocked out value if model is blocked
+  /// in value if model is unblocked to be used to restore previous state when unblocked
+  /// \param isAttributeSendUpdatedBlocked out value if model signal is blocked
+  static void blockFeatureAttribute(const AttributePtr& theAttribute,
+                                    const FeaturePtr& theFeature,
+                                    const bool& theToBlock,
+                                    bool& isFlushesActived,
+                                    bool& isAttributeSetInitializedBlocked,
+                                    bool& isAttributeSendUpdatedBlocked);
+
+  /// Checks the current attibute in all attribute validators
+  /// \param theAttribute an attribute to be validated
+  /// \return true if all validators return that the attribute is valid
+  static bool isValidAttribute(const AttributePtr& theAttribute);
+
 protected:
   /// Checks whether all active viewer filters validate the presentation
   /// \param thePrs a selected presentation in the view
@@ -127,17 +147,14 @@ protected:
   /// to be used to restore flush state when unblocked
   /// \param isAttributeSetInitializedBlocked out value if model is blocked
   /// in value if model is unblocked to be used to restore previous state when unblocked
+  /// \param isAttributeSendUpdatedBlocked out value if model signal is blocked
   virtual void blockAttribute(const AttributePtr& theAttribute, const bool& theToBlock,
-                              bool& isFlushesActived, bool& isAttributeSetInitializedBlocked);
-
-private:
-  /// Checks the current attibute in all attribute validators
-  /// \param theAttribute an attribute to be validated
-  /// \return true if all validators return that the attribute is valid
-  bool isValidAttribute(const AttributePtr& theAttribute) const;
+                              bool& isFlushesActived, bool& isAttributeSetInitializedBlocked,
+                              bool& isAttributeSendUpdatedBlocked);
 
 protected:
-  /// Gets the validity state of the presentation in an internal map. Returns true if the valid state of value is stored
+  /// Gets the validity state of the presentation in an internal map.
+  /// Returns true if the valid state of value is stored
   /// \param theValue a viewer presentation
   /// \param theValid a valid state
   bool getValidState(const std::shared_ptr<ModuleBase_ViewerPrs>& theValue, bool& theValid);
@@ -166,8 +183,11 @@ protected:
 private:
   ObjectPtr myPresentedObject; /// back up of the filtered object
 #ifdef LIST_OF_VALID_PRS
-  QList<std::shared_ptr<ModuleBase_ViewerPrs>> myValidPrs; /// cash of valid selection presentations
-  QList<std::shared_ptr<ModuleBase_ViewerPrs>> myInvalidPrs; /// cash of invalid selection presentations
+  /// cash of valid selection presentations
+  QList<std::shared_ptr<ModuleBase_ViewerPrs>> myValidPrs;
+
+  /// cash of invalid selection presentations
+  QList<std::shared_ptr<ModuleBase_ViewerPrs>> myInvalidPrs;
 #else
   // assume that one presentation selection presentation corresponds only one shape
   NCollection_DataMap<TopoDS_Shape, std::shared_ptr<ModuleBase_ViewerPrs> > myValidPrs;