Salome HOME
NRI : Merge from V1_2.
[modules/geom.git] / src / GEOMGUI / GeometryGUI_TorusDlg.h
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   : GeometryGUI_TorusDlg.h
25 //  Author : Lucien PIGNOLONI
26 //  Module : GEOM
27 //  $Header$
28
29 #ifndef DIALOGBOX_TORUS_H
30 #define DIALOGBOX_TORUS_H
31
32 #include "SALOME_Selection.h"
33 #include "GEOM_ShapeTypeFilter.hxx"
34 #include "GEOM_EdgeFilter.hxx"
35 #include "GeometryGUI_SpinBox.h"
36
37 #include <TopoDS_Shape.hxx>
38 #include <BRepPrimAPI_MakeTorus.hxx>
39 #include <gp_Pnt.hxx>
40 #include <gp_Dir.hxx>
41
42 #include <qvariant.h>
43 #include <qdialog.h>
44 #include <qvalidator.h>
45
46 class QVBoxLayout; 
47 class QHBoxLayout; 
48 class QGridLayout; 
49 class QButtonGroup;
50 class QGroupBox;
51 class QLabel;
52 class QLineEdit;
53 class QPushButton;
54 class QRadioButton;
55 class QSpinBox ;
56 class GeometryGUI;
57
58
59 //=================================================================================
60 // class    : GeometryGUI_TorusDlg
61 // purpose  :
62 //=================================================================================
63 class GeometryGUI_TorusDlg : public QDialog
64
65     Q_OBJECT
66
67 public:
68     GeometryGUI_TorusDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
69     ~GeometryGUI_TorusDlg();
70
71 private:
72
73     void Init( SALOME_Selection* Sel ) ;
74     void closeEvent( QCloseEvent* e ) ;
75     void enterEvent ( QEvent * ) ;                 /* mouse enter the QWidget */
76     void MakeTorusSimulationAndDisplay() ;
77
78     GEOM::GEOM_Gen_var myGeom ;                 /* Current GeomI object */
79     GeometryGUI*          myGeomGUI ;              /* Current GeomGUI object */
80     TopoDS_Shape          mySimulationTopoDs ;
81     SALOME_Selection*     mySelection ;            /* User shape selection */
82
83     gp_Pnt                myPoint1 ;               /* Topology used  */
84     gp_Dir                myDir ;
85     bool                  myOkPoint1 ;
86     bool                  myOkDir ;                /* to check when arguments is defined */
87
88     Standard_Real         myRadius1 ;
89     Standard_Real         myRadius2 ;
90     bool                  myOkRadius1 ;
91     bool                  myOkRadius2 ;
92     QDoubleValidator      *myVa ;                  /* Double validator for numeric input myRadius1 */
93     QDoubleValidator      *myVb ;                  /* Double validator for numeric input myRadius2 */
94
95     int                   myConstructorId ;        /* Current constructor id = radio button id */
96     QWidget*              myEditCurrentArgument;   /* Current LineEdit or spin box */
97     Handle(GEOM_ShapeTypeFilter) myVertexFilter ;  /* Filter selection */
98     Handle(GEOM_EdgeFilter) myEdgeFilter ;         /* Filter selection */
99
100     QButtonGroup* GroupConstructors;
101     QRadioButton* Constructor1;
102     QRadioButton* Constructor2;
103     QGroupBox* GroupC1;
104     QGroupBox* GroupC2;
105     QPushButton* SelectButtonC1A1;
106     QPushButton* SelectButtonC1A2;
107     QLineEdit* LineEditC1A1;
108     QLineEdit* LineEditC1A2;
109     
110     GeometryGUI_SpinBox* SpinBox_C1A3 ;
111     GeometryGUI_SpinBox* SpinBox_C1A4 ;
112      
113     QLabel* TextLabelC1A1;
114     QLabel* TextLabelC1A2;
115     QLabel* TextLabelC1A3;
116     QLabel* TextLabelC1A4;
117     QGroupBox* GroupButtons;
118     QPushButton* buttonApply;
119     QPushButton* buttonOk;
120     QPushButton* buttonCancel;
121
122     QLabel* TextLabel_Radius1 ;
123     QLabel* TextLabel_Radius2 ;
124     GeometryGUI_SpinBox* SpinBox_Radius1 ;
125     GeometryGUI_SpinBox* SpinBox_Radius2 ;
126
127 private slots:
128
129     void ConstructorsClicked(int constructorId);
130     void ClickOnOk();
131     void ClickOnCancel();
132     void ClickOnApply();
133     void SetEditCurrentArgument() ;
134     void SelectionIntoArgument() ;
135     void LineEditReturnPressed() ;
136     void DeactivateActiveDialog() ;
137     void ActivateThisDialog() ;
138     void ValueChangedInSpinBox( double newValue ) ;
139
140 protected:
141     QGridLayout* GeometryGUI_TorusDlgLayout;
142     QGridLayout* GroupButtonsLayout;
143     QGridLayout* GroupConstructorsLayout;
144     QGridLayout* GroupC1Layout;
145     QGridLayout* GroupC2Layout;
146 };
147
148 #endif // DIALOGBOX_TORUS_H