Salome HOME
IMP19942 - Convert group on geometry into group of elements
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_GroupDlg.h
1 // SMESH SMESHGUI : GUI for SMESH component
2 //
3 // Copyright (C) 2003  CEA
4 // 
5 // This library is free software; you can redistribute it and/or 
6 // modify it under the terms of the GNU Lesser General Public 
7 // License as published by the Free Software Foundation; either 
8 // version 2.1 of the License. 
9 // 
10 // This library is distributed in the hope that it will be useful, 
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
13 // Lesser General Public License for more details. 
14 // 
15 // You should have received a copy of the GNU Lesser General Public 
16 // License along with this library; if not, write to the Free Software 
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
18 // 
19 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 //
21 // File   : SMESHGUI_GroupDlg.h
22 // Author : Natalia KOPNOVA, Open CASCADE S.A.S.
23 //
24
25 #ifndef SMESHGUI_GROUPDLG_H
26 #define SMESHGUI_GROUPDLG_H
27
28 // SMESH includes
29 #include "SMESH_SMESHGUI.hxx"
30
31 // Qt includes
32 #include <QDialog>
33 #include <QList>
34 #include <QMap>
35
36 // IDL includes
37 #include <SALOMEconfig.h>
38 #include CORBA_SERVER_HEADER(SMESH_Mesh)
39 #include CORBA_SERVER_HEADER(SMESH_Group)
40
41 class QLineEdit;
42 class QButtonGroup;
43 class QListWidget;
44 class QMenu;
45 class QPushButton;
46 class QToolButton;
47 class QCheckBox;
48 class QStackedWidget;
49 class QAction;
50 class SMESHGUI;
51 class SMESH_Actor;
52 class SMESHGUI_FilterDlg;
53 class SMESHGUI_ShapeByMeshOp;
54 class QtxColorButton;
55 class SUIT_Operation;
56 class SVTK_Selector;
57 class SUIT_SelectionFilter;
58 class LightApp_SelectionMgr;
59
60 //=================================================================================
61 // class    : SMESHGUI_GroupDlg
62 // purpose  :
63 //=================================================================================
64 class SMESHGUI_EXPORT SMESHGUI_GroupDlg : public QDialog
65
66   Q_OBJECT
67
68 public:
69   SMESHGUI_GroupDlg( SMESHGUI*,
70                      SMESH::SMESH_Mesh_ptr = SMESH::SMESH_Mesh::_nil() );
71   SMESHGUI_GroupDlg( SMESHGUI*,
72                      SMESH::SMESH_GroupBase_ptr,
73                      const bool theIsConvert = false );
74   ~SMESHGUI_GroupDlg();
75   
76   static QString                GetDefaultName( const QString& );
77   
78 public slots:
79   void onAdd();
80   void onRemove();
81
82 private slots:
83   void                          onTypeChanged( int );
84   void                          onGrpTypeChanged( int );
85   void                          onColorChanged( QColor );
86   
87   void                          onOK();
88   void                          onClose();
89   bool                          onApply();
90   void                          onHelp();
91   void                          onDeactivate();
92   
93   void                          onListSelectionChanged();
94   void                          onObjectSelectionChanged();
95   
96   void                          onSelectSubMesh( bool );
97   void                          onSelectGroup( bool );
98   void                          onSelectGeomGroup( bool );
99   void                          setCurrentSelection();
100   
101   void                          setFilters();
102   void                          onSort();
103   
104   void                          onNameChanged( const QString& );
105   void                          onFilterAccepted();
106   
107   void                          onGeomPopup( QAction* );
108   void                          onGeomSelectionButton( bool );
109   
110   void                          onPublishShapeByMeshDlg( SUIT_Operation* );
111   void                          onCloseShapeByMeshDlg( SUIT_Operation* );
112
113 private:
114   void                          initDialog( bool );
115   void                          init( SMESH::SMESH_Mesh_ptr );
116   void                          init( SMESH::SMESH_GroupBase_ptr,
117                                       const bool theIsConvert = false );
118   void                          closeEvent( QCloseEvent* );
119   void                          enterEvent( QEvent* );
120   void                          hideEvent( QHideEvent* );   /* ESC key */
121   void                          keyPressEvent( QKeyEvent* );
122   void                          setSelectionMode( int );
123   void                          updateButtons();
124   void                          updateGeomPopup();
125   bool                          SetAppropriateActor();
126   void                          setShowEntityMode();
127   void                          restoreShowEntityMode();
128   
129   void                          setGroupColor( const SALOMEDS::Color& );
130   SALOMEDS::Color               getGroupColor() const;
131   
132   void                          setGroupQColor( const QColor& );
133   QColor                        getGroupQColor() const;
134   
135   void                          setDefaultGroupColor();
136   
137   SMESHGUI*                     mySMESHGUI;              /* Current SMESHGUI object */
138   LightApp_SelectionMgr*        mySelectionMgr;          /* User shape selection */
139   SMESH_Actor*                  myActor;                 /* Current mesh actor */
140   int                           myGrpTypeId;             /* Current group type id : standalone or group on geometry */
141   int                           myTypeId;                /* Current type id = radio button id */
142   int                           myStoredShownEntity;     /* Store ShowEntity mode of myMesh */
143   QLineEdit*                    myCurrentLineEdit;       /* Current  LineEdit */
144   SVTK_Selector*                mySelector;
145   
146   QPushButton*                  myMeshGroupBtn;
147   QLineEdit*                    myMeshGroupLine;
148   
149   QButtonGroup*                 myTypeGroup;
150   QLineEdit*                    myName;
151   QString                       myOldName;
152   
153   QButtonGroup*                 myGrpTypeGroup;
154   
155   QStackedWidget*               myWGStack;
156   QListWidget*                  myElements;
157   QPushButton*                  myFilter;
158   
159   QCheckBox*                    mySelectSubMesh;
160   QPushButton*                  mySubMeshBtn;
161   QLineEdit*                    mySubMeshLine;
162   
163   QCheckBox*                    mySelectGroup;
164   QPushButton*                  myGroupBtn;
165   QLineEdit*                    myGroupLine;
166   
167   QtxColorButton*               myColorBtn;
168   
169   QCheckBox*                    mySelectGeomGroup;
170   QToolButton*                  myGeomGroupBtn;
171   QLineEdit*                    myGeomGroupLine;
172   QMenu*                        myGeomPopup;
173
174   QPushButton*                  myOKBtn;
175   QPushButton*                  myApplyBtn;
176   QPushButton*                  myCloseBtn;
177   QPushButton*                  myHelpBtn;
178   
179   SMESHGUI_ShapeByMeshOp*       myShapeByMeshOp;
180   
181   SMESH::SMESH_Mesh_var         myMesh;
182   SMESH::SMESH_Group_var        myGroup;
183   SMESH::SMESH_GroupOnGeom_var  myGroupOnGeom;
184   QList<int>                    myIdList;
185   GEOM::ListOfGO_var            myGeomObjects;
186   
187   int                           mySelectionMode;
188   //Handle(SMESH_TypeFilter)      myMeshFilter;
189   //Handle(SMESH_TypeFilter)      mySubMeshFilter;
190   //Handle(SMESH_TypeFilter)      myGroupFilter;
191   SUIT_SelectionFilter*         myMeshFilter;
192   SUIT_SelectionFilter*         mySubMeshFilter;
193   SUIT_SelectionFilter*         myGroupFilter;
194   SUIT_SelectionFilter*         myGeomFilter;
195   
196   SMESHGUI_FilterDlg*           myFilterDlg;
197   
198   bool                          myCreate, myIsBusy;
199   
200   QString                       myHelpFileName;
201   
202   QMap<QAction*, int>           myActions;
203
204   bool                          myNameChanged; //added by skl for IPAL19574
205 };
206
207 #endif // SMESHGUI_GROUPDLG_H