1 // VISU VISUGUI : GUI of VISU component
3 // Copyright (C) 2003 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
24 // File : VisuGUI_PhaseMagnitudeDlg.cxx
25 // Author : Laurent CORNABE & Hubert ROLLAND
30 #include "VisuGUI_PhaseMagnitudeDlg.h"
32 #include <qgroupbox.h>
34 #include <qlineedit.h>
35 #include <qpushbutton.h>
39 #include <qwhatsthis.h>
44 VisuGUI_PhaseMagnitudeDlg::VisuGUI_PhaseMagnitudeDlg( QWidget* parent, const char* name, bool modal, WFlags fl )
45 : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
48 setName( "VisuGUI_PhaseMagnitudeDlg" );
49 setCaption( tr( "Phase Magnitude" ) );
50 setSizeGripEnabled( TRUE );
52 QGridLayout* TopLayout = new QGridLayout( this );
53 TopLayout->setSpacing( 6 );
54 TopLayout->setMargin( 11 );
56 TopGroup = new QGroupBox( this, "TopGroup" );
57 TopGroup->setColumnLayout(0, Qt::Vertical );
58 TopGroup->layout()->setSpacing( 0 );
59 TopGroup->layout()->setMargin( 0 );
60 QGridLayout* TopGroupLayout = new QGridLayout( TopGroup->layout() );
61 TopGroupLayout->setAlignment( Qt::AlignTop );
62 TopGroupLayout->setSpacing( 6 );
63 TopGroupLayout->setMargin( 11 );
65 PhaseLabel = new QLabel( tr( "Phase:" ), TopGroup, "PhaseLabel" );
66 PhaseSpin = new QAD_SpinBoxDbl( TopGroup, -999.99, 999.99, 0.1 );
67 PhaseSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
68 PhaseSpin->setMinimumSize( 70, 0 );
69 PhaseSpin->setValue( 0.0 );
71 MagnLabel = new QLabel( tr( "Magnitude:" ), TopGroup, "MagnLabel" );
72 MagnSpin = new QAD_SpinBoxDbl( TopGroup, -999.99, 999.99, 0.1 );
73 MagnSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
74 MagnSpin->setMinimumSize( 70, 0 );
75 MagnSpin->setValue( 0.0 );
77 TopGroupLayout->addWidget( PhaseLabel, 0, 0 );
78 TopGroupLayout->addWidget( PhaseSpin, 0, 1 );
79 TopGroupLayout->addWidget( MagnLabel, 1, 0 );
80 TopGroupLayout->addWidget( MagnSpin, 1, 1 );
82 GroupButtons = new QGroupBox( this, "GroupButtons" );
83 GroupButtons->setColumnLayout(0, Qt::Vertical );
84 GroupButtons->layout()->setSpacing( 0 );
85 GroupButtons->layout()->setMargin( 0 );
86 QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
87 GroupButtonsLayout->setAlignment( Qt::AlignTop );
88 GroupButtonsLayout->setSpacing( 6 );
89 GroupButtonsLayout->setMargin( 11 );
91 buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
92 buttonOk->setAutoDefault( TRUE );
93 buttonOk->setDefault( TRUE );
94 GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
95 GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
96 buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
97 buttonCancel->setAutoDefault( TRUE );
98 GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
100 TopLayout->addWidget( TopGroup, 0, 0 );
101 TopLayout->addWidget( GroupButtons, 1, 0 );
103 // signals and slots connections
104 connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
105 connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
111 VisuGUI_PhaseMagnitudeDlg::~VisuGUI_PhaseMagnitudeDlg()
118 void VisuGUI_PhaseMagnitudeDlg::setPhase( const double ph )
120 PhaseSpin->setValue( ph );
126 double VisuGUI_PhaseMagnitudeDlg::getPhase()
128 return PhaseSpin->value();
134 void VisuGUI_PhaseMagnitudeDlg::setMagnitude( const double magn )
136 MagnSpin->setValue( magn );
142 double VisuGUI_PhaseMagnitudeDlg::getMagnitude()
144 return MagnSpin->value();