Salome HOME
NRI : Merge from V1_2.
[modules/visu.git] / src / VISUGUI / VisuGUI_CellsResultsDlg.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_CellsResultsDlg.cxx
25 //  Author : Laurent CORNABE & Hubert ROLLAND 
26 //  Module : VISU
27 //  $Header$
28
29 using namespace std;
30 #include "VisuGUI_CellsResultsDlg.h"
31 #include <qlayout.h>
32 #include <qheader.h>
33
34 /*!
35    Constructor
36 */
37 VisuGUI_CellsResultsDlg::VisuGUI_CellsResultsDlg( QWidget* parent,  const char* name, bool modal, WFlags fl )
38      : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
39 {
40   if ( !name )
41     setName( "VisuGUI_CellsResultsDlg" );
42   setCaption( tr( "Results on selected Cell" ) );
43   setSizeGripEnabled( TRUE );
44   
45   QGridLayout* TopLayout = new QGridLayout( this ); 
46   TopLayout->setSpacing( 6 );
47   TopLayout->setMargin( 11 );
48   
49   GroupLimit = new QGroupBox( this, "GroupLimit" );
50   GroupLimit->setTitle( tr( "Results on Cell" ) );
51   GroupLimit->setColumnLayout(0, Qt::Vertical );
52   GroupLimit->layout()->setSpacing( 0 );
53   GroupLimit->layout()->setMargin( 0 );
54   QGridLayout* GroupLimitLayout = new QGridLayout( GroupLimit->layout() );
55   GroupLimitLayout->setAlignment( Qt::AlignTop );
56   GroupLimitLayout->setSpacing( 6 );
57   GroupLimitLayout->setMargin( 11 );
58   
59   IdCell = new QLabel( tr( "IdCell" ), GroupLimit, "IdCell" );
60   QFont IdCell_font = IdCell->font();
61   IdCell_font.setBold( TRUE );
62   IdCell->setFont( IdCell_font ); 
63   IdCell->setAlignment( QLabel::AlignVCenter | QLabel::AlignRight );
64   IdCell->setFrameStyle( QLabel::Box | QLabel::Plain );
65   IdCell->setMargin( 5 );
66   QHBoxLayout* IdLayout = new QHBoxLayout;
67   
68   IdLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ));
69   IdLayout->addWidget( IdCell );
70   GroupLimitLayout->addMultiCellLayout( IdLayout, 0, 0, 0, 2);
71
72   NbPoints = new QLabel( tr( "Number of Points :"), GroupLimit, "NbPoints" );
73   GroupLimitLayout->addWidget( NbPoints, 1, 0 );
74   NbPoint = new QLabel( tr( "NbPoints" ), GroupLimit, "NbPoint" );
75   NbPoint->setAlignment( AlignLeft );
76   GroupLimitLayout->addWidget( NbPoint, 1, 1 );
77   GroupLimitLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 1, 2 );
78
79   ListPoints = new QListView( GroupLimit, "ListPoints" );
80   ListPoints->setMinimumSize( 300, 120 );
81   ListPoints->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
82   ListPoints->addColumn( tr( "Point" ) );
83   ListPoints->addColumn( tr( "X" ) );
84   ListPoints->addColumn( tr( "Y" ) );
85   ListPoints->addColumn( tr( "Z" ) );
86   ListPoints->setAllColumnsShowFocus( true );
87   ListPoints->setShowToolTips( true );
88   ListPoints->setSelectionMode( QListView::Single );
89   ListPoints->header()->setStretchEnabled( true );
90   ListPoints->header()->setStretchEnabled( true, 0 );
91   ListPoints->header()->setStretchEnabled( true, 1 );
92   ListPoints->header()->setStretchEnabled( true, 2 );
93   ListPoints->header()->setStretchEnabled( true, 3 );
94   GroupLimitLayout->addMultiCellWidget( ListPoints, 2, 2, 0, 2 );
95
96   Scalar_Results = new QLabel( tr( "Scalar result :" ), GroupLimit, "Scalar_Results" );
97   GroupLimitLayout->addWidget( Scalar_Results, 3, 0 );
98   ScalValue = new QLabel( tr( "Scalar Value" ), GroupLimit, "ScalValue" );
99   ScalValue->setAlignment( AlignLeft );
100   GroupLimitLayout->addWidget( ScalValue, 3, 1 );
101   GroupLimitLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 3, 2 );
102
103   Vector_Results = new QLabel( tr( "Vector result :" ), GroupLimit, "Vector_Results" );
104   GroupLimitLayout->addWidget( Vector_Results, 4, 0 );
105   VectTxt = new QLabel( tr( "Vector Txt" ), GroupLimit, "VectTxt" );
106   VectTxt->setAlignment( AlignLeft );
107   GroupLimitLayout->addWidget( VectTxt, 4, 1 );
108   GroupLimitLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 4, 2 );
109
110   GroupButtons = new QGroupBox( this, "GroupButtons" );
111   GroupButtons->setColumnLayout(0, Qt::Vertical );
112   GroupButtons->layout()->setSpacing( 0 );
113   GroupButtons->layout()->setMargin( 0 );
114   QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
115   GroupButtonsLayout->setAlignment( Qt::AlignTop );
116   GroupButtonsLayout->setSpacing( 6 );
117   GroupButtonsLayout->setMargin( 11 );
118
119   buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
120   buttonOk->setAutoDefault( TRUE );
121   buttonOk->setDefault( TRUE );
122   GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 0 );
123   GroupButtonsLayout->addWidget( buttonOk, 0, 1 );
124   GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 2 );
125   
126   TopLayout->addWidget( GroupLimit,   0, 0 );
127   TopLayout->addWidget( GroupButtons, 1, 0 );
128
129   // signals and slots connections
130   connect( buttonOk,     SIGNAL( clicked() ), this, SLOT( accept() ) );
131 }
132
133 /*!
134    Destructor
135 */
136 VisuGUI_CellsResultsDlg::~VisuGUI_CellsResultsDlg()
137 {
138 }