Salome HOME
Update mail address
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_MeshDlg.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 /**
21 *  SMESH SMESHGUI
22 *
23 *  Copyright (C) 2005  CEA/DEN, EDF R&D
24 *
25 *
26 *
27 *  File   : SMESHGUI_MeshDlg.h
28 *  Author : Sergey LITONIN
29 *  Module : SMESH
30 */
31
32
33 #ifndef SMESHGUI_MeshDlg_H
34 #define SMESHGUI_MeshDlg_H
35
36 #include "SMESHGUI_Dialog.h"
37 #include <qframe.h>
38 #include <qstringlist.h>
39 #include <qmap.h>
40
41 class SMESHGUI_MeshTab;
42 class QTabWidget;
43 class QLineEdit;
44 class QComboBox;
45 class QToolButton;
46 class QString;
47 class QPopupMenu;
48
49 /*!
50  * \brief Dialog for mech creation or editing
51  *
52  *  This dialog is used for mech creation or editing. 
53 */
54 class SMESHGUI_MeshDlg : public SMESHGUI_Dialog
55
56   Q_OBJECT       
57       
58 public:
59   
60   enum Controls { Obj, Mesh, Geom };
61   
62   /*! Describes dimensions */
63   enum Dimensions { Dim1D = 0, Dim2D, Dim3D };      
64   
65 public:
66   SMESHGUI_MeshDlg( const bool theToCreate, const bool theIsMesh );
67   virtual ~SMESHGUI_MeshDlg();
68   
69   SMESHGUI_MeshTab*            tab( const int ) const;
70   void                         reset();
71   void                         setCurrentTab( const int );
72   void                         setMaxHypoDim( const int );
73   void                         setHypoSets( const QStringList& );
74   void                         setGeomPopupEnabled( const bool );
75
76 signals:
77
78   void                         hypoSet( const QString& );
79   void                         geomSelectionByMesh( bool );
80
81 private slots:  
82
83   void                         onHypoSetPopup( int );
84   void                         onHypoSetButton();
85   void                         onGeomPopup( int );
86   void                         onGeomSelectionButton( bool );
87
88 private:
89
90   QMap< int, SMESHGUI_MeshTab* > myTabs;
91   QTabWidget*                    myTabWg;
92   QPopupMenu*                    myHypoSetPopup;
93   QPopupMenu*                    myGeomPopup;
94 };
95
96 /*!
97  * \brief Tab for tab widget containing controls for definition of 
98  * algorithms and hypotheses
99 */ 
100
101 class SMESHGUI_MeshTab : public QFrame
102 {
103   Q_OBJECT
104       
105 public:      
106   /*! To differ main algorithms, hypotheses and additional ones*/
107   enum HypType
108   { 
109     Algo = 0, //!< algorithms
110     MainHyp,  //!< main hypothesis
111     AddHyp    //!< additional hypothesis
112   };            
113       
114 public:      
115   SMESHGUI_MeshTab( QWidget* );
116   virtual ~SMESHGUI_MeshTab();
117   
118   void                         setAvailableHyps( const int, const QStringList& );
119   void                         setExistingHyps( const int, const QStringList& );
120   void                         addHyp( const int, const QString& );
121   void                         renameHyp( const int, const int, const QString& );
122   void                         setCurrentHyp( const int, const int );
123   int                          currentHyp( const int ) const;
124   void                         reset();
125
126 signals:  
127
128   void                         createHyp( const int theHypType, const int theIndex );
129   //!< Emited when "Create hypothesis" button clicked
130   void                         editHyp( const int theHypType, const int theIndex );
131   //!< Emited when "Edit hypothesis" button clicked
132   void                         selectAlgo( const int theIndex );
133   //!< Emited when an algorithm is selected
134   
135 private slots:  
136
137   void                         onCreateHyp();  
138   void                         onEditHyp();
139   void                         onHyp( int );
140   void                         onPopupItem( int );
141   
142 private:  
143   
144   QMap< int, QComboBox* >      myHyp;
145   QMap< int, QToolButton* >    myCreateHyp;
146   QMap< int, QToolButton* >    myEditHyp;
147   
148   QMap< int, QStringList >     myAvailableHyps;
149   QMap< int, QStringList >     myExistingHyps;
150   
151   QPopupMenu*                  myPopup;
152 };
153
154 #endif