Salome HOME
yfr : merge 1.2
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_Preferences_ScalarBarDlg.cxx
1 //  SMESH SMESHGUI : GUI for SMESH 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   : SMESHGUI_Preferences_ScalarBarDlg.cxx
25 //  Author : Nicolas REJNERI
26 //  Module : SMESH
27 //  $Header$
28
29 using namespace std;
30 #include "SMESHGUI_Preferences_ScalarBarDlg.h"
31
32 #include <qbuttongroup.h>
33 #include <qcheckbox.h>
34 #include <qcombobox.h>
35 #include <qgroupbox.h>
36 #include <qlabel.h>
37 #include <qlineedit.h>
38 #include <qpushbutton.h>
39 #include <qradiobutton.h>
40 #include <qspinbox.h>
41 #include <qlayout.h>
42 #include <qvariant.h>
43 #include <qtooltip.h>
44 #include <qwhatsthis.h>
45
46 /* 
47  *  Constructs a SMESHGUI_Preferences_ScalarBarDlg which is a child of 'parent', with the 
48  *  name 'name' and widget flags set to 'f' 
49  *
50  *  The dialog will by default be modeless, unless you set 'modal' to
51  *  TRUE to construct a modal dialog.
52  */
53 SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( QWidget* parent,  const char* name, bool modal, WFlags fl )
54     : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
55 {
56     if ( !name )
57         setName( "SMESHGUI_Preferences_ScalarBarDlg" );
58     setCaption( tr( "SMESH_PREFERENCES_SCALARBAR"  ) );
59     setSizeGripEnabled( TRUE );
60
61     grid = new QGridLayout( this ); 
62     grid->setSpacing( 6 );
63     grid->setMargin( 11 );
64
65     /******************************************************************************/
66     Properties = new QGroupBox( this, "Properties" );
67     Properties->setTitle( tr( "SMESH_PROPERTIES"  ) );
68     Properties->setColumnLayout(0, Qt::Vertical );
69     Properties->layout()->setSpacing( 0 );
70     Properties->layout()->setMargin( 0 );
71     grid_4 = new QGridLayout( Properties->layout() );
72     grid_4->setAlignment( Qt::AlignTop );
73     grid_4->setSpacing( 6 );
74     grid_4->setMargin( 11 );
75
76     /* Font */
77     grid_5 = new QGridLayout; 
78     grid_5->setSpacing( 6 );
79     grid_5->setMargin( 0 );
80     TextLabel2 = new QLabel( Properties, "TextLabel2" );
81     TextLabel2->setText( tr( "SMESH_FONT"  ) );
82     grid_5->addWidget( TextLabel2, 0, 0 );
83     ComboBox1 = new QComboBox( FALSE, Properties, "ComboBox1" );
84     ComboBox1->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
85     ComboBox1->insertItem( tr( "SMESH_FONT_ARIAL" ) );
86     ComboBox1->insertItem( tr( "SMESH_FONT_COURIER" ) );
87     ComboBox1->insertItem( tr( "SMESH_FONT_TIMES" ) );
88     grid_5->addWidget( ComboBox1, 0, 1 );
89     grid_4->addLayout( grid_5, 0, 0 );
90     
91     /* Font attributes */
92     grid_6 = new QGridLayout; 
93     grid_6->setSpacing( 6 );
94     grid_6->setMargin( 0 );
95     Bold = new QCheckBox( Properties, "Bold" );
96     Bold->setText( tr( "SMESH_FONT_BOLD"  ) );
97     grid_6->addWidget( Bold, 0, 0 );
98     Italic = new QCheckBox( Properties, "Italic" );
99     Italic->setText( tr( "SMESH_FONT_ITALIC"  ) );
100     grid_6->addWidget( Italic, 0, 1 );
101     Shadow = new QCheckBox( Properties, "Shadow" );
102     Shadow->setText( tr( "SMESH_FONT_SHADOW"  ) );
103     grid_6->addWidget( Shadow, 0, 2 );
104     grid_4->addLayout( grid_6, 1, 0 );
105
106     grid_7 = new QGridLayout; 
107     grid_7->setSpacing( 6 );
108     grid_7->setMargin( 0 );
109     NumberColors = new QLabel( Properties, "NumberColors" );
110     NumberColors->setText( tr( "SMESH_NUMBEROFCOLORS"  ) );
111     grid_7->addWidget( NumberColors, 0, 0 );
112     SpinBoxColors = new QSpinBox( Properties, "SpinBoxColors" );
113     SpinBoxColors->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
114     SpinBoxColors->setMinValue( 1 );
115     grid_7->addWidget( SpinBoxColors, 0, 1 );
116     NumberLabels = new QLabel( Properties, "NumberLabels" );
117     NumberLabels->setText( tr( "SMESH_NUMBEROFLABELS"  ) );
118     grid_7->addWidget( NumberLabels, 1, 0 );
119     SpinBoxLabels = new QSpinBox( Properties, "SpinBoxLabels" );
120     SpinBoxLabels->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
121     SpinBoxLabels->setMinValue( 1 );
122     grid_7->addWidget( SpinBoxLabels, 1, 1 );
123     grid_4->addLayout( grid_7, 2, 0 );
124
125     grid->addWidget( Properties, 0, 0 );
126
127     /******************************************************************************/
128     ButtonGroup_Orientation = new QButtonGroup( this, "ButtonGroup_Orientation" );
129     ButtonGroup_Orientation->setTitle( tr( "SMESH_ORIENTATION"  ) );
130     ButtonGroup_Orientation->setColumnLayout(0, Qt::Vertical );
131     ButtonGroup_Orientation->layout()->setSpacing( 0 );
132     ButtonGroup_Orientation->layout()->setMargin( 0 );
133     grid_2 = new QGridLayout( ButtonGroup_Orientation->layout() );
134     grid_2->setAlignment( Qt::AlignTop );
135     grid_2->setSpacing( 6 );
136     grid_2->setMargin( 11 );
137     RadioVert = new QRadioButton( ButtonGroup_Orientation, "RadioVert" );
138     RadioVert->setText( tr( "SMESH_VERTICAL"  ) );
139     RadioHoriz = new QRadioButton( ButtonGroup_Orientation, "RadioHoriz" );
140     RadioHoriz->setText( tr( "SMESH_HORIZONTAL"  ) );
141     grid_2->addWidget( RadioVert, 0, 0 );
142     grid_2->addWidget( RadioHoriz, 0, 1 );
143
144     grid->addWidget( ButtonGroup_Orientation, 1, 0 );
145
146     /******************************************************************************/
147     GroupBox5 = new QGroupBox( this, "GroupBox5" );
148     GroupBox5->setTitle( tr( "SMESH_DIMENSIONS"  ) );
149     GroupBox5->setColumnLayout(0, Qt::Vertical );
150     GroupBox5->layout()->setSpacing( 0 );
151     GroupBox5->layout()->setMargin( 0 );
152     grid_11 = new QGridLayout( GroupBox5->layout() );
153     grid_11->setAlignment( Qt::AlignTop );
154     grid_11->setSpacing( 6 );
155     grid_11->setMargin( 11 );
156
157     LineEditWidth = new QLineEdit( GroupBox5, "LineEditWidth" );
158     grid_11->addWidget( LineEditWidth, 0, 0 );
159     Width = new QLabel( GroupBox5, "Width" );
160     Width->setText( tr( "SMESH_WIDTH"  ) );
161     grid_11->addWidget( Width, 0, 1 );
162     LineEditHeight = new QLineEdit( GroupBox5, "LineEditHeight" );
163     grid_11->addWidget( LineEditHeight, 1, 0 );
164     Height = new QLabel( GroupBox5, "Height" );
165     Height->setText( tr( "SMESH_HEIGHT"  ) );
166     grid_11->addWidget( Height, 1, 1 );
167
168     grid->addWidget( GroupBox5, 2, 0 );
169
170     /***************************************************************/
171     QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
172     GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
173     GroupButtons->setTitle( tr( ""  ) );
174     GroupButtons->setColumnLayout(0, Qt::Vertical );
175     GroupButtons->layout()->setSpacing( 0 );
176     GroupButtons->layout()->setMargin( 0 );
177     grid_15 = new QGridLayout( GroupButtons->layout() );
178     grid_15->setAlignment( Qt::AlignTop );
179     grid_15->setSpacing( 6 );
180     grid_15->setMargin( 11 );
181     buttonOk = new QPushButton( GroupButtons, "buttonOk" );
182     buttonOk->setText( tr( "SMESH_BUT_OK"  ) );
183     buttonOk->setAutoDefault( TRUE );
184     buttonOk->setDefault( TRUE );
185     grid_15->addWidget( buttonOk, 0, 0 );
186     grid_15->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
187     buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
188     buttonCancel->setText( tr( "SMESH_BUT_CANCEL"  ) );
189     buttonCancel->setAutoDefault( TRUE );
190     grid_15->addWidget( buttonCancel, 0, 2 );
191
192     grid->addWidget( GroupButtons, 3, 0 );
193
194     // signals and slots connections
195     connect( buttonOk,     SIGNAL( clicked() ), this, SLOT( accept() ) );
196     connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
197 }
198
199 /*  
200  *  Destroys the object and frees any allocated resources
201  */
202 SMESHGUI_Preferences_ScalarBarDlg::~SMESHGUI_Preferences_ScalarBarDlg()
203 {
204     // no need to delete child widgets, Qt does it all for us
205 }
206