]> SALOME platform Git repositories - modules/gui.git/blob - src/STD/STD_LoadStudiesDlg.cxx
Salome HOME
ENV: Windows porting
[modules/gui.git] / src / STD / STD_LoadStudiesDlg.cxx
1 #include "STD_LoadStudiesDlg.h"
2
3 #include <qlabel.h>
4 #include <qlayout.h>
5 #include <qlistbox.h>
6 #include <qpushbutton.h>
7
8 #ifndef WNT
9 using namespace std;
10 #endif
11
12 #define SPACING_SIZE             6
13 #define MARGIN_SIZE             11
14 #define MIN_LISTBOX_WIDTH      150
15 #define MIN_LISTBOX_HEIGHT     100
16
17 //================================================================================
18 /*! Public -
19  * \brief creates a Load study dialog box
20  * \param parent a parent widget
21  * \param modal bool argument, if true the dialog box is a modal dialog box
22  * \param f style flags
23  * 
24  */
25 //================================================================================
26 STD_LoadStudiesDlg::STD_LoadStudiesDlg( QWidget* parent,  bool modal, WFlags fl )
27     : QDialog(parent, "STD_LoadStudiesDlg", modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
28 {
29     resize( 321, 181 ); 
30     setCaption( tr("DLG_LOAD_STUDY_CAPTION") );
31     setSizeGripEnabled( TRUE );
32
33     QGridLayout* aTopLayout = new QGridLayout(this);
34     aTopLayout->setMargin(MARGIN_SIZE);
35     aTopLayout->setSpacing(SPACING_SIZE);
36
37     TextLabel1 = new QLabel( this, "TextLabel1" );
38     TextLabel1->setGeometry( QRect( 11, 12, 297, 16 ) ); 
39     TextLabel1->setText( tr( "MEN_STUDIES_CHOICE"  ) );
40
41     QHBoxLayout* aBtnLayout = new QHBoxLayout;
42     aBtnLayout->setSpacing( SPACING_SIZE );
43     aBtnLayout->setMargin( 0 );
44     
45     buttonOk = new QPushButton( this, "buttonOk" );
46     buttonOk->setText( tr( "BUT_OK"  ) );
47     buttonOk->setAutoDefault( true );
48     buttonOk->setDefault( true );
49     
50     buttonCancel = new QPushButton( this, "buttonCancel" );
51     buttonCancel->setText( tr( "BUT_CANCEL"  ) );
52     buttonCancel->setAutoDefault( true ); 
53   
54     aBtnLayout->addWidget( buttonOk );
55     aBtnLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
56     aBtnLayout->addWidget( buttonCancel );
57
58     ListComponent = new QListBox( this, "ListComponent" );
59     ListComponent->setVScrollBarMode(QListBox::AlwaysOn);
60     ListComponent->setMinimumSize(MIN_LISTBOX_WIDTH, MIN_LISTBOX_HEIGHT);
61     ListComponent->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
62     ListComponent->setSelectionMode(QListBox::Single);
63
64     aTopLayout->addWidget(TextLabel1,    0, 0);
65     aTopLayout->addWidget(ListComponent, 1, 0);
66     aTopLayout->addLayout(aBtnLayout,    2, 0);
67
68     // signals and slots connections
69     connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
70     connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
71 }
72