Salome HOME
Update from local sources
[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_ViewWindow*              myViewWindow;
123     SVTK_Selector*                mySelector;
124
125     QPushButton*                  myMeshGroupBtn;
126     QLineEdit*                    myMeshGroupLine;
127     
128     QButtonGroup*                 myTypeGroup;
129     QLineEdit*                    myName;
130
131     QButtonGroup*                 myGrpTypeGroup;
132
133     QWidgetStack*                 myWGStack;
134     QListBox*                     myElements;
135     QPushButton*                  myFilter;
136
137     QCheckBox*                    mySelectSubMesh;
138     QPushButton*                  mySubMeshBtn;
139     QLineEdit*                    mySubMeshLine;
140
141     QCheckBox*                    mySelectGroup;
142     QPushButton*                  myGroupBtn;
143     QLineEdit*                    myGroupLine;
144
145     QCheckBox*                    mySelectGeomGroup;
146     QPushButton*                  myGeomGroupBtn;
147     QLineEdit*                    myGeomGroupLine;
148
149     SMESH::SMESH_Mesh_var         myMesh;
150     SMESH::SMESH_Group_var        myGroup;
151     QValueList<int>               myIdList;
152     GEOM::GEOM_Object_var         myGeomGroup;
153
154     int                           mySelectionMode;
155     //Handle(SMESH_TypeFilter)      myMeshFilter;
156     //Handle(SMESH_TypeFilter)      mySubMeshFilter;
157     //Handle(SMESH_TypeFilter)      myGroupFilter;
158     SUIT_SelectionFilter*         myMeshFilter;
159     SUIT_SelectionFilter*         mySubMeshFilter;
160     SUIT_SelectionFilter*         myGroupFilter;
161
162     SMESHGUI_FilterDlg*           myFilterDlg;
163
164     bool                          myCreate, myIsBusy;
165 };
166
167 #endif // DIALOGBOX_GROUP_H