Salome HOME
Issue #2024: Redesign of circle and arc of circle (validate preselected object)
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetValidator.cpp
index 35d8fca626d4928de85d619eb04d27c3c4e3d398..d6c9d9f0fab27518f68ac8aea0811e991cacb3e9 100755 (executable)
@@ -1,6 +1,8 @@
 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
 
 #include <ModuleBase_WidgetValidator.h>
+#include <ModuleBase_WidgetSelectorStore.h>
+#include <ModuleBase_WidgetValidated.h>
 
 #include <ModuleBase_ModelWidget.h>
 #include <ModuleBase_ViewerPrs.h>
 
 ModuleBase_WidgetValidator::ModuleBase_WidgetValidator(ModuleBase_ModelWidget* theModelWidget,
                                                        ModuleBase_IWorkshop* theWorkshop)
-: myModelWidget(theModelWidget), myWorkshop(theWorkshop)
+: myModelWidget(theModelWidget), myWorkshop(theWorkshop), myIsInValidate(false)
 {
+  myAttributeStore = new ModuleBase_WidgetSelectorStore();
 }
 
 ModuleBase_WidgetValidator::~ModuleBase_WidgetValidator()
 {
+  delete myAttributeStore;
 }
 
 //********************************************************************
@@ -47,6 +51,24 @@ bool ModuleBase_WidgetValidator::activateFilters(const bool toActivate)
   return aHasSelectionFilter;
 }
 
+void ModuleBase_WidgetValidator::storeAttributeValue(const AttributePtr& theAttribute)
+{
+  myIsInValidate = true;
+  myAttributeStore->storeAttributeValue(theAttribute, myWorkshop);
+}
+
+void ModuleBase_WidgetValidator::restoreAttributeValue(const AttributePtr& theAttribute,
+                                                       const bool theValid)
+{
+  myIsInValidate = false;
+  myAttributeStore->restoreAttributeValue(theAttribute, myWorkshop);
+}
+
+bool ModuleBase_WidgetValidator::isValidAttribute(const AttributePtr& theAttribute) const
+{
+  return ModuleBase_WidgetValidated::isValidAttribute(theAttribute);
+}
+
 bool ModuleBase_WidgetValidator::isFilterActivated() const
 {
   bool isActivated = false;