1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/
19 #include "STD_CloseDlg.h"
23 #include <qpushbutton.h>
24 #include <qmessagebox.h>
25 #include <qhbuttongroup.h>
32 * \brief creates a Close dialog box
33 * \param parent a parent widget
34 * \param modal bool argument, if true the dialog box is a modal dialog box
35 * \param f style flags
38 STD_CloseDlg::STD_CloseDlg( QWidget* parent, bool modal, WFlags f )
39 : QDialog( parent, "", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
41 setSizeGripEnabled( true );
42 setCaption( tr( "CLOSE_DLG_CAPTION" ) );
44 QVBoxLayout* m_vbL = new QVBoxLayout( this );
45 m_vbL->setMargin( 11 );
46 m_vbL->setSpacing( 6 );
48 QLabel* m_lIcon = new QLabel( this, "m_lDescr" );
49 QPixmap pm = QMessageBox::standardIcon( QMessageBox::Warning );
50 m_lIcon->setPixmap( pm );
51 m_lIcon->setScaledContents( false );
52 m_lIcon->setAlignment( Qt::AlignCenter );
54 QLabel* m_lDescr = new QLabel (this, "m_lDescr");
55 m_lDescr->setText ( tr ("CLOSE_DLG_DESCRIPTION") );
56 m_lDescr->setAlignment( Qt::AlignCenter );
57 m_lDescr->setMinimumHeight( m_lDescr->sizeHint().height()*5 );
58 m_lDescr->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
60 QHBoxLayout* m_hl1 = new QHBoxLayout();
61 m_hl1->setMargin( 0 ); m_hl1->setSpacing( 6 );
62 m_hl1->addWidget( m_lIcon );
63 m_hl1->addWidget( m_lDescr );
65 m_pb1 = new QPushButton( tr ("CLOSE_DLG_SAVE_CLOSE"), this );
66 m_pb2 = new QPushButton( tr ("CLOSE_DLG_CLOSE"), this );
67 m_pb3 = new QPushButton( tr ("CLOSE_DLG_UNLOAD"), this );
68 m_pb4 = new QPushButton( tr ("BUT_CANCEL"), this );
70 QGridLayout* m_hl2 = new QGridLayout();
71 m_hl2->setMargin( 0 ); m_hl2->setSpacing( 6 );
72 m_hl2->addWidget( m_pb1, 0, 0 );
73 m_hl2->addWidget( m_pb2, 0, 1 );
74 m_hl2->addWidget( m_pb3, 0, 2 );
75 m_hl2->addColSpacing( 3, 10 );
76 m_hl2->setColStretch( 3, 5 );
77 m_hl2->addWidget( m_pb4, 0, 4 );
79 m_vbL->addLayout( m_hl1 );
80 m_vbL->addLayout( m_hl2 );
82 connect( m_pb1, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
83 connect( m_pb2, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
84 connect( m_pb3, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) );
85 connect( m_pb4, SIGNAL( clicked() ), this, SLOT( reject() ) );
89 * \brief reaction on clicked(pressed) button
91 void STD_CloseDlg::onButtonClicked()
93 QPushButton* btn = ( QPushButton* )sender();