1 // Copyright (C) 2014-2015 EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 // Lesser General Public License for more details.
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #include "HYDROGUI_SetBoundaryTypePolygonDlg.h"
20 #include <QVBoxLayout>
21 #include <QPushButton>
25 #include <SUIT_ResourceMgr.h>
26 #include <SUIT_Session.h>
27 #include <QListWidgetItem>
29 HYDROGUI_SetBoundaryTypePolygonDlg::HYDROGUI_SetBoundaryTypePolygonDlg( QWidget* theParent, int theType )
30 : QDialog( theParent )
32 QVBoxLayout* aMainLayout = new QVBoxLayout( this );
33 aMainLayout->setMargin( 5 );
34 aMainLayout->setSpacing( 5 );
36 QFrame* aBTFrame = new QFrame( this );
37 QLabel* aBoundaryLabel = new QLabel( tr( "BOUNDARY_TYPE" ), aBTFrame );
38 myBTBox = new QComboBox( aBTFrame );
39 myBTBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
41 SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
43 Types << QObject::tr( QString("HYDRO_BC_POLYGON_TYPE1_ICO").toLatin1()) <<
44 QObject::tr( QString("HYDRO_BC_POLYGON_TYPE2_ICO").toLatin1()) <<
45 QObject::tr( QString("HYDRO_BC_POLYGON_TYPE3_ICO").toLatin1());
47 myBTBox->addItem(QIcon( aResMgr->loadPixmap( "HYDRO", Types[0])), tr( "CUT_TOOL" ));
48 myBTBox->addItem(QIcon( aResMgr->loadPixmap( "HYDRO", Types[1])), tr( "INCLUDE_TOOL" ));
49 myBTBox->addItem(QIcon( aResMgr->loadPixmap( "HYDRO", Types[2])), tr( "SELECTION_TOOL" ));
51 if (theType != 1 && theType != 2 && theType != 3)
53 myBTBox->setCurrentIndex(theType - 1);
55 QBoxLayout* aColorLayout = new QHBoxLayout( aBTFrame );
56 aColorLayout->setMargin( 10 );
57 aColorLayout->setSpacing( 5 );
58 aColorLayout->addWidget( aBoundaryLabel );
59 aColorLayout->addWidget( myBTBox );
61 aMainLayout->addWidget( aBTFrame );
64 QPushButton* anOkButton = new QPushButton( tr( "OK" ), this );
65 anOkButton->setDefault( true );
66 QPushButton* aCancelButton = new QPushButton( tr( "CANCEL" ), this );
67 aCancelButton->setAutoDefault( true );
69 QHBoxLayout* aButtonsLayout = new QHBoxLayout;
70 aButtonsLayout->setMargin( 5 );
71 aButtonsLayout->setSpacing( 5 );
72 aButtonsLayout->addWidget( anOkButton );
73 aButtonsLayout->addStretch();
74 aButtonsLayout->addWidget( aCancelButton );
76 aMainLayout->addStretch();
77 aMainLayout->addLayout( aButtonsLayout );
79 setLayout( aMainLayout );
81 connect( anOkButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
82 connect( aCancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) );
85 int HYDROGUI_SetBoundaryTypePolygonDlg::GetCurrentType()
87 return myBTBox->currentIndex();
90 HYDROGUI_SetBoundaryTypePolygonDlg::~HYDROGUI_SetBoundaryTypePolygonDlg()