Salome HOME
Portation on new based dialog
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_RemoveDlg.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_RemoveDlg.cxx
25 //  Author : Nicolas REJNERI
26 //  Module : SMESH
27 //  $Header$
28
29 #include "SMESHGUI_RemoveDlg.h"
30
31 #include <SUIT_ResourceMgr.h>
32
33 #include <SMDSAbs_ElementType.hxx>
34
35 #include <qlayout.h>
36 #include <qgroupbox.h>
37 #include <qbuttongroup.h>
38 #include <qradiobutton.h>
39
40 //=================================================================================
41 // class    : SMESHGUI_RemoveDlg()
42 // purpose  :
43 //=================================================================================
44 SMESHGUI_RemoveDlg::SMESHGUI_RemoveDlg( const bool elem )
45 : SMESHGUI_Dialog( 0, false, true, OK | Apply | Close )
46 {
47     QString entity = elem ? "ELEMENT" : "NODE";
48     QString name = QString( "ICON_DLG_REM_%1" ).arg( entity );
49     QPixmap image0( resMgr()->loadPixmap("SMESH", tr( name ) ) );
50
51     setName("SMESHGUI_RemoveDlg");
52     resize(303, 185);
53     setCaption( tr( QString( "SMESH_REMOVE_%1S_TITLE" ).arg( entity ) ) );
54     setSizeGripEnabled(TRUE);
55
56     QVBoxLayout* main = new QVBoxLayout( mainFrame() );
57
58     /***************************************************************/
59     QButtonGroup* GroupConstructors = new QButtonGroup( mainFrame(), "GroupConstructors");
60     GroupConstructors->setTitle(tr( QString( "SMESH_%1S" ).arg( entity ) ) );
61     GroupConstructors->setExclusive(TRUE);
62     GroupConstructors->setColumnLayout(0, Qt::Vertical);
63     GroupConstructors->layout()->setSpacing(0);
64     GroupConstructors->layout()->setMargin(0);
65     QGridLayout* GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
66     GroupConstructorsLayout->setAlignment(Qt::AlignTop);
67     GroupConstructorsLayout->setSpacing(6);
68     GroupConstructorsLayout->setMargin(11);
69     QRadioButton* Constructor1 = new QRadioButton(GroupConstructors, "Constructor1");
70     Constructor1->setText(tr("" ));
71     Constructor1->setPixmap(image0);
72     Constructor1->setChecked(TRUE);
73     Constructor1->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth()));
74     Constructor1->setMinimumSize(QSize(50, 0));
75     GroupConstructorsLayout->addWidget(Constructor1, 0, 0);
76     QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
77     GroupConstructorsLayout->addItem(spacer, 0, 1);
78     main->addWidget(GroupConstructors);
79
80     /***************************************************************/
81     QGroupBox* GroupC1 = new QGroupBox( mainFrame(), "GroupC1");
82     GroupC1->setTitle(tr("SMESH_REMOVE" ));
83     GroupC1->setMinimumSize(QSize(0, 0));
84     GroupC1->setFrameShape(QGroupBox::Box);
85     GroupC1->setFrameShadow(QGroupBox::Sunken);
86     GroupC1->setColumnLayout( 3, Qt::Horizontal );
87 //    GroupC1->layout()->setSpacing(0);
88 //    GroupC1->layout()->setMargin(0);
89
90     createObject( tr( QString( "SMESH_ID_%1S" ).arg( entity ) ), GroupC1, 0 );
91     setNameIndication( 0, ListOfNames );
92     setReadOnly( 0, false );
93     int pr = prefix( "SMESH element" );
94     if( elem )
95       setObjectType( 0, pr + SMDSAbs_Edge, pr + SMDSAbs_Face, pr + SMDSAbs_Volume, -1 );
96     else
97       setObjectType( 0, pr + SMDSAbs_Node, -1 );
98
99     main->addWidget(GroupC1);
100 }
101
102 //=================================================================================
103 // function : ~SMESHGUI_RemoveDlg()
104 // purpose  : Destroys the object and frees any allocated resources
105 //=================================================================================
106 SMESHGUI_RemoveDlg::~SMESHGUI_RemoveDlg()
107 {
108 }