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"
31 #include "GeometryGUI.h"
32 #include "SALOME_Selection.h"
34 #include <qpushbutton.h>
36 //=================================================================================
37 // class : GEOMBase_Skeleton()
38 // purpose : Constructs a GEOMBase_Skeleton which is a child of 'parent', with the
39 // name 'name' and widget flags set to 'f'.
40 // The dialog will by default be modeless, unless you set 'modal' to
41 // TRUE to construct a modal dialog.
42 //=================================================================================
43 GEOMBase_Skeleton::GEOMBase_Skeleton(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl)
44 :DlgRef_Skeleton_QTD(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ), GEOMBase_Helper()
47 setName("GEOMBase_Skeleton");
49 buttonCancel->setText(tr("GEOM_BUT_CLOSE"));
50 buttonOk->setText(tr("GEOM_BUT_OK"));
51 buttonApply->setText(tr("GEOM_BUT_APPLY"));
53 GroupMedium->close(TRUE);
60 //=================================================================================
61 // function : ~GEOMBase_Skeleton()
62 // purpose : Destroys the object and frees any allocated resources
63 //=================================================================================
64 GEOMBase_Skeleton::~GEOMBase_Skeleton()
66 myGeomGUI->SetActiveDialogBox( 0 );
70 //=================================================================================
73 //=================================================================================
74 void GEOMBase_Skeleton::Init(SALOME_Selection* Sel)
76 myGeomGUI = GeometryGUI::GetGeomGUI();
81 myGeomBase = new GEOMBase(); // SAN -- TO BE REMOVED !!!
82 myGeomGUI->SetActiveDialogBox(this);
84 /* signals and slots connections */
85 connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
86 connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
87 connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
89 /* Move widget on the botton right corner of main widget */
91 // myGeomBase->DefineDlgPosition( this, x, y );
94 RadioButton1->setChecked(TRUE);
101 //=================================================================================
102 // function : ClickOnCancel()
104 //=================================================================================
105 void GEOMBase_Skeleton::ClickOnCancel()
111 //=================================================================================
112 // function : LineEditReturnPressed()
114 //=================================================================================
115 void GEOMBase_Skeleton::LineEditReturnPressed()
117 if ( !myEditCurrentArgument )
120 /* User name of object input management */
121 /* If successfull the selection is changed and signal emitted... */
122 /* so SelectionIntoArgument() is automatically called. */
123 const QString objectUserName = myEditCurrentArgument->text();
124 QWidget* thisWidget = (QWidget*)this;
125 if(GEOMBase::SelectionByNameInDialogs(thisWidget, objectUserName, mySelection))
126 myEditCurrentArgument->setText(objectUserName);
132 //=================================================================================
133 // function : DeactivateActiveDialog()
135 //=================================================================================
136 void GEOMBase_Skeleton::DeactivateActiveDialog()
138 this->setEnabled(false);
140 //myGeomGUI->ResetState();
141 disconnect(mySelection, 0, this, 0);
142 GeometryGUI::GetGeomGUI()->SetActiveDialogBox(0);
147 //=================================================================================
148 // function : ActivateThisDialog()
150 //=================================================================================
151 void GEOMBase_Skeleton::ActivateThisDialog()
153 /* Emit a signal to deactivate the active dialog */
154 GeometryGUI::GetGeomGUI()->EmitSignalDeactivateDialog();
155 this->setEnabled(true);
156 GeometryGUI::GetGeomGUI()->SetActiveDialogBox((QDialog*)this);
161 //=================================================================================
162 // function : closeEvent()
163 // purpose : same than click on cancel button
164 //=================================================================================
165 void GEOMBase_Skeleton::closeEvent(QCloseEvent* e)
167 disconnect(mySelection, 0, this, 0);
168 QDialog::closeEvent( e );
171 //=================================================================================
172 // function : initName()
173 // purpose : initialize the Name field with a string "thePrefix_X" (Vertex_3)
174 //=================================================================================
175 void GEOMBase_Skeleton::initName( const char* thePrefix )
178 setPrefix( thePrefix );
179 ResultName->setText( GEOMBase::GetDefaultName( getPrefix() ) );
182 //=================================================================================
183 // function : getNewObjectName()
184 // purpose : returns contents of Name field
185 //=================================================================================
186 const char* GEOMBase_Skeleton::getNewObjectName() const
188 return ResultName->text();
191 //=================================================================================
192 // function : getConstructorId()
194 //=================================================================================
195 int GEOMBase_Skeleton::getConstructorId() const
197 if ( GroupConstructors != NULL && GroupConstructors->selected() != NULL )
198 return GroupConstructors->id( GroupConstructors->selected() );