1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #include "HYDROGUI_CalculationDlg.h"
25 #include "HYDROGUI_ObjSelector.h"
26 #include "HYDROGUI_Tool.h"
28 #include <SUIT_FileDlg.h>
29 #include <SUIT_ResourceMgr.h>
30 #include <SUIT_Session.h>
36 #include <QListWidget>
38 #include <QPushButton>
39 #include <QToolButton>
41 HYDROGUI_CalculationDlg::HYDROGUI_CalculationDlg( HYDROGUI_Module* theModule, const QString& theTitle )
42 : HYDROGUI_InputPanel( theModule, theTitle )
45 myObjectNameGroup = new QGroupBox( tr( "CALCULATION_NAME" ), mainFrame() );
47 myObjectName = new QLineEdit( myObjectNameGroup );
49 QBoxLayout* aNameLayout = new QHBoxLayout( myObjectNameGroup );
50 aNameLayout->setMargin( 5 );
51 aNameLayout->setSpacing( 5 );
52 aNameLayout->addWidget( new QLabel( tr( "NAME" ), myObjectNameGroup ) );
53 aNameLayout->addWidget( myObjectName );
56 QFrame* anObjectsFrame = new QFrame( mainFrame() );
58 myGeomObjects = new QListWidget( anObjectsFrame );
59 myGeomObjects->setSelectionMode( QListWidget::SingleSelection );
60 myGeomObjects->setEditTriggers( QListWidget::NoEditTriggers );
61 myGeomObjects->setViewMode( QListWidget::ListMode );
63 QGridLayout* aZonesLayout = new QGridLayout( anObjectsFrame );
64 aZonesLayout->setMargin( 5 );
65 aZonesLayout->setSpacing( 5 );
66 aZonesLayout->addWidget( new QLabel( tr( "CALCULATION_REFERENCE_OBJECTS" ), myGeomObjects ), 0, 0 );
67 aZonesLayout->addWidget( myGeomObjects, 0, 1 );
70 addWidget( myObjectNameGroup );
71 addWidget( anObjectsFrame );
75 HYDROGUI_CalculationDlg::~HYDROGUI_CalculationDlg()
79 void HYDROGUI_CalculationDlg::reset()
81 myObjectName->clear();
83 myGeomObjects->clear();
86 void HYDROGUI_CalculationDlg::setObjectName( const QString& theName )
88 myObjectName->setText( theName );
91 QString HYDROGUI_CalculationDlg::getObjectName() const
93 return myObjectName->text();
96 void HYDROGUI_CalculationDlg::setGeomObjects( const QStringList& theObjects )
100 void HYDROGUI_CalculationDlg::setSelectedGeomObjects( const QStringList& theObjects )
102 myGeomObjects->clear();
104 for ( int i = 0, n = theObjects.length(); i < n; ++i )
106 QString anObjName = theObjects.at( i );
108 QListWidgetItem* aListItem = new QListWidgetItem( anObjName, myGeomObjects );
109 aListItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable );
113 QStringList HYDROGUI_CalculationDlg::getSelectedGeomObjects() const
115 QStringList aResList;
117 for ( int i = 0, n = myGeomObjects->count(); i < n; ++i )
119 QListWidgetItem* aListItem = myGeomObjects->item( i );
123 QString aSelObjName = aListItem->text();
124 aResList.append( aSelObjName );