Salome HOME
NRI : Comment unused ComponentType enum.
[modules/kernel.git] / src / RegistryDisplay / IntervalWindow.cxx
1 // File:        IntervalWindow.cxx
2 // Created:     Thu Apr  3 10:55:19 2003
3 // Author:      Oksana TCHEBANOVA
4 //              <ota@parcex.nnov.matra-dtv.fr>
5
6
7 #include <IntervalWindow.hxx>
8
9 #include <qbuttongroup.h>
10 #include <qlabel.h>
11 #include <qpushbutton.h>
12 #include <qlayout.h>
13 # include "utilities.h"
14
15 #define MARGIN_SIZE      11
16 #define SPACING_SIZE      6
17 #define MIN_SPIN_WIDTH  100 
18
19 IntervalWindow::IntervalWindow ( QWidget* parent )
20      : QDialog( parent, "IntervalWindow" , true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
21 {
22   BEGIN_OF("IntervalWindow constructor")
23   setCaption( tr( "Refresh Interval"  ) );
24   setSizeGripEnabled( true );
25
26   QGridLayout* topLayout = new QGridLayout( this );
27   topLayout->setSpacing( SPACING_SIZE );
28   topLayout->setMargin( MARGIN_SIZE );
29
30   QGroupBox* intervalGrp = new QGroupBox( this, "intervalGrp" );
31   intervalGrp->setColumnLayout( 0, Qt::Horizontal );//Vertical
32   intervalGrp->layout()->setSpacing( 0 );
33   intervalGrp->layout()->setMargin( 0 );
34   QGridLayout* intervalGrpLayout = new QGridLayout( intervalGrp->layout() );
35   intervalGrpLayout->setAlignment( Qt::AlignTop );
36   intervalGrpLayout->setSpacing( SPACING_SIZE );
37   intervalGrpLayout->setMargin( MARGIN_SIZE  );  
38
39   QHBoxLayout* aBtnLayout = new QHBoxLayout;
40   aBtnLayout->setSpacing( SPACING_SIZE );
41   aBtnLayout->setMargin( 0 );
42
43   myButtonOk = new QPushButton( this, "buttonOk" );
44   myButtonOk->setText( tr( "BUT_OK"  ) );
45   myButtonOk->setAutoDefault( TRUE );
46   myButtonOk->setDefault( TRUE );
47   
48   myButtonCancel = new QPushButton( this, "buttonCancel" );
49   myButtonCancel->setText( tr( "BUT_CANCEL"  ) );
50   myButtonCancel->setAutoDefault( TRUE );
51
52   QLabel* TextLabel = new QLabel( intervalGrp, "TextLabel" );
53   TextLabel->setText( tr( "Please, enter a number of seconds:"  ) );
54
55   mySpinBox = new QSpinBox( 1, 999999999, 1, intervalGrp, "SpinBox" );
56   mySpinBox->setValue( 100 );
57   mySpinBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
58   mySpinBox->setMinimumWidth(MIN_SPIN_WIDTH);
59
60   intervalGrpLayout->addWidget(TextLabel, 0, 0);
61   intervalGrpLayout->addWidget(mySpinBox, 0, 1);
62
63   aBtnLayout->addWidget( myButtonOk );
64   aBtnLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
65   aBtnLayout->addWidget( myButtonCancel );
66
67   topLayout->addWidget( intervalGrp, 0, 0 );
68   topLayout->addLayout( aBtnLayout, 1, 0 ); 
69
70   END_OF("IntervalWindow constructor")
71 }
72 IntervalWindow::~IntervalWindow() {}
73 /* 
74    Sets start interval size
75 */
76 void IntervalWindow::setValue(const int size)
77 {
78   mySpinBox->setValue(size);
79 }
80
81 /*
82    Gets interval size
83 */
84 int IntervalWindow::getValue()
85 {
86   return mySpinBox->value();
87 }
88
89 /*
90    gets a pointer to myButtonOk
91 */
92 QPushButton* IntervalWindow::Ok()
93 {
94   return myButtonOk;
95 }
96
97 /*
98    gets a pointer to myButtonCancel
99 */
100 QPushButton* IntervalWindow::Cancel()
101 {
102   return myButtonCancel;
103 }