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