Salome HOME
76c34f686be2f843774e481a3177d547fec0f2b3
[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   ~SMESHGUI_GroupDlg();
74   
75   static QString                GetDefaultName( const QString& );
76   
77 public slots:
78   void onAdd();
79   void onRemove();
80
81 private slots:
82   void                          onTypeChanged( int );
83   void                          onGrpTypeChanged( int );
84   void                          onColorChanged( QColor );
85   
86   void                          onOK();
87   void                          onClose();
88   bool                          onApply();
89   void                          onHelp();
90   void                          onDeactivate();
91   
92   void                          onListSelectionChanged();
93   void                          onObjectSelectionChanged();
94   
95   void                          onSelectSubMesh( bool );
96   void                          onSelectGroup( bool );
97   void                          onSelectGeomGroup( bool );
98   void                          setCurrentSelection();
99   
100   void                          setFilters();
101   void                          onSort();
102   
103   void                          onNameChanged( const QString& );
104   void                          onFilterAccepted();
105   
106   void                          onGeomPopup( QAction* );
107   void                          onGeomSelectionButton( bool );
108   
109   void                          onPublishShapeByMeshDlg( SUIT_Operation* );
110   void                          onCloseShapeByMeshDlg( SUIT_Operation* );
111
112 private:
113   void                          initDialog( bool );
114   void                          init( SMESH::SMESH_Mesh_ptr );
115   void                          init( SMESH::SMESH_GroupBase_ptr );
116   void                          closeEvent( QCloseEvent* );
117   void                          enterEvent( QEvent* );
118   void                          hideEvent( QHideEvent* );   /* ESC key */
119   void                          keyPressEvent( QKeyEvent* );
120   void                          setSelectionMode( int );
121   void                          updateButtons();
122   void                          updateGeomPopup();
123   bool                          SetAppropriateActor();
124   void                          setShowEntityMode();
125   void                          restoreShowEntityMode();
126   
127   void                          setGroupColor( const SALOMEDS::Color& );
128   SALOMEDS::Color               getGroupColor() const;
129   
130   void                          setGroupQColor( const QColor& );
131   QColor                        getGroupQColor() const;
132   
133   void                          setDefaultGroupColor();
134   
135   SMESHGUI*                     mySMESHGUI;              /* Current SMESHGUI object */
136   LightApp_SelectionMgr*        mySelectionMgr;          /* User shape selection */
137   SMESH_Actor*                  myActor;                 /* Current mesh actor */
138   int                           myGrpTypeId;             /* Current group type id : standalone or group on geometry */
139   int                           myTypeId;                /* Current type id = radio button id */
140   int                           myStoredShownEntity;     /* Store ShowEntity mode of myMesh */
141   QLineEdit*                    myCurrentLineEdit;       /* Current  LineEdit */
142   SVTK_Selector*                mySelector;
143   
144   QPushButton*                  myMeshGroupBtn;
145   QLineEdit*                    myMeshGroupLine;
146   
147   QButtonGroup*                 myTypeGroup;
148   QLineEdit*                    myName;
149   QString                       myOldName;
150   
151   QButtonGroup*                 myGrpTypeGroup;
152   
153   QStackedWidget*               myWGStack;
154   QListWidget*                  myElements;
155   QPushButton*                  myFilter;
156   
157   QCheckBox*                    mySelectSubMesh;
158   QPushButton*                  mySubMeshBtn;
159   QLineEdit*                    mySubMeshLine;
160   
161   QCheckBox*                    mySelectGroup;
162   QPushButton*                  myGroupBtn;
163   QLineEdit*                    myGroupLine;
164   
165   QtxColorButton*               myColorBtn;
166   
167   QCheckBox*                    mySelectGeomGroup;
168   QToolButton*                  myGeomGroupBtn;
169   QLineEdit*                    myGeomGroupLine;
170   QMenu*                        myGeomPopup;
171
172   QPushButton*                  myOKBtn;
173   QPushButton*                  myApplyBtn;
174   QPushButton*                  myCloseBtn;
175   QPushButton*                  myHelpBtn;
176   
177   SMESHGUI_ShapeByMeshOp*       myShapeByMeshOp;
178   
179   SMESH::SMESH_Mesh_var         myMesh;
180   SMESH::SMESH_Group_var        myGroup;
181   SMESH::SMESH_GroupOnGeom_var  myGroupOnGeom;
182   QList<int>                    myIdList;
183   GEOM::ListOfGO_var            myGeomObjects;
184   
185   int                           mySelectionMode;
186   //Handle(SMESH_TypeFilter)      myMeshFilter;
187   //Handle(SMESH_TypeFilter)      mySubMeshFilter;
188   //Handle(SMESH_TypeFilter)      myGroupFilter;
189   SUIT_SelectionFilter*         myMeshFilter;
190   SUIT_SelectionFilter*         mySubMeshFilter;
191   SUIT_SelectionFilter*         myGroupFilter;
192   SUIT_SelectionFilter*         myGeomFilter;
193   
194   SMESHGUI_FilterDlg*           myFilterDlg;
195   
196   bool                          myCreate, myIsBusy;
197   
198   QString                       myHelpFileName;
199   
200   QMap<QAction*, int>           myActions;
201
202   bool                          myNameChanged; //added by skl for IPAL19574
203 };
204
205 #endif // SMESHGUI_GROUPDLG_H