Salome HOME
Merge with version on tag OCC-V2_1_0d
[modules/geom.git] / src / DlgRef / DlgRef_3Sel3Spin1Check.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   : DlgRef_3Sel3Spin1Check.cxx
25 //  Author : Michael Zorin
26 //  Module : GEOM
27 //  $Header: 
28
29 #include <DlgRef_3Sel3Spin1Check.h>
30 #include <qlabel.h>
31 #include <qpushbutton.h>
32 #include <qlineedit.h>
33 #include <qcheckbox.h>
34 #include <qspinbox.h>
35 #include <qlayout.h>
36 #include <qgroupbox.h>
37
38
39 /* 
40  *  Constructs a DlgRef_3Sel3Spin1Check which is a child of 'parent', with the 
41  *  name 'name' and widget flags set to 'f' 
42  */
43 DlgRef_3Sel3Spin1Check::DlgRef_3Sel3Spin1Check(QWidget* parent,  const char* name, WFlags fl)
44   :DlgRef_3Sel3Spin1Check_QTD(parent, name, fl)
45 {
46   SpinBox_1->close(TRUE);
47   SpinBox_2->close(TRUE);
48   SpinBox_3->close(TRUE);
49   SpinBox1 = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX");
50   SpinBox2 = new DlgRef_SpinBox(GroupBox1, "SpinBox_DY");
51   SpinBox3 = new DlgRef_SpinBox(GroupBox1, "SpinBox_DZ");
52   Layout1->addWidget(SpinBox1, 3, 2);
53   Layout1->addWidget(SpinBox2, 4, 2);
54   Layout1->addWidget(SpinBox3, 5, 2);
55 }
56
57
58 /*  
59  *  Destroys the object and frees any allocated resources
60  */
61 DlgRef_3Sel3Spin1Check::~DlgRef_3Sel3Spin1Check()
62 {
63     // no need to delete child widgets, Qt does it all for us
64 }
65
66 void DlgRef_3Sel3Spin1Check:: ShowRows(int fromRow, int toRow, bool toShow)
67 {
68   typedef void (QWidget::* ShowFun)(); 
69   ShowFun pShowFun;    
70
71   if (toShow)
72         pShowFun = &QWidget::show;
73   else
74         pShowFun = &QWidget::hide;
75
76   if (fromRow >= 0 && toRow>=0 && toRow >= fromRow)
77     {
78       if ( fromRow == 0)
79         {
80           (TextLabel1->*pShowFun)();
81           (PushButton1->*pShowFun)();
82           (LineEdit1->*pShowFun)();
83         }
84       if ( fromRow <= 1 && 1 <= toRow)
85         {
86           (TextLabel2->*pShowFun)();
87           (PushButton2->*pShowFun)();
88           (LineEdit2->*pShowFun)(); 
89         }
90       if ( fromRow <= 2 && 2 <= toRow)
91         {
92           (TextLabel3->*pShowFun)();
93           (PushButton3->*pShowFun)();
94           (LineEdit3->*pShowFun)(); 
95         }
96       if ( fromRow <= 3 && 3 <= toRow)
97         {
98           (TextLabel4->*pShowFun)();
99           (SpinBox1->*pShowFun)();
100         }
101       if ( fromRow <= 4 && 4 <= toRow)
102         {
103           (TextLabel5->*pShowFun)();
104           (SpinBox2->*pShowFun)();
105         }
106       if ( fromRow <= 5 && 5 <= toRow)
107         {
108           (TextLabel6->*pShowFun)();
109           (SpinBox3->*pShowFun)();
110         }
111       if ( fromRow <= 6 && 6 <= toRow)
112         (CheckBox1->*pShowFun)();
113     }
114 }