Salome HOME
4a098c8eca755b58730691ef30821ddbfe286377
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_AddSubMeshDlg.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_AddSubMeshDlg.cxx
25 //  Author : Nicolas REJNERI
26 //  Module : SMESH
27 //  $Header$
28
29 #include "SMESHGUI_AddSubMeshDlg.h"
30
31 #include <SMESH_Type.h>
32
33 #include <qlayout.h>
34 #include <qgroupbox.h>
35 #include <qlabel.h>
36 #include <qlineedit.h>
37
38 //=================================================================================
39 // function : SMESHGUI_AddSubMeshDlg()
40 // purpose  : Constructs a SMESHGUI_AddSubMeshDlg which is a child of 'parent', with the
41 //            name 'name' and widget flags set to 'f'.
42 //            The dialog will by default be modeless, unless you set 'modal' to
43 //            TRUE to construct a modal dialog.
44 //=================================================================================
45 SMESHGUI_AddSubMeshDlg::SMESHGUI_AddSubMeshDlg()
46 : SMESHGUI_Dialog( false, true )
47 {
48     setCaption(tr("SMESH_ADD_SUBMESH"));
49
50     QVBoxLayout* main = new QVBoxLayout( mainFrame() );
51
52     /***************************************************************/
53     QGroupBox* GroupC1 = new QGroupBox (tr("SMESH_ARGUMENTS"), mainFrame(), "GroupC1");
54     GroupC1->setColumnLayout(3, Qt::Horizontal);
55     GroupC1->layout()->setSpacing(6);
56     GroupC1->layout()->setMargin(11);
57
58     new QLabel(tr("SMESH_NAME"), GroupC1, "TextLabel_NameMesh");
59     GroupC1->addSpace(1);
60     myMeshName = new QLineEdit(GroupC1, "LineEdit_NameMesh");
61     connect( myMeshName, SIGNAL( textChanged( const QString& ) ), this, SIGNAL( nameChanged( const QString& ) ) );
62
63     createObject( tr("SMESH_OBJECT_MESH"), GroupC1, MeshObj );
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( MeshObj, OneName );
69     setNameIndication( GeomObj, OneName );
70
71     int _smesh = prefix( "SMESH" );
72     setObjectType( Hypo, _smesh + HYPOTHESIS, -1 );
73     setObjectType( Algo, _smesh + ALGORITHM, -1 );
74
75     main->addWidget( GroupC1 );
76 }
77
78 //=================================================================================
79 // function : ~SMESHGUI_AddSubMeshDlg()
80 // purpose  : Destroys the object and frees any allocated resources
81 //=================================================================================
82 SMESHGUI_AddSubMeshDlg::~SMESHGUI_AddSubMeshDlg()
83 {
84   // no need to delete child widgets, Qt does it all for us
85 }
86
87 //=================================================================================
88 // function : subMeshName
89 // purpose  :
90 //=================================================================================
91 QString SMESHGUI_AddSubMeshDlg::subMeshName() const
92 {
93   return myMeshName->text().stripWhiteSpace();
94 }
95
96 //=================================================================================
97 // function : setSubMeshName
98 // purpose  :
99 //=================================================================================
100 void SMESHGUI_AddSubMeshDlg::setSubMeshName( const QString& name )
101 {
102   myMeshName->setText( name );
103 }