Salome HOME
22fe93ffa6619816ee4068a777b25a22743252a9
[modules/geom.git] / src / GEOMGUI / GeometryGUI_ChamferDlg.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_ChamferDlg.h
25 //  Author : Damien COQUERET
26 //  Module : GEOM
27 //  $Header$
28
29 #ifndef DIALOGBOX_CHAMFER_H
30 #define DIALOGBOX_CHAMFER_H
31
32 #include "SALOME_Selection.h"
33 #include "GEOM_ShapeTypeFilter.hxx"
34 #include "GeometryGUI_SpinBox.h"
35
36 // Qt Includes
37 #include <qvariant.h>
38 #include <qdialog.h>
39 #include <qvalidator.h>
40
41 // Open CASCADE Includes
42 #include <AIS_InteractiveContext.hxx>
43
44 class QVBoxLayout; 
45 class QHBoxLayout; 
46 class QGridLayout; 
47 class QButtonGroup;
48 class QFrame;
49 class QGroupBox;
50 class QLineEdit;
51 class QPushButton;
52 class QRadioButton;
53 class QToolButton;
54 class QLabel;
55 class GeometryGUI;
56
57 //=================================================================================
58 // class    : GeometryGUI_ChamferDlg
59 // purpose  :
60 //=================================================================================
61 class GeometryGUI_ChamferDlg : public QDialog
62
63     Q_OBJECT
64
65 public:
66     GeometryGUI_ChamferDlg( QWidget* parent = 0,
67                       const char* name = 0,
68                       SALOME_Selection* Sel = 0,
69                       Handle (AIS_InteractiveContext) ic = 0,
70                       bool modal = FALSE,
71                       WFlags fl = 0 );
72     
73     ~GeometryGUI_ChamferDlg();
74
75 private :
76  
77     void Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic  ) ;
78     void closeEvent( QCloseEvent* e ) ;
79     void enterEvent( QEvent* e);
80     void ResetStateOfDialog() ;
81
82     /* Interactive and local context management see also : bool myUseLocalContext() */
83     Handle (AIS_InteractiveContext) myIC ;                 /* Interactive context */ 
84     Standard_Integer                myLocalContextId ;     /* identify a local context used by this method */
85     bool                            myUseLocalContext ;    /* true when this method as opened a local context  */
86
87     QDoubleValidator      *myVa ;                  /* Double validator for numeric input */
88     QDoubleValidator      *myVb ;                  /* Double validator for numeric input */
89
90     GEOM::GEOM_Gen_var myGeom ;                       /* Current Geom object */
91     GeometryGUI*          myGeomGUI ;                    /* Current GeomGUI object */
92     SALOME_Selection*     mySelection ;                  /* User shape selection */    
93
94     TopoDS_Shape          myShape ;
95     bool                  myOkShape ;
96     char*                 myShapeIOR ;
97   
98     QLineEdit*            myEditCurrentArgument;         /* Current LineEdit */   
99     int                   myConstructorId ;              /* Current constructor id = radio button id */
100     int                   myShapeType ;
101
102     TopoDS_Shape          mySimulationTopoDs ;    /* Shape used for simulation display */
103     void MakePreview();
104
105     bool                  myOkD1 ;
106     double                myD1 ;
107     bool                  myOkD2 ;
108     double                myD2 ;
109     
110     QButtonGroup* GroupConstructors;
111
112     QRadioButton* Constructor1;
113     QRadioButton* Constructor2;
114     QRadioButton* Constructor3;
115
116     QGroupBox* GroupButtons;
117     QPushButton* buttonOk;
118     QPushButton* buttonCancel;
119     QPushButton* buttonApply;
120
121     QGroupBox* GroupC1;
122     QPushButton* SelectButtonC1A1;   
123     QLineEdit* LineEditC1A1;
124     QLabel* TextLabelC1A1; 
125     GeometryGUI_SpinBox* SpinBox_C1A2 ;
126     QLabel* TextLabelC1A2; 
127     GeometryGUI_SpinBox* SpinBox_C1A3 ;
128     QLabel* TextLabelC1A3; 
129
130     QGroupBox* GroupC2;
131     QPushButton* SelectButtonC2A1;   
132     QLineEdit* LineEditC2A1;
133     QLabel* TextLabelC2A1; 
134     GeometryGUI_SpinBox* SpinBox_C2A2 ;
135     QLabel* TextLabelC2A2; 
136     GeometryGUI_SpinBox* SpinBox_C2A3;
137     QLabel* TextLabelC2A3; 
138
139     QGroupBox* GroupC3;
140     QPushButton* SelectButtonC3A1;   
141     QLineEdit* LineEditC3A1;
142     QLabel* TextLabelC3A1; 
143     GeometryGUI_SpinBox* SpinBox_C3A2 ;
144     QLabel* TextLabelC3A2; 
145     GeometryGUI_SpinBox* SpinBox_C3A3;
146     QLabel* TextLabelC3A3; 
147
148 private slots:
149
150     void ConstructorsClicked(int constructorId);
151     void ClickOnOk();
152     void ClickOnCancel();
153     void ClickOnApply();
154     void SetEditCurrentArgument() ;
155     void SelectionIntoArgument() ;
156     void LineEditReturnPressed() ;
157     void DeactivateActiveDialog() ;
158     void ActivateThisDialog() ;
159     void ValueChangedInSpinBox( double newValue ) ;
160
161 protected:
162
163     QGridLayout* GeometryGUI_ChamferDlgLayout;
164     QGridLayout* GroupButtonsLayout;
165     QGridLayout* GroupConstructorsLayout;
166     QGridLayout* GroupC1Layout;
167     QGridLayout* GroupC2Layout;
168     QGridLayout* GroupC3Layout;
169 };
170
171 #endif // DIALOGBOX_CHAMFER_H
172