X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_MeshDlg.cxx;h=6d9e88e588efae9c0304b35a2d9d39b2e44e5573;hb=94b4c4f7f76abd57f72199e83f37f0e1d96ee22c;hp=8f427ffe9f7eae7d56db26505623f46eff8aa842;hpb=24d6fd82e6e0f8daa90e318e365226e81e7816ee;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_MeshDlg.cxx b/src/SMESHGUI/SMESHGUI_MeshDlg.cxx index 8f427ffe9..6d9e88e58 100644 --- a/src/SMESHGUI/SMESHGUI_MeshDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshDlg.cxx @@ -1,3 +1,22 @@ +// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// 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. +// +// This library is distributed in the hope that it will be useful +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// /** * SMESH SMESHGUI * @@ -25,6 +44,7 @@ #include #include #include +#include /*! * \brief Tab for tab widget containing controls for definition of @@ -361,14 +381,19 @@ SMESHGUI_MeshDlg::SMESHGUI_MeshDlg( const bool theToCreate, const bool theIsMesh myTabWg->addTab( myTabs[ Dim1D ], tr( "DIM_1D" ) ); myTabWg->addTab( myTabs[ Dim2D ], tr( "DIM_2D" ) ); myTabWg->addTab( myTabs[ Dim3D ], tr( "DIM_3D" ) ); + + // Hypotheses Sets + myHypoSetPopup = new QPopupMenu(); + QButton* aHypoSetButton = new QPushButton( mainFrame(), "aHypoSetButton"); + aHypoSetButton->setText( tr( "HYPOTHESES_SETS" ) ); // Fill layout - QVBoxLayout* aLay = new QVBoxLayout( mainFrame(), 0, 5 ); aLay->addWidget( aGrp ); aLay->addItem( new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum) ); aLay->addWidget( myTabWg ); - + aLay->addWidget( aHypoSetButton ); + // Disable controls if necessary setObjectShown( Mesh, false ); if ( theToCreate ) @@ -389,10 +414,16 @@ SMESHGUI_MeshDlg::SMESHGUI_MeshDlg( const bool theToCreate, const bool theIsMesh objectWg( Mesh, Btn )->hide(); objectWg( Geom, Btn )->hide(); } + + // Connect signals and slots + connect( aHypoSetButton, SIGNAL( clicked() ), SLOT( onHypoSetButton() ) ); + connect( myHypoSetPopup, SIGNAL( activated( int ) ), SLOT( onHypoSetPopup( int ) ) ); } SMESHGUI_MeshDlg::~SMESHGUI_MeshDlg() { + if ( myHypoSetPopup ) + delete myHypoSetPopup; } //================================================================================ @@ -432,16 +463,60 @@ void SMESHGUI_MeshDlg::setCurrentTab( const int theId ) { myTabWg->setCurrentPage( theId ); } - - - - - - +//================================================================================ +/*! + * \brief Enable/disable tabs + * \param int - maximum possible dimention + */ +//================================================================================ +void SMESHGUI_MeshDlg::setMaxHypoDim( const int maxDim ) +{ + for ( int i = Dim1D; i <= Dim3D; ++i ) { + int dim = i + 1; + bool enable = ( dim <= maxDim ); + if ( !enable ) + myTabs[ i ]->reset(); + myTabWg->setTabEnabled( myTabs[ i ], enable ); + } +} +//================================================================================ +/*! + * \brief Sets list of available Sets of Hypotheses + */ +//================================================================================ +void SMESHGUI_MeshDlg::setHypoSets( const QStringList& theSets ) +{ + myHypoSetPopup->clear(); + for ( int i = 0, n = theSets.count(); i < n; i++ ) { + myHypoSetPopup->insertItem( theSets[ i ], i ); + } +} +//================================================================================ +/*! + * \brief Emits hypoSet signal + * + * SLOT is called when a hypotheses set is selected. Emits hypoSet + * signal to notify operation about this event + */ +//================================================================================ +void SMESHGUI_MeshDlg::onHypoSetPopup( int theIndex ) +{ + emit hypoSet( myHypoSetPopup->text( theIndex )); +} + +//================================================================================ +/*! + * \brief Shows myHypoSetPopup + */ +//================================================================================ +void SMESHGUI_MeshDlg::onHypoSetButton() +{ + myHypoSetPopup->exec( QCursor::pos() ); +}