Back to index

salome-smesh  6.5.0
SMESHGUI_ConvToQuadDlg.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 // SMESH SMESHGUI : GUI for SMESH component
00024 // File   : SMESHGUI_ConvToQuadDlg.cxx
00025 // Author : Open CASCADE S.A.S.
00026 // SMESH includes
00027 //
00028 #include "SMESHGUI_ConvToQuadDlg.h"
00029 
00030 // Qt includes
00031 #include <QGroupBox>
00032 #include <QCheckBox>
00033 #include <QRadioButton>
00034 #include <QButtonGroup>
00035 #include <QGroupBox>
00036 #include <QFrame>
00037 #include <QHBoxLayout>
00038 #include <QGridLayout>
00039 #include <QLabel>
00040 
00041 #define SPACING 6
00042 #define MARGIN  11
00043 
00044 SMESHGUI_ConvToQuadDlg::SMESHGUI_ConvToQuadDlg()
00045   : SMESHGUI_Dialog( 0, false, true )
00046 {
00047   setWindowTitle( tr( "CAPTION" ) );
00048 
00049   // Create top controls  
00050 
00051   // mesh
00052   setObjectPixmap( "SMESH", tr( "ICON_SELECT" ) );
00053   createObject( tr( "MESH" ), mainFrame(), 0 );
00054 
00055   //Create check box
00056   myMedNdsOnGeom = new QCheckBox( tr( "MEDIUMNDS" ), mainFrame() );
00057 
00058   //Create RadioButtons
00059   myBGBox = new QGroupBox( mainFrame() );
00060   myBG = new QButtonGroup( mainFrame() );
00061   QVBoxLayout* aBGLayout = new QVBoxLayout( myBGBox );
00062   aBGLayout->setMargin(MARGIN);
00063   aBGLayout->setSpacing(SPACING);
00064   
00065   myRB1 = new QRadioButton( tr( "RADIOBTN_1" ), myBGBox );
00066   myRB2 = new QRadioButton( tr( "RADIOBTN_2" ), myBGBox );
00067 
00068   aBGLayout->addWidget(myRB1);
00069   aBGLayout->addWidget(myRB2);
00070   myBG->addButton(myRB1, 0);
00071   myBG->addButton(myRB2, 1);
00072   myRB1->setChecked( true );
00073 
00074   myWarning = new QLabel(QString("<b>%1</b>").arg(tr("NON_CONFORM_WARNING")), mainFrame());
00075 
00076   // Fill layout
00077   QGridLayout* aLay = new QGridLayout( mainFrame() );
00078   aLay->setMargin( 5 );
00079   aLay->setSpacing( 5 );
00080 
00081   aLay->addWidget( objectWg( 0,  Label ),   0, 0 );
00082   aLay->addWidget( objectWg( 0,  Btn ),     0, 1 );
00083   aLay->addWidget( objectWg( 0,  Control ), 0, 2 );
00084   aLay->addWidget( myMedNdsOnGeom,          1, 0, 1, 3 );
00085   aLay->addWidget( myBGBox,                 2, 0, 1, 3 );
00086   aLay->addWidget( myWarning,               3, 0, 1, 3 );
00087   
00088   connect(myBG, SIGNAL( buttonClicked( int ) ), this, SIGNAL( onClicked( int ) ) );
00089 }
00090 
00091 SMESHGUI_ConvToQuadDlg::~SMESHGUI_ConvToQuadDlg()
00092 {
00093 }
00094 
00095 bool SMESHGUI_ConvToQuadDlg::IsMediumNdsOnGeom() const
00096 {
00097   return !myMedNdsOnGeom->isChecked();
00098 }
00099 
00100 void SMESHGUI_ConvToQuadDlg::SetMediumNdsOnGeom(const bool theCheck)
00101 {
00102   myMedNdsOnGeom->setChecked(theCheck);
00103 }
00104 
00105 bool SMESHGUI_ConvToQuadDlg::IsEnabledCheck() const
00106 {
00107   return myMedNdsOnGeom->isEnabled();
00108 }
00109 
00110 void SMESHGUI_ConvToQuadDlg::SetEnabledCheck( const bool theCheck )
00111 {
00112   myMedNdsOnGeom->setEnabled( theCheck );
00113 }
00114 
00115 int SMESHGUI_ConvToQuadDlg::CurrentRB( )
00116 {
00117   return myBG->checkedId();
00118 }
00119 
00120 void SMESHGUI_ConvToQuadDlg::ShowWarning(bool toShow)
00121 {
00122   if ( toShow )
00123     myWarning->show();
00124   else
00125     myWarning->hide();
00126 }
00127 
00128 bool SMESHGUI_ConvToQuadDlg::isWarningShown()
00129 {
00130   return myWarning->isVisible();
00131 }
00132 
00133 void SMESHGUI_ConvToQuadDlg::SetEnabledControls( const bool theCheck )
00134 {
00135   //myBGBox->setEnabled( theCheck );
00136   myRB1->setEnabled( theCheck );
00137   myRB2->setEnabled( theCheck );
00138   myMedNdsOnGeom->setEnabled( theCheck );
00139   //setButtonEnabled( theCheck, QtxDialog::OK | QtxDialog::Apply );
00140 }
00141 
00142 void SMESHGUI_ConvToQuadDlg::SetEnabledRB( const int idx, const bool theCheck ) 
00143 {
00144   if(idx)
00145   {
00146     myRB2->setEnabled( theCheck );
00147     myRB1->setEnabled( !theCheck );
00148     myRB1->setChecked( true );
00149   }
00150   else
00151   {
00152     myRB1->setEnabled( theCheck );
00153     myRB2->setEnabled( !theCheck );
00154     myRB2->setChecked( true );
00155   }
00156   emit onClicked( myBG->checkedId() );
00157 }
00158 
00159