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 // File : ToolsGUI_IntervalWindow.cxx
20 // Author : Oksana TCHEBANOVA
23 #include "ToolsGUI_IntervalWindow.h"
25 #include <qbuttongroup.h>
27 #include <qpushbutton.h>
29 # include "utilities.h"
31 #define MARGIN_SIZE 11
32 #define SPACING_SIZE 6
33 #define MIN_SPIN_WIDTH 100
38 ToolsGUI_IntervalWindow::ToolsGUI_IntervalWindow ( QWidget* parent )
39 : QDialog( parent, "ToolsGUI_IntervalWindow" , true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
41 BEGIN_OF("ToolsGUI_IntervalWindow constructor")
42 setCaption( tr( "Refresh Interval" ) );
43 setSizeGripEnabled( true );
45 QGridLayout* topLayout = new QGridLayout( this );
46 topLayout->setSpacing( SPACING_SIZE );
47 topLayout->setMargin( MARGIN_SIZE );
49 QGroupBox* intervalGrp = new QGroupBox( this, "intervalGrp" );
50 intervalGrp->setColumnLayout( 0, Qt::Horizontal );//Vertical
51 intervalGrp->layout()->setSpacing( 0 );
52 intervalGrp->layout()->setMargin( 0 );
53 QGridLayout* intervalGrpLayout = new QGridLayout( intervalGrp->layout() );
54 intervalGrpLayout->setAlignment( Qt::AlignTop );
55 intervalGrpLayout->setSpacing( SPACING_SIZE );
56 intervalGrpLayout->setMargin( MARGIN_SIZE );
58 QHBoxLayout* aBtnLayout = new QHBoxLayout;
59 aBtnLayout->setSpacing( SPACING_SIZE );
60 aBtnLayout->setMargin( 0 );
62 myButtonOk = new QPushButton( this, "buttonOk" );
63 myButtonOk->setText( tr( "BUT_OK" ) );
64 myButtonOk->setAutoDefault( TRUE );
65 myButtonOk->setDefault( TRUE );
67 myButtonCancel = new QPushButton( this, "buttonCancel" );
68 myButtonCancel->setText( tr( "BUT_CANCEL" ) );
69 myButtonCancel->setAutoDefault( TRUE );
71 QLabel* TextLabel = new QLabel( intervalGrp, "TextLabel" );
72 TextLabel->setText( tr( "Please, enter a number of seconds:" ) );
74 mySpinBox = new QSpinBox( 1, 999999999, 1, intervalGrp, "SpinBox" );
75 mySpinBox->setValue( 100 );
76 mySpinBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
77 mySpinBox->setMinimumWidth(MIN_SPIN_WIDTH);
79 intervalGrpLayout->addWidget(TextLabel, 0, 0);
80 intervalGrpLayout->addWidget(mySpinBox, 0, 1);
82 aBtnLayout->addWidget( myButtonOk );
83 aBtnLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
84 aBtnLayout->addWidget( myButtonCancel );
86 topLayout->addWidget( intervalGrp, 0, 0 );
87 topLayout->addLayout( aBtnLayout, 1, 0 );
89 END_OF("ToolsGUI_IntervalWindow constructor")
95 ToolsGUI_IntervalWindow::~ToolsGUI_IntervalWindow() {}
98 Sets start interval size
100 void ToolsGUI_IntervalWindow::setValue(const int size)
102 mySpinBox->setValue(size);
106 \return interval size
108 int ToolsGUI_IntervalWindow::getValue()
110 return mySpinBox->value();
114 \return a pointer to myButtonOk
116 QPushButton* ToolsGUI_IntervalWindow::Ok()
122 \return a pointer to myButtonCancel
124 QPushButton* ToolsGUI_IntervalWindow::Cancel()
126 return myButtonCancel;