]> SALOME platform Git repositories - modules/visu.git/blob - src/VISUGUI/VisuGUI_PartialScaDlg.cxx
Salome HOME
NRI : Correction 1.1a version.
[modules/visu.git] / src / VISUGUI / VisuGUI_PartialScaDlg.cxx
1 using namespace std;
2 //  File      : VisuGUI_PartialScaDlg.cxx
3 //  Created   : Wed Aug 01 10:23:06 2001
4 //  Author    : Laurent CORNABE & Hubert ROLLAND 
5 //  Project   : SALOME
6 //  Module    : VISUGUI
7 //  Copyright : PRINCIPIA
8 //  $Header$
9
10 #include "VisuGUI_PartialScaDlg.h"
11
12 #include <qgroupbox.h>
13 #include <qlabel.h>
14 #include <qlineedit.h>
15 #include <qpushbutton.h>
16 #include <qlayout.h>
17 #include <qvariant.h>
18 #include <qtooltip.h>
19 #include <qwhatsthis.h>
20
21 /*!
22   Constructor
23 */
24 VisuGUI_PartialScaDlg::VisuGUI_PartialScaDlg( QWidget* parent,  const char* name, bool modal, WFlags fl )
25     : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
26 {
27   if ( !name )
28     setName( "VisuGUI_PartialScaDlg" );
29   setCaption( tr( "Partial Scale" ) );
30   setSizeGripEnabled( TRUE );
31
32   QGridLayout* TopLayout = new QGridLayout( this ); 
33   TopLayout->setSpacing( 6 );
34   TopLayout->setMargin( 11 );
35   
36   TopGroup = new QGroupBox( this, "TopGroup" );
37   TopGroup->setColumnLayout(0, Qt::Vertical );
38   TopGroup->layout()->setSpacing( 0 );
39   TopGroup->layout()->setMargin( 0 );
40   QGridLayout* TopGroupLayout = new QGridLayout( TopGroup->layout() );
41   TopGroupLayout->setAlignment( Qt::AlignTop );
42   TopGroupLayout->setSpacing( 6 );
43   TopGroupLayout->setMargin( 11 );
44   
45   MinLabel = new QLabel( tr( "Min:" ), TopGroup, "MinLabel" );
46   MinSpin = new QAD_SpinBoxDbl( TopGroup, -999.99, 999.99, 0.1 );
47   MinSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
48   MinSpin->setMinimumSize( 70, 0 );
49   MinSpin->setValue( 0.0 );
50
51   MaxLabel = new QLabel( tr( "Max:" ), TopGroup, "MaxLabel" );
52   MaxSpin = new QAD_SpinBoxDbl( TopGroup, -999.99, 999.99, 0.1 );
53   MaxSpin->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
54   MaxSpin->setMinimumSize( 70, 0 );
55   MaxSpin->setValue( 0.0 );
56   
57   TopGroupLayout->addWidget( MinLabel, 0, 0 );
58   TopGroupLayout->addWidget( MinSpin,  0, 1 );
59   TopGroupLayout->addWidget( MaxLabel, 1, 0 );
60   TopGroupLayout->addWidget( MaxSpin,  1, 1 );
61
62   GroupButtons = new QGroupBox( this, "GroupButtons" );
63   GroupButtons->setColumnLayout(0, Qt::Vertical );
64   GroupButtons->layout()->setSpacing( 0 );
65   GroupButtons->layout()->setMargin( 0 );
66   QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
67   GroupButtonsLayout->setAlignment( Qt::AlignTop );
68   GroupButtonsLayout->setSpacing( 6 );
69   GroupButtonsLayout->setMargin( 11 );
70
71   buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
72   buttonOk->setAutoDefault( TRUE );
73   buttonOk->setDefault( TRUE );
74   GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
75   GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
76   buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
77   buttonCancel->setAutoDefault( TRUE );
78   GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
79   
80   TopLayout->addWidget( TopGroup,     0, 0 );
81   TopLayout->addWidget( GroupButtons, 1, 0 );
82
83   // signals and slots connections
84   connect( buttonOk,     SIGNAL( clicked() ), this, SLOT( accept() ) );
85   connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
86 }
87
88 /*!
89   Destructor
90 */
91 VisuGUI_PartialScaDlg::~VisuGUI_PartialScaDlg()
92 {
93 }
94
95 /*!
96   Sets min, max values
97 */
98 void VisuGUI_PartialScaDlg::setMinMax( const double min, const double max )
99 {
100   MinSpin->setValue( min );
101   MaxSpin->setValue( max );
102 }
103
104 /*!
105   Gets min value
106 */
107 double VisuGUI_PartialScaDlg::getMin()
108 {
109   return MinSpin->value();
110 }
111
112 /*!
113   Gets max value
114 */
115 double VisuGUI_PartialScaDlg::getMax()
116 {
117   return MaxSpin->value();
118 }
119