Salome HOME
17.12.2013. Added Partition algorithm (draft version).
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_Zone.cxx
index 26aa2f08878e24ebc3d2992d8233402d8533ce05..4485ec4f32d06c669953b2d563101340247ec42d 100644 (file)
@@ -31,8 +31,9 @@
 
 HYDROGUI_Zone::HYDROGUI_Zone( SUIT_DataObject* theParent, 
                                           Handle(HYDROData_Zone) theData,
-                                          const QString& theParentEntry )
-: HYDROGUI_DataObject( theParent, theData, theParentEntry ), CAM_DataObject( theParent )
+                                          const QString& theParentEntry,
+                                          const bool theIsInOperation )
+: HYDROGUI_DataObject( theParent, theData, theParentEntry, theIsInOperation ), CAM_DataObject( theParent )
 {
 }
 
@@ -202,7 +203,7 @@ QColor HYDROGUI_Zone::color( const ColorRole theColorRole, const int theColumnId
   }
   if ( !aRes.isValid() )
   {
-    aRes = LightApp_DataObject::color( theColorRole, theColumnId );
+    aRes = HYDROGUI_DataObject::color( theColorRole, theColumnId );
   }
   return aRes;
 }
@@ -277,3 +278,58 @@ void HYDROGUI_Zone::setMergeType( int theMergeType, QString theBathymetryName )
     }
   }
 }
+
+/*!
+  \brief Check if this object is can't be renamed in place
+
+  \param id column id
+  \return \c true if the item can be renamed by the user in place (e.g. in the Object browser)
+*/
+bool HYDROGUI_Zone::renameAllowed( const int id ) const
+{
+  if ( id == NameId && isInOperation() )
+  {
+    return true;
+  }
+  return HYDROGUI_DataObject::renameAllowed( id );
+}
+
+///*!
+//  \brief Set name of this object.
+//
+//  \return \c true if rename operation finished successfully, \c false otherwise.
+//*/
+//bool HYDROGUI_Zone::setName(const QString& theName)
+//{
+//  if ( isInOperation() )
+//  {
+//    bool aRes = false;
+//    if ( !theName.isEmpty() )
+//    {
+//      Handle(HYDROData_Entity) anEntity = modelObject();
+//      CAM_Module* aModule = module();
+//      if( anEntity->GetName() != theName && aModule )
+//      {
+//        // check that there are no other objects with the same name in the document
+//        Handle(HYDROData_Entity) anObject = HYDROGUI_Tool::FindObjectByName( aModule, theName );
+//        if ( anObject.IsNull() )
+//        {
+//          anEntity->SetName( theName );
+//          aRes = true;
+//        }
+//        else
+//        {
+//          // Inform the user that the name is already used
+//          QString aTitle = QObject::tr( "INSUFFICIENT_INPUT_DATA" );
+//          QString aMessage = QObject::tr( "OBJECT_EXISTS_IN_DOCUMENT" ).arg( theName );
+//          SUIT_MessageBox::critical( getApp()->desktop(), aTitle, aMessage );
+//        }
+//      }
+//    }
+//  }
+//  else
+//  {
+//    aRes = HYDROGUI_DataObject::setName( theName );
+//  }
+//  return aRes;
+//}