Salome HOME
0020154: Implement major axis support for ellipse creation (merge development from...
[modules/geom.git] / src / DlgRef / DlgRef_4Sel1Spin2Check.cxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  GEOM GEOMGUI : GUI for Geometry component
23 //  File   : DlgRef_4Sel1Spin2Check.cxx
24 //  Author : Damien COQUERET
25 //  Module : GEOM
26 //  $Header: 
27 //
28 #include "DlgRef_4Sel1Spin2Check.h"
29
30 #include <qlabel.h>
31 #include <qpushbutton.h>
32 #include <qlineedit.h>
33 #include <qcheckbox.h>
34 #include <qlayout.h>
35 #include <qspinbox.h>
36 #include <qgroupbox.h>
37
38 /* 
39  *  Constructs a DlgRef_4Sel1Spin2Check which is a child of 'parent', with the 
40  *  name 'name' and widget flags set to 'f' 
41  */
42 DlgRef_4Sel1Spin2Check::DlgRef_4Sel1Spin2Check(QWidget* parent, const char* name, WFlags fl)
43   :DlgRef_4Sel1Spin2Check_QTD(parent, name, fl)
44 {
45   SpinBox1->close(TRUE);
46   SpinBox_DX = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX");
47   Layout1->addWidget(SpinBox_DX, 4, 2);
48 }
49
50
51 /*  
52  *  Destroys the object and frees any allocated resources
53  */
54 DlgRef_4Sel1Spin2Check::~DlgRef_4Sel1Spin2Check()
55 {
56     // no need to delete child widgets, Qt does it all for us
57 }
58
59 void DlgRef_4Sel1Spin2Check::ShowRows(int fromRow, int toRow, bool toShow)
60 {
61   typedef void (QWidget::* ShowFun)(); 
62   ShowFun pShowFun;    
63
64   if (toShow)
65         pShowFun = &QWidget::show;
66   else
67         pShowFun = &QWidget::hide;
68
69   if (fromRow >= 0 && toRow >= 0 && toRow >= fromRow)
70   {
71     if ( fromRow == 0)
72     {
73       (TextLabel1->*pShowFun)();
74       (PushButton1->*pShowFun)();
75       (LineEdit1->*pShowFun)();
76     }
77     if ( fromRow <= 1 && 1 <= toRow)
78     {
79       (TextLabel2->*pShowFun)();
80       (PushButton2->*pShowFun)();
81       (LineEdit2->*pShowFun)(); 
82     }
83     if ( fromRow <= 2 && 2 <= toRow)
84     {
85       (TextLabel4->*pShowFun)();
86       (PushButton4->*pShowFun)();
87       (LineEdit4->*pShowFun)(); 
88     }
89     if ( fromRow <= 3 && 3 <= toRow)
90     {
91       (TextLabel5->*pShowFun)();
92       (PushButton5->*pShowFun)();
93       (LineEdit5->*pShowFun)(); 
94     }
95     if ( fromRow <= 4 && 4 <= toRow)
96     {
97       (TextLabel3->*pShowFun)();
98       (SpinBox_DX->*pShowFun)();
99       (CheckButton2->*pShowFun)();
100     }
101     if ( fromRow <= 5 && 5 <= toRow)
102     (CheckButton1->*pShowFun)();
103   }
104 }
105