+// 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
*
#include <qcombobox.h>
#include <qpopupmenu.h>
#include <qcursor.h>
+#include <qpushbutton.h>
/*!
* \brief Tab for tab widget containing controls for definition of
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 )
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;
}
//================================================================================
{
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() );
+}