Salome HOME
b0b33e8911e3520d9470d91b4713dc0f20ee1630
[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 "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 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_GroupBase_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 onHelp();
91     void onDeactivate();
92
93     void onListSelectionChanged();
94     void onObjectSelectionChanged();
95
96     void onSelectSubMesh(bool on);
97     void onSelectGroup(bool on);
98     void onSelectGeomGroup(bool on);
99     void onSelectColorGroup(bool on);
100     void setCurrentSelection();
101
102     void setFilters();
103     void onSort();
104
105     void onNameChanged(const QString& text);
106     void onNbColorsChanged(const QString& text);
107     void onFilterAccepted();
108
109 private:
110     void initDialog(bool create);
111     void init(SMESH::SMESH_Mesh_ptr theMesh);
112     void init(SMESH::SMESH_GroupBase_ptr theGroup);
113     void closeEvent(QCloseEvent* e);
114     void enterEvent (QEvent*);
115     void hideEvent (QHideEvent*);                          /* ESC key */
116     void setSelectionMode(int theMode);
117     void updateButtons();
118
119     SMESHGUI*                     mySMESHGUI;              /* Current SMESHGUI object */
120     LightApp_SelectionMgr*        mySelectionMgr;          /* User shape selection */
121     SMESH_Actor*                  myActor;                 /* Current mesh actor */
122     int                           myGrpTypeId; /* Current group type id : standalone or group on geometry */
123     int                           myTypeId;                /* Current type id = radio button id */
124     QLineEdit*                    myCurrentLineEdit;       /* Current  LineEdit */
125     SVTK_Selector*                mySelector;
126
127     QPushButton*                  myMeshGroupBtn;
128     QLineEdit*                    myMeshGroupLine;
129     
130     QButtonGroup*                 myTypeGroup;
131     QLineEdit*                    myName;
132
133     QButtonGroup*                 myGrpTypeGroup;
134
135     QWidgetStack*                 myWGStack;
136     QListBox*                     myElements;
137     QPushButton*                  myFilter;
138
139     QCheckBox*                    mySelectSubMesh;
140     QPushButton*                  mySubMeshBtn;
141     QLineEdit*                    mySubMeshLine;
142
143     QCheckBox*                    mySelectGroup;
144     QPushButton*                  myGroupBtn;
145     QLineEdit*                    myGroupLine;
146
147     QCheckBox*                    mySelectColorGroup;
148     QLineEdit*                    myColorGroupLine;
149
150     QCheckBox*                    mySelectGeomGroup;
151     QPushButton*                  myGeomGroupBtn;
152     QLineEdit*                    myGeomGroupLine;
153
154     SMESH::SMESH_Mesh_var         myMesh;
155     SMESH::SMESH_Group_var        myGroup;
156     SMESH::SMESH_GroupOnGeom_var  myGroupOnGeom;
157     QValueList<int>               myIdList;
158     GEOM::GEOM_Object_var         myGeomGroup;
159
160     int                           mySelectionMode;
161     //Handle(SMESH_TypeFilter)      myMeshFilter;
162     //Handle(SMESH_TypeFilter)      mySubMeshFilter;
163     //Handle(SMESH_TypeFilter)      myGroupFilter;
164     SUIT_SelectionFilter*         myMeshFilter;
165     SUIT_SelectionFilter*         mySubMeshFilter;
166     SUIT_SelectionFilter*         myGroupFilter;
167
168     SMESHGUI_FilterDlg*           myFilterDlg;
169
170     bool                          myCreate, myIsBusy;
171
172     QString                       myHelpFileName;
173 };
174
175 #endif // DIALOGBOX_GROUP_H