Salome HOME
Merge from BR_V5_DEV 16Feb09
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_GroupOpDlg.h
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 // SMESH SMESHGUI : GUI for SMESH component
23 // File   : SMESHGUI_GroupOpDlg.h
24 // Author : Sergey LITONIN, Open CASCADE S.A.S.
25 //
26 #ifndef SMESHGUI_GROUPOPDLG_H
27 #define SMESHGUI_GROUPOPDLG_H
28
29 // SMESH includes
30 #include "SMESH_SMESHGUI.hxx"
31
32 // Qt includes
33 #include <QDialog>
34
35 // IDL includes
36 #include <SALOMEconfig.h>
37 #include CORBA_SERVER_HEADER(SMESH_Group)
38
39 class QPushButton;
40 class QtxColorButton;
41 class QComboBox;
42 class QListWidget;
43 class QGroupBox;
44 class QLineEdit;
45 class SMESHGUI;
46 class LightApp_SelectionMgr;
47 class SVTK_Selector;
48
49 /*
50   Class       : SMESHGUI_GroupOpDlg
51   Description : Perform boolean operations on groups
52 */
53
54 class SMESHGUI_EXPORT SMESHGUI_GroupOpDlg : public QDialog
55
56   Q_OBJECT
57     
58 public:
59   //enum { UNION, INTERSECT, CUT };
60     
61 public:
62   SMESHGUI_GroupOpDlg( SMESHGUI* );
63   virtual ~SMESHGUI_GroupOpDlg();
64
65   void                      Init();
66
67 protected slots:
68
69   virtual bool              onApply();
70   virtual void              onSelectionDone();
71   virtual void              setVisible ( bool visible );
72
73 protected:
74
75   virtual void              reset();
76
77   QString                   getName() const;
78   void                      setName( const QString& theName );
79
80   QGroupBox*                getArgGrp() const;
81   void                      setHelpFileName( const QString& theFName );
82   SMESHGUI*                 getSMESHGUI() const;
83   bool                      isValid( const QList<SMESH::SMESH_GroupBase_var>& theListGrp );
84   bool                      getSelectedGroups( QList<SMESH::SMESH_GroupBase_var>& theOutList,
85                                                QStringList& theOutNames );
86   SMESH::ListOfGroups*      convert( const QList<SMESH::SMESH_GroupBase_var>& );
87
88   SALOMEDS::Color           getColor() const;
89
90 private:
91   void                      closeEvent( QCloseEvent* );
92   void                      enterEvent( QEvent* );            
93   void                      keyPressEvent( QKeyEvent* );
94   
95 private slots:
96   void                      onOk();
97   void                      onClose();
98   void                      onHelp();
99
100   void                      onDeactivate();
101
102 private:
103   QWidget*                  createButtonFrame( QWidget* );
104   QWidget*                  createMainFrame  ( QWidget* );
105     
106 private:
107   QPushButton*              myOkBtn;
108   QPushButton*              myApplyBtn;
109   QPushButton*              myCloseBtn;
110   QPushButton*              myHelpBtn;
111   
112   QLineEdit*                myNameEdit;
113   QGroupBox*                myArgGrp;
114   QtxColorButton*           myColorBtn;
115   
116   SMESHGUI*                 mySMESHGUI;
117   LightApp_SelectionMgr*    mySelectionMgr;
118   SVTK_Selector*            mySelector;
119   
120   QString                   myHelpFileName;
121 };
122
123 /*
124   Class       : SMESHGUI_UnionGroupsDlg
125   Description : Perform union of several groups
126 */
127
128 class SMESHGUI_EXPORT SMESHGUI_UnionGroupsDlg : public SMESHGUI_GroupOpDlg
129
130   Q_OBJECT
131     
132 public:
133
134   SMESHGUI_UnionGroupsDlg( SMESHGUI* );
135   virtual ~SMESHGUI_UnionGroupsDlg();
136
137 protected slots:
138   virtual bool                      onApply();
139   virtual void                      onSelectionDone();
140
141 protected:
142   virtual void                      reset();
143
144 private:
145   QListWidget*                      myListWg;
146   QList<SMESH::SMESH_GroupBase_var> myGroups;
147 };
148
149 /*
150   Class       : SMESHGUI_IntersectGroupsDlg
151   Description : Perform intersection of several groups
152 */
153
154 class SMESHGUI_EXPORT SMESHGUI_IntersectGroupsDlg : public SMESHGUI_GroupOpDlg
155
156   Q_OBJECT
157     
158 public:
159
160   SMESHGUI_IntersectGroupsDlg( SMESHGUI* );
161   virtual ~SMESHGUI_IntersectGroupsDlg();
162
163 protected slots:
164   virtual bool                      onApply();
165   virtual void                      onSelectionDone();
166
167 protected:
168   virtual void                      reset();
169     
170 private:
171   QListWidget*                      myListWg;
172   QList<SMESH::SMESH_GroupBase_var> myGroups;
173 };
174
175 /*
176   Class       : SMESHGUI_CutGroupsDlg
177   Description : Perform cut of several groups
178 */
179
180 class SMESHGUI_EXPORT SMESHGUI_CutGroupsDlg : public SMESHGUI_GroupOpDlg
181
182   Q_OBJECT
183     
184 public:
185
186   SMESHGUI_CutGroupsDlg( SMESHGUI* );
187   virtual ~SMESHGUI_CutGroupsDlg();
188
189 protected slots:
190   virtual bool                      onApply();
191   virtual void                      onSelectionDone();
192
193 protected:
194   virtual void                      reset();
195
196 private:
197   QPushButton*                      myBtn1;
198   QPushButton*                      myBtn2;
199   QListWidget*                      myListWg1;
200   QListWidget*                      myListWg2;
201   QList<SMESH::SMESH_GroupBase_var> myGroups1;
202   QList<SMESH::SMESH_GroupBase_var> myGroups2;
203 };
204
205 /*
206   Class       : SMESHGUI_DimGroupDlg
207   Description : Dialog for creating groups of entities from existing 
208                 groups of superior dimensions
209 */
210
211 class SMESHGUI_EXPORT SMESHGUI_DimGroupDlg : public SMESHGUI_GroupOpDlg
212
213   Q_OBJECT
214     
215 public:
216
217   SMESHGUI_DimGroupDlg( SMESHGUI* );
218   virtual ~SMESHGUI_DimGroupDlg();
219
220   SMESH::ElementType                getElementType() const;
221   void                              setElementType( const SMESH::ElementType& theElemType );
222
223 protected:
224   virtual void                      reset();
225
226 protected slots:
227   virtual bool                      onApply();
228   virtual void                      onSelectionDone();
229
230 private:
231   QComboBox*                        myCombo;
232   QListWidget*                      myListWg;
233   QList<SMESH::SMESH_GroupBase_var> myGroups;
234 };
235
236 #endif // SMESHGUI_GROUPOPDLG_H
237
238