1 // GEOM GEOMGUI : GUI for Geometry component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : GEOMBase_Skeleton.cxx
25 // Author : Damien COQUERET
30 #include "GEOMBase_Skeleton.h"
32 //=================================================================================
33 // class : GEOMBase_Skeleton()
34 // purpose : Constructs a GEOMBase_Skeleton which is a child of 'parent', with the
35 // name 'name' and widget flags set to 'f'.
36 // The dialog will by default be modeless, unless you set 'modal' to
37 // TRUE to construct a modal dialog.
38 //=================================================================================
39 GEOMBase_Skeleton::GEOMBase_Skeleton(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl)
40 :DlgRef_Skeleton_QTD(parent, name, modal, fl)
43 setName("GEOMBase_Skeleton");
45 buttonCancel->setText(tr("GEOM_BUT_CLOSE"));
46 buttonOk->setText(tr("GEOM_BUT_OK"));
47 buttonApply->setText(tr("GEOM_BUT_APPLY"));
49 GroupMedium->close(TRUE);
56 //=================================================================================
57 // function : ~GEOMBase_Skeleton()
58 // purpose : Destroys the object and frees any allocated resources
59 //=================================================================================
60 GEOMBase_Skeleton::~GEOMBase_Skeleton()
62 // no need to delete child widgets, Qt does it all for us
63 this->destroy(TRUE, TRUE);
67 //=================================================================================
70 //=================================================================================
71 void GEOMBase_Skeleton::Init(SALOME_Selection* Sel)
75 mySimulationTopoDs.Nullify();
77 myGeomBase = new GEOMBase();
78 myGeomGUI = GEOMContext::GetGeomGUI();
79 myGeomGUI->SetActiveDialogBox((QDialog*)this);
80 myGeom = myGeomGUI->myComponentGeom;
82 /* signals and slots connections */
83 connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
84 connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
85 connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
87 /* Move widget on the botton right corner of main widget */
89 // myGeomBase->DefineDlgPosition( this, x, y );
92 RadioButton1->setChecked(TRUE);
98 //=================================================================================
99 // function : ClickOnCancel()
101 //=================================================================================
102 void GEOMBase_Skeleton::ClickOnCancel()
104 myGeomBase->EraseSimulationShape();
105 mySimulationTopoDs.Nullify();
107 mySelection->ClearFilters();
108 disconnect(mySelection, 0, this, 0);
110 //myGeomGUI->ResetState();
117 //=================================================================================
118 // function : LineEditReturnPressed()
120 //=================================================================================
121 void GEOMBase_Skeleton::LineEditReturnPressed()
123 /* User name of object input management */
124 /* If successfull the selection is changed and signal emitted... */
125 /* so SelectionIntoArgument() is automatically called. */
126 const QString objectUserName = myEditCurrentArgument->text();
127 QWidget* thisWidget = (QWidget*)this;
128 if(myGeomBase->SelectionByNameInDialogs(thisWidget, objectUserName, mySelection))
129 myEditCurrentArgument->setText(objectUserName);
135 //=================================================================================
136 // function : DeactivateActiveDialog()
138 //=================================================================================
139 void GEOMBase_Skeleton::DeactivateActiveDialog()
141 this->setEnabled(false);
142 mySelection->ClearFilters();
143 //myGeomGUI->ResetState();
144 disconnect(mySelection, 0, this, 0);
145 myGeomBase->EraseSimulationShape();
146 myGeomGUI->SetActiveDialogBox(0);
151 //=================================================================================
152 // function : ActivateThisDialog()
154 //=================================================================================
155 void GEOMBase_Skeleton::ActivateThisDialog()
157 /* Emit a signal to deactivate the active dialog */
158 myGeomGUI->EmitSignalDeactivateDialog();
159 this->setEnabled(true);
160 myGeomGUI->SetActiveDialogBox((QDialog*)this);
165 //=================================================================================
166 // function : closeEvent()
168 //=================================================================================
169 void GEOMBase_Skeleton::closeEvent(QCloseEvent* e)
171 /* same than click on cancel button */
172 this->ClickOnCancel();