1 // Copyright (C) 2007-2012 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 // SMESH SMESHGUI : GUI for SMESH component
24 // File : SMESHGUI_ConvToQuadDlg.cxx
25 // Author : Open CASCADE S.A.S.
28 #include "SMESHGUI_ConvToQuadDlg.h"
33 #include <QRadioButton>
34 #include <QButtonGroup>
37 #include <QHBoxLayout>
38 #include <QGridLayout>
44 SMESHGUI_ConvToQuadDlg::SMESHGUI_ConvToQuadDlg()
45 : SMESHGUI_Dialog( 0, false, true )
47 setWindowTitle( tr( "CAPTION" ) );
49 // Create top controls
52 setObjectPixmap( "SMESH", tr( "ICON_SELECT" ) );
53 createObject( tr( "MESH" ), mainFrame(), 0 );
56 myMedNdsOnGeom = new QCheckBox( tr( "MEDIUMNDS" ), mainFrame() );
59 myBGBox = new QGroupBox( mainFrame() );
60 myBG = new QButtonGroup( mainFrame() );
61 QVBoxLayout* aBGLayout = new QVBoxLayout( myBGBox );
62 aBGLayout->setMargin(MARGIN);
63 aBGLayout->setSpacing(SPACING);
65 myRB1 = new QRadioButton( tr( "RADIOBTN_1" ), myBGBox );
66 myRB2 = new QRadioButton( tr( "RADIOBTN_2" ), myBGBox );
68 aBGLayout->addWidget(myRB1);
69 aBGLayout->addWidget(myRB2);
70 myBG->addButton(myRB1, 0);
71 myBG->addButton(myRB2, 1);
72 myRB1->setChecked( true );
74 myWarning = new QLabel(QString("<b>%1</b>").arg(tr("NON_CONFORM_WARNING")), mainFrame());
77 QGridLayout* aLay = new QGridLayout( mainFrame() );
79 aLay->setSpacing( 5 );
81 aLay->addWidget( objectWg( 0, Label ), 0, 0 );
82 aLay->addWidget( objectWg( 0, Btn ), 0, 1 );
83 aLay->addWidget( objectWg( 0, Control ), 0, 2 );
84 aLay->addWidget( myMedNdsOnGeom, 1, 0, 1, 3 );
85 aLay->addWidget( myBGBox, 2, 0, 1, 3 );
86 aLay->addWidget( myWarning, 3, 0, 1, 3 );
88 connect(myBG, SIGNAL( buttonClicked( int ) ), this, SIGNAL( onClicked( int ) ) );
91 SMESHGUI_ConvToQuadDlg::~SMESHGUI_ConvToQuadDlg()
95 bool SMESHGUI_ConvToQuadDlg::IsMediumNdsOnGeom() const
97 return !myMedNdsOnGeom->isChecked();
100 void SMESHGUI_ConvToQuadDlg::SetMediumNdsOnGeom(const bool theCheck)
102 myMedNdsOnGeom->setChecked(theCheck);
105 bool SMESHGUI_ConvToQuadDlg::IsEnabledCheck() const
107 return myMedNdsOnGeom->isEnabled();
110 void SMESHGUI_ConvToQuadDlg::SetEnabledCheck( const bool theCheck )
112 myMedNdsOnGeom->setEnabled( theCheck );
115 int SMESHGUI_ConvToQuadDlg::CurrentRB( )
117 return myBG->checkedId();
120 void SMESHGUI_ConvToQuadDlg::ShowWarning(bool toShow)
128 bool SMESHGUI_ConvToQuadDlg::isWarningShown()
130 return myWarning->isVisible();
133 void SMESHGUI_ConvToQuadDlg::SetEnabledControls( const bool theCheck )
135 //myBGBox->setEnabled( theCheck );
136 myRB1->setEnabled( theCheck );
137 myRB2->setEnabled( theCheck );
138 myMedNdsOnGeom->setEnabled( theCheck );
139 //setButtonEnabled( theCheck, QtxDialog::OK | QtxDialog::Apply );
142 void SMESHGUI_ConvToQuadDlg::SetEnabledRB( const int idx, const bool theCheck )
146 myRB2->setEnabled( theCheck );
147 myRB1->setEnabled( !theCheck );
148 myRB1->setChecked( true );
152 myRB1->setEnabled( theCheck );
153 myRB2->setEnabled( !theCheck );
154 myRB2->setChecked( true );
156 emit onClicked( myBG->checkedId() );