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_PartialScaDlg.cxx
25 // Author : Laurent CORNABE & Hubert ROLLAND
30 #include "VisuGUI_PartialScaDlg.h"
32 #include <qgroupbox.h>
34 #include <qlineedit.h>
35 #include <qpushbutton.h>
39 #include <qwhatsthis.h>
44 VisuGUI_PartialScaDlg::VisuGUI_PartialScaDlg( 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_PartialScaDlg" );
49 setCaption( tr( "Partial Scale" ) );
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 MinLabel = new QLabel( tr( "Min:" ), TopGroup, "MinLabel" );
66 MinSpin = new QAD_SpinBoxDbl( TopGroup, -999.99, 999.99, 0.1 );
67 MinSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
68 MinSpin->setMinimumSize( 70, 0 );
69 MinSpin->setValue( 0.0 );
71 MaxLabel = new QLabel( tr( "Max:" ), TopGroup, "MaxLabel" );
72 MaxSpin = new QAD_SpinBoxDbl( TopGroup, -999.99, 999.99, 0.1 );
73 MaxSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
74 MaxSpin->setMinimumSize( 70, 0 );
75 MaxSpin->setValue( 0.0 );
77 TopGroupLayout->addWidget( MinLabel, 0, 0 );
78 TopGroupLayout->addWidget( MinSpin, 0, 1 );
79 TopGroupLayout->addWidget( MaxLabel, 1, 0 );
80 TopGroupLayout->addWidget( MaxSpin, 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_PartialScaDlg::~VisuGUI_PartialScaDlg()
118 void VisuGUI_PartialScaDlg::setMinMax( const double min, const double max )
120 MinSpin->setValue( min );
121 MaxSpin->setValue( max );
127 double VisuGUI_PartialScaDlg::getMin()
129 return MinSpin->value();
135 double VisuGUI_PartialScaDlg::getMax()
137 return MaxSpin->value();