Salome HOME
NRI : Add message (GUI lib not found).
[modules/kernel.git] / src / SALOMEGUI / SALOMEGUI_LoadStudiesDlg.cxx
1 using namespace std;
2 //  File      : SALOMEGUI_LoadStudiesDlg.cxx
3 //  Created   : Wed Apr 03 13:37:13 2002
4 //  Author    : Nicolas REJNERI
5 //  Project   : SALOME
6 //  Module    : SALOMEGUI
7 //  Copyright : Open CASCADE 2002
8 //  $Header$
9
10 #include "SALOMEGUI_LoadStudiesDlg.h"
11
12 #include <qlabel.h>
13 #include <qlayout.h>
14 #include <qlistbox.h>
15 #include <qpushbutton.h>
16
17 #define SPACING_SIZE             6
18 #define MARGIN_SIZE             11
19 #define MIN_LISTBOX_WIDTH      150
20 #define MIN_LISTBOX_HEIGHT     100
21
22 SALOMEGUI_LoadStudiesDlg::SALOMEGUI_LoadStudiesDlg( QWidget* parent,  const char* name, bool modal, WFlags fl )
23     : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
24 {
25     if ( !name )
26         setName( "SALOMEGUI_LoadStudiesDlg" );
27     resize( 321, 181 ); 
28     setCaption( name );
29     setSizeGripEnabled( TRUE );
30
31     QGridLayout* aTopLayout = new QGridLayout(this);
32     aTopLayout->setMargin(MARGIN_SIZE);
33     aTopLayout->setSpacing(SPACING_SIZE);
34
35     TextLabel1 = new QLabel( this, "TextLabel1" );
36     TextLabel1->setGeometry( QRect( 11, 12, 297, 16 ) ); 
37     TextLabel1->setText( tr( "MEN_STUDIES_CHOICE"  ) );
38
39     QHBoxLayout* aBtnLayout = new QHBoxLayout;
40     aBtnLayout->setSpacing( SPACING_SIZE );
41     aBtnLayout->setMargin( 0 );
42     
43     buttonOk = new QPushButton( this, "buttonOk" );
44     buttonOk->setText( tr( "BUT_OK"  ) );
45     buttonOk->setAutoDefault( true );
46     buttonOk->setDefault( true );
47     
48     buttonCancel = new QPushButton( this, "buttonCancel" );
49     buttonCancel->setText( tr( "BUT_CANCEL"  ) );
50     buttonCancel->setAutoDefault( true ); 
51   
52     aBtnLayout->addWidget( buttonOk );
53     aBtnLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
54     aBtnLayout->addWidget( buttonCancel );
55
56     ListComponent = new QListBox( this, "ListComponent" );
57     ListComponent->setVScrollBarMode(QListBox::AlwaysOn);
58     ListComponent->setMinimumSize(MIN_LISTBOX_WIDTH, MIN_LISTBOX_HEIGHT);
59     ListComponent->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
60     ListComponent->setSelectionMode(QListBox::Single);
61
62     aTopLayout->addWidget(TextLabel1,    0, 0);
63     aTopLayout->addWidget(ListComponent, 1, 0);
64     aTopLayout->addLayout(aBtnLayout,    2, 0);
65
66     // signals and slots connections
67     connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
68     connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
69 }
70
71 /*  
72  *  Destroys the object and frees any allocated resources
73  */
74 SALOMEGUI_LoadStudiesDlg::~SALOMEGUI_LoadStudiesDlg()
75 {
76   // no need to delete child widgets, Qt does it all for us
77 }