Salome HOME
Merge from BR_V5_DEV 16Feb09
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_GroupOpDlg.h
index 2dfce3bb5b067bee3aa9ef94fd1be7d265b932c4..fda94dd0101a732c1c2ba1ca7d18b3f5b7e78285 100644 (file)
@@ -1,47 +1,49 @@
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  This library is free software; you can redistribute it and/or 
-//  modify it under the terms of the GNU Lesser General Public 
-//  License as published by the Free Software Foundation; either 
-//  version 2.1 of the License. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
 //
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
 //
-//  File   : SMESHGUI_GroupOpDlg.h
-//  Author : Sergey LITONIN
-//  Module : SMESH
-
-
-#ifndef SMESHGUI_GroupOpDlg_H
-#define SMESHGUI_GroupOpDlg_H
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// SMESH SMESHGUI : GUI for SMESH component
+// File   : SMESHGUI_GroupOpDlg.h
+// Author : Sergey LITONIN, Open CASCADE S.A.S.
+//
+#ifndef SMESHGUI_GROUPOPDLG_H
+#define SMESHGUI_GROUPOPDLG_H
 
+// SMESH includes
 #include "SMESH_SMESHGUI.hxx"
 
-#include <qdialog.h>
+// Qt includes
+#include <QDialog>
 
+// IDL includes
 #include <SALOMEconfig.h>
 #include CORBA_SERVER_HEADER(SMESH_Group)
 
-class QCloseEvent;
-class QLabel;
-class QFrame;
 class QPushButton;
-class LightApp_SelectionMgr;
+class QtxColorButton;
+class QComboBox;
+class QListWidget;
+class QGroupBox;
 class QLineEdit;
 class SMESHGUI;
