Salome HOME
sources v1.2
[modules/kernel.git] / src / SALOMEGUI / SALOMEGUI_LoadStudiesDlg.cxx
1 //  SALOME SALOMEGUI : implementation of desktop and GUI kernel
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
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. 
10 // 
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. 
15 // 
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 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : SALOMEGUI_LoadStudiesDlg.cxx
25 //  Author : Nicolas REJNERI
26 //  Module : SALOME
27 //  $Header$
28
29 using namespace std;
30 #include "SALOMEGUI_LoadStudiesDlg.h"
31
32 #include <qlabel.h>
33 #include <qlayout.h>
34 #include <qlistbox.h>
35 #include <qpushbutton.h>
36
37 #define SPACING_SIZE             6
38 #define MARGIN_SIZE             11
39 #define MIN_LISTBOX_WIDTH      150
40 #define MIN_LISTBOX_HEIGHT     100
41
42 SALOMEGUI_LoadStudiesDlg::SALOMEGUI_LoadStudiesDlg( QWidget* parent,  const char* name, bool modal, WFlags fl )
43     : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
44 {
45     if ( !name )
46         setName( "SALOMEGUI_LoadStudiesDlg" );
47     resize( 321, 181 ); 
48     setCaption( name );
49     setSizeGripEnabled( TRUE );
50
51     QGridLayout* aTopLayout = new QGridLayout(this);
52     aTopLayout->setMargin(MARGIN_SIZE);
53     aTopLayout->setSpacing(SPACING_SIZE);
54
55     TextLabel1 = new QLabel( this, "TextLabel1" );
56     TextLabel1->setGeometry( QRect( 11, 12, 297, 16 ) ); 
57     TextLabel1->setText( tr( "MEN_STUDIES_CHOICE"  ) );
58
59     QHBoxLayout* aBtnLayout = new QHBoxLayout;
60     aBtnLayout->setSpacing( SPACING_SIZE );
61     aBtnLayout->setMargin( 0 );
62     
63     buttonOk = new QPushButton( this, "buttonOk" );
64     buttonOk->setText( tr( "BUT_OK"  ) );
65     buttonOk->setAutoDefault( true );
66     buttonOk->setDefault( true );
67     
68     buttonCancel = new QPushButton( this, "buttonCancel" );
69     buttonCancel->setText( tr( "BUT_CANCEL"  ) );
70     buttonCancel->setAutoDefault( true ); 
71   
72     aBtnLayout->addWidget( buttonOk );
73     aBtnLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
74     aBtnLayout->addWidget( buttonCancel );
75
76     ListComponent = new QListBox( this, "ListComponent" );
77     ListComponent->setVScrollBarMode(QListBox::AlwaysOn);
78     ListComponent->setMinimumSize(MIN_LISTBOX_WIDTH, MIN_LISTBOX_HEIGHT);
79     ListComponent->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
80     ListComponent->setSelectionMode(QListBox::Single);
81
82     aTopLayout->addWidget(TextLabel1,    0, 0);
83     aTopLayout->addWidget(ListComponent, 1, 0);
84     aTopLayout->addLayout(aBtnLayout,    2, 0);
85
86     // signals and slots connections
87     connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
88     connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
89 }
90
91 /*  
92  *  Destroys the object and frees any allocated resources
93  */
94 SALOMEGUI_LoadStudiesDlg::~SALOMEGUI_LoadStudiesDlg()
95 {
96   // no need to delete child widgets, Qt does it all for us
97 }