Salome HOME
Useless code concerning start of operations removed
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_InitMeshDlg.cxx
1 //  SMESH SMESHGUI : GUI for SMESH component
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
21 //
22 //
23 //
24 //  File   : SMESHGUI_InitMeshDlg.cxx
25 //  Author : Nicolas REJNERI
26 //  Module : SMESH
27 //  $Header$
28
29 #include "SMESHGUI_InitMeshDlg.h"
30 #include <SMESHGUI.h>
31 #include <SMESHGUI_Operation.h>
32
33 #include <SMESH_Type.h>
34
35 #include <qgroupbox.h>
36 #include <qlayout.h>
37 #include <qlineedit.h>
38 #include <qlabel.h>
39
40 //=================================================================================
41 // class    : SMESHGUI_InitMeshDlg()
42 // purpose  : Constructs a SMESHGUI_InitMeshDlg which is a child of 'parent', with the
43 //            name 'name' and widget flags set to 'f'.
44 //            The dialog will by default be modeless, unless you set 'modal' to
45 //            TRUE to construct a modal dialog.
46 //=================================================================================
47 SMESHGUI_InitMeshDlg::SMESHGUI_InitMeshDlg( SMESHGUI* theModule )
48 : SMESHGUI_Dialog( theModule, false, true )
49 {
50     setCaption(tr("SMESH_INIT_MESH"));
51
52     QVBoxLayout* main = new QVBoxLayout( mainFrame() );
53
54     /***************************************************************/
55     QGroupBox* GroupC1 = new QGroupBox( tr( "SMESH_ARGUMENTS" ), mainFrame(), "GroupC1" );
56     GroupC1->setColumnLayout(3, Qt::Horizontal);
57     GroupC1->layout()->setSpacing(6);
58     GroupC1->layout()->setMargin(11);
59    
60     new QLabel(tr("SMESH_NAME"), GroupC1, "TextLabel_NameMesh");
61     GroupC1->addSpace(1);
62     myMeshName = new QLineEdit(GroupC1, "LineEdit_NameMesh");
63     
64     createObject( tr("SMESH_OBJECT_GEOM"), GroupC1, GeomObj );
65     createObject( tr("SMESH_OBJECT_HYPOTHESIS"), GroupC1, Hypo );
66     createObject( tr("SMESH_OBJECT_ALGORITHM"), GroupC1, Algo );
67
68     setNameIndication( GeomObj, OneName );
69     
70     int _smesh = SMESHGUI_Operation::prefix( "SMESH" );
71     setObjectType( Hypo, _smesh + HYPOTHESIS, -1 );
72     setObjectType( Algo, _smesh + ALGORITHM, -1 );
73     
74     main->addWidget( GroupC1 );
75 }
76
77 //=================================================================================
78 // function : ~SMESHGUI_InitMeshDlg()
79 // purpose  : Destroys the object and frees any allocated resources
80 //=================================================================================
81 SMESHGUI_InitMeshDlg::~SMESHGUI_InitMeshDlg()
82 {
83   // no need to delete child widgets, Qt does it all for us
84 }
85
86 //=================================================================================
87 // function : updateControlState
88 // purpose  :
89 //=================================================================================
90 void SMESHGUI_InitMeshDlg::updateControlState()
91 {
92   bool isEnabled = !meshName().isEmpty() &&
93                    hasSelection( GeomObj ) && hasSelection( Hypo ) && hasSelection( Algo );
94   setButtonEnabled( isEnabled, OK | Apply );
95 }
96
97 //=================================================================================
98 // function : meshName
99 // purpose  :
100 //=================================================================================
101 QString SMESHGUI_InitMeshDlg::meshName() const
102 {
103   return myMeshName->text().stripWhiteSpace();
104 }
105
106 //=================================================================================
107 // function : setMeshName
108 // purpose  :
109 //=================================================================================
110 void SMESHGUI_InitMeshDlg::setMeshName( const QString& name )
111 {
112   myMeshName->setText( name.stripWhiteSpace() );
113 }
114