Salome HOME
Merging with WPdev
[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 //
22 //
23 //  File   : SMESHGUI_GroupDlg.h
24 //  Author : Natalia KOPNOVA
25 //  Module : SMESH
26 //  $Header$
27
28 #ifndef DIALOGBOX_GROUP_H
29 #define DIALOGBOX_GROUP_H
30
31 #include "SMESH_SMESHGUI.hxx"
32
33 #include "LightApp_SelectionMgr.h"
34 //#include "SMESH_TypeFilter.hxx"
35 #include "SUIT_SelectionFilter.h"
36
37 // QT Includes
38 #include <qdialog.h>
39 #include <qvaluelist.h>
40
41 // IDL Headers
42 #include <SALOMEconfig.h>
43 #include CORBA_SERVER_HEADER(SMESH_Mesh)
44 #include CORBA_SERVER_HEADER(SMESH_Group)
45
46 class QLineEdit;
47 class QButtonGroup;
48 class QGroupBox;
49 class QListBox;
50 class QPopupMenu;
51 class QPushButton;
52 class QToolButton;
53 class QCheckBox;
54 class QWidgetStack;
55 class QtxIntSpinBox;
56 class SMESHGUI;
57 class SMESH_Actor;
58 class SMESHGUI_FilterDlg;
59 class SMESHGUI_ShapeByMeshOp;
60 class SUIT_Operation;
61 class SVTK_Selector;
62 class SVTK_ViewWindow;
63
64 //=================================================================================
65 // class    : SMESHGUI_GroupDlg
66 // purpose  :
67 //=================================================================================
68 class SMESHGUI_EXPORT SMESHGUI_GroupDlg : public QDialog
69
70     Q_OBJECT
71
72 public:
73     SMESHGUI_GroupDlg( SMESHGUI*,
74                        const char* name = 0, 
75                        SMESH::SMESH_Mesh_ptr theMesh = SMESH::SMESH_Mesh::_nil(), 
76                        bool modal = FALSE, WFlags fl = 0 );
77     SMESHGUI_GroupDlg( SMESHGUI*,
78                        const char* name, 
79                        SMESH::SMESH_GroupBase_ptr theGroup,
80                        bool modal = FALSE, WFlags fl = 0 );
81     ~SMESHGUI_GroupDlg();
82
83 public slots:
84
85     void onAdd();
86     void onRemove();
87
88
89 private slots:
90
91     void onTypeChanged(int id);
92     void onGrpTypeChanged(int id);
93
94     void onOK();
95     void onClose();
96     bool onApply();
97     void onHelp();
98     void onDeactivate();
99
100     void onListSelectionChanged();
101     void onObjectSelectionChanged();
102
103     void onSelectSubMesh(bool on);
104     void onSelectGroup(bool on);
105     void onSelectGeomGroup(bool on);
106     void onSelectColorGroup(bool on);
107     void setCurrentSelection();
108
109     void setFilters();
110     void onSort();
111
112     void onNameChanged(const QString& text);
113     void onNbColorsChanged(const QString& text);
114     void onFilterAccepted();
115
116     void onGeomPopup( int );
117     void onGeomSelectionButton( bool );
118
119     void onPublishShapeByMeshDlg(SUIT_Operation*);
120     void onCloseShapeByMeshDlg(SUIT_Operation*);
121
122 private:
123     void initDialog(bool create);
124     void init(SMESH::SMESH_Mesh_ptr theMesh);
125     void init(SMESH::SMESH_GroupBase_ptr theGroup);
126     void closeEvent(QCloseEvent* e);
127     void enterEvent (QEvent*);
128     void hideEvent (QHideEvent*);                          /* ESC key */
129     void keyPressEvent(QKeyEvent*);
130     void setSelectionMode(int theMode);
131     void updateButtons();
132     void updateGeomPopup();
133
134     SMESHGUI*                     mySMESHGUI;              /* Current SMESHGUI object */
135     LightApp_SelectionMgr*        mySelectionMgr;          /* User shape selection */
136     SMESH_Actor*                  myActor;                 /* Current mesh actor */
137     int                           myGrpTypeId; /* Current group type id : standalone or group on geometry */
138     int                           myTypeId;                /* Current type id = radio button id */
139     QLineEdit*                    myCurrentLineEdit;       /* Current  LineEdit */
140     SVTK_Selector*                mySelector;
141
142     QPushButton*                  myMeshGroupBtn;
143     QLineEdit*                    myMeshGroupLine;
144     
145     QButtonGroup*                 myTypeGroup;
146     QLineEdit*                    myName;
147
148     QButtonGroup*                 myGrpTypeGroup;
149
150     QWidgetStack*                 myWGStack;
151     QListBox*                     myElements;
152     QPushButton*                  myFilter;
153
154     QCheckBox*                    mySelectSubMesh;
155     QPushButton*                  mySubMeshBtn;
156     QLineEdit*                    mySubMeshLine;
157
158     QCheckBox*                    mySelectGroup;
159     QPushButton*                  myGroupBtn;
160     QLineEdit*                    myGroupLine;
161
162     QCheckBox*                    mySelectColorGroup;
163     QtxIntSpinBox*                myColorSpinBox;
164
165     QCheckBox*                    mySelectGeomGroup;
166     QToolButton*                  myGeomGroupBtn;
167     QLineEdit*                    myGeomGroupLine;
168     QPopupMenu*                   myGeomPopup;
169
170     SMESHGUI_ShapeByMeshOp*       myShapeByMeshOp;
171
172     SMESH::SMESH_Mesh_var         myMesh;
173     SMESH::SMESH_Group_var        myGroup;
174     SMESH::SMESH_GroupOnGeom_var  myGroupOnGeom;
175     QValueList<int>               myIdList;
176     GEOM::ListOfGO_var            myGeomObjects;
177
178     int                           mySelectionMode;
179     //Handle(SMESH_TypeFilter)      myMeshFilter;
180     //Handle(SMESH_TypeFilter)      mySubMeshFilter;
181     //Handle(SMESH_TypeFilter)      myGroupFilter;
182     SUIT_SelectionFilter*         myMeshFilter;
183     SUIT_SelectionFilter*         mySubMeshFilter;
184     SUIT_SelectionFilter*         myGroupFilter;
185     SUIT_SelectionFilter*         myGeomFilter;
186
187     SMESHGUI_FilterDlg*           myFilterDlg;
188
189     bool                          myCreate, myIsBusy;
190
191     QString                       myHelpFileName;
192 };
193
194 #endif // DIALOGBOX_GROUP_H