Salome HOME
Join modifications from branch BR_DEBUG_3_2_0b1
[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 QPushButton;
49 class QCheckBox;
50 class QWidgetStack;
51 class QtxIntSpinBox;
52 class SMESHGUI;
53 class SMESH_Actor;
54 class SMESHGUI_FilterDlg;
55 class SVTK_Selector;
56 class SVTK_ViewWindow;
57
58 //=================================================================================
59 // class    : SMESHGUI_GroupDlg
60 // purpose  :
61 //=================================================================================
62 class SMESHGUI_GroupDlg : public QDialog
63
64     Q_OBJECT
65
66 public:
67     SMESHGUI_GroupDlg( SMESHGUI*,
68                        const char* name = 0, 
69                        SMESH::SMESH_Mesh_ptr theMesh = SMESH::SMESH_Mesh::_nil(), 
70                        bool modal = FALSE, WFlags fl = 0 );
71     SMESHGUI_GroupDlg( SMESHGUI*,
72                        const char* name, 
73                        SMESH::SMESH_GroupBase_ptr theGroup,
74                        bool modal = FALSE, WFlags fl = 0 );
75     ~SMESHGUI_GroupDlg();
76
77 public slots:
78
79     void onAdd();
80     void onRemove();
81
82
83 private slots:
84
85     void onTypeChanged(int id);
86     void onGrpTypeChanged(int id);
87
88     void onOK();
89     void onClose();
90     bool onApply();
91     void onHelp();
92     void onDeactivate();
93
94     void onListSelectionChanged();
95     void onObjectSelectionChanged();
96
97     void onSelectSubMesh(bool on);
98     void onSelectGroup(bool on);
99     void onSelectGeomGroup(bool on);
100     void onSelectColorGroup(bool on);
101     void setCurrentSelection();
102
103     void setFilters();
104     void onSort();
105
106     void onNameChanged(const QString& text);
107     void onNbColorsChanged(const QString& text);
108     void onFilterAccepted();
109
110 private:
111     void initDialog(bool create);
112     void init(SMESH::SMESH_Mesh_ptr theMesh);
113     void init(SMESH::SMESH_GroupBase_ptr theGroup);
114     void closeEvent(QCloseEvent* e);
115     void enterEvent (QEvent*);
116     void hideEvent (QHideEvent*);                          /* ESC key */
117     void setSelectionMode(int theMode);
118     void updateButtons();
119
120     SMESHGUI*                     mySMESHGUI;              /* Current SMESHGUI object */
121     LightApp_SelectionMgr*        mySelectionMgr;          /* User shape selection */
122     SMESH_Actor*                  myActor;                 /* Current mesh actor */
123     int                           myGrpTypeId; /* Current group type id : standalone or group on geometry */
124     int                           myTypeId;                /* Current type id = radio button id */
125     QLineEdit*                    myCurrentLineEdit;       /* Current  LineEdit */
126     SVTK_Selector*                mySelector;
127
128     QPushButton*                  myMeshGroupBtn;
129     QLineEdit*                    myMeshGroupLine;
130     
131     QButtonGroup*                 myTypeGroup;
132     QLineEdit*                    myName;
133
134     QButtonGroup*                 myGrpTypeGroup;
135
136     QWidgetStack*                 myWGStack;
137     QListBox*                     myElements;
138     QPushButton*                  myFilter;
139
140     QCheckBox*                    mySelectSubMesh;
141     QPushButton*                  mySubMeshBtn;
142     QLineEdit*                    mySubMeshLine;
143
144     QCheckBox*                    mySelectGroup;
145     QPushButton*                  myGroupBtn;
146     QLineEdit*                    myGroupLine;
147
148     QCheckBox*                    mySelectColorGroup;
149     QtxIntSpinBox*                myColorSpinBox;
150
151     QCheckBox*                    mySelectGeomGroup;
152     QPushButton*                  myGeomGroupBtn;
153     QLineEdit*                    myGeomGroupLine;
154
155     SMESH::SMESH_Mesh_var         myMesh;
156     SMESH::SMESH_Group_var        myGroup;
157     SMESH::SMESH_GroupOnGeom_var  myGroupOnGeom;
158     QValueList<int>               myIdList;
159     GEOM::GEOM_Object_var         myGeomGroup;
160
161     int                           mySelectionMode;
162     //Handle(SMESH_TypeFilter)      myMeshFilter;
163     //Handle(SMESH_TypeFilter)      mySubMeshFilter;
164     //Handle(SMESH_TypeFilter)      myGroupFilter;
165     SUIT_SelectionFilter*         myMeshFilter;
166     SUIT_SelectionFilter*         mySubMeshFilter;
167     SUIT_SelectionFilter*         myGroupFilter;
168
169     SMESHGUI_FilterDlg*           myFilterDlg;
170
171     bool                          myCreate, myIsBusy;
172
173     QString                       myHelpFileName;
174 };
175
176 #endif // DIALOGBOX_GROUP_H