Salome HOME
Prevent exception at shape selection if no mesh was pre-selected
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_AddMeshElementDlg.h
1 //  SMESH SMESHGUI : GUI for SMESH 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   : SMESHGUI_AddMeshElementDlg.h
25 //  Author : Nicolas REJNERI
26 //  Module : SMESH
27 //  $Header$
28
29 #ifndef DIALOGBOX_ADD_FACE_H
30 #define DIALOGBOX_ADD_FACE_H
31
32 #include "SALOME_Selection.h"
33
34 #include "SMDSAbs_ElementType.hxx"
35
36
37 // QT Includes
38 #include <qvariant.h>
39 #include <qdialog.h>
40
41 class QVBoxLayout; 
42 class QHBoxLayout; 
43 class QGridLayout; 
44 class QButtonGroup;
45 class QGroupBox;
46 class QLabel;
47 class QLineEdit;
48 class QPushButton;
49 class QRadioButton;
50 class QCheckBox;
51 class SMESHGUI;
52 class SMESH_Actor;
53 class SMDS_Mesh;
54
55 namespace SMESH{
56   struct TElementSimulation;
57 }
58
59 // IDL Headers
60 #include <SALOMEconfig.h>
61 #include CORBA_SERVER_HEADER(SMESH_Mesh)
62
63 //=================================================================================
64 // class    : SMESHGUI_AddMeshElementDlg
65 // purpose  :
66 //=================================================================================
67 class SMESHGUI_AddMeshElementDlg : public QDialog
68
69     Q_OBJECT
70
71 public:
72     SMESHGUI_AddMeshElementDlg( QWidget* parent = 0, const char* name = 0,
73                                 SALOME_Selection* Sel = 0, 
74                                 SMDSAbs_ElementType ElementType = SMDSAbs_Edge,
75                                 int nbNodes = 2, bool modal = FALSE, WFlags fl = 0 );
76     ~SMESHGUI_AddMeshElementDlg();
77
78 private:
79
80     void Init( SALOME_Selection* Sel ) ;
81     void closeEvent( QCloseEvent* e ) ;
82     void hideEvent ( QHideEvent * );                 /* ESC key */
83     void enterEvent ( QEvent * ) ;                   /* mouse enter the QWidget */
84     void displaySimulation();
85
86     SMESHGUI*              mySMESHGUI ;              /* Current SMESHGUI object */
87     SALOME_Selection*      mySelection ;             /* User shape selection */
88     bool                   myOkNodes ;               /* to check when arguments is defined */
89     bool                   myBusy;
90
91     QLineEdit*             myEditCurrentArgument;    /* Current  LineEdit */
92
93     int                             myElementType ;
94     int                             myNbNodes;
95
96     SMESH::SMESH_Mesh_var           myMesh;
97     SMESH_Actor*                    myActor;
98     SMESH::TElementSimulation*      mySimulation;
99     
100     QButtonGroup* GroupConstructors;
101     QRadioButton* Constructor1;
102     QGroupBox   * GroupButtons;
103     QPushButton * buttonOk;
104     QPushButton * buttonCancel;
105     QPushButton * buttonApply;
106     QGroupBox   * GroupC1;
107     QLabel      * TextLabelC1A1;
108     QPushButton * SelectButtonC1A1;
109     QLineEdit   * LineEditC1A1;
110
111     QCheckBox   * Reverse;
112
113 private slots:
114
115     void ClickOnOk();
116     void ClickOnCancel();
117     void ClickOnApply();
118     void SetEditCurrentArgument() ;
119     void SelectionIntoArgument() ;
120     void DeactivateActiveDialog() ;
121     void ActivateThisDialog() ;
122     void CheckBox( int );
123     void onTextChange(const QString&);
124
125 protected:
126     QGridLayout* SMESHGUI_AddMeshElementDlgLayout;
127     QGridLayout* GroupConstructorsLayout;
128     QGridLayout* GroupButtonsLayout;
129     QGridLayout* GroupC1Layout;
130 };
131
132 #endif // DIALOGBOX_ADD_FACE_H