Salome HOME
latests developments debug and porting Python3
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_PolylineStyleDlg.cxx
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.
6 //
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.
11 //
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
15 //
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
17 //
18
19 #include "HYDROGUI_PolylineStyleDlg.h"
20 #include <QFrame>
21 #include <QLayout>
22 #include <QComboBox>
23 #include <QSpinBox>
24 #include <QLabel>
25 #include <QGroupBox>
26
27 HYDROGUI_PolylineStyleDlg::HYDROGUI_PolylineStyleDlg( HYDROGUI_Module* theModule )
28   : HYDROGUI_InputPanel( theModule, tr( "POLYLINE_STYLE" ) )
29 {
30   QGroupBox* group = new QGroupBox( tr( "POLYLINE_STYLE" ), mainFrame() );
31
32   QGridLayout* lay = new QGridLayout( group );
33
34   myShape = new QComboBox( mainFrame() );
35   myShape->addItem( "???" );
36   myShape->addItem( tr( "No" ) );
37   myShape->addItem( tr( "Triangle" ) );
38   myShape->addItem( tr( "Cone" ) );
39
40   mySize = new QSpinBox( mainFrame() );
41   mySize->setRange( -1, 50 );
42   mySize->setSpecialValueText( "   " );
43
44   lay->addWidget( new QLabel( tr( "PREF_POLYLINE_ARROW" ) ), 0, 0 );
45   lay->addWidget( myShape, 0, 1 );
46   lay->addWidget( new QLabel( tr( "PREF_POLYLINE_ARROW_SIZE" ) ), 1, 0 );
47   lay->addWidget( mySize, 1, 1 );
48   lay->setRowStretch( 2, 1 );
49
50   addWidget( group );
51 }
52
53 HYDROGUI_PolylineStyleDlg::~HYDROGUI_PolylineStyleDlg()
54 {
55 }
56
57 void HYDROGUI_PolylineStyleDlg::getStyle( int& theShape, int& theSize ) const
58 {
59   theShape = myShape->currentIndex();
60   theSize = mySize->value();
61 }
62
63 void HYDROGUI_PolylineStyleDlg::setStyle( int theShape, int theSize )
64 {
65   myShape->setCurrentIndex( theShape );
66   mySize->setValue( theSize );
67 }
68