Salome HOME
Add copyright header according to request of CEA from 06.06.2017
[modules/shaper.git] / src / XGUI / XGUI_DeflectionDialog.cpp
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #include <XGUI_DeflectionDialog.h>
22
23 #include <ModelAPI_Tools.h>
24
25 #include <ModuleBase_DoubleSpinBox.h>
26
27 #include <QLabel>
28 #include <QButtonGroup>
29 #include <QGridLayout>
30 #include <QRadioButton>
31 #include <QDialogButtonBox>
32
33 XGUI_DeflectionDialog::XGUI_DeflectionDialog(QWidget* theParent)
34   : QDialog(theParent)
35 {
36   setWindowTitle(tr("Deflection"));
37   QGridLayout* aLay = new QGridLayout(this);
38
39   myDeflection = new ModuleBase_DoubleSpinBox(this);
40   myDeflection->setDecimals(12);
41   myDeflection->setRange(0, 1);
42   myDeflection->setSingleStep(0.001);
43   aLay->addWidget(myDeflection, 0, 0);
44
45   QDialogButtonBox* aButtons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
46                                                     Qt::Horizontal, this);
47   connect(aButtons, SIGNAL(accepted()), this, SLOT(accept()));
48   connect(aButtons, SIGNAL(rejected()), this, SLOT(reject()));
49   aLay->addWidget(aButtons, 1, 0);
50 }
51
52 void XGUI_DeflectionDialog::setDeflection(const double& theValue)
53 {
54   myDeflection->setValue(theValue);
55 }
56
57 double XGUI_DeflectionDialog::getDeflection() const
58 {
59   return myDeflection->value();
60 }