Salome HOME
refs #431: margins are updated
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_LocalCSDlg.cxx
1 // Copyright (C) 2007-2013  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 #include <HYDROGUI_LocalCSDlg.h>
24 #include <QtxDoubleSpinBox.h>
25 #include <QLayout>
26 #include <QLabel>
27
28 const double RANGE = 1E+10;
29 const double STEP = 1.00;
30 const double PREC = 2;
31
32 HYDROGUI_LocalCSDlg::HYDROGUI_LocalCSDlg( HYDROGUI_Module* theModule, const QString& theTitle )
33 : HYDROGUI_InputPanel( theModule, theTitle )
34 {
35   QFrame* aFrame = new QFrame( mainFrame() );
36   addWidget( aFrame, 1 );
37
38   QGridLayout* aLayout = new QGridLayout( aFrame );
39   aLayout->setMargin( 5 );
40   aLayout->setSpacing( 5 );
41
42   myLX = new QtxDoubleSpinBox( 0, RANGE, STEP, PREC, PREC, aFrame );
43   myLX->setValue( 0.0 );
44   myLY = new QtxDoubleSpinBox( 0, RANGE, STEP, PREC, PREC, aFrame );
45   myLY->setValue( 0.0 );
46
47   aLayout->addWidget( new QLabel( tr( "LX" ), aFrame ), 0, 0 );
48   aLayout->addWidget( myLX, 0, 1 );
49   aLayout->addWidget( new QLabel( tr( "LY" ), aFrame ), 1, 0 );
50   aLayout->addWidget( myLY, 1, 1 );
51   aLayout->setColumnStretch( 0, 0 );
52   aLayout->setColumnStretch( 1, 1 );
53   aLayout->setRowStretch( 2, 1 );
54 }
55
56 HYDROGUI_LocalCSDlg::~HYDROGUI_LocalCSDlg()
57 {
58 }
59
60 double HYDROGUI_LocalCSDlg::GetLocalX() const
61 {
62   return myLX->value();
63 }
64
65 double HYDROGUI_LocalCSDlg::GetLocalY() const
66 {
67   return myLY->value();
68 }
69
70 void HYDROGUI_LocalCSDlg::SetLocalCS( double theLX, double theLY )
71 {
72   myLX->setValue( theLX );
73   myLY->setValue( theLY );
74 }
75