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