1 // SALOME SALOMEGUI : implementation of desktop and GUI kernel
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SALOMEGUI_TrihedronSizeDlg.cxx
25 // Author : Nicolas REJNERI
30 #include "SALOMEGUI_TrihedronSizeDlg.h"
32 #include <qbuttongroup.h>
34 #include <qpushbutton.h>
38 #define MARGIN_SIZE 11
39 #define SPACING_SIZE 6
40 #define MIN_SPIN_WIDTH 100
43 * Constructs a modal SALOMEGUI_TrihedronSizeDlg which is a child of 'parent'
46 SALOMEGUI_TrihedronSizeDlg::SALOMEGUI_TrihedronSizeDlg( QWidget* parent )
47 : QDialog( parent, "SALOMEGUI_TrihedronSizeDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
49 setCaption( tr( "MEN_TRIHEDRON" ) );
50 setSizeGripEnabled( true );
52 QGridLayout* topLayout = new QGridLayout( this );
53 topLayout->setSpacing( SPACING_SIZE );
54 topLayout->setMargin( MARGIN_SIZE );
56 QGroupBox* trihedronGrp = new QGroupBox( this, "trihedronGrp" );
57 trihedronGrp->setColumnLayout( 0, Qt::Vertical );
58 trihedronGrp->layout()->setSpacing( 0 );
59 trihedronGrp->layout()->setMargin( 0 );
60 QGridLayout* trihedronGrpLayout = new QGridLayout( trihedronGrp->layout() );
61 trihedronGrpLayout->setAlignment( Qt::AlignTop );
62 trihedronGrpLayout->setSpacing( SPACING_SIZE );
63 trihedronGrpLayout->setMargin( MARGIN_SIZE );
65 QHBoxLayout* aBtnLayout = new QHBoxLayout;
66 aBtnLayout->setSpacing( SPACING_SIZE );
67 aBtnLayout->setMargin( 0 );
69 QPushButton* buttonOk = new QPushButton( this, "buttonOk" );
70 buttonOk->setText( tr( "BUT_OK" ) );
71 buttonOk->setAutoDefault( TRUE );
72 buttonOk->setDefault( TRUE );
74 QPushButton* buttonCancel = new QPushButton( this, "buttonCancel" );
75 buttonCancel->setText( tr( "BUT_CANCEL" ) );
76 buttonCancel->setAutoDefault( TRUE );
78 QLabel* TextLabel = new QLabel( trihedronGrp, "TextLabel" );
79 TextLabel->setText( tr( "MEN_TRIHEDRON_SIZE" ) );
81 SpinBox = new QSpinBox( 1, 999999999, 1, trihedronGrp, "SpinBox" );
82 SpinBox->setValue( 100 );
83 SpinBox->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
84 SpinBox->setMinimumWidth(MIN_SPIN_WIDTH);
86 trihedronGrpLayout->addWidget(TextLabel, 0, 0);
87 trihedronGrpLayout->addWidget(SpinBox, 0, 1);
89 aBtnLayout->addWidget( buttonOk );
90 aBtnLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
91 aBtnLayout->addWidget( buttonCancel );
93 topLayout->addWidget( trihedronGrp, 0, 0 );
94 topLayout->addLayout( aBtnLayout, 1, 0 );
96 // signals and slots connections
97 connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
98 connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
102 * Destroys the object and frees any allocated resources
104 SALOMEGUI_TrihedronSizeDlg::~SALOMEGUI_TrihedronSizeDlg()
106 // no need to delete child widgets, Qt does it all for us
110 Sets start trihedron size
112 void SALOMEGUI_TrihedronSizeDlg::setTrihedronSize(const int size)
114 SpinBox->setValue(size);
120 int SALOMEGUI_TrihedronSizeDlg::getTrihedronSize()
122 return SpinBox->value();