1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include <ATOMICGUI_AddAtomDlg.h>
22 #include <qlineedit.h>
24 #include <QtxDoubleSpinBox.h>
26 #define DBL_MAX 1000.0
29 ATOMICGUI_AddAtomDlg::ATOMICGUI_AddAtomDlg( QWidget* parent )
30 : LightApp_Dialog( parent, 0, false, true, OK | Apply | Close )
32 setWindowTitle( tr( "CAPTION" ) );
34 QGridLayout* main = new QGridLayout( mainFrame() );
36 QLabel* xn = new QLabel( tr( "ATOMIC_ATOM" ) + ":", mainFrame() );
37 myName = new QLineEdit( mainFrame() );
39 QLabel* xl = new QLabel( "X:", mainFrame() );
40 myX = new QtxDoubleSpinBox( -DBL_MAX, DBL_MAX, 1, mainFrame() );
41 myX->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
43 QLabel* yl = new QLabel( "Y:", mainFrame() );
44 myY = new QtxDoubleSpinBox( -DBL_MAX, DBL_MAX, 1, mainFrame() );
45 myY->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
47 QLabel* zl = new QLabel( "Z:", mainFrame() );
48 myZ = new QtxDoubleSpinBox( -DBL_MAX, DBL_MAX, 1, mainFrame() );
49 myZ->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
51 main->addWidget( xn, 0, 0 );
52 main->addWidget( myName, 0, 1 );
53 main->addWidget( xl, 1, 0 );
54 main->addWidget( myX, 1, 1 );
55 main->addWidget( yl, 2, 0 );
56 main->addWidget( myY, 2, 1 );
57 main->addWidget( zl, 3, 0 );
58 main->addWidget( myZ, 3, 1 );
60 setButtonPosition( Right, Close );
68 ATOMICGUI_AddAtomDlg::~ATOMICGUI_AddAtomDlg()
72 /*! Validates data. */
73 bool ATOMICGUI_AddAtomDlg::acceptData( const QStringList& selected ) const
76 if( selected.count()!=1 )
80 return !myName->text().toLatin1().trimmed().isEmpty();
83 /*! Returns values of dialog widgets. */
84 void ATOMICGUI_AddAtomDlg::data( QString& name, double& x, double& y, double& z ) const
86 name = myName->text().toLatin1().trimmed();