-class SVTK_ViewWindow;
+class LightApp_SelectionMgr;
 class SVTK_Selector;
 
 /*
@@ -54,63 +56,183 @@ class SMESHGUI_EXPORT SMESHGUI_GroupOpDlg : public QDialog
   Q_OBJECT
     
 public:
-  enum { UNION, INTERSECT, CUT };
+  //enum { UNION, INTERSECT, CUT };
     
 public:
-                            SMESHGUI_GroupOpDlg( SMESHGUI*, const int );
-  virtual                   ~SMESHGUI_GroupOpDlg();
+  SMESHGUI_GroupOpDlg( SMESHGUI* );
+  virtual ~SMESHGUI_GroupOpDlg();
 
   void                      Init();
-  
-private:
 
-  void                      closeEvent( QCloseEvent* e ) ;
-  void                      enterEvent ( QEvent * ) ;            
-  void                      keyPressEvent(QKeyEvent*);
+protected slots:
+
+  virtual bool              onApply();
+  virtual void              onSelectionDone();
+  virtual void              setVisible ( bool visible );
+
+protected:
+
+  virtual void              reset();
+
+  QString                   getName() const;
+  void                      setName( const QString& theName );
+
+  QGroupBox*                getArgGrp() const;
+  void                      setHelpFileName( const QString& theFName );
+  SMESHGUI*                 getSMESHGUI() const;
+  bool                      isValid( const QList<SMESH::SMESH_GroupBase_var>& theListGrp );
+  bool                      getSelectedGroups( QList<SMESH::SMESH_GroupBase_var>& theOutList,
+                                               QStringList& theOutNames );
+  SMESH::ListOfGroups*      convert( const QList<SMESH::SMESH_GroupBase_var>& );
+
+  SALOMEDS::Color           getColor() const;
+
+private:
+  void                      closeEvent( QCloseEvent* );
+  void                      enterEvent( QEvent* );            
+  void                      keyPressEvent( QKeyEvent* );
   
 private slots:
-
   void                      onOk();
-  bool                      onApply();
   void                      onClose();
   void                      onHelp();
 
   void                      onDeactivate();
-  void                      onSelectionDone();
-  void                      onFocusChanged();
 
 private:
-
-  QFrame*                   createButtonFrame( QWidget* );
-  QFrame*                   createMainFrame  ( QWidget* );
-  bool                      isValid();
-  void                      reset();
-  
+  QWidget*                  createButtonFrame( QWidget* );
+  QWidget*                  createMainFrame  ( QWidget* );
+    
 private:
-
   QPushButton*              myOkBtn;
   QPushButton*              myApplyBtn;
   QPushButton*              myCloseBtn;
   QPushButton*              myHelpBtn;
   
   QLineEdit*                myNameEdit;
-  QLineEdit*                myEdit1;
-  QLineEdit*                myEdit2;
-  QPushButton*              myBtn1;
-  QPushButton*              myBtn2;
+  QGroupBox*                myArgGrp;
+  QtxColorButton*           myColorBtn;
   
   SMESHGUI*                 mySMESHGUI;
   LightApp_SelectionMgr*    mySelectionMgr;
-  int                       myMode;
   SVTK_Selector*            mySelector;
   
-  QLineEdit*                myFocusWg;
-  
-  SMESH::SMESH_GroupBase_var    myGroup1;
-  SMESH::SMESH_GroupBase_var    myGroup2;
-  
   QString                   myHelpFileName;
-  
 };
 
-#endif
+/*
+  Class       : SMESHGUI_UnionGroupsDlg
+  Description : Perform union of several groups
+*/
+
+class SMESHGUI_EXPORT SMESHGUI_UnionGroupsDlg : public SMESHGUI_GroupOpDlg
+{ 
+  Q_OBJECT
+    
+public:
+
+  SMESHGUI_UnionGroupsDlg( SMESHGUI* );
+  virtual ~SMESHGUI_UnionGroupsDlg();
+
+protected slots:
+  virtual bool                      onApply();
+  virtual void                      onSelectionDone();
+
+protected:
+  virtual void                      reset();
+
+private:
+  QListWidget*                      myListWg;
+  QList<SMESH::SMESH_GroupBase_var> myGroups;
+};
+
+/*
+  Class       : SMESHGUI_IntersectGroupsDlg
+  Description : Perform intersection of several groups
+*/
+
+class SMESHGUI_EXPORT SMESHGUI_IntersectGroupsDlg : public SMESHGUI_GroupOpDlg
+{ 
+  Q_OBJECT
+    
+public:
+
+  SMESHGUI_IntersectGroupsDlg( SMESHGUI* );
+  virtual ~SMESHGUI_IntersectGroupsDlg();
+
+protected slots:
+  virtual bool                      onApply();
+  virtual void                      onSelectionDone();
+
+protected:
+  virtual void                      reset();
+    
+private:
+  QListWidget*                      myListWg;
+  QList<SMESH::SMESH_GroupBase_var> myGroups;
+};
+
+/*
+  Class       : SMESHGUI_CutGroupsDlg
+  Description : Perform cut of several groups
+*/
+
+class SMESHGUI_EXPORT SMESHGUI_CutGroupsDlg : public SMESHGUI_GroupOpDlg
+{ 
+  Q_OBJECT
+    
+public:
+
+  SMESHGUI_CutGroupsDlg( SMESHGUI* );
+  virtual ~SMESHGUI_CutGroupsDlg();
+
+protected slots:
+  virtual bool                      onApply();
+  virtual void                      onSelectionDone();
+
+protected:
+  virtual void                      reset();
+
+private:
+  QPushButton*                      myBtn1;
+  QPushButton*                      myBtn2;
+  QListWidget*                      myListWg1;
+  QListWidget*                      myListWg2;
+  QList<SMESH::SMESH_GroupBase_var> myGroups1;
+  QList<SMESH::SMESH_GroupBase_var> myGroups2;
+};
+
+/*
+  Class       : SMESHGUI_DimGroupDlg
+  Description : Dialog for creating groups of entities from existing 
+                groups of superior dimensions
+*/
+
+class SMESHGUI_EXPORT SMESHGUI_DimGroupDlg : public SMESHGUI_GroupOpDlg
+{ 
+  Q_OBJECT
+    
+public:
+
+  SMESHGUI_DimGroupDlg( SMESHGUI* );
+  virtual ~SMESHGUI_DimGroupDlg();
+
+  SMESH::ElementType                getElementType() const;
+  void                              setElementType( const SMESH::ElementType& theElemType );
+
+protected:
+  virtual void                      reset();
+
+protected slots:
+  virtual bool                      onApply();
+  virtual void                      onSelectionDone();
+
+private:
+  QComboBox*                        myCombo;
+  QListWidget*                      myListWg;
+  QList<SMESH::SMESH_GroupBase_var> myGroups;
+};
+
+#endif // SMESHGUI_GROUPOPDLG_H
+
+