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_DeleteDlg.h"
25 #include <SUIT_MessageBox.h>
28 #include <QVBoxLayout>
30 #include <QPushButton>
32 HYDROGUI_DeleteDlg::HYDROGUI_DeleteDlg( QWidget* theParent )
33 : QtxDialog( theParent, false, true, QtxDialog::YesNo )
35 setWindowTitle( tr( "DELETE_OBJECTS" ) );
36 setButtonPosition( Left, Yes );
37 setButtonPosition( Right, No );
39 QLabel* anIconLabelLabel = new QLabel( mainFrame() );
40 anIconLabelLabel->setPixmap( SUIT_MessageBox::standardIcon( QMessageBox::Question ) );
41 anIconLabelLabel->setScaledContents( false );
42 anIconLabelLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
44 myObjectsLabel = new QLabel( tr( "CONFIRM_DELETION" ), mainFrame() );
45 myObjects = new QTextEdit( mainFrame() );
46 myObjects->setReadOnly( true );
47 myObjects->setFocusPolicy( Qt::NoFocus );
49 QGridLayout* aLayout = new QGridLayout( mainFrame() );
50 aLayout->setMargin( 5 );
51 aLayout->setSpacing( 5 );
52 aLayout->addWidget( anIconLabelLabel, 0, 0 );
53 aLayout->addWidget( myObjectsLabel, 0, 1 );
54 aLayout->addWidget( myObjects, 1, 0, 1, 2 );
56 if ( QPushButton* aYesBtn = ::qobject_cast<QPushButton*>( button( Yes ) ) )
58 setFocusProxy( aYesBtn );
59 aYesBtn->setAutoDefault( true );
60 aYesBtn->setDefault( true );
62 if ( QPushButton* aNoBtn = ::qobject_cast<QPushButton*>( button( No ) ) )
64 aNoBtn->setAutoDefault( true );
67 setMinimumSize( 275, 250 );
70 HYDROGUI_DeleteDlg::~HYDROGUI_DeleteDlg()
74 void HYDROGUI_DeleteDlg::setObjectsToRemove( const QStringList& theObjects )
76 myObjectsLabel->setText( tr( "CONFIRM_DELETION" ).arg( theObjects.length() ) );
78 QStringList anObjects;
80 QStringListIterator anIter( theObjects );
81 while ( anIter.hasNext() )
83 QString anObject = anIter.next();
84 anObjects.append( anObject.prepend( "- " ) );
87 myObjects->setPlainText( anObjects.join( "\n" ) );