Salome HOME
101f4b47d397ca6e85297a0d4b8952a9836e2689
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_ConvToQuadDlg.cxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 /**
23 *  SMESH SMESHGUI
24 *
25 *  Copyright (C) 2005  CEA/DEN, EDF R&D
26 *
27 *
28 *
29 *  File   : SMESHGUI_ConvToQuadDlg.cxx
30 *  Module : SMESH
31 */
32
33 #include <SMESHGUI_ConvToQuadDlg.h>
34 #include <SUIT_Session.h>
35
36 #include <qgroupbox.h>
37 #include <qlayout.h>
38 #include <qcheckbox.h>
39 #include <qradiobutton.h>
40 #include <qbuttongroup.h>
41
42 SMESHGUI_ConvToQuadDlg::SMESHGUI_ConvToQuadDlg()
43 : SMESHGUI_Dialog( 0, false, true )
44 {
45
46   setCaption( tr( "CAPTION" ) );
47
48   // Create top controls  
49   QGroupBox* aGrp = new QGroupBox( 3, Qt::Horizontal, mainFrame() );
50   aGrp->setFrameStyle( QFrame::NoFrame );
51   aGrp->setInsideMargin( 0 );
52
53   // mesh
54   createObject( tr( "MESH" ), aGrp, 0 );
55
56   //Create check box
57    myMedNdsOnGeom = new QCheckBox( tr( "MEDIUMNDS" ), mainFrame() );
58
59   //Create RadioButtons
60   myBG = new QButtonGroup( 2, Qt::Vertical, "", mainFrame() );
61   myBG->setExclusive( true );
62   
63   myRB1 = new QRadioButton( myBG );  
64   myRB1->setText( tr( "RADIOBTN_1" ) );
65   myRB1->setChecked( true );
66
67   myRB2 = new QRadioButton( myBG );  
68   myRB2->setText( tr( "RADIOBTN_2" ) );
69
70   // Fill layout
71   QVBoxLayout* aLay = new QVBoxLayout( mainFrame(), 5, 5 );
72   aLay->addWidget( aGrp );
73   aLay->addWidget( myMedNdsOnGeom );
74   aLay->addWidget( myBG );
75   
76   connect(myBG, SIGNAL( clicked( int ) ), this, SIGNAL( onClicked( int ) ) );
77 }
78
79 SMESHGUI_ConvToQuadDlg::~SMESHGUI_ConvToQuadDlg()
80 {
81 }
82
83 bool SMESHGUI_ConvToQuadDlg::IsMediumNdsOnGeom() const
84 {
85   return !myMedNdsOnGeom->isChecked();
86 }
87
88 void SMESHGUI_ConvToQuadDlg::SetMediumNdsOnGeom(const bool theCheck)
89 {
90   myMedNdsOnGeom->setChecked(theCheck);
91 }
92
93 bool SMESHGUI_ConvToQuadDlg::IsEnabledCheck() const
94 {
95   return myMedNdsOnGeom->isEnabled();
96 }
97
98 void SMESHGUI_ConvToQuadDlg::SetEnabledCheck( const bool theCheck )
99 {
100   myMedNdsOnGeom->setEnabled( theCheck );
101 }
102
103 int SMESHGUI_ConvToQuadDlg::CurrentRB( )
104 {
105   return myBG->selectedId();
106 }
107
108 void SMESHGUI_ConvToQuadDlg::SetEnabledControls( const bool theCheck )
109 {
110   myBG->setEnabled( theCheck );
111   myMedNdsOnGeom->setEnabled( theCheck );
112   setButtonEnabled( theCheck, QtxDialog::OK | QtxDialog::Apply );
113 }
114
115 void SMESHGUI_ConvToQuadDlg::SetEnabledRB( const int idx, const bool theCheck ) 
116 {
117   if(idx)
118   {
119     myRB2->setEnabled( theCheck );
120     myRB1->setEnabled( !theCheck );
121     myRB1->setChecked( true );
122   }
123   else
124   {
125     myRB1->setEnabled( theCheck );
126     myRB2->setEnabled( !theCheck );
127     myRB2->setChecked( true );
128   }
129   emit onClicked( myBG->selectedId() );
130 }
131
132