Salome HOME
Update copyright information
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_GroupDlg.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_GroupDlg.h
24 // Author : Natalia KOPNOVA, Open CASCADE S.A.S.
25 //
26 #ifndef SMESHGUI_GROUPDLG_H
27 #define SMESHGUI_GROUPDLG_H
28
29 // SMESH includes
30 #include "SMESH_SMESHGUI.hxx"
31
32 // Qt includes
33 #include <QDialog>
34 #include <QList>
35 #include <QMap>
36
37 // IDL includes
38 #include <SALOMEconfig.h>
39 #include CORBA_SERVER_HEADER(SMESH_Mesh)
40 #include CORBA_SERVER_HEADER(SMESH_Group)
41
42 class QLineEdit;
43 class QButtonGroup;
44 class QListWidget;
45 class QMenu;
46 class QPushButton;
47 class QToolButton;
48 class QCheckBox;
49 class QStackedWidget;
50 class QAction;
51 class SMESHGUI;
52 class SMESH_Actor;
53 class SMESHGUI_FilterDlg;
54 class SMESHGUI_ShapeByMeshOp;
55 class QtxColorButton;
56 class SUIT_Operation;
57 class SVTK_Selector;
58 class SUIT_SelectionFilter;
59 class LightApp_SelectionMgr;
60
61 //=================================================================================
62 // class    : SMESHGUI_GroupDlg
63 // purpose  :
64 //=================================================================================
65 class SMESHGUI_EXPORT SMESHGUI_GroupDlg : public QDialog
66
67   Q_OBJECT
68
69 public:
70   SMESHGUI_GroupDlg( SMESHGUI*,
71                      SMESH::SMESH_Mesh_ptr = SMESH::SMESH_Mesh::_nil() );
72   SMESHGUI_GroupDlg( SMESHGUI*,
73                      SMESH::SMESH_GroupBase_ptr );
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   void                          closeEvent( QCloseEvent* );
118   void                          enterEvent( QEvent* );
119   void                          hideEvent( QHideEvent* );   /* ESC key */
120   void                          keyPressEvent( QKeyEvent* );
121   void                          setSelectionMode( int );
122   void                          updateButtons();
123   void                          updateGeomPopup();
124   bool                          SetAppropriateActor();
125   void                          setShowEntityMode();
126   void                          restoreShowEntityMode();
127   
128   void                          setGroupColor( const SALOMEDS::Color& );
129   SALOMEDS::Color               getGroupColor() const;
130   
131   void                          setGroupQColor( const QColor& );
132   QColor                        getGroupQColor() const;
133   
134   void                          setDefaultGroupColor();
135   
136   SMESHGUI*                     mySMESHGUI;              /* Current SMESHGUI object */
137   LightApp_SelectionMgr*        mySelectionMgr;          /* User shape selection */
138   SMESH_Actor*                  myActor;                 /* Current mesh actor */
139   int                           myGrpTypeId;             /* Current group type id : standalone or group on geometry */
140   int                           myTypeId;                /* Current type id = radio button id */
141   int                           myStoredShownEntity;     /* Store ShowEntity mode of myMesh */
142   QLineEdit*                    myCurrentLineEdit;       /* Current  LineEdit */
143   SVTK_Selector*                mySelector;
144   
145   QPushButton*                  myMeshGroupBtn;
146   QLineEdit*                    myMeshGroupLine;
147   
148   QButtonGroup*                 myTypeGroup;
149   QLineEdit*                    myName;
150   QString                       myOldName;
151   
152   QButtonGroup*                 myGrpTypeGroup;
153   
154   QStackedWidget*               myWGStack;
155   QListWidget*                  myElements;
156   QPushButton*                  myFilter;
157   
158   QCheckBox*                    mySelectSubMesh;
159   QPushButton*                  mySubMeshBtn;
160   QLineEdit*                    mySubMeshLine;
161   
162   QCheckBox*                    mySelectGroup;
163   QPushButton*                  myGroupBtn;
164   QLineEdit*                    myGroupLine;
165   
166   QtxColorButton*               myColorBtn;
167   
168   QCheckBox*                    mySelectGeomGroup;
169   QToolButton*                  myGeomGroupBtn;
170   QLineEdit*                    myGeomGroupLine;
171   QMenu*                        myGeomPopup;
172
173   QPushButton*                  myOKBtn;
174   QPushButton*                  myApplyBtn;
175   QPushButton*                  myCloseBtn;
176   QPushButton*                  myHelpBtn;
177   
178   SMESHGUI_ShapeByMeshOp*       myShapeByMeshOp;
179   
180   SMESH::SMESH_Mesh_var         myMesh;
181   SMESH::SMESH_Group_var        myGroup;
182   SMESH::SMESH_GroupOnGeom_var  myGroupOnGeom;
183   QList<int>                    myIdList;
184   GEOM::ListOfGO_var            myGeomObjects;
185   
186   int                           mySelectionMode;
187   //Handle(SMESH_TypeFilter)      myMeshFilter;
188   //Handle(SMESH_TypeFilter)      mySubMeshFilter;
189   //Handle(SMESH_TypeFilter)      myGroupFilter;
190   SUIT_SelectionFilter*         myMeshFilter;
191   SUIT_SelectionFilter*         mySubMeshFilter;
192   SUIT_SelectionFilter*         myGroupFilter;
193   SUIT_SelectionFilter*         myGeomFilter;
194   
195   SMESHGUI_FilterDlg*           myFilterDlg;
196   
197   bool                          myCreate, myIsBusy;
198   
199   QString                       myHelpFileName;
200   
201   QMap<QAction*, int>           myActions;
202
203   bool                          myNameChanged; //added by skl for IPAL19574
204 };
205
206 #endif // SMESHGUI_GROUPDLG_H