Salome HOME
Merge branch 'master' of https://git.salome-platform.org/git/modules/hydro
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ObjComboBox.cxx
index 6ead5e400e990a34767327a589e5f33883aa651d..8d2ef26ef570d45a22acaec35d8525ee7240b936 100644 (file)
@@ -18,7 +18,7 @@
 
 #include "HYDROGUI_ObjComboBox.h"
 
-#include "HYDROGUI_Tool.h"
+#include "HYDROGUI_Tool2.h"
 #include "HYDROGUI_Module.h"
 
 #include <LightApp_Application.h>
@@ -82,7 +82,8 @@ void HYDROGUI_ObjComboBox::reset()
     myObject->blockSignals( true );
 
     myObject->clear();
-    myObject->addItems( objectNames() );
+    myObjects.Clear();
+    myObject->addItems( objectNames( myObjects ) );
     myObject->setCurrentIndex( -1 );
 
     myObject->blockSignals( block );
@@ -91,7 +92,7 @@ void HYDROGUI_ObjComboBox::reset()
     updateSelection();
 }
 
-void HYDROGUI_ObjComboBox::setSectedObject( const QString& theName )
+void HYDROGUI_ObjComboBox::setSelectedObject( const QString& theName )
 {
     int aNewIdx = myObject->findText( theName );
     if ( aNewIdx != myObject->currentIndex() )
@@ -115,13 +116,16 @@ SUIT_SelectionMgr* HYDROGUI_ObjComboBox::selectionMgr() const
     return aSelMgr;
 }
 
-QStringList HYDROGUI_ObjComboBox::objectNames() const
+QStringList HYDROGUI_ObjComboBox::objectNames( HYDROData_SequenceOfObjects& theObjects ) const
 {
     QStringList aNames;
     for ( HYDROData_Iterator it( HYDROData_Document::Document( module()->getStudyId() ), objectType() ); it.More(); it.Next() )
     {
         if ( !objectFilter() || objectFilter()->isOk( it.Current() ) )
+        {
+          theObjects.Append( it.Current() );
             aNames.append( it.Current()->GetName() );
+        }
     }
     return aNames;
 }
@@ -153,3 +157,13 @@ void HYDROGUI_ObjComboBox::updateSelection()
         emit objectSelected( myObject->itemText( idx ) );
     }
 }
+
+Handle( HYDROData_Entity ) HYDROGUI_ObjComboBox::GetObject() const
+{
+  int anIndex = myObject->currentIndex();
+  if( anIndex>=0 && anIndex<myObjects.Length() )
+    return myObjects.Value( myObjects.Lower() + anIndex );
+  else
+    return Handle( HYDROData_Entity )();
+}
+