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"
20 #define MARGIN_SIZE 11
21 #define SPACING_SIZE 6
22 #define MIN_SPIN_WIDTH 100
24 IntervalWindow::IntervalWindow ( QWidget* parent )
25 : QDialog( parent, "IntervalWindow" , true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
27 BEGIN_OF("IntervalWindow constructor")
28 setCaption( tr( "Refresh Interval" ) );
29 setSizeGripEnabled( true );
31 QGridLayout* topLayout = new QGridLayout( this );
32 topLayout->setSpacing( SPACING_SIZE );
33 topLayout->setMargin( MARGIN_SIZE );
35 QGroupBox* intervalGrp = new QGroupBox( this, "intervalGrp" );
36 intervalGrp->setColumnLayout( 0, Qt::Horizontal );//Vertical
37 intervalGrp->layout()->setSpacing( 0 );
38 intervalGrp->layout()->setMargin( 0 );
39 QGridLayout* intervalGrpLayout = new QGridLayout( intervalGrp->layout() );
40 intervalGrpLayout->setAlignment( Qt::AlignTop );
41 intervalGrpLayout->setSpacing( SPACING_SIZE );
42 intervalGrpLayout->setMargin( MARGIN_SIZE );
44 QHBoxLayout* aBtnLayout = new QHBoxLayout;
45 aBtnLayout->setSpacing( SPACING_SIZE );
46 aBtnLayout->setMargin( 0 );
48 myButtonOk = new QPushButton( this, "buttonOk" );
49 myButtonOk->setText( tr( "BUT_OK" ) );
50 myButtonOk->setAutoDefault( TRUE );
51 myButtonOk->setDefault( TRUE );
53 myButtonCancel = new QPushButton( this, "buttonCancel" );
54 myButtonCancel->setText( tr( "BUT_CANCEL" ) );
55 myButtonCancel->setAutoDefault( TRUE );
57 QLabel* TextLabel = new QLabel( intervalGrp, "TextLabel" );
58 TextLabel->setText( tr( "Please, enter a number of seconds:" ) );
60 mySpinBox = new QSpinBox( 1, 999999999, 1, intervalGrp, "SpinBox" );
61 mySpinBox->setValue( 100 );
62 mySpinBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
63 mySpinBox->setMinimumWidth(MIN_SPIN_WIDTH);
65 intervalGrpLayout->addWidget(TextLabel, 0, 0);
66 intervalGrpLayout->addWidget(mySpinBox, 0, 1);
68 aBtnLayout->addWidget( myButtonOk );
69 aBtnLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
70 aBtnLayout->addWidget( myButtonCancel );
72 topLayout->addWidget( intervalGrp, 0, 0 );
73 topLayout->addLayout( aBtnLayout, 1, 0 );
75 END_OF("IntervalWindow constructor")
77 IntervalWindow::~IntervalWindow() {}
79 Sets start interval size
81 void IntervalWindow::setValue(const int size)
83 mySpinBox->setValue(size);
89 int IntervalWindow::getValue()
91 return mySpinBox->value();
95 gets a pointer to myButtonOk
97 QPushButton* IntervalWindow::Ok()
103 gets a pointer to myButtonCancel
105 QPushButton* IntervalWindow::Cancel()
107 return myButtonCancel;