Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_ShapeByMeshDlg.h
index 1f1a50c6e63174ba1082f4890693f9de520400ed..222a38bbaafca611d8b3ee33ccd869d2895db0a5 100644 (file)
@@ -15,7 +15,7 @@
 //  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //
 //
 #ifndef SMESHGUI_ShapeByMeshDlg_H
 #define SMESHGUI_ShapeByMeshDlg_H
 
-#include <qdialog.h>
+#include "SMESH_SMESHGUI.hxx"
+
+#include "SMESHGUI_Dialog.h"
+#include "SMESHGUI_SelectionOp.h"
 
 // IDL Headers
 #include <SALOMEconfig.h>
@@ -48,68 +51,74 @@ class SMESHGUI;
  *        by selecting mesh elements
  */
 
-class SMESHGUI_ShapeByMeshDlg : public QDialog
+class SMESHGUI_EXPORT SMESHGUI_ShapeByMeshDlg : public SMESHGUI_Dialog
 {
   Q_OBJECT
 
 public:
-                           SMESHGUI_ShapeByMeshDlg( SMESHGUI*   theModule,
-                                                    const char* theName = 0);
+                           SMESHGUI_ShapeByMeshDlg();
   virtual                  ~SMESHGUI_ShapeByMeshDlg();
 
-  void                     Init();
-  void                     SetMesh (SMESH::SMESH_Mesh_ptr);
-  SMESH::SMESH_Mesh_ptr    GetMesh () { return myMesh; }
-  GEOM::GEOM_Object_ptr    GetShape();
+private:
 
-signals:
+  QFrame*                  createMainFrame   (QWidget*);
 
-  void                     PublishShape();
-  void                     Close();
+  QButtonGroup*            myElemTypeGroup;
+  QLineEdit*               myElementId;
+  QLineEdit*               myGeomName;
 
-private:
+  bool                     myIsMultipleAllowed;
+  void                     setMultipleAllowed(bool isAllowed) {myIsMultipleAllowed = isAllowed;};
 
-  void                     closeEvent (QCloseEvent* e);
-  void                     enterEvent (QEvent*);
+  friend class SMESHGUI_ShapeByMeshOp;
+};
 
-private slots:
+/*!
+ * \brief Operation to publish a sub-shape of the mesh main shape
+ *        by selecting mesh elements
+ */
+class SMESHGUI_ShapeByMeshOp: public SMESHGUI_SelectionOp
+{
+  Q_OBJECT
 
-  void                     onOk();
-  void                     onClose();
+public:
+  SMESHGUI_ShapeByMeshOp(bool isMultipleAllowed = false);
+  virtual ~SMESHGUI_ShapeByMeshOp();
 
-  void                     onDeactivate();
+  virtual LightApp_Dialog*       dlg() const;  
 
-  void                     onSelectionDone();
-  void                     onTypeChanged (int);
-  void                     onElemIdChanged (const QString&);
+  void                     Init();
+  void                     SetMesh (SMESH::SMESH_Mesh_ptr);
+  SMESH::SMESH_Mesh_ptr    GetMesh () { return myMesh; }
+  GEOM::GEOM_Object_ptr    GetShape();
 
-private:
+protected:
+
+  virtual void                   commitOperation();
+  virtual void                   startOperation();
 
-  QFrame*                  createButtonFrame (QWidget*);
-  QFrame*                  createMainFrame   (QWidget*);
-  //void                     displayPreview();
-  //void                     erasePreview();
   void                     activateSelection();
   void                     setElementID(const QString&);
 
-private:
+protected slots:
 
-  QButtonGroup*            myElemTypeGroup;
-  QLineEdit*               myElementId;
-  QLineEdit*               myGeomName;
+  virtual bool                   onApply() { return true; }
 
-  QPushButton*             myOkBtn;
-  QPushButton*             myCloseBtn;
+private slots:
 
-  SMESHGUI*                mySMESHGUI;
-  LightApp_SelectionMgr*   mySelectionMgr;
-  SVTK_ViewWindow*         myViewWindow;
+  void                     onSelectionDone();
+  void                     onTypeChanged (int);
+  void                     onElemIdChanged (const QString&);
+
+private:
 
+  SMESHGUI_ShapeByMeshDlg* myDlg;
   SMESH::SMESH_Mesh_var    myMesh;
   GEOM::GEOM_Object_var    myGeomObj;
 
   bool                     myIsManualIdEnter;
   bool                     myHasSolids;
+  bool                     myIsMultipleAllowed;
 };
 
 #endif