Salome HOME
updated copyright message
[modules/shaper.git] / src / ModelHighAPI / ModelHighAPI_Folder.cpp
index 77d696723bf36619630e0e2e073ce6a2dfdf1436..ec7265ce204b898219504263941ad3dac59a1b4f 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 //
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "ModelHighAPI_Folder.h"
@@ -25,6 +24,7 @@
 
 #include <ModelAPI_AttributeReference.h>
 #include <ModelAPI_Document.h>
+#include <ModelAPI_Events.h>
 
 //--------------------------------------------------------------------------------------
 
@@ -59,13 +59,13 @@ bool ModelHighAPI_Folder::initialize()
   return true;
 }
 
-void ModelHighAPI_Folder::setName(const std::string& theName)
+void ModelHighAPI_Folder::setName(const std::wstring& theName)
 {
   if (myFolder && myFolder->data() && myFolder->data()->isValid())
     myFolder->data()->setName(theName);
 }
 
-std::string ModelHighAPI_Folder::name() const
+std::wstring ModelHighAPI_Folder::name() const
 {
   return myFolder->data()->name();
 }
@@ -110,5 +110,13 @@ std::shared_ptr<ModelHighAPI_Folder> addFolder(const std::shared_ptr<ModelAPI_Do
   AttributeReferencePtr aLastFeatAttr = aFolder->reference(ModelAPI_Folder::LAST_FEATURE_ID());
   fillAttribute(theLastFeature.feature(), aLastFeatAttr);
 
+  // to update the folder state in the Object Browser
+  theDoc->updateHistory(ModelAPI_Feature::group());
+
   return std::shared_ptr<ModelHighAPI_Folder>(new ModelHighAPI_Folder(aFolder));
 }
+
+void removeFolder(std::shared_ptr<ModelHighAPI_Folder>& theFolder)
+{
+  theFolder->folder()->document()->removeFolder(theFolder->folder());
+}