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