Salome HOME
lot 10 - warnings for DTM - untested
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ListSelector.cxx
index d060381fa98956baea11cbabad84422febbb7903..7ae11a62ba7c1bc2905c77b7a9874eb851435abc 100644 (file)
@@ -1,12 +1,8 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
+// Copyright (C) 2014-2015  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
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 
 #include "HYDROGUI_OrderedListWidget.h"
 
-#include <LightApp_DataOwner.h>
+#ifdef TEST_MODE
+  #include <SUIT_DataOwner.h>
+  class TestOwner : public SUIT_DataOwner
+  {
+  public:
+    TestOwner( const QString& entry ) { myEntry = entry; }
+    virtual ~TestOwner() {}
+
+    QString keyString() const { return myEntry; }
+    QString entry() const { return myEntry; }
+
+  private:
+    QString myEntry;
+  };
+  #define OWNER_CLASS TestOwner
+
+#else
+  #include <LightApp_DataOwner.h>
+  #define OWNER_CLASS LightApp_DataOwner
+#endif
 
 
 HYDROGUI_ListSelector::HYDROGUI_ListSelector( HYDROGUI_OrderedListWidget* theListWidget,
@@ -61,7 +76,7 @@ void HYDROGUI_ListSelector::getSelection( SUIT_DataOwnerPtrList& theList ) const
 
   foreach ( const QString& anEntry, aSelectedEntries ) {
     if ( !anEntry.isEmpty() ) {
-      theList.append( SUIT_DataOwnerPtr( new LightApp_DataOwner( anEntry ) ) );
+      theList.append( SUIT_DataOwnerPtr( new OWNER_CLASS( anEntry ) ) );
     }
   }
 }
@@ -77,7 +92,7 @@ void HYDROGUI_ListSelector::setSelection( const SUIT_DataOwnerPtrList& theList )
   QStringList aSelectedEntries;
   SUIT_DataOwnerPtrList::const_iterator anIt = theList.begin();
   for ( ; anIt != theList.end(); ++anIt ) {
-    const LightApp_DataOwner* anOwner = dynamic_cast<const LightApp_DataOwner*>( (*anIt).operator->() );
+    const OWNER_CLASS* anOwner = dynamic_cast<const OWNER_CLASS*>( (*anIt).operator->() );
     if ( anOwner ) {
       aSelectedEntries << anOwner->entry();
     }