1 // VISU VISUGUI : GUI of VISU component
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 : VisuGUI_SelVectCompDlg.cxx
25 // Author : Laurent CORNABE & Hubert ROLLAND
30 #include "VisuGUI_SelVectCompDlg.h"
36 VisuGUI_SelVectCompDlg::VisuGUI_SelVectCompDlg( QWidget* parent, const char* name, bool modal, WFlags fl )
37 : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
40 setName( "VisuGUI_SelVectCompDlg" );
41 setCaption( tr( "Vector Field" ) );
42 setSizeGripEnabled( true );
44 QVBoxLayout* TopLayout = new QVBoxLayout( this );
45 TopLayout->setSpacing( 6 );
46 TopLayout->setMargin( 11 );
48 Comment1_2 = new QLabel( tr( "Select a component of the vector, or modulus," ), this, "Comment1_2" );
49 Comment1_2->setAlignment( AlignCenter );
51 Comment2_2 = new QLabel( tr( "to be displayed as a scalar result" ), this, "Comment2_2" );
52 Comment2_2->setAlignment( AlignCenter );
54 SelComp = new QButtonGroup( this, "SelComp" );
55 SelComp->setColumnLayout(0, Qt::Vertical );
56 SelComp->layout()->setSpacing( 0 );
57 SelComp->layout()->setMargin( 0 );
58 QGridLayout* SelCompLayout = new QGridLayout( SelComp->layout() );
59 SelCompLayout->setAlignment( Qt::AlignTop );
60 SelCompLayout->setSpacing( 6 );
61 SelCompLayout->setMargin( 11 );
63 Comp1 = new QRadioButton( tr( "Component 1" ), SelComp, "Comp1" );
64 SelCompLayout->addWidget( Comp1, 0, 0 );
66 Modulus = new QRadioButton( tr( "Modulus" ), SelComp, "Modulus" );
67 Modulus->setChecked( TRUE );
68 SelCompLayout->addWidget( Modulus, 0, 1 );
70 Comp2 = new QRadioButton( tr( "Component 2" ), SelComp, "Comp2" );
71 SelCompLayout->addWidget( Comp2, 1, 0 );
73 Comp3 = new QRadioButton( tr( "Component 3" ), SelComp, "Comp3" );
74 SelCompLayout->addWidget( Comp3, 2, 0 );
76 GroupButtons = new QGroupBox( this, "GroupButtons" );
77 GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
78 GroupButtons->setTitle( tr( "" ) );
79 GroupButtons->setColumnLayout(0, Qt::Vertical );
80 GroupButtons->layout()->setSpacing( 0 );
81 GroupButtons->layout()->setMargin( 0 );
82 QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
83 GroupButtonsLayout->setAlignment( Qt::AlignTop );
84 GroupButtonsLayout->setSpacing( 6 );
85 GroupButtonsLayout->setMargin( 11 );
87 buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
88 buttonOk->setAutoDefault( TRUE );
89 buttonOk->setDefault( TRUE );
90 GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
91 GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
92 buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
93 buttonCancel->setAutoDefault( TRUE );
94 GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
96 TopLayout->addWidget( Comment1_2, 0, 0 );
97 TopLayout->addWidget( Comment2_2, 1, 0 );
98 TopLayout->addWidget( SelComp, 2, 0 );
99 TopLayout->addWidget( GroupButtons, 3, 0 );
101 // signals and slots connections
102 connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
103 connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
109 VisuGUI_SelVectCompDlg::~VisuGUI_SelVectCompDlg()
116 int VisuGUI_SelVectCompDlg::whatIsChecked()
119 if ( Modulus->isChecked() )
121 else if ( Comp1->isChecked() )
123 else if ( Comp2->isChecked() )
125 else if ( Comp3->isChecked() )