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