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