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 : BuildGUI_CompoundDlg.cxx
25 // Author : Lucien PIGNOLONI
30 #include "BuildGUI_CompoundDlg.h"
32 //=================================================================================
33 // class : BuildGUI_CompoundDlg()
34 // purpose : Constructs a BuildGUI_CompoundDlg 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 BuildGUI_CompoundDlg::BuildGUI_CompoundDlg(QWidget* parent, const char* name, BuildGUI* theBuildGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
40 :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
42 QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_BUILD_COMPOUND")));
43 QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
45 setCaption(tr("GEOM_COMPOUND_TITLE"));
47 /***************************************************************/
48 GroupConstructors->setTitle(tr("GEOM_COMPOUND"));
49 RadioButton1->setPixmap(image0);
50 RadioButton2->close(TRUE);
51 RadioButton3->close(TRUE);
53 GroupPoints = new DlgRef_1Sel_QTD(this, "GroupPoints");
54 GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
55 GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS"));
56 GroupPoints->PushButton1->setPixmap(image1);
58 Layout1->addWidget(GroupPoints, 1, 0);
59 /***************************************************************/
62 myBuildGUI = theBuildGUI;
67 //=================================================================================
68 // function : ~BuildGUI_CompoundDlg()
69 // purpose : Destroys the object and frees any allocated resources
70 //=================================================================================
71 BuildGUI_CompoundDlg::~BuildGUI_CompoundDlg()
73 // no need to delete child widgets, Qt does it all for us
77 //=================================================================================
80 //=================================================================================
81 void BuildGUI_CompoundDlg::Init()
84 myEditCurrentArgument = GroupPoints->LineEdit1;
85 myOkListShapes = false;
87 /* signals and slots connections */
88 connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
89 connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
90 connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
91 connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
101 //=================================================================================
102 // function : ClickOnOk()
104 //=================================================================================
105 void BuildGUI_CompoundDlg::ClickOnOk()
107 this->ClickOnApply();
113 //=================================================================================
114 // function : ClickOnApply()
116 //=================================================================================
117 void BuildGUI_CompoundDlg::ClickOnApply()
119 QAD_Application::getDesktop()->putInfo(tr(""));
121 myBuildGUI->MakeCompoundAndDisplay(myListShapes);
126 //=================================================================================
127 // function : SelectionIntoArgument()
128 // purpose : Called when selection as changed or other case
129 //=================================================================================
130 void BuildGUI_CompoundDlg::SelectionIntoArgument()
132 myEditCurrentArgument->setText("");
133 QString aString = ""; /* name of selection */
135 myOkListShapes = false;
136 int nbSel = mySelection->IObjectCount();
139 aString = tr("%1_objects").arg(nbSel);
141 // int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
143 // myOkListShapes = false;
147 myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes);
148 myEditCurrentArgument->setText(aString);
149 myOkListShapes = true;
155 //=================================================================================
156 // function : SetEditCurrentArgument()
158 //=================================================================================
159 void BuildGUI_CompoundDlg::SetEditCurrentArgument()
161 GroupPoints->LineEdit1->setFocus();
162 this->SelectionIntoArgument();
167 //=================================================================================
168 // function : ActivateThisDialog()
170 //=================================================================================
171 void BuildGUI_CompoundDlg::ActivateThisDialog()
173 GEOMBase_Skeleton::ActivateThisDialog();
174 connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
179 //=================================================================================
180 // function : enterEvent()
182 //=================================================================================
183 void BuildGUI_CompoundDlg::enterEvent(QEvent* e)
185 if (GroupConstructors->isEnabled())
187 this->ActivateThisDialog();