]> SALOME platform Git repositories - modules/geom.git/blob - src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.cxx
Salome HOME
Windows porting
[modules/geom.git] / src / GEOMToolsGUI / GEOMToolsGUI_NbIsosDlg.cxx
1 //  GEOM GEOMGUI : GUI for Geometry component
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
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. 
10 // 
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. 
15 // 
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 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : GEOMBase_NbIsosDlg.cxx
25 //  Author : 
26 //  Module : GEOM
27 //  $Header: 
28
29
30 #include "GEOMToolsGUI_NbIsosDlg.h"
31 #include <SUIT_Tools.h>
32
33 #include <qlabel.h>
34 #include <qpushbutton.h>
35 #include <qgroupbox.h>
36 #include <qlayout.h>
37 #include <qspinbox.h>
38 //using namespace std;
39
40 //=================================================================================
41 // class    : GEOMToolsGUI_NbIsosDlg()
42 // purpose  : Constructs a GEOMToolsGUI_NbIsosDlg which is a child of 'parent', with the 
43 //            name 'name' and widget flags set to 'f'.
44 //            The dialog will by default be modeless, unless you set 'modal' to
45 //            TRUE to construct a modal dialog.
46 //=================================================================================
47 GEOMToolsGUI_NbIsosDlg::GEOMToolsGUI_NbIsosDlg(QWidget* parent )
48   :QDialog( parent, "GEOMToolsGUI_NbIsosDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
49 {
50   setCaption( tr( "GEOM_MEN_ISOS" ) );
51   setSizeGripEnabled(TRUE);
52   QGridLayout* MyDialogLayout = new QGridLayout(this); 
53   MyDialogLayout->setSpacing(6);
54   MyDialogLayout->setMargin(11);
55   
56   /***************************************************************/
57   QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" );
58   GroupC1->setColumnLayout(0, Qt::Vertical );
59   GroupC1->layout()->setSpacing( 0 );
60   GroupC1->layout()->setMargin( 0 );
61   QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() );
62   GroupC1Layout->setAlignment( Qt::AlignTop );
63   GroupC1Layout->setSpacing( 6 );
64   GroupC1Layout->setMargin( 11 );
65   
66   QLabel* TextLabel1 = new QLabel( GroupC1, "TextLabel1" );
67   TextLabel1->setText( tr( "GEOM_MEN_ISOU") );
68   GroupC1Layout->addWidget( TextLabel1, 0, 0 );
69   
70   SpinBoxU = new QSpinBox( GroupC1, "SpinBoxU" );
71   SpinBoxU->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
72   SpinBoxU->setMinValue( 0 );
73   SpinBoxU->setValue( 1 );
74   GroupC1Layout->addWidget( SpinBoxU, 0, 1 );
75
76   QLabel* TextLabel2 = new QLabel( GroupC1, "TextLabel2" );
77   TextLabel2->setText( tr( "GEOM_MEN_ISOV") ) ;
78   GroupC1Layout->addWidget( TextLabel2, 0, 2 );
79
80   SpinBoxV = new QSpinBox( GroupC1, "SpinBoxV");
81   SpinBoxV->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
82   SpinBoxV->setValue( 1 );
83   SpinBoxV->setMinValue( 0 );
84   GroupC1Layout->addWidget( SpinBoxV, 0, 3 );
85   
86   /***************************************************************/
87   QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
88   GroupButtons->setColumnLayout(0, Qt::Vertical );
89   GroupButtons->layout()->setSpacing( 0 );
90   GroupButtons->layout()->setMargin( 0 );
91   QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
92   GroupButtonsLayout->setAlignment( Qt::AlignTop );
93   GroupButtonsLayout->setSpacing( 6 );
94   GroupButtonsLayout->setMargin( 11 );
95   
96   QPushButton* buttonOk = new QPushButton( GroupButtons, "buttonOk" );
97   buttonOk->setText( tr( "GEOM_BUT_OK" ) ) ;
98   buttonOk->setAutoDefault( TRUE );
99   buttonOk->setDefault( TRUE );
100   GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
101   
102   GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
103   
104   QPushButton* buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
105   buttonCancel->setText( tr( "GEOM_BUT_CANCEL" ) ) ;
106   buttonCancel->setAutoDefault( TRUE );
107   GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
108   /***************************************************************/
109   
110   MyDialogLayout->addWidget(GroupC1, 0, 0);
111   MyDialogLayout->addWidget(GroupButtons, 1, 0);
112  
113   
114   // signals and slots connections
115   connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
116   connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
117   
118   /* Move widget on the botton right corner of main widget */
119   SUIT_Tools::centerWidget(this, parent);
120 }
121
122
123 //=================================================================================
124 // function : ~GEOMToolsGUI_NbIsosDlg()
125 // purpose  : Destroys the object and frees any allocated resources
126 //=================================================================================
127 GEOMToolsGUI_NbIsosDlg::~GEOMToolsGUI_NbIsosDlg()
128 {
129     // no need to delete child widgets, Qt does it all for us
130 }
131
132 int GEOMToolsGUI_NbIsosDlg::getU() const
133 {
134   return SpinBoxU->text().toInt();
135 }
136
137 int GEOMToolsGUI_NbIsosDlg::getV() const
138 {
139   return SpinBoxV->text().toInt();
140 }
141
142 void GEOMToolsGUI_NbIsosDlg::setU( const int v )
143 {
144   SpinBoxU->setValue( v );
145 }
146
147 void GEOMToolsGUI_NbIsosDlg::setV( const int v )
148 {
149   SpinBoxV->setValue( v );
150 }
151