]> SALOME platform Git repositories - modules/smesh.git/blob - src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx
Salome HOME
*** empty log message ***
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_AddMeshElementDlg.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_AddMeshElementDlg.cxx
25 //  Author : Nicolas REJNERI
26 //  Module : SMESH
27 //  $Header$
28
29 #include "SMESHGUI_AddMeshElementDlg.h"
30 #include <SMESHGUI_Operation.h>
31
32 #include <SUIT_ResourceMgr.h>
33
34 #include <SMDSAbs_ElementType.hxx>
35
36 #include <qlayout.h>
37 #include <qgroupbox.h>
38 #include <qbuttongroup.h>
39 #include <qradiobutton.h>
40 #include <qcheckbox.h>
41
42 //=================================================================================
43 // function : SMESHGUI_AddMeshElementDlg()
44 // purpose  : constructor
45 //=================================================================================
46 SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( const QString& elemName, const bool reverse )
47 : SMESHGUI_Dialog()
48 {
49   QString iconName      = tr(QString("ICON_DLG_%1").arg(elemName));
50   QString buttonGrTitle = tr(QString("SMESH_%1").arg(elemName));
51   QString caption       = tr(QString("SMESH_ADD_%1_TITLE").arg(elemName));
52   QString grBoxTitle    = tr(QString("SMESH_ADD_%1").arg(elemName));
53
54   QPixmap image0 ( resMgr()->loadPixmap("SMESH", iconName));
55   QPixmap image1 ( resMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
56
57   setName("SMESHGUI_AddMeshElementDlg");
58   resize(303, 185);
59   setCaption(caption);
60
61   setSizeGripEnabled(TRUE);
62   QVBoxLayout* main = new QVBoxLayout( mainFrame() );
63
64   /***************************************************************/
65   QButtonGroup* GroupConstructors = new QButtonGroup(mainFrame(), "GroupConstructors");
66   GroupConstructors->setTitle(buttonGrTitle);
67
68   GroupConstructors->setExclusive(TRUE);
69   GroupConstructors->setColumnLayout(0, Qt::Vertical);
70   GroupConstructors->layout()->setSpacing(0);
71   GroupConstructors->layout()->setMargin(0);
72   QGridLayout* GroupConstructorsLayout = new QGridLayout(GroupConstructors->layout());
73   GroupConstructorsLayout->setAlignment(Qt::AlignTop);
74   GroupConstructorsLayout->setSpacing(6);
75   GroupConstructorsLayout->setMargin(11);
76   QRadioButton* Constructor1 = new QRadioButton(GroupConstructors, "Constructor1");
77   Constructor1->setText(tr("" ));
78   Constructor1->setPixmap(image0);
79   Constructor1->setChecked(TRUE);
80   Constructor1->setSizePolicy(QSizePolicy((QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth()));
81   Constructor1->setMinimumSize(QSize(50, 0));
82   GroupConstructorsLayout->addWidget(Constructor1, 0, 0);
83   QSpacerItem* spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
84   GroupConstructorsLayout->addItem(spacer, 0, 1);
85   main->addWidget(GroupConstructors);
86
87   /***************************************************************/
88   QGroupBox* GroupC1 = new QGroupBox( mainFrame(), "GroupC1");
89   GroupC1->setTitle(grBoxTitle);
90
91   GroupC1->setMinimumSize(QSize(0, 0));
92   GroupC1->setFrameShape(QGroupBox::Box);
93   GroupC1->setFrameShadow(QGroupBox::Sunken);
94   GroupC1->setColumnLayout(3, Qt::Horizontal);
95
96   createObject( tr( "SMESH_ID_NODES" ), GroupC1, 0 );
97   setNameIndication( 0, ListOfNames );
98   setReadOnly( 0, false );
99   setObjectType( 0, SMESHGUI_Operation::prefix( "SMESH element" ) + SMDSAbs_Node, -1 );
100
101   myReverse = 0;
102   if ( reverse ) {
103     myReverse = new QCheckBox(GroupC1, "Reverse");
104     myReverse->setText(tr("SMESH_REVERSE" ));
105   }
106
107   if( myReverse )
108     connect( myReverse, SIGNAL(stateChanged(int)), this, SIGNAL(reverse(int)));
109     
110   main->addWidget(GroupC1);
111 }
112
113 //=================================================================================
114 // function : ~SMESHGUI_AddMeshElementDlg()
115 // purpose  : Destroys the object and frees any allocated resources
116 //=================================================================================
117 SMESHGUI_AddMeshElementDlg::~SMESHGUI_AddMeshElementDlg()
118 {
119 }
120
121 //=================================================================================
122 // function : ~SMESHGUI_AddMeshElementDlg()
123 // purpose  : Destroys the object and frees any allocated resources
124 //=================================================================================
125 bool SMESHGUI_AddMeshElementDlg::isReverse() const
126 {
127   if( myReverse )
128     return myReverse->isChecked();
129   else
130     return false;
131 }
132
133 //=================================================================================
134 // function : ~SMESHGUI_AddMeshElementDlg()
135 // purpose  : Destroys the object and frees any allocated resources
136 //=================================================================================
137 void SMESHGUI_AddMeshElementDlg::setBusy( const bool b )
138 {
139   myIsBusy = b;
140 }