Salome HOME
refs #568: use ordered list view with selection synchronized with object browser...
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_ImmersibleZoneDlg.cxx
index fecb29f8df47fb317e8d279610ae3f4455128244..85130b2a2098a8e8ed946788a525b3aabf8890fb 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 <QGroupBox>
 #include <QLabel>
 #include <QLayout>
-#include <QLineEdit>
 
 HYDROGUI_ImmersibleZoneDlg::HYDROGUI_ImmersibleZoneDlg( HYDROGUI_Module* theModule, const QString& theTitle )
-: HYDROGUI_InputPanel( theModule, theTitle )
+: HYDROGUI_BasicZoneDlg( theModule, theTitle,
+                         tr( "ZONE_NAME" ), tr( "NAME" ),
+                         tr( "ZONE_PARAMETERS" ), tr( "ZONE_BATHYMETRY" ) )
 {
-  // Zone name
-  myObjectNameGroup = new QGroupBox( tr( "ZONE_NAME" ), mainFrame() );
-
-  myObjectName = new QLineEdit( myObjectNameGroup );
-
-  QBoxLayout* aNameLayout = new QHBoxLayout( myObjectNameGroup );
-  aNameLayout->setMargin( 5 );
-  aNameLayout->setSpacing( 5 );
-  aNameLayout->addWidget( new QLabel( tr( "NAME" ), myObjectNameGroup ) );
-  aNameLayout->addWidget( myObjectName );
-
-
-  QGroupBox* aParamGroup = new QGroupBox( tr( "ZONE_PARAMETERS" ), mainFrame() );
-
-  QFrame* aPolylineFrame = new QFrame( aParamGroup );
-
-  myPolylines = new QComboBox( aPolylineFrame );
+  myPolylines = new QComboBox( myPolylineFrame );
   myPolylines->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
 
-  QBoxLayout* aPolyLayout = new QHBoxLayout( aPolylineFrame );
+  QBoxLayout* aPolyLayout = new QHBoxLayout( myPolylineFrame );
   aPolyLayout->setMargin( 0 );
   aPolyLayout->setSpacing( 5 );
-  aPolyLayout->addWidget( new QLabel( tr( "ZONE_POLYLINE" ), aPolylineFrame ) );
+  aPolyLayout->addWidget( new QLabel( tr( "ZONE_POLYLINE" ), myPolylineFrame ) );
   aPolyLayout->addWidget( myPolylines );
   
-  QBoxLayout* aParamLayout = new QVBoxLayout( aParamGroup );
+  QBoxLayout* aParamLayout = new QVBoxLayout( myParamGroup );
   aParamLayout->setMargin( 5 );
   aParamLayout->setSpacing( 5 );
-  aParamLayout->addWidget( aPolylineFrame );
-
-  QGroupBox* aBathGroup = new QGroupBox( tr( "ZONE_BATHYMETRY" ), mainFrame() );
-
-  myBathymetries = new QComboBox( aPolylineFrame );
-  myBathymetries->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-
-  QBoxLayout* aBathLayout = new QHBoxLayout( aBathGroup );
-  aBathLayout->setMargin( 5 );
-  aBathLayout->setSpacing( 5 );
-  aBathLayout->addWidget( myBathymetries );
-
-
-  // Common
-  addWidget( myObjectNameGroup );
-  addWidget( aParamGroup );
-  addWidget( aBathGroup );
-
-  addStretch();
-
+  aParamLayout->addWidget( myPolylineFrame );
 
   // Connect signals and slots
   connect( myPolylines, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onZoneDefChanged() ) );
@@ -94,26 +56,15 @@ void HYDROGUI_ImmersibleZoneDlg::reset()
 {
   bool isBlocked = blockSignals( true );
 
-  myObjectName->clear();
+  HYDROGUI_BasicZoneDlg::reset(); 
 
   myPolylines->clear();
-  myBathymetries->clear();
-
+  
   blockSignals( isBlocked );
 
   onZoneDefChanged();
 }
 
-void HYDROGUI_ImmersibleZoneDlg::setObjectName( const QString& theName )
-{
-  myObjectName->setText( theName );
-}
-
-QString HYDROGUI_ImmersibleZoneDlg::getObjectName() const
-{
-  return myObjectName->text();
-}
-
 void HYDROGUI_ImmersibleZoneDlg::setPolylineNames( const QStringList& thePolylines )
 {
   bool isBlocked = blockSignals( true );
@@ -142,27 +93,6 @@ QString HYDROGUI_ImmersibleZoneDlg::getPolylineName() const
   return myPolylines->currentText();
 }
 
-void HYDROGUI_ImmersibleZoneDlg::setBathymetryNames( const QStringList& theBathymetries )
-{
-  bool isBlocked = blockSignals( true );
-
-  myBathymetries->clear();
-  myBathymetries->addItems( theBathymetries );
-
-  blockSignals( isBlocked );
-}
-
-void HYDROGUI_ImmersibleZoneDlg::setBathymetryName( const QString& theName )
-{
-  int aNewIdx = myBathymetries->findText( theName );
-  myBathymetries->setCurrentIndex( aNewIdx );
-}
-
-QString HYDROGUI_ImmersibleZoneDlg::getBathymetryName() const
-{
-  return myBathymetries->currentText();
-}
-
 void HYDROGUI_ImmersibleZoneDlg::onZoneDefChanged()
 {
   if ( signalsBlocked() )