Salome HOME
Fix for bug IPAL19502 (Qt4 porting. Edit Group. Ok (Apply) doesn't become active...
[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   
124   void                          setGroupColor( const SALOMEDS::Color& );
125   SALOMEDS::Color               getGroupColor() const;
126   
127   void                          setGroupQColor( const QColor& );
128   QColor                        getGroupQColor() const;
129   
130   void                          setDefaultGroupColor();
131   
132   SMESHGUI*                     mySMESHGUI;              /* Current SMESHGUI object */
133   LightApp_SelectionMgr*        mySelectionMgr;          /* User shape selection */
134   SMESH_Actor*                  myActor;                 /* Current mesh actor */
135   int                           myGrpTypeId;             /* Current group type id : standalone or group on geometry */
136   int                           myTypeId;                /* Current type id = radio button id */
137   QLineEdit*                    myCurrentLineEdit;       /* Current  LineEdit */
138   SVTK_Selector*                mySelector;
139   
140   QPushButton*                  myMeshGroupBtn;
141   QLineEdit*                    myMeshGroupLine;
142   
143   QButtonGroup*                 myTypeGroup;
144   QLineEdit*                    myName;
145   QString                       myOldName;
146   
147   QButtonGroup*                 myGrpTypeGroup;
148   
149   QStackedWidget*               myWGStack;
150   QListWidget*                  myElements;
151   QPushButton*                  myFilter;
152   
153   QCheckBox*                    mySelectSubMesh;
154   QPushButton*                  mySubMeshBtn;
155   QLineEdit*                    mySubMeshLine;
156   
157   QCheckBox*                    mySelectGroup;
158   QPushButton*                  myGroupBtn;
159   QLineEdit*                    myGroupLine;
160   
161   QtxColorButton*               myColorBtn;
162   
163   QCheckBox*                    mySelectGeomGroup;
164   QToolButton*                  myGeomGroupBtn;
165   QLineEdit*                    myGeomGroupLine;
166   QMenu*                        myGeomPopup;
167
168   QPushButton*                  myOKBtn;
169   QPushButton*                  myApplyBtn;
170   QPushButton*                  myCloseBtn;
171   QPushButton*                  myHelpBtn;
172   
173   SMESHGUI_ShapeByMeshOp*       myShapeByMeshOp;
174   
175   SMESH::SMESH_Mesh_var         myMesh;
176   SMESH::SMESH_Group_var        myGroup;
177   SMESH::SMESH_GroupOnGeom_var  myGroupOnGeom;
178   QList<int>                    myIdList;
179   GEOM::ListOfGO_var            myGeomObjects;
180   
181   int                           mySelectionMode;
182   //Handle(SMESH_TypeFilter)      myMeshFilter;
183   //Handle(SMESH_TypeFilter)      mySubMeshFilter;
184   //Handle(SMESH_TypeFilter)      myGroupFilter;
185   SUIT_SelectionFilter*         myMeshFilter;
186   SUIT_SelectionFilter*         mySubMeshFilter;
187   SUIT_SelectionFilter*         myGroupFilter;
188   SUIT_SelectionFilter*         myGeomFilter;
189   
190   SMESHGUI_FilterDlg*           myFilterDlg;
191   
192   bool                          myCreate, myIsBusy;
193   
194   QString                       myHelpFileName;
195   
196   QMap<QAction*, int>           myActions;
197 };
198
199 #endif // SMESHGUI_GROUPDLG_H