+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
-#include <HYDROGUI_TwoImagesDlg.h>
-#include <HYDROGUI_ObjSelector.h>
-#include <HYDROGUI_ColorWidget.h>
+#include "HYDROGUI_TwoImagesDlg.h"
+
+#include "HYDROGUI_ColorWidget.h"
+#include "HYDROGUI_ObjSelector.h"
+
+#include <QGroupBox>
+#include <QLabel>
+#include <QLayout>
#include <QLineEdit>
#include <QRadioButton>
-#include <QLayout>
HYDROGUI_TwoImagesDlg::HYDROGUI_TwoImagesDlg( HYDROGUI_Module* theModule, const QString& theTitle )
: HYDROGUI_InputPanel( theModule, theTitle )
{
- myName = new QLineEdit();
- myImage1 = new HYDROGUI_ObjSelector( module(), 0 );
- myImage2 = new HYDROGUI_ObjSelector( module(), 0 );
- myTransparent = new QRadioButton( tr( "TRANSPARENT" ) );
+ // Image name
+ QGroupBox* anImageNameGroup = new QGroupBox( tr( "IMAGE_NAME" ) );
+
+ QLabel* anImageNameLabel = new QLabel( tr( "NAME" ), anImageNameGroup );
+ myImageName = new QLineEdit( anImageNameGroup );
+
+ QBoxLayout* anImageNameLayout = new QHBoxLayout( anImageNameGroup );
+ anImageNameLayout->setMargin( 5 );
+ anImageNameLayout->setSpacing( 5 );
+ anImageNameLayout->addWidget( anImageNameLabel );
+ anImageNameLayout->addWidget( myImageName );
+
+ // Image name
+ QGroupBox* aParamGroup = new QGroupBox( tr( "PARAMETERS" ) );
+
+ QLabel* anImage1Label = new QLabel( tr( "IMAGE_1" ), aParamGroup );
+ myImage1 = new HYDROGUI_ObjSelector( theModule, aParamGroup );
+
+ QLabel* anImage2Label = new QLabel( tr( "IMAGE_2" ), aParamGroup );
+ myImage2 = new HYDROGUI_ObjSelector( theModule, aParamGroup );
+
+ QFrame* aBackgroundFrame = new QFrame( aParamGroup );
+ QLabel* aBackgroundLabel = new QLabel( tr( "BACKGROUND" ), aBackgroundFrame );
+ myTransparent = new QRadioButton( tr( "TRANSPARENT" ), aBackgroundFrame );
myTransparent->setChecked( true );
- myColor = new QRadioButton( tr( "COLOR" ) );
- myColorBox = new HYDROGUI_ColorWidget( 0 );
-
- addWidget( tr( "NAME" ), myName );
- addSeparator();
- addWidget( tr( "IMAGE_1" ), myImage1 );
- addWidget( tr( "IMAGE_2" ), myImage2 );
-
- QFrame* aBackground = new QFrame();
- QGridLayout* aLayout = new QGridLayout( aBackground );
- aLayout->addWidget( myTransparent, 0, 0 );
- aLayout->addWidget( myColor, 1, 0 );
- aLayout->addWidget( myColorBox, 1, 1 );
-
- addWidget( tr( "BACKGROUND" ), aBackground );
- addSeparator();
- setRowStretch();
+ myColor = new QRadioButton( tr( "COLOR" ), aBackgroundFrame );
+ myColorBox = new HYDROGUI_ColorWidget( aBackgroundFrame );
+
+ QGridLayout* aBackgroundLayout = new QGridLayout( aBackgroundFrame );
+ aBackgroundLayout->setMargin( 0 );
+ aBackgroundLayout->setSpacing( 5 );
+ aBackgroundLayout->addWidget( aBackgroundLabel, 0, 0, 2, 1 );
+ aBackgroundLayout->addWidget( myTransparent, 0, 1 );
+ aBackgroundLayout->addWidget( myColor, 1, 1 );
+ aBackgroundLayout->addWidget( myColorBox, 1, 2 );
+
+ QGridLayout* aParamLayout = new QGridLayout( aParamGroup );
+ aParamLayout->setMargin( 5 );
+ aParamLayout->setSpacing( 5 );
+ aParamLayout->addWidget( anImage1Label, 0, 0 );
+ aParamLayout->addWidget( myImage1, 0, 1 );
+ aParamLayout->addWidget( anImage2Label, 1, 0 );
+ aParamLayout->addWidget( myImage2, 1, 1 );
+ aParamLayout->addWidget( aBackgroundFrame, 2, 0, 1, 2 );
+
+ // Common
+ addWidget( anImageNameGroup );
+ addWidget( aParamGroup );
+ addStretch();
}
HYDROGUI_TwoImagesDlg::~HYDROGUI_TwoImagesDlg()
{
}
-void HYDROGUI_TwoImagesDlg::GetSelectedImages( QString& theName1, QString& theName2 ) const
+void HYDROGUI_TwoImagesDlg::reset()
+{
+ myImageName->clear();
+ myImage1->Clear();
+ myImage2->Clear();
+ myTransparent->setChecked( true );
+ myColorBox->resetColor();
+}
+
+void HYDROGUI_TwoImagesDlg::setImageName( const QString& theName )
+{
+ myImageName->setText( theName );
+}
+
+QString HYDROGUI_TwoImagesDlg::getImageName() const
+{
+ return myImageName->text();
+}
+
+void HYDROGUI_TwoImagesDlg::setSelectedImages( const QString& theName1,
+ const QString& theName2 )
+{
+ myImage1->SetName( theName1 );
+ myImage2->SetName( theName2 );
+}
+
+bool HYDROGUI_TwoImagesDlg::getSelectedImages( QString& theName1,
+ QString& theName2 ) const
{
theName1 = myImage1->GetName();
theName2 = myImage2->GetName();
+ return !theName1.isEmpty() && !theName2.isEmpty();
}