Salome HOME
sources v1.2c
[modules/geom.git] / GEOMGUI / GeometryGUI_BoxDlg.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_BoxDlg.h
25 //  Author : Lucien PIGNOLONI
26 //  Module : GEOM
27 //  $Header$
28
29 #ifndef DIALOGBOX_BOX_H
30 #define DIALOGBOX_BOX_H
31
32 #include "SALOME_Selection.h"
33 #include "GEOM_ShapeTypeFilter.hxx"
34
35 #include <gp_Pnt.hxx>
36 #include <BRepPrimAPI_MakeBox.hxx>
37 #include <Precision.hxx>
38
39 #include <qvariant.h>
40 #include <qdialog.h>
41 #include <qwidget.h>
42
43 class QVBoxLayout; 
44 class QHBoxLayout; 
45 class QGridLayout; 
46 class QButtonGroup;
47 class QFrame;
48 class QGroupBox;
49 class QLineEdit;
50 class QPushButton;
51 class QRadioButton;
52 class QLabel;
53 class QPushButton;
54 class GeometryGUI_SpinBox;
55 class GeometryGUI;
56
57
58 //=================================================================================
59 // class    : GeometryGUI_BoxDlg
60 // purpose  :
61 //=================================================================================
62 class GeometryGUI_BoxDlg : public QDialog
63
64     Q_OBJECT
65
66 public:
67     GeometryGUI_BoxDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
68     ~GeometryGUI_BoxDlg();
69
70 private :
71  
72     void closeEvent( QCloseEvent* e ) ;
73     void enterEvent( QEvent* e );
74     void Init(SALOME_Selection* Sel) ;
75     bool TestBoxDimensions( gp_Pnt P1, gp_Pnt P2 ) ;
76
77     GEOM::GEOM_Gen_var myGeom ;                /* Current GeomI object */
78     GeometryGUI*          myGeomGUI ;             /* Current GeomGUI object */
79     TopoDS_Shape          mySimulationTopoDs ;    /* Shape used for simulation display */
80     SALOME_Selection*     mySelection ;           /* User shape selection */    
81     gp_Pnt                myPoint1 ;              /* Points containing the vector */    
82     gp_Pnt                myPoint2 ;
83     bool                  myOkPoint1 ;            /* true when myPoint is defined */
84     bool                  myOkPoint2 ;
85     int                   myConstructorId ;       /* Current constructor id = radio button id */ 
86     QLineEdit*            myEditCurrentArgument;  /* Current LineEdit */
87     Handle(GEOM_ShapeTypeFilter) myVertexFilter;  /* filter for selection */
88
89
90     QButtonGroup* GroupConstructors;
91     QRadioButton* Constructor1;
92     QRadioButton* Constructor2;
93
94     QGroupBox* GroupButtons;
95     QPushButton* buttonApply;
96     QPushButton* buttonOk;
97     QPushButton* buttonCancel;
98
99     QGroupBox* GroupPoints;
100     QPushButton* SelectButtonPt1;    
101     QPushButton* SelectButtonPt2;
102     QLineEdit* LineEditPt2;
103     QLineEdit* LineEditPt1;
104     QLabel* TextLabelPt1;
105     QLabel* TextLabelPt2;
106
107     QGroupBox* GroupDimensions ;    
108     QLabel* TextLabel_DX ;
109     QLabel* TextLabel_DY ;
110     QLabel* TextLabel_DZ ;
111
112     GeometryGUI_SpinBox* SpinBox_DX ;
113     GeometryGUI_SpinBox* SpinBox_DY ;
114     GeometryGUI_SpinBox* SpinBox_DZ ;
115
116 private slots:
117
118     void ConstructorsClicked(int constructorId);
119     void ClickOnOk();
120     void ClickOnCancel();
121     void ClickOnApply();
122     void SetEditCurrentArgument() ;
123     void SelectionIntoArgument() ;
124     void LineEditReturnPressed() ;
125     void DeactivateActiveDialog() ;
126     void ActivateThisDialog() ;
127     void ValueChangedInSpinBox( double newValue ) ;
128
129 protected:
130
131     QGridLayout* GeometryGUI_BoxDlgLayout;
132     QGridLayout* GroupConstructorsLayout;
133     QGridLayout* GroupButtonsLayout;
134     QGridLayout* GroupPointsLayout;
135     QGridLayout* GroupDimensionsLayout;
136
137 };
138
139 #endif // DIALOGBOX_BOX_H