Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_AddQuadraticElementDlg.h
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 //
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
8 //
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20 #ifndef DIALOGBOX_ADD_QUADRATIC_ELEMENT_H
21 #define DIALOGBOX_ADD_QUADRATIC_ELEMENT_H
22
23 #include "LightApp_SelectionMgr.h"
24
25 // QT Includes
26 #include <qdialog.h>
27 #include <qtable.h>
28
29 class QButtonGroup;
30 class QGroupBox;
31 class QLineEdit;
32 class QPushButton;
33 class QRadioButton;
34 class QCheckBox;
35 class QTable;
36 class SMESHGUI;
37 class SMESH_Actor;
38 class SVTK_Selector;
39
40 namespace SMESH{
41   struct TElementSimulation;
42 }
43
44 // IDL Headers
45 #include <SALOMEconfig.h>
46 #include CORBA_SERVER_HEADER(SMESH_Mesh)
47
48 enum { QUAD_EDGE, QUAD_TRIANGLE, QUAD_QUADRANGLE, QUAD_TETRAHEDRON, QUAD_PYRAMID, QUAD_PENTAHEDRON, QUAD_HEXAHEDRON };
49
50 //=================================================================================
51 // class    : SMESHGUI_AddQuadraticElementDlg
52 // purpose  :
53 //=================================================================================
54 class SMESHGUI_AddQuadraticElementDlg : public QDialog
55
56     Q_OBJECT
57
58 public:
59     SMESHGUI_AddQuadraticElementDlg( SMESHGUI* theModule,
60                                      const int theType,
61                                      const char* = 0, 
62                                      bool modal = FALSE, WFlags fl = 0 );
63     ~SMESHGUI_AddQuadraticElementDlg();
64
65 private:
66     void Init ();
67     void closeEvent (QCloseEvent*);
68     void hideEvent (QHideEvent*);                 /* ESC key */
69     void enterEvent (QEvent*);                    /* mouse enter the QWidget */
70     void keyPressEvent(QKeyEvent*);
71     void displaySimulation();
72     void UpdateTable( bool theConersValidity = true );
73     bool IsValid();
74
75     SMESHGUI*                   mySMESHGUI;       /* Current SMESHGUI object */
76     LightApp_SelectionMgr*      mySelectionMgr;   /* User shape selection */
77     int                         myNbCorners;      /* The required number of corners */
78     bool                        myBusy;
79     SVTK_Selector*              mySelector;
80
81     SMESH::SMESH_Mesh_var       myMesh;
82     SMESH_Actor*                myActor;
83     SMESH::TElementSimulation*  mySimulation;
84
85     int                         myType;
86     bool                        myIsEditCorners;
87     
88     QButtonGroup* GroupConstructors;
89     QRadioButton* myRadioButton1;
90
91     QGroupBox*    GroupArguments;
92     QLineEdit*    myCornerNodes;
93     QPushButton*  mySelectButton;
94     QTable*       myTable;
95     QCheckBox*    myReverseCB;
96
97     QGroupBox*    GroupButtons;
98     QPushButton*  buttonOk;
99     QPushButton*  buttonCancel;
100     QPushButton*  buttonApply;
101     QPushButton * buttonHelp;
102
103     QString       myHelpFileName;
104
105 private slots:
106   
107     void onTextChange(const QString&);
108     void onCellTextChange(int, int);
109     void onReverse( int );
110     void onCellDoubleClicked(int, int, int, const QPoint&);
111   
112     void ClickOnOk();
113     void ClickOnCancel();
114     void ClickOnApply();
115     void ClickOnHelp();
116     void SetEditCorners() ;
117     void SelectionIntoArgument() ;
118     void DeactivateActiveDialog() ;
119     void ActivateThisDialog() ;
120 };
121
122 class SMESHGUI_IdEditItem: public QTableItem
123 {
124 public:
125     SMESHGUI_IdEditItem(QTable* table, EditType et, const QString& text ):
126       QTableItem(table, et, text) {};
127     ~SMESHGUI_IdEditItem() {};
128
129     QWidget* createEditor() const;
130 };
131
132
133 #endif // DIALOGBOX_ADD_QUADRATIC_ELEMENT_H