Salome HOME
Merge from V6_5_BR 05/06/2012
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_GroupOpDlg.h
1 // Copyright (C) 2007-2012  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
23 // SMESH SMESHGUI : GUI for SMESH component
24 // File   : SMESHGUI_GroupOpDlg.h
25 // Author : Sergey LITONIN, Open CASCADE S.A.S.
26 //
27 #ifndef SMESHGUI_GROUPOPDLG_H
28 #define SMESHGUI_GROUPOPDLG_H
29
30 // SMESH includes
31 #include "SMESH_SMESHGUI.hxx"
32
33 // Qt includes
34 #include <QDialog>
35
36 // IDL includes
37 #include <SALOMEconfig.h>
38 #include CORBA_SERVER_HEADER(SMESH_Group)
39
40 class QPushButton;
41 class QtxColorButton;
42 class QComboBox;
43 class QListWidget;
44 class QGroupBox;
45 class QLineEdit;
46 class SMESHGUI;
47 class LightApp_SelectionMgr;
48 class SVTK_Selector;
49
50 /*
51   Class       : SMESHGUI_GroupOpDlg
52   Description : Perform boolean operations on groups
53 */
54
55 class SMESHGUI_EXPORT SMESHGUI_GroupOpDlg : public QDialog
56
57   Q_OBJECT
58     
59 public:
60   //enum { UNION, INTERSECT, CUT };
61     
62 public:
63   SMESHGUI_GroupOpDlg( SMESHGUI* );
64   virtual ~SMESHGUI_GroupOpDlg();
65
66   void                      Init();
67
68 protected slots:
69
70   virtual bool              onApply();
71   virtual void              onSelectionDone();
72   virtual void              setVisible ( bool visible );
73
74 protected:
75
76   virtual void              reset();
77
78   QString                   getName() const;
79   void                      setName( const QString& theName );
80
81   QGroupBox*                getArgGrp() const;
82   void                      setHelpFileName( const QString& theFName );
83   SMESHGUI*                 getSMESHGUI() const;
84   bool                      isValid( const QList<SMESH::SMESH_GroupBase_var>& theListGrp );
85   bool                      getSelectedGroups( QList<SMESH::SMESH_GroupBase_var>& theOutList,
86                                                QStringList& theOutNames );
87   SMESH::ListOfGroups*      convert( const QList<SMESH::SMESH_GroupBase_var>& );
88
89   SALOMEDS::Color           getColor() const;
90
91   void                      setIsApplyAndClose( const bool theFlag );
92   bool                      isApplyAndClose() const;
93
94 private:
95   void                      closeEvent( QCloseEvent* );
96   void                      enterEvent( QEvent* );            
97   void                      keyPressEvent( QKeyEvent* );
98   
99 private slots:
100   void                      onOk();
101   void                      onClose();
102   void                      onHelp();
103
104   void                      onDeactivate();
105
106 private:
107   QWidget*                  createButtonFrame( QWidget* );
108   QWidget*                  createMainFrame  ( QWidget* );
109     
110 private:
111   QPushButton*              myOkBtn;
112   QPushButton*              myApplyBtn;
113   QPushButton*              myCloseBtn;
114   QPushButton*              myHelpBtn;
115   
116   QLineEdit*                myNameEdit;
117   QGroupBox*                myArgGrp;
118   QtxColorButton*           myColorBtn;
119   
120   SMESHGUI*                 mySMESHGUI;
121   LightApp_SelectionMgr*    mySelectionMgr;
122   SVTK_Selector*            mySelector;
123   
124   QString                   myHelpFileName;
125
126   bool                      myIsApplyAndClose;
127 };
128
129 /*
130   Class       : SMESHGUI_UnionGroupsDlg
131   Description : Perform union of several groups
132 */
133
134 class SMESHGUI_EXPORT SMESHGUI_UnionGroupsDlg : public SMESHGUI_GroupOpDlg
135
136   Q_OBJECT
137     
138 public:
139
140   SMESHGUI_UnionGroupsDlg( SMESHGUI* );
141   virtual ~SMESHGUI_UnionGroupsDlg();
142
143 protected slots:
144   virtual bool                      onApply();
145   virtual void                      onSelectionDone();
146
147 protected:
148   virtual void                      reset();
149
150 private:
151   QListWidget*                      myListWg;
152   QList<SMESH::SMESH_GroupBase_var> myGroups;
153 };
154
155 /*
156   Class       : SMESHGUI_IntersectGroupsDlg
157   Description : Perform intersection of several groups
158 */
159
160 class SMESHGUI_EXPORT SMESHGUI_IntersectGroupsDlg : public SMESHGUI_GroupOpDlg
161
162   Q_OBJECT
163     
164 public:
165
166   SMESHGUI_IntersectGroupsDlg( SMESHGUI* );
167   virtual ~SMESHGUI_IntersectGroupsDlg();
168
169 protected slots:
170   virtual bool                      onApply();
171   virtual void                      onSelectionDone();
172
173 protected:
174   virtual void                      reset();
175     
176 private:
177   QListWidget*                      myListWg;
178   QList<SMESH::SMESH_GroupBase_var> myGroups;
179 };
180
181 /*
182   Class       : SMESHGUI_CutGroupsDlg
183   Description : Perform cut of several groups
184 */
185
186 class SMESHGUI_EXPORT SMESHGUI_CutGroupsDlg : public SMESHGUI_GroupOpDlg
187
188   Q_OBJECT
189     
190 public:
191
192   SMESHGUI_CutGroupsDlg( SMESHGUI* );
193   virtual ~SMESHGUI_CutGroupsDlg();
194
195 protected slots:
196   virtual bool                      onApply();
197   virtual void                      onSelectionDone();
198
199 protected:
200   virtual void                      reset();
201
202 private:
203   QPushButton*                      myBtn1;
204   QPushButton*                      myBtn2;
205   QListWidget*                      myListWg1;
206   QListWidget*                      myListWg2;
207   QList<SMESH::SMESH_GroupBase_var> myGroups1;
208   QList<SMESH::SMESH_GroupBase_var> myGroups2;
209 };
210
211 /*
212   Class       : SMESHGUI_DimGroupDlg
213   Description : Dialog for creating groups of entities from existing 
214                 groups of superior dimensions
215 */
216
217 class SMESHGUI_EXPORT SMESHGUI_DimGroupDlg : public SMESHGUI_GroupOpDlg
218
219   Q_OBJECT
220     
221 public:
222
223   SMESHGUI_DimGroupDlg( SMESHGUI* );
224   virtual ~SMESHGUI_DimGroupDlg();
225
226   SMESH::ElementType                getElementType() const;
227   void                              setElementType( const SMESH::ElementType& theElemType );
228
229 protected:
230   virtual void                      reset();
231
232 protected slots:
233   virtual bool                      onApply();
234   virtual void                      onSelectionDone();
235
236 private:
237   QComboBox*                        myCombo;
238   QListWidget*                      myListWg;
239   QList<SMESH::SMESH_GroupBase_var> myGroups;
240 };
241
242 #endif // SMESHGUI_GROUPOPDLG_H
243
244