1 // SALOME RegistryDisplay : GUI for Registry server implementation
3 // Copyright (C) 2003 CEA/DEN, EDF R&D
7 // File : IntervalWindow.cxx
8 // Author : Oksana TCHEBANOVA
11 #include <IntervalWindow.hxx>
13 #include <qbuttongroup.h>
15 #include <qpushbutton.h>
17 # include "utilities.h"
19 #define MARGIN_SIZE 11
20 #define SPACING_SIZE 6
21 #define MIN_SPIN_WIDTH 100
26 IntervalWindow::IntervalWindow ( QWidget* parent )
27 : QDialog( parent, "IntervalWindow" , true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
29 BEGIN_OF("IntervalWindow constructor")
30 setCaption( tr( "Refresh Interval" ) );
31 setSizeGripEnabled( true );
33 QGridLayout* topLayout = new QGridLayout( this );
34 topLayout->setSpacing( SPACING_SIZE );
35 topLayout->setMargin( MARGIN_SIZE );
37 QGroupBox* intervalGrp = new QGroupBox( this, "intervalGrp" );
38 intervalGrp->setColumnLayout( 0, Qt::Horizontal );//Vertical
39 intervalGrp->layout()->setSpacing( 0 );
40 intervalGrp->layout()->setMargin( 0 );
41 QGridLayout* intervalGrpLayout = new QGridLayout( intervalGrp->layout() );
42 intervalGrpLayout->setAlignment( Qt::AlignTop );
43 intervalGrpLayout->setSpacing( SPACING_SIZE );
44 intervalGrpLayout->setMargin( MARGIN_SIZE );
46 QHBoxLayout* aBtnLayout = new QHBoxLayout;
47 aBtnLayout->setSpacing( SPACING_SIZE );
48 aBtnLayout->setMargin( 0 );
50 myButtonOk = new QPushButton( this, "buttonOk" );
51 myButtonOk->setText( tr( "BUT_OK" ) );
52 myButtonOk->setAutoDefault( TRUE );
53 myButtonOk->setDefault( TRUE );
55 myButtonCancel = new QPushButton( this, "buttonCancel" );
56 myButtonCancel->setText( tr( "BUT_CANCEL" ) );
57 myButtonCancel->setAutoDefault( TRUE );
59 QLabel* TextLabel = new QLabel( intervalGrp, "TextLabel" );
60 TextLabel->setText( tr( "Please, enter a number of seconds:" ) );
62 mySpinBox = new QSpinBox( 1, 999999999, 1, intervalGrp, "SpinBox" );
63 mySpinBox->setValue( 100 );
64 mySpinBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
65 mySpinBox->setMinimumWidth(MIN_SPIN_WIDTH);
67 intervalGrpLayout->addWidget(TextLabel, 0, 0);
68 intervalGrpLayout->addWidget(mySpinBox, 0, 1);
70 aBtnLayout->addWidget( myButtonOk );
71 aBtnLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
72 aBtnLayout->addWidget( myButtonCancel );
74 topLayout->addWidget( intervalGrp, 0, 0 );
75 topLayout->addLayout( aBtnLayout, 1, 0 );
77 END_OF("IntervalWindow constructor")
83 IntervalWindow::~IntervalWindow() {}
86 Sets start interval size
88 void IntervalWindow::setValue(const int size)
90 mySpinBox->setValue(size);
96 int IntervalWindow::getValue()
98 return mySpinBox->value();
102 gets a pointer to myButtonOk
104 QPushButton* IntervalWindow::Ok()
110 gets a pointer to myButtonCancel
112 QPushButton* IntervalWindow::Cancel()
114 return myButtonCancel;