1 // Copyright (C) 2007-2010 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
22 #include <ATOMICGUI_AddAtomDlg.h>
24 #include <qlineedit.h>
26 #include <QtxDoubleSpinBox.h>
28 #define DBL_MAX 1000.0
31 ATOMICGUI_AddAtomDlg::ATOMICGUI_AddAtomDlg( QWidget* parent )
32 : LightApp_Dialog( parent, 0, false, true, OK | Apply | Close )
34 setWindowTitle( tr( "CAPTION" ) );
36 QGridLayout* main = new QGridLayout( mainFrame() );
38 QLabel* xn = new QLabel( tr( "ATOMIC_ATOM" ) + ":", mainFrame() );
39 myName = new QLineEdit( mainFrame() );
41 QLabel* xl = new QLabel( "X:", mainFrame() );
42 myX = new QtxDoubleSpinBox( -DBL_MAX, DBL_MAX, 1, mainFrame() );
43 myX->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
45 QLabel* yl = new QLabel( "Y:", mainFrame() );
46 myY = new QtxDoubleSpinBox( -DBL_MAX, DBL_MAX, 1, mainFrame() );
47 myY->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
49 QLabel* zl = new QLabel( "Z:", mainFrame() );
50 myZ = new QtxDoubleSpinBox( -DBL_MAX, DBL_MAX, 1, mainFrame() );
51 myZ->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
53 main->addWidget( xn, 0, 0 );
54 main->addWidget( myName, 0, 1 );
55 main->addWidget( xl, 1, 0 );
56 main->addWidget( myX, 1, 1 );
57 main->addWidget( yl, 2, 0 );
58 main->addWidget( myY, 2, 1 );
59 main->addWidget( zl, 3, 0 );
60 main->addWidget( myZ, 3, 1 );
62 setButtonPosition( Right, Close );
70 ATOMICGUI_AddAtomDlg::~ATOMICGUI_AddAtomDlg()
74 /*! Validates data. */
75 bool ATOMICGUI_AddAtomDlg::acceptData( const QStringList& selected ) const
78 if( selected.count()!=1 )
82 return !myName->text().toLatin1().trimmed().isEmpty();
85 /*! Returns values of dialog widgets. */
86 void ATOMICGUI_AddAtomDlg::data( QString& name, double& x, double& y, double& z ) const
88 name = myName->text().toLatin1().trimmed();