1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // SALOME RegistryDisplay : GUI for Registry server implementation
21 // File : IntervalWindow.cxx
22 // Author : Oksana TCHEBANOVA
25 #include <IntervalWindow.hxx>
27 #include <qbuttongroup.h>
29 #include <qpushbutton.h>
31 # include "utilities.h"
33 #define MARGIN_SIZE 11
34 #define SPACING_SIZE 6
35 #define MIN_SPIN_WIDTH 100
40 IntervalWindow::IntervalWindow ( QWidget* parent )
41 : QDialog( parent, "IntervalWindow" , true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
43 BEGIN_OF("IntervalWindow constructor")
44 setCaption( tr( "Refresh Interval" ) );
45 setSizeGripEnabled( true );
47 QGridLayout* topLayout = new QGridLayout( this );
48 topLayout->setSpacing( SPACING_SIZE );
49 topLayout->setMargin( MARGIN_SIZE );
51 QGroupBox* intervalGrp = new QGroupBox( this, "intervalGrp" );
52 intervalGrp->setColumnLayout( 0, Qt::Horizontal );//Vertical
53 intervalGrp->layout()->setSpacing( 0 );
54 intervalGrp->layout()->setMargin( 0 );
55 QGridLayout* intervalGrpLayout = new QGridLayout( intervalGrp->layout() );
56 intervalGrpLayout->setAlignment( Qt::AlignTop );
57 intervalGrpLayout->setSpacing( SPACING_SIZE );
58 intervalGrpLayout->setMargin( MARGIN_SIZE );
60 QHBoxLayout* aBtnLayout = new QHBoxLayout;
61 aBtnLayout->setSpacing( SPACING_SIZE );
62 aBtnLayout->setMargin( 0 );
64 myButtonOk = new QPushButton( this, "buttonOk" );
65 myButtonOk->setText( tr( "BUT_OK" ) );
66 myButtonOk->setAutoDefault( TRUE );
67 myButtonOk->setDefault( TRUE );
69 myButtonCancel = new QPushButton( this, "buttonCancel" );
70 myButtonCancel->setText( tr( "BUT_CANCEL" ) );
71 myButtonCancel->setAutoDefault( TRUE );
73 QLabel* TextLabel = new QLabel( intervalGrp, "TextLabel" );
74 TextLabel->setText( tr( "Please, enter a number of seconds:" ) );
76 mySpinBox = new QSpinBox( 1, 999999999, 1, intervalGrp, "SpinBox" );
77 mySpinBox->setValue( 100 );
78 mySpinBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
79 mySpinBox->setMinimumWidth(MIN_SPIN_WIDTH);
81 intervalGrpLayout->addWidget(TextLabel, 0, 0);
82 intervalGrpLayout->addWidget(mySpinBox, 0, 1);
84 aBtnLayout->addWidget( myButtonOk );
85 aBtnLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
86 aBtnLayout->addWidget( myButtonCancel );
88 topLayout->addWidget( intervalGrp, 0, 0 );
89 topLayout->addLayout( aBtnLayout, 1, 0 );
91 END_OF("IntervalWindow constructor")
97 IntervalWindow::~IntervalWindow() {}
100 Sets start interval size
102 void IntervalWindow::setValue(const int size)
104 mySpinBox->setValue(size);
110 int IntervalWindow::getValue()
112 return mySpinBox->value();
116 gets a pointer to myButtonOk
118 QPushButton* IntervalWindow::Ok()
124 gets a pointer to myButtonCancel
126 QPushButton* IntervalWindow::Cancel()
128 return myButtonCancel;