Salome HOME
c3c832270debd506df3a203d3961f230c5975875
[modules/visu.git] / src / VISUGUI / VisuGUI_CursorDlg.cxx
1 //  VISU VISUGUI : GUI of VISU component
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
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. 
10 // 
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. 
15 // 
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 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : VisuGUI_CursorDlg.cxx
25 //  Author : Laurent CORNABE & Hubert ROLLAND 
26 //  Module : VISU
27 //  $Header$
28
29 using namespace std;
30 #include "VisuGUI_CursorDlg.h"
31 #include <qlayout.h>
32
33 /*!
34   Constructor
35 */
36 VisuGUI_CursorDlg::VisuGUI_CursorDlg( QWidget* parent,  const char* name, bool modal, WFlags fl )
37     : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
38 {
39   if ( !name )
40     setName( "VisuGUI_CursorDlg" );
41   setCaption( name );
42   setSizeGripEnabled( TRUE );
43
44   QGridLayout* TopLayout = new QGridLayout( this ); 
45   TopLayout->setSpacing( 6 );
46   TopLayout->setMargin( 11 );
47   
48   TopGroupBox = new QGroupBox( this, "TopGroupBox" );
49   TopGroupBox->setColumnLayout(0, Qt::Vertical );
50   TopGroupBox->layout()->setSpacing( 0 );
51   TopGroupBox->layout()->setMargin( 0 );
52   QGridLayout* TopGroupBoxLayout = new QGridLayout( TopGroupBox->layout() );
53   TopGroupBoxLayout->setAlignment( Qt::AlignTop );
54   TopGroupBoxLayout->setSpacing( 6 );
55   TopGroupBoxLayout->setMargin( 11 );
56
57   Comment1 = new QLabel( tr( "TextLabel1" ), TopGroupBox, "Comment1" );
58   Comment1->setAlignment( QLabel::AlignCenter );
59   TopGroupBoxLayout->addWidget( Comment1, 0, 0 );
60
61   Comment2 = new QLabel(  tr( "TextLabel2" ), TopGroupBox, "Comment2" );
62   Comment2->setAlignment( QLabel::AlignCenter );
63   TopGroupBoxLayout->addWidget( Comment2, 1, 0 );
64
65   SpinBox1 = new QSpinBox( 1, 100, 1, TopGroupBox, "SpinBox1" );
66   SpinBox1->setValue( 100 );
67   SpinBox1->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
68   SpinBox1->setMinimumSize( 70, 0 );
69   QHBoxLayout* SLayout = new QHBoxLayout;
70   SLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
71   SLayout->addWidget( SpinBox1 );
72   SLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
73   TopGroupBoxLayout->addLayout( SLayout, 2, 0 );
74   
75   GroupButtons = new QGroupBox( this, "GroupButtons" );
76   GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
77   GroupButtons->setTitle( tr( ""  ) );
78   GroupButtons->setColumnLayout(0, Qt::Vertical );
79   GroupButtons->layout()->setSpacing( 0 );
80   GroupButtons->layout()->setMargin( 0 );
81   QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
82   GroupButtonsLayout->setAlignment( Qt::AlignTop );
83   GroupButtonsLayout->setSpacing( 6 );
84   GroupButtonsLayout->setMargin( 11 );
85
86   buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
87   buttonOk->setAutoDefault( TRUE );
88   buttonOk->setDefault( TRUE );
89   GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
90   GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
91   buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
92   buttonCancel->setAutoDefault( TRUE );
93   GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
94   
95   TopLayout->addWidget( TopGroupBox,  0, 0 );
96   TopLayout->addWidget( GroupButtons, 1, 0 );
97
98   // signals and slots connections
99   connect( buttonOk,     SIGNAL( clicked() ), this, SLOT( accept() ) );
100   connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
101 }
102
103 /*!
104   Destructor
105 */
106 VisuGUI_CursorDlg::~VisuGUI_CursorDlg()
107 {
108 }
109