Salome HOME
Integration of PAL/SALOME V2.1.0c from OCC
[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 "SALOME_Selection.h"
32 #include "SMESH_TypeFilter.hxx"
33
34 // QT Includes
35 #include <qdialog.h>
36 #include <qvaluelist.h>
37
38 // IDL Headers
39 #include <SALOMEconfig.h>
40 #include CORBA_SERVER_HEADER(SMESH_Mesh)
41 #include CORBA_SERVER_HEADER(SMESH_Group)
42
43 class QLineEdit;
44 class QButtonGroup;
45 class QGroupBox;
46 class QListBox;
47 class QPushButton;
48 class QCheckBox;
49 class SMESHGUI;
50 class SMESH_Actor;
51 class SMESHGUI_FilterDlg;
52
53 //=================================================================================
54 // class    : SMESHGUI_GroupDlg
55 // purpose  :
56 //=================================================================================
57 class SMESHGUI_GroupDlg : public QDialog
58
59     Q_OBJECT
60
61 public:
62     SMESHGUI_GroupDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* theSel = 0, 
63                        SMESH::SMESH_Mesh_ptr theMesh = SMESH::SMESH_Mesh::_nil(), 
64                        bool modal = FALSE, WFlags fl = 0 );
65     SMESHGUI_GroupDlg( QWidget* parent, const char* name, SALOME_Selection* theSel, 
66                        SMESH::SMESH_Group_ptr theGroup, bool modal = FALSE, WFlags fl = 0 );
67     ~SMESHGUI_GroupDlg();
68
69 public slots:
70
71     void onAdd();
72     void onRemove();
73
74
75 private slots:
76
77     void onTypeChanged(int id);
78
79     void onOK();
80     void onClose();
81     bool onApply();
82     void onDeactivate();
83
84     void onListSelectionChanged();
85     void onObjectSelectionChanged();
86
87     void onSelectSubMesh(bool on);
88     void onSelectGroup(bool on);
89     void onSelectGeomGroup(bool on);
90     void setCurrentSelection();
91
92     void setFilters();
93     void onSort();
94
95     void onNameChanged(const QString& text);
96     void onFilterAccepted();
97
98 private:
99     void initDialog(SALOME_Selection* theSel, bool create);
100     void init(SMESH::SMESH_Mesh_ptr theMesh);
101     void init(SMESH::SMESH_Group_ptr theGroup);
102     void closeEvent(QCloseEvent* e);
103     void enterEvent ( QEvent * ) ;            
104     void hideEvent ( QHideEvent * );                        /* ESC key */
105     void setSelectionMode(int theMode);
106     void updateButtons();
107
108     SMESHGUI*                     mySMESHGUI ;              /* Current SMESHGUI object */
109     SALOME_Selection*             mySelection ;             /* User shape selection */
110     SMESH_Actor*                  myActor;                  /* Current mesh actor */
111     int                           myTypeId ;                /* Current type id = radio button id */
112     QLineEdit*                    myCurrentLineEdit;        /* Current  LineEdit */
113
114     QButtonGroup*                 myTypeGroup;
115     QLineEdit*                    myName;
116     QListBox*                     myElements;
117     QPushButton*                  myFilter;
118     QCheckBox*                    mySelectSubMesh;
119     QPushButton*                  mySubMeshBtn;
120     QLineEdit*                    mySubMeshLine;
121
122     QCheckBox*                    mySelectGroup;
123     QPushButton*                  myGroupBtn;
124     QLineEdit*                    myGroupLine;
125
126     QCheckBox*                    mySelectGeomGroup;
127     QPushButton*                  myGeomGroupBtn;
128     QLineEdit*                    myGeomGroupLine;
129
130     SMESH::SMESH_Mesh_var         myMesh;
131     SMESH::SMESH_Group_var        myGroup;
132     QValueList<int>               myIdList;
133     GEOM::GEOM_Object_var         myGeomGroup;
134
135     int                           mySelectionMode;
136     Handle(SMESH_TypeFilter)      mySubMeshFilter;
137     Handle(SMESH_TypeFilter)      myGroupFilter;
138
139     SMESHGUI_FilterDlg*           myFilterDlg;
140 };
141
142 #endif // DIALOGBOX_GROUP_H