Salome HOME
SALOME PAL V1_4_1
[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 QListBox;
46 class QPushButton;
47 class QCheckBox;
48 class SMESHGUI;
49 class SMESH_Actor;
50 class SMESHGUI_FilterDlg;
51
52 //=================================================================================
53 // class    : SMESHGUI_GroupDlg
54 // purpose  :
55 //=================================================================================
56 class SMESHGUI_GroupDlg : public QDialog
57
58     Q_OBJECT
59
60 public:
61     SMESHGUI_GroupDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* theSel = 0, 
62                        SMESH::SMESH_Mesh_ptr theMesh = SMESH::SMESH_Mesh::_nil(), 
63                        bool modal = FALSE, WFlags fl = 0 );
64     SMESHGUI_GroupDlg( QWidget* parent, const char* name, SALOME_Selection* theSel, 
65                        SMESH::SMESH_Group_ptr theGroup, bool modal = FALSE, WFlags fl = 0 );
66     ~SMESHGUI_GroupDlg();
67
68 public slots:
69
70     void onAdd();
71     void onRemove();
72
73
74 private slots:
75
76     void onTypeChanged(int id);
77
78     void onOK();
79     void onClose();
80     bool onApply();
81
82     void onListSelectionChanged();
83     void onObjectSelectionChanged();
84
85     void onSelectSubMesh(bool on);
86     void onSelectGroup(bool on);
87     void setCurrentSelection();
88
89     void setFilters();
90     void onSort();
91
92     void onNameChanged(const QString& text);
93
94 private:
95     void initDialog(SALOME_Selection* theSel, bool create);
96     void init(SMESH::SMESH_Mesh_ptr theMesh);
97     void init(SMESH::SMESH_Group_ptr theGroup);
98     void closeEvent(QCloseEvent* e);
99     void setSelectionMode(int theMode);
100     void updateButtons();
101
102     SMESHGUI*                     mySMESHGUI ;              /* Current SMESHGUI object */
103     SALOME_Selection*             mySelection ;             /* User shape selection */
104     SMESH_Actor*                  myActor;                  /* Current mesh actor */
105     int                           myTypeId ;                /* Current type id = radio button id */
106     QLineEdit*                    myCurrentLineEdit;        /* Current  LineEdit */
107
108     QButtonGroup*                 myTypeGroup;
109     QLineEdit*                    myName;
110     QListBox*                     myElements;
111     QPushButton*                  myFilter;
112
113     QCheckBox*                    mySelectSubMesh;
114     QPushButton*                  mySubMeshBtn;
115     QLineEdit*                    mySubMeshLine;
116
117     QCheckBox*                    mySelectGroup;
118     QPushButton*                  myGroupBtn;
119     QLineEdit*                    myGroupLine;
120
121     SMESH::SMESH_Mesh_var         myMesh;
122     SMESH::SMESH_Group_var        myGroup;
123     QValueList<int>               myIdList;
124
125     int                           mySelectionMode;
126     Handle(SMESH_TypeFilter)      mySubMeshFilter;
127     Handle(SMESH_TypeFilter)      myGroupFilter;
128
129     SMESHGUI_FilterDlg*           myFilterDlg;
130 };
131
132 #endif // DIALOGBOX_GROUP_H