]> SALOME platform Git repositories - modules/gui.git/blob - src/STD/STD_LoadStudiesDlg.cxx
Salome HOME
b8a655249a90e7f3d13db13984c6f9d77149f1d5
[modules/gui.git] / src / STD / STD_LoadStudiesDlg.cxx
1 // Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
2 // 
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.
7 // 
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/
18 //
19 #include "STD_LoadStudiesDlg.h"
20
21 #include <qlabel.h>
22 #include <qlayout.h>
23 #include <qlistbox.h>
24 #include <qpushbutton.h>
25
26 #define SPACING_SIZE             6
27 #define MARGIN_SIZE             11
28 #define MIN_LISTBOX_WIDTH      150
29 #define MIN_LISTBOX_HEIGHT     100
30
31 /*!
32 * \brief creates a Load study 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
36 */
37
38 STD_LoadStudiesDlg::STD_LoadStudiesDlg( QWidget* parent,  bool modal, WFlags fl )
39 : QDialog( parent, "STD_LoadStudiesDlg", modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
40 {
41     resize( 321, 181 ); 
42     setCaption( tr("DLG_LOAD_STUDY_CAPTION") );
43     setSizeGripEnabled( TRUE );
44
45     QGridLayout* aTopLayout = new QGridLayout(this);
46     aTopLayout->setMargin(MARGIN_SIZE);
47     aTopLayout->setSpacing(SPACING_SIZE);
48
49     TextLabel1 = new QLabel( this, "TextLabel1" );
50     TextLabel1->setGeometry( QRect( 11, 12, 297, 16 ) ); 
51     TextLabel1->setText( tr( "MEN_STUDIES_CHOICE"  ) );
52
53     QHBoxLayout* aBtnLayout = new QHBoxLayout;
54     aBtnLayout->setSpacing( SPACING_SIZE );
55     aBtnLayout->setMargin( 0 );
56     
57     buttonOk = new QPushButton( this, "buttonOk" );
58     buttonOk->setText( tr( "BUT_OK"  ) );
59     buttonOk->setAutoDefault( true );
60     buttonOk->setDefault( true );
61     
62     buttonCancel = new QPushButton( this, "buttonCancel" );
63     buttonCancel->setText( tr( "BUT_CANCEL"  ) );
64     buttonCancel->setAutoDefault( true ); 
65   
66     aBtnLayout->addWidget( buttonOk );
67     aBtnLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
68     aBtnLayout->addWidget( buttonCancel );
69
70     ListComponent = new QListBox( this, "ListComponent" );
71     ListComponent->setVScrollBarMode(QListBox::AlwaysOn);
72     ListComponent->setMinimumSize(MIN_LISTBOX_WIDTH, MIN_LISTBOX_HEIGHT);
73     ListComponent->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
74     ListComponent->setSelectionMode(QListBox::Single);
75
76     aTopLayout->addWidget(TextLabel1,    0, 0);
77     aTopLayout->addWidget(ListComponent, 1, 0);
78     aTopLayout->addLayout(aBtnLayout,    2, 0);
79
80     // signals and slots connections
81     connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
82     connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
83 }
84