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 );
48 QGridLayout* aLayout = new QGridLayout( mainFrame() );
49 aLayout->setMargin( 5 );
50 aLayout->setSpacing( 5 );
51 aLayout->addWidget( anIconLabelLabel, 0, 0 );
52 aLayout->addWidget( myObjectsLabel, 0, 1 );
53 aLayout->addWidget( myObjects, 1, 0, 1, 2 );
55 if ( QPushButton* aYesBtn = ::qobject_cast<QPushButton*>( button( Yes ) ) )
57 setFocusProxy( aYesBtn );
58 aYesBtn->setDefault( true );
61 setMinimumSize( 275, 250 );
64 HYDROGUI_DeleteDlg::~HYDROGUI_DeleteDlg()
68 void HYDROGUI_DeleteDlg::setObjectsToRemove( const QStringList& theObjects )
70 myObjectsLabel->setText( tr( "CONFIRM_DELETION" ).arg( theObjects.length() ) );
72 QStringList anObjects;
74 QStringListIterator anIter( theObjects );
75 while ( anIter.hasNext() )
77 QString anObject = anIter.next();
78 anObjects.append( anObject.prepend( "- " ) );
81 myObjects->setPlainText( anObjects.join( "\n" ) );