1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #include "HYDROGUI_TwoImagesDlg.h"
25 #include "HYDROGUI_ColorWidget.h"
26 #include "HYDROGUI_ObjSelector.h"
32 #include <QRadioButton>
34 HYDROGUI_TwoImagesDlg::HYDROGUI_TwoImagesDlg( HYDROGUI_Module* theModule, const QString& theTitle )
35 : HYDROGUI_InputPanel( theModule, theTitle )
38 QGroupBox* anImageNameGroup = new QGroupBox( tr( "IMAGE_NAME" ) );
40 QLabel* anImageNameLabel = new QLabel( tr( "NAME" ), anImageNameGroup );
41 myImageName = new QLineEdit( anImageNameGroup );
43 QBoxLayout* anImageNameLayout = new QHBoxLayout( anImageNameGroup );
44 anImageNameLayout->setMargin( 5 );
45 anImageNameLayout->setSpacing( 5 );
46 anImageNameLayout->addWidget( anImageNameLabel );
47 anImageNameLayout->addWidget( myImageName );
50 QGroupBox* aParamGroup = new QGroupBox( tr( "PARAMETERS" ) );
52 QLabel* anImage1Label = new QLabel( tr( "IMAGE_1" ), aParamGroup );
53 myImage1 = new HYDROGUI_ObjSelector( theModule, aParamGroup );
55 QLabel* anImage2Label = new QLabel( tr( "IMAGE_2" ), aParamGroup );
56 myImage2 = new HYDROGUI_ObjSelector( theModule, aParamGroup );
58 QFrame* aBackgroundFrame = new QFrame( aParamGroup );
59 QLabel* aBackgroundLabel = new QLabel( tr( "BACKGROUND" ), aBackgroundFrame );
60 myTransparent = new QRadioButton( tr( "TRANSPARENT" ), aBackgroundFrame );
61 myTransparent->setChecked( true );
62 myColor = new QRadioButton( tr( "COLOR" ), aBackgroundFrame );
63 myColorBox = new HYDROGUI_ColorWidget( aBackgroundFrame );
65 QGridLayout* aBackgroundLayout = new QGridLayout( aBackgroundFrame );
66 aBackgroundLayout->setMargin( 0 );
67 aBackgroundLayout->setSpacing( 5 );
68 aBackgroundLayout->addWidget( aBackgroundLabel, 0, 0, 2, 1 );
69 aBackgroundLayout->addWidget( myTransparent, 0, 1 );
70 aBackgroundLayout->addWidget( myColor, 1, 1 );
71 aBackgroundLayout->addWidget( myColorBox, 1, 2 );
73 QGridLayout* aParamLayout = new QGridLayout( aParamGroup );
74 aParamLayout->setMargin( 5 );
75 aParamLayout->setSpacing( 5 );
76 aParamLayout->addWidget( anImage1Label, 0, 0 );
77 aParamLayout->addWidget( myImage1, 0, 1 );
78 aParamLayout->addWidget( anImage2Label, 1, 0 );
79 aParamLayout->addWidget( myImage2, 1, 1 );
80 aParamLayout->addWidget( aBackgroundFrame, 2, 0, 1, 2 );
83 addWidget( anImageNameGroup );
84 addWidget( aParamGroup );
88 HYDROGUI_TwoImagesDlg::~HYDROGUI_TwoImagesDlg()
92 void HYDROGUI_TwoImagesDlg::reset()
97 myTransparent->setChecked( true );
98 myColorBox->resetColor();
101 void HYDROGUI_TwoImagesDlg::setImageName( const QString& theName )
103 myImageName->setText( theName );
106 QString HYDROGUI_TwoImagesDlg::getImageName() const
108 return myImageName->text();
111 void HYDROGUI_TwoImagesDlg::setSelectedImages( const QString& theName1,
112 const QString& theName2 )
114 myImage1->SetName( theName1 );
115 myImage2->SetName( theName2 );
118 bool HYDROGUI_TwoImagesDlg::getSelectedImages( QString& theName1,
119 QString& theName2 ) const
121 theName1 = myImage1->GetName();
122 theName2 = myImage2->GetName();
123 return !theName1.isEmpty() && !theName2.isEmpty();