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