Salome HOME
0020319: EDF SMESH 1007: creation of a sub-mesh on face tries to assign Netgen3D...
[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 // SMESH SMESHGUI : GUI for SMESH component
23 // File   : SMESHGUI_MeshDlg.h
24 // Author : Sergey LITONIN, Open CASCADE S.A.S.
25 //
26 #ifndef SMESHGUI_MESHDLG_H
27 #define SMESHGUI_MESHDLG_H
28
29 // SMESH includes
30 #include "SMESH_SMESHGUI.hxx"
31
32 #include "SMESHGUI_Dialog.h"
33
34 // Qt includes
35 #include <QFrame>
36 #include <QStringList>
37 #include <QMap>
38
39 class SMESHGUI_MeshTab;
40 class QTabWidget;
41 class QComboBox;
42 class QToolButton;
43 class QMenu;
44 class QAction;
45
46 /*!
47  * \brief Dialog for mech creation or editing
48  *
49  *  This dialog is used for mech creation or editing. 
50 */
51 class SMESHGUI_EXPORT SMESHGUI_MeshDlg : public SMESHGUI_Dialog
52
53   Q_OBJECT       
54       
55 public:
56   
57   enum Controls { Obj, Mesh, Geom };
58   
59   /*! Describes dimensions */
60   enum Dimensions { Dim0D = 0, Dim1D, Dim2D, Dim3D };      
61   
62 public:
63   SMESHGUI_MeshDlg( const bool, const bool );
64   virtual ~SMESHGUI_MeshDlg();
65   
66   SMESHGUI_MeshTab*            tab( const int ) const;
67   void                         reset();
68   void                         setCurrentTab( const int );
69   void                         setMaxHypoDim( const int );
70   void                         setHypoSets( const QStringList& );
71   void                         setGeomPopupEnabled( const bool );
72   void                         disableTab(const int);
73   void                         enableTab(const int);
74   bool                         isTabEnabled(const int) const;
75   int                          getActiveObject();
76
77 signals:
78   void                         hypoSet( const QString& );
79   void                         geomSelectionByMesh( bool );
80
81 private slots:  
82   void                         onHypoSetPopup( QAction* );
83   void                         onGeomPopup( QAction* );
84   void                         onGeomSelectionButton( bool );
85
86 private:
87   QMap<int, SMESHGUI_MeshTab*> myTabs;
88   QTabWidget*                  myTabWg;
89   QToolButton*                 myHypoSetButton;
90   QMenu*                       myGeomPopup;
91 };
92
93 /*!
94  * \brief Tab for tab widget containing controls for definition of 
95  * algorithms and hypotheses
96 */ 
97
98 class SMESHGUI_EXPORT SMESHGUI_MeshTab : public QFrame
99 {
100   Q_OBJECT
101       
102 public:      
103   /*! To differ main algorithms, hypotheses and additional ones*/
104   enum HypType
105   { 
106     Algo = 0, //!< algorithms
107     MainHyp,  //!< main hypothesis
108     AddHyp    //!< additional hypothesis
109   };            
110       
111 public:      
112   SMESHGUI_MeshTab( QWidget* );
113   virtual ~SMESHGUI_MeshTab();
114   
115   void                         setAvailableHyps( const int, const QStringList& );
116   void                         setExistingHyps( const int, const QStringList& );
117   void                         addHyp( const int, const QString& );
118   void                         renameHyp( const int, const int, const QString& );
119   void                         setCurrentHyp( const int, const int );
120   int                          currentHyp( const int ) const;
121   void                         reset();
122
123 signals:  
124   void                         createHyp( const int, const int );
125   //!< Emited when "Create hypothesis" button clicked
126   void                         editHyp( const int, const int );
127   //!< Emited when "Edit hypothesis" button clicked
128   void                         selectAlgo( const int );
129   //!< Emited when an algorithm is selected
130   
131 private slots:  
132   void                         onCreateHyp();  
133   void                         onEditHyp();
134   void                         onHyp( int );
135   
136 private:  
137   QMap<int, QComboBox*>        myHyp;
138   QMap<int, QToolButton*>      myCreateHyp;
139   QMap<int, QToolButton*>      myEditHyp;
140   
141   QMap<int, QStringList>       myAvailableHyps;
142   QMap<int, QStringList>       myExistingHyps;
143 };
144
145 #endif // SMESHGUI_MESHDLG_H