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