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