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