1 // SMESH SMESHGUI : GUI for SMESH component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SMESHGUI_AddMeshElementDlg.cxx
25 // Author : Nicolas REJNERI
29 #include "SMESHGUI_AddMeshElementDlg.h"
30 #include <SMESHGUI_Operation.h>
32 #include <SUIT_ResourceMgr.h>
34 #include <SMDSAbs_ElementType.hxx>
37 #include <qgroupbox.h>
38 #include <qbuttongroup.h>
39 #include <qradiobutton.h>
40 #include <qcheckbox.h>
42 //=================================================================================
43 // function : SMESHGUI_AddMeshElementDlg()
44 // purpose : constructor
45 //=================================================================================
46 SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( const QString& elemName, const bool reverse )
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));
54 QPixmap image0 ( resMgr()->loadPixmap("SMESH", iconName));
55 QPixmap image1 ( resMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
57 setName("SMESHGUI_AddMeshElementDlg");
61 setSizeGripEnabled(TRUE);
62 QVBoxLayout* main = new QVBoxLayout( mainFrame() );
64 /***************************************************************/
65 QButtonGroup* GroupConstructors = new QButtonGroup(mainFrame(), "GroupConstructors");
66 GroupConstructors->setTitle(buttonGrTitle);
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);
87 /***************************************************************/
88 QGroupBox* GroupC1 = new QGroupBox( mainFrame(), "GroupC1");
89 GroupC1->setTitle(grBoxTitle);
91 GroupC1->setMinimumSize(QSize(0, 0));
92 GroupC1->setFrameShape(QGroupBox::Box);
93 GroupC1->setFrameShadow(QGroupBox::Sunken);
94 GroupC1->setColumnLayout(3, Qt::Horizontal);
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 );
103 myReverse = new QCheckBox(GroupC1, "Reverse");
104 myReverse->setText(tr("SMESH_REVERSE" ));
108 connect( myReverse, SIGNAL(stateChanged(int)), this, SIGNAL(reverse(int)));
110 main->addWidget(GroupC1);
113 //=================================================================================
114 // function : ~SMESHGUI_AddMeshElementDlg()
115 // purpose : Destroys the object and frees any allocated resources
116 //=================================================================================
117 SMESHGUI_AddMeshElementDlg::~SMESHGUI_AddMeshElementDlg()
121 //=================================================================================
122 // function : ~SMESHGUI_AddMeshElementDlg()
123 // purpose : Destroys the object and frees any allocated resources
124 //=================================================================================
125 bool SMESHGUI_AddMeshElementDlg::isReverse() const
128 return myReverse->isChecked();
133 //=================================================================================
134 // function : ~SMESHGUI_AddMeshElementDlg()
135 // purpose : Destroys the object and frees any allocated resources
136 //=================================================================================
137 void SMESHGUI_AddMeshElementDlg::setBusy( const bool b )