Salome HOME
PAL17644: automatic actor's entity mode
[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.com
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 QPopupMenu;
49 class QPushButton;
50 class QToolButton;
51 class QCheckBox;
52 class QWidgetStack;
53 class QtxIntSpinBox;
54 class SMESHGUI;
55 class SMESH_Actor;
56 class SMESHGUI_FilterDlg;
57 class SMESHGUI_ShapeByMeshOp;
58 class SUIT_Operation;
59 class SVTK_Selector;
60 class SVTK_ViewWindow;
61
62 //=================================================================================
63 // class    : SMESHGUI_GroupDlg
64 // purpose  :
65 //=================================================================================
66 class SMESHGUI_GroupDlg : public QDialog
67
68     Q_OBJECT
69
70 public:
71     SMESHGUI_GroupDlg( SMESHGUI*,
72                        const char* name = 0, 
73                        SMESH::SMESH_Mesh_ptr theMesh = SMESH::SMESH_Mesh::_nil(), 
74                        bool modal = FALSE, WFlags fl = 0 );
75     SMESHGUI_GroupDlg( SMESHGUI*,
76                        const char* name, 
77                        SMESH::SMESH_GroupBase_ptr theGroup,
78                        bool modal = FALSE, WFlags fl = 0 );
79     ~SMESHGUI_GroupDlg();
80
81     static QString GetDefaultName(const QString& theOperation);
82
83 public slots:
84
85     void onAdd();
86     void onRemove();
87
88
89 private slots:
90
91     void onTypeChanged(int id);
92     void onGrpTypeChanged(int id);
93
94     void onOK();
95     void onClose();
96     bool onApply();
97     void onHelp();
98     void onDeactivate();
99
100     void onListSelectionChanged();
101     void onObjectSelectionChanged();
102
103     void onSelectSubMesh(bool on);
104     void onSelectGroup(bool on);
105     void onSelectGeomGroup(bool on);
106     void onSelectColorGroup(bool on);
107     void setCurrentSelection();
108
109     void setFilters();
110     void onSort();
111
112     void onNameChanged(const QString& text);
113     void onNbColorsChanged(const QString& text);
114     void onFilterAccepted();
115
116     void onGeomPopup( int );
117     void onGeomSelectionButton( bool );
118
119     void onPublishShapeByMeshDlg(SUIT_Operation*);
120     void onCloseShapeByMeshDlg(SUIT_Operation*);
121
122 private:
123     void initDialog(bool create);
124     void init(SMESH::SMESH_Mesh_ptr theMesh);
125     void init(SMESH::SMESH_GroupBase_ptr theGroup);
126     void closeEvent(QCloseEvent* e);
127     void enterEvent (QEvent*);
128     void hideEvent (QHideEvent*);                          /* ESC key */
129     void keyPressEvent(QKeyEvent*);
130     void setSelectionMode(int theMode);
131     void updateButtons();
132     void updateGeomPopup();
133     void storeMode();
134
135     SMESHGUI*                     mySMESHGUI;              /* Current SMESHGUI object */
136     LightApp_SelectionMgr*        mySelectionMgr;          /* User shape selection */
137     SMESH_Actor*                  myActor;                 /* Current mesh actor */
138     int                           myGrpTypeId; /* Current group type id : standalone or group on geometry */
139     int                           myTypeId;                /* Current type id = radio button id */
140     QLineEdit*                    myCurrentLineEdit;       /* Current  LineEdit */
141     SVTK_Selector*                mySelector;
142
143     QPushButton*                  myMeshGroupBtn;
144     QLineEdit*                    myMeshGroupLine;
145     
146     QButtonGroup*                 myTypeGroup;
147     QLineEdit*                    myName;
148     QString                       myOldName;
149
150     QButtonGroup*                 myGrpTypeGroup;
151
152     QWidgetStack*                 myWGStack;
153     QListBox*                     myElements;
154     QPushButton*                  myFilter;
155
156     QCheckBox*                    mySelectSubMesh;
157     QPushButton*                  mySubMeshBtn;
158     QLineEdit*                    mySubMeshLine;
159
160     QCheckBox*                    mySelectGroup;
161     QPushButton*                  myGroupBtn;
162     QLineEdit*                    myGroupLine;
163
164     QCheckBox*                    mySelectColorGroup;
165     QtxIntSpinBox*                myColorSpinBox;
166
167     QCheckBox*                    mySelectGeomGroup;
168     QToolButton*                  myGeomGroupBtn;
169     QLineEdit*                    myGeomGroupLine;
170     QPopupMenu*                   myGeomPopup;
171
172     SMESHGUI_ShapeByMeshOp*       myShapeByMeshOp;
173
174     SMESH::SMESH_Mesh_var         myMesh;
175     SMESH::SMESH_Group_var        myGroup;
176     SMESH::SMESH_GroupOnGeom_var  myGroupOnGeom;
177     QValueList<int>               myIdList;
178     GEOM::ListOfGO_var            myGeomObjects;
179
180     int                           mySelectionMode;
181     //Handle(SMESH_TypeFilter)      myMeshFilter;
182     //Handle(SMESH_TypeFilter)      mySubMeshFilter;
183     //Handle(SMESH_TypeFilter)      myGroupFilter;
184     SUIT_SelectionFilter*         myMeshFilter;
185     SUIT_SelectionFilter*         mySubMeshFilter;
186     SUIT_SelectionFilter*         myGroupFilter;
187     SUIT_SelectionFilter*         myGeomFilter;
188
189     SMESHGUI_FilterDlg*           myFilterDlg;
190
191     bool                          myCreate, myIsBusy;
192
193     QString                       myHelpFileName;
194     int                           myOldActorMode;
195 };
196
197 #endif // DIALOGBOX_GROUP_H