Salome HOME
*** empty log message ***
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_GroupOpDlg.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_GroupOpDlg.cxx
25 //  Author : Sergey LITONIN
26 //  Module : SMESH
27
28 #include "SMESHGUI_GroupOpDlg.h"
29
30 #include <qlayout.h>
31 #include <qgroupbox.h>
32 #include <qlabel.h>
33 #include <qlineedit.h>
34
35 #define SPACING 5
36 #define MARGIN  10
37
38 /*!
39  *  Class       : SMESHGUI_GroupOpDlg
40  *  Description : Perform boolean operations on groups
41  */
42
43 //=======================================================================
44 // name    : SMESHGUI_GroupOpDlg::SMESHGUI_GroupOpDlg
45 // Purpose : Constructor
46 //=======================================================================
47 SMESHGUI_GroupOpDlg::SMESHGUI_GroupOpDlg( const int aMode )
48 : SMESHGUI_Dialog( false, true )
49 {
50   QString caption;
51   if( aMode == 0 )
52     caption = "UNION_OF_TWO_GROUPS";
53   else if( aMode == 1 )
54     caption = "INTERSECTION_OF_TWO_GROUPS";
55   else
56     caption = "CUT_OF_TWO_GROUPS";
57   
58   setCaption( tr( caption ) );
59
60   QVBoxLayout* aDlgLay = new QVBoxLayout( mainFrame() );
61 //  aDlgLay->setMargin( MARGIN );
62 //  aDlgLay->setSpacing( SPACING );
63
64   QGroupBox* aNameGrp = new QGroupBox(1, Qt::Vertical, tr("NAME"), mainFrame() );
65   new QLabel(tr("RESULT_NAME"), aNameGrp);
66   myNameEdit = new QLineEdit(aNameGrp);
67   connect( myNameEdit, SIGNAL( textChanged( const QString& ) ), this, SIGNAL( nameChanged( const QString& ) ) );
68
69   QGroupBox* anArgGrp = new QGroupBox(3, Qt::Horizontal, tr("ARGUMENTS"), mainFrame() );
70
71   createObject( aMode==2 ? tr( "MAIN_OBJECT" ) : tr( "OBJECT_1" ), anArgGrp, 1 );
72   createObject( aMode==2 ? tr( "TOOL_OBJECT" ) : tr( "OBJECT_2" ), anArgGrp, 2 );
73
74   aDlgLay->addWidget( aNameGrp );
75   aDlgLay->addWidget( anArgGrp );
76 }
77
78 //=======================================================================
79 // name    : SMESHGUI_GroupOpDlg::~SMESHGUI_GroupOpDlg
80 // Purpose : Destructor
81 //=======================================================================
82 SMESHGUI_GroupOpDlg::~SMESHGUI_GroupOpDlg()
83 {
84 }
85
86 //=======================================================================
87 // name    : setName
88 // Purpose : 
89 //=======================================================================
90 void SMESHGUI_GroupOpDlg::setName( const QString& name )
91 {
92   myNameEdit->setText( name );
93 }
94
95 //=======================================================================
96 // name    : name
97 // Purpose : 
98 //=======================================================================
99 QString SMESHGUI_GroupOpDlg::name() const
100 {
101   return myNameEdit->text().stripWhiteSpace();
102 }