]> SALOME platform Git repositories - modules/geom.git/blobdiff - src/GEOMBase/GEOMBase_Skeleton.cxx
Salome HOME
Merge with version on tag OCC-V2_1_0d
[modules/geom.git] / src / GEOMBase / GEOMBase_Skeleton.cxx
index 85b4f326f0e368940d16467c7ba40e2c1e16a405..5d2c7fb530b6d301394d50daf27af17a177da4f2 100644 (file)
 //  File   : GEOMBase_Skeleton.cxx
 //  Author : Damien COQUERET
 //  Module : GEOM
-//  $Header
+//  $Header$
 
 using namespace std;
 #include "GEOMBase_Skeleton.h"
+#include "GeometryGUI.h"
+#include "SALOME_Selection.h"
+
+#include <qpushbutton.h>
 
 //=================================================================================
 // class    : GEOMBase_Skeleton()
@@ -37,7 +41,7 @@ using namespace std;
 //            TRUE to construct a modal dialog.
 //=================================================================================
 GEOMBase_Skeleton::GEOMBase_Skeleton(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl)
-  :DlgRef_Skeleton_QTD(parent, name, modal, fl)
+:DlgRef_Skeleton_QTD(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ), GEOMBase_Helper()
 {
   if (!name)
     setName("GEOMBase_Skeleton");
@@ -59,8 +63,7 @@ GEOMBase_Skeleton::GEOMBase_Skeleton(QWidget* parent, const char* name, SALOME_S
 //=================================================================================
 GEOMBase_Skeleton::~GEOMBase_Skeleton()
 {
-  // no need to delete child widgets, Qt does it all for us
-  this->destroy(TRUE, TRUE);
+  myGeomGUI->SetActiveDialogBox( 0 );
 }
 
 
@@ -70,14 +73,13 @@ GEOMBase_Skeleton::~GEOMBase_Skeleton()
 //=================================================================================
 void GEOMBase_Skeleton::Init(SALOME_Selection* Sel)
 {
+  myGeomGUI = GeometryGUI::GetGeomGUI();
+
   /* init variables */
   mySelection = Sel;
-  mySimulationTopoDs.Nullify();
 
-  myGeomBase = new GEOMBase();
-  myGeomGUI = GEOMContext::GetGeomGUI();
-  myGeomGUI->SetActiveDialogBox((QDialog*)this);
-  myGeom = myGeomGUI->myComponentGeom;
+  myGeomBase = new GEOMBase();  // SAN -- TO BE REMOVED !!!
+  myGeomGUI->SetActiveDialogBox(this);
 
   /* signals and slots connections */
   connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
@@ -90,6 +92,7 @@ void GEOMBase_Skeleton::Init(SALOME_Selection* Sel)
 
   /* displays Dialog */
   RadioButton1->setChecked(TRUE);
+  RadioButton4->hide();
 
   return;
 }
@@ -101,16 +104,7 @@ void GEOMBase_Skeleton::Init(SALOME_Selection* Sel)
 //=================================================================================
 void GEOMBase_Skeleton::ClickOnCancel()
 {
-  myGeomBase->EraseSimulationShape();
-  mySimulationTopoDs.Nullify();
-
-  mySelection->ClearFilters();
-  disconnect(mySelection, 0, this, 0);
-
-  //myGeomGUI->ResetState();
-  reject();
-
-  return;
+  close();
 }
 
 
@@ -125,7 +119,7 @@ void GEOMBase_Skeleton::LineEditReturnPressed()
   /* so SelectionIntoArgument() is automatically called.           */
   const QString objectUserName = myEditCurrentArgument->text();
   QWidget* thisWidget = (QWidget*)this;
-  if(myGeomBase->SelectionByNameInDialogs(thisWidget, objectUserName, mySelection))
+  if(GEOMBase::SelectionByNameInDialogs(thisWidget, objectUserName, mySelection))
     myEditCurrentArgument->setText(objectUserName);
 
   return;
@@ -139,11 +133,10 @@ void GEOMBase_Skeleton::LineEditReturnPressed()
 void GEOMBase_Skeleton::DeactivateActiveDialog()
 {
   this->setEnabled(false);
-  mySelection->ClearFilters();
+  globalSelection();
   //myGeomGUI->ResetState();
   disconnect(mySelection, 0, this, 0);
-  myGeomBase->EraseSimulationShape();
-  myGeomGUI->SetActiveDialogBox(0);
+  GeometryGUI::GetGeomGUI()->SetActiveDialogBox(0);
   return;
 }
 
@@ -155,20 +148,50 @@ void GEOMBase_Skeleton::DeactivateActiveDialog()
 void GEOMBase_Skeleton::ActivateThisDialog()
 {
   /* Emit a signal to deactivate the active dialog */
-  myGeomGUI->EmitSignalDeactivateDialog();
+  GeometryGUI::GetGeomGUI()->EmitSignalDeactivateDialog();
   this->setEnabled(true);
-  myGeomGUI->SetActiveDialogBox((QDialog*)this);
+  GeometryGUI::GetGeomGUI()->SetActiveDialogBox((QDialog*)this);
   return;
 }
 
 
 //=================================================================================
 // function : closeEvent()
-// purpose  :
+// purpose  : same than click on cancel button
 //=================================================================================
 void GEOMBase_Skeleton::closeEvent(QCloseEvent* e)
 {
-  /* same than click on cancel button */
-  this->ClickOnCancel();
-  return;
+  disconnect(mySelection, 0, this, 0);
+  QDialog::closeEvent( e );
+}
+
+//=================================================================================
+// function : initName()
+// purpose  : initialize the Name field with a string "thePrefix_X" (Vertex_3)
+//=================================================================================
+void GEOMBase_Skeleton::initName( const char* thePrefix )
+{
+  if ( thePrefix )
+    setPrefix( thePrefix );
+  ResultName->setText( GEOMBase::GetDefaultName( getPrefix() ) );
+}
+
+//=================================================================================
+// function : getNewObjectName()
+// purpose  : returns contents of Name field
+//=================================================================================
+const char* GEOMBase_Skeleton::getNewObjectName() const
+{
+  return ResultName->text();
+}
+
+//=================================================================================
+// function : getConstructorId()
+// purpose  :
+//=================================================================================
+int GEOMBase_Skeleton::getConstructorId() const
+{
+  if ( GroupConstructors != NULL && GroupConstructors->selected() != NULL )
+    return GroupConstructors->id( GroupConstructors->selected() );
+  return -1;
 }