smesh/src/SMESHGUI/SMESHGUI_ConvToQuadDlg.cxx

175 lines
4.8 KiB
C++
Raw Normal View History

2013-04-01 19:05:47 +06:00
// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
//
2012-08-09 16:03:55 +06:00
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
2012-08-09 16:03:55 +06:00
// 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.
//
2012-08-09 16:03:55 +06:00
// 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.
2009-02-17 10:27:49 +05:00
//
2012-08-09 16:03:55 +06:00
// 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
2009-02-17 10:27:49 +05:00
//
2012-08-09 16:03:55 +06:00
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
2009-02-17 10:27:49 +05:00
//
2012-08-09 16:03:55 +06:00
2009-02-17 10:27:49 +05:00
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_ConvToQuadDlg.cxx
// Author : Open CASCADE S.A.S.
// SMESH includes
//
#include "SMESHGUI_ConvToQuadDlg.h"
2013-03-06 19:57:01 +06:00
#include "SMESHGUI_ConvToQuadOp.h"
2009-02-17 10:27:49 +05:00
// Qt includes
#include <QGroupBox>
#include <QCheckBox>
#include <QRadioButton>
#include <QButtonGroup>
#include <QGroupBox>
#include <QFrame>
#include <QHBoxLayout>
#include <QGridLayout>
2012-08-09 16:03:55 +06:00
#include <QLabel>
2009-02-17 10:27:49 +05:00
#define SPACING 6
#define MARGIN 11
SMESHGUI_ConvToQuadDlg::SMESHGUI_ConvToQuadDlg()
2009-02-17 10:27:49 +05:00
: SMESHGUI_Dialog( 0, false, true )
{
2009-02-17 10:27:49 +05:00
setWindowTitle( tr( "CAPTION" ) );
// Create top controls
// mesh
2009-02-17 10:27:49 +05:00
setObjectPixmap( "SMESH", tr( "ICON_SELECT" ) );
createObject( tr( "MESH" ), mainFrame(), 0 );
//Create check box
2009-02-17 10:27:49 +05:00
myMedNdsOnGeom = new QCheckBox( tr( "MEDIUMNDS" ), mainFrame() );
//Create RadioButtons
2009-02-17 10:27:49 +05:00
myBGBox = new QGroupBox( mainFrame() );
myBG = new QButtonGroup( mainFrame() );
QVBoxLayout* aBGLayout = new QVBoxLayout( myBGBox );
aBGLayout->setMargin(MARGIN);
aBGLayout->setSpacing(SPACING);
2013-03-06 19:57:01 +06:00
myRB2Lin = new QRadioButton( tr( "RADIOBTN_1" ), myBGBox );
myRB2Quad = new QRadioButton( tr( "RADIOBTN_2" ), myBGBox );
myRB2BiQua = new QRadioButton( tr( "RADIOBTN_3" ), myBGBox );
aBGLayout->addWidget(myRB2Lin);
aBGLayout->addWidget(myRB2Quad);
aBGLayout->addWidget(myRB2BiQua);
myBG->addButton(myRB2Lin, 0);
myBG->addButton(myRB2Quad, 1);
myBG->addButton(myRB2BiQua, 2);
myRB2Lin->setChecked( true );
2012-08-09 16:03:55 +06:00
myWarning = new QLabel(QString("<b>%1</b>").arg(tr("NON_CONFORM_WARNING")), mainFrame());
// Fill layout
2009-02-17 10:27:49 +05:00
QGridLayout* aLay = new QGridLayout( mainFrame() );
aLay->setMargin( 5 );
aLay->setSpacing( 5 );
aLay->addWidget( objectWg( 0, Label ), 0, 0 );
aLay->addWidget( objectWg( 0, Btn ), 0, 1 );
aLay->addWidget( objectWg( 0, Control ), 0, 2 );
aLay->addWidget( myMedNdsOnGeom, 1, 0, 1, 3 );
aLay->addWidget( myBGBox, 2, 0, 1, 3 );
2012-08-09 16:03:55 +06:00
aLay->addWidget( myWarning, 3, 0, 1, 3 );
2009-02-17 10:27:49 +05:00
connect(myBG, SIGNAL( buttonClicked( int ) ), this, SIGNAL( onClicked( int ) ) );
}
SMESHGUI_ConvToQuadDlg::~SMESHGUI_ConvToQuadDlg()
{
}
2013-03-06 19:57:01 +06:00
bool SMESHGUI_ConvToQuadDlg::IsBiQuadratic() const
{
return myRB2BiQua->isChecked();
}
bool SMESHGUI_ConvToQuadDlg::IsMediumNdsOnGeom() const
{
return !myMedNdsOnGeom->isChecked();
}
void SMESHGUI_ConvToQuadDlg::SetMediumNdsOnGeom(const bool theCheck)
{
myMedNdsOnGeom->setChecked(theCheck);
}
bool SMESHGUI_ConvToQuadDlg::IsEnabledCheck() const
{
return myMedNdsOnGeom->isEnabled();
}
void SMESHGUI_ConvToQuadDlg::SetEnabledCheck( const bool theCheck )
{
myMedNdsOnGeom->setEnabled( theCheck );
}
int SMESHGUI_ConvToQuadDlg::CurrentRB( )
{
2009-02-17 10:27:49 +05:00
return myBG->checkedId();
}
2012-08-09 16:03:55 +06:00
void SMESHGUI_ConvToQuadDlg::ShowWarning(bool toShow)
{
if ( toShow )
myWarning->show();
else
myWarning->hide();
}
bool SMESHGUI_ConvToQuadDlg::isWarningShown()
{
return myWarning->isVisible();
}
void SMESHGUI_ConvToQuadDlg::SetEnabledControls( const bool theCheck )
{
2012-08-09 16:03:55 +06:00
//myBGBox->setEnabled( theCheck );
2013-03-06 19:57:01 +06:00
myRB2Lin->setEnabled( theCheck );
myRB2Quad->setEnabled( theCheck );
myRB2BiQua->setEnabled( theCheck );
myMedNdsOnGeom->setEnabled( theCheck );
2012-08-09 16:03:55 +06:00
//setButtonEnabled( theCheck, QtxDialog::OK | QtxDialog::Apply );
}
void SMESHGUI_ConvToQuadDlg::SetEnabledRB( const int idx, const bool theCheck )
{
2013-03-06 19:57:01 +06:00
myRB2Lin ->setEnabled( idx & SMESHGUI_ConvToQuadOp::Linear );
myRB2Quad ->setEnabled( idx & SMESHGUI_ConvToQuadOp::Quadratic );
myRB2BiQua->setEnabled( idx & SMESHGUI_ConvToQuadOp::BiQuadratic );
if ( idx & SMESHGUI_ConvToQuadOp::Linear )
{
2013-03-06 19:57:01 +06:00
myRB2Lin->setChecked( true );
myRB2Quad->setChecked( false );
}
else
{
2013-03-06 19:57:01 +06:00
myRB2Lin->setChecked( false );
myRB2Quad->setChecked( true );
}
2013-03-06 19:57:01 +06:00
myRB2BiQua->setChecked( false );
2013-03-06 19:57:01 +06:00
myMedNdsOnGeom->setEnabled( theCheck );
2013-03-06 19:57:01 +06:00
emit onClicked( myBG->checkedId() );
}