--- /dev/null
+// VISU VISUGUI : GUI for SMESH component\r
+//\r
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,\r
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS \r
+// \r
+// This library is free software; you can redistribute it and/or \r
+// modify it under the terms of the GNU Lesser General Public \r
+// License as published by the Free Software Foundation; either \r
+// version 2.1 of the License. \r
+// \r
+// This library is distributed in the hope that it will be useful, \r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of \r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU \r
+// Lesser General Public License for more details. \r
+// \r
+// You should have received a copy of the GNU Lesser General Public \r
+// License along with this library; if not, write to the Free Software \r
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
+// \r
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org \r
+//\r
+//\r
+//\r
+// File : VisuGUI_CubeAxesDlg.cxx\r
+// Author : Sergey LITONIN\r
+// Module : VISU\r
+\r
+#include "VisuGUI_CubeAxesDlg.h"\r
+#include "VisuGUI_FontWg.h"\r
+#include "VisuGUI.h"\r
+\r
+#include <qlayout.h>\r
+#include <qframe.h>\r
+#include <qpushbutton.h>\r
+#include <qtabwidget.h>\r
+#include <qcheckbox.h>\r
+#include <qgroupbox.h>\r
+#include <qlineedit.h>\r
+#include <qlabel.h>\r
+#include <qobjectlist.h>\r
+\r
+#include <VTKViewer_ViewFrame.h>\r
+#include <SALOME_CubeAxesActor2D.h>\r
+\r
+#include <vtkAxisActor2D.h>\r
+#include <vtkTextProperty.h>\r
+\r
+/*\r
+ Class : AxisWg\r
+ Description : Tab of dialog\r
+*/\r
+\r
+//=======================================================================\r
+// name : VisuGUI_AxisWg::AxisWg\r
+// Purpose : Constructor\r
+//=======================================================================\r
+VisuGUI_AxisWg::VisuGUI_AxisWg( QWidget* theParent )\r
+: QFrame( theParent )\r
+{\r
+ QValueList< QLabel* > aLabels;\r
+\r
+ // "Name" grp\r
+ \r
+ myNameGrp = new QGroupBox( 3, Qt::Vertical, tr( "AXIS_NAME" ), this );\r
+ myIsNameVisible = new QCheckBox( tr( "IS_VISIBLE" ), myNameGrp );\r
+\r
+ QHBox* aHBox = new QHBox( myNameGrp );\r
+ aHBox->setSpacing( 5 );\r
+ QLabel* aLabel = new QLabel( tr( "NAME" ), aHBox );\r
+ myAxisName = new QLineEdit( aHBox );\r
+ aLabels.append( aLabel );\r
+ \r
+ aHBox = new QHBox( myNameGrp );\r
+ aHBox->setSpacing( 5 );\r
+ aLabel = new QLabel( tr( "FONT" ), aHBox );\r
+ myNameFont = new VisuGUI_FontWg( aHBox );\r
+ aLabels.append( aLabel );\r
+ \r
+ \r
+ // "Labels" grp\r
+\r
+ myLabelsGrp = new QGroupBox( 4, Qt::Vertical, tr( "LABELS" ), this );\r
+ myIsLabelsVisible = new QCheckBox( tr( "IS_VISIBLE" ), myLabelsGrp );\r
+\r
+ aHBox = new QHBox( myLabelsGrp );\r
+ aHBox->setSpacing( 5 );\r
+ aLabel = new QLabel( tr( "NUMBER" ), aHBox );\r
+ myLabelNumber = new QLineEdit( aHBox );\r
+ aLabels.append( aLabel );\r
+\r
+ aHBox = new QHBox( myLabelsGrp );\r
+ aHBox->setSpacing( 5 );\r
+ aLabel = new QLabel( tr( "OFFSET" ), aHBox );\r
+ myLabelOffset = new QLineEdit( aHBox );\r
+ aLabels.append( aLabel );\r
+\r
+ aHBox = new QHBox( myLabelsGrp );\r
+ aHBox->setSpacing( 5 );\r
+ aLabel = new QLabel( tr( "FONT" ), aHBox );\r
+ myLabelsFont = new VisuGUI_FontWg( aHBox );\r
+ aLabels.append( aLabel );\r
+\r
+ // "Tick marks" grp\r
+\r
+ myTicksGrp = new QGroupBox( 2, Qt::Vertical, tr( "TICK_MARKS" ), this );\r
+ myIsTicksVisible = new QCheckBox( tr( "IS_VISIBLE" ), myTicksGrp );\r
+\r
+ aHBox = new QHBox( myTicksGrp );\r
+ aHBox->setSpacing( 5 );\r
+ aLabel = new QLabel( tr( "LENGTH" ), aHBox );\r
+ myTickLength = new QLineEdit( aHBox );\r
+ aLabels.append( aLabel );\r
+\r
+ // Layout\r
+\r
+ QVBoxLayout* aLay = new QVBoxLayout( this, 0, 5 );\r
+ aLay->addWidget( myNameGrp );\r
+ aLay->addWidget( myLabelsGrp );\r
+ aLay->addWidget( myTicksGrp );\r
+\r
+ // init\r
+ myIsNameVisible->setChecked( true );\r
+ myIsLabelsVisible->setChecked( true );\r
+ myIsTicksVisible->setChecked( true );\r
+ updateControlState();\r
+\r
+ // Adjust label widths\r
+ QValueList< QLabel* >::iterator anIter;\r
+ int aMaxWidth = 0;\r
+ for ( anIter = aLabels.begin(); anIter != aLabels.end(); anIter++ )\r
+ aMaxWidth = QMAX( aMaxWidth, (*anIter)->sizeHint().width() );\r
+ for ( anIter = aLabels.begin(); anIter != aLabels.end(); anIter++ )\r
+ (*anIter)->setFixedWidth( aMaxWidth );\r
+\r
+ // connect signals and slots\r
+ connect( myIsNameVisible, SIGNAL( stateChanged( int ) ), SLOT( onNameChecked() ) );\r
+ connect( myIsLabelsVisible, SIGNAL( stateChanged( int ) ), SLOT( onLabelsChecked() ) );\r
+ connect( myIsTicksVisible, SIGNAL( stateChanged( int ) ), SLOT( onTicksChecked() ) );\r
+}\r
+\r
+VisuGUI_AxisWg::~VisuGUI_AxisWg()\r
+{\r
+}\r
+\r
+void VisuGUI_AxisWg::updateControlState()\r
+{\r
+ onNameChecked();\r
+ onLabelsChecked();\r
+ onTicksChecked();\r
+}\r
+\r
+//=======================================================================\r
+// name : VisuGUI_AxisWg::onNameChecked\r
+// Purpose :\r
+//=======================================================================\r
+void VisuGUI_AxisWg::setEnabled( QGroupBox* theGrp, const bool theState )\r
+{\r
+ QObjectList aChildren( *theGrp->children() );\r
+ QObject* anObj;\r
+ for( anObj = aChildren.first(); anObj !=0; anObj = aChildren.next() )\r
+ if ( anObj !=0 && anObj->inherits( "QHBox" ) )\r
+ ( (QHBox*)anObj )->setEnabled( theState );\r
+}\r
+\r
+//=======================================================================\r
+// Labels : VisuGUI_AxisWg::onLabelsChecked\r
+// Purpose : \r
+//=======================================================================\r
+void VisuGUI_AxisWg::onLabelsChecked()\r
+{\r
+ setEnabled( myLabelsGrp, myIsLabelsVisible->isChecked() ); \r
+}\r
+\r
+//=======================================================================\r
+// Labels : VisuGUI_AxisWg::onTicksChecked\r
+// Purpose :\r
+//=======================================================================\r
+void VisuGUI_AxisWg::onTicksChecked()\r
+{\r
+ setEnabled( myTicksGrp, myIsTicksVisible->isChecked() );\r
+}\r
+\r
+//=======================================================================\r
+// name : VisuGUI_AxisWg::onNameChecked\r
+// Purpose :\r
+//=======================================================================\r
+void VisuGUI_AxisWg::onNameChecked()\r
+{\r
+ setEnabled( myNameGrp, myIsNameVisible->isChecked() );\r
+}\r
+\r
+//=======================================================================\r
+// name : VisuGUI_AxisWg::UseName\r
+// Purpose :\r
+//=======================================================================\r
+void VisuGUI_AxisWg::UseName( const bool toUse )\r
+{\r
+ myIsNameVisible->setChecked( toUse );\r
+}\r
+\r
+//=======================================================================\r
+// name : VisuGUI_AxisWg::SetName\r
+// Purpose :\r
+//================================================== =====================\r
+void VisuGUI_AxisWg::SetName( const QString& theName )\r
+{\r
+ myAxisName->setText( theName );\r
+}\r
+\r
+//=======================================================================\r
+// name : VisuGUI_AxisWg::SetNameFont\r
+// Purpose :\r
+//=======================================================================\r
+void VisuGUI_AxisWg::SetNameFont( const QColor& theColor,\r
+ const int theFont,\r
+ const bool theIsBold,\r
+ const bool theIsItalic,\r
+ const bool theIsShadow )\r
+{\r
+ myNameFont->SetData( theColor, theFont, theIsBold, theIsItalic, theIsShadow );\r
+}\r
+\r
+//=======================================================================\r
+// name : VisuGUI_AxisWg::SetNameFont\r
+// Purpose :\r
+//=======================================================================\r
+bool VisuGUI_AxisWg::ReadData( vtkAxisActor2D* theActor )\r
+{\r
+ if ( theActor == 0 )\r
+ return false;\r
+\r
+ // Name\r
+ \r
+ bool useName = theActor->GetTitleVisibility();\r
+ QString aTitle( theActor->GetTitle() );\r
+\r
+ QColor aTitleColor( 255, 255, 255 );\r
+ int aTitleFontFamily = VTK_ARIAL;\r
+ bool isTitleBold = false;\r
+ bool isTitleItalic = false;\r
+ bool isTitleShadow = false;\r
+\r
+ vtkTextProperty* aTitleProp = theActor->GetTitleTextProperty();\r
+ if ( aTitleProp !=0 )\r
+ {\r
+ float c[ 3 ];\r
+ aTitleProp->GetColor( c );\r
+ aTitleColor.setRgb( (int)( c[ 0 ] * 255 ), (int)( c[ 1 ] * 255 ), (int)( c[ 2 ] * 255 ) );\r
+ aTitleFontFamily = aTitleProp->GetFontFamily();\r
+ isTitleBold = aTitleProp->GetBold() ? true : false;\r
+ isTitleItalic = aTitleProp->GetItalic() ? true : false;\r
+ isTitleShadow = aTitleProp->GetShadow() ? true : false;\r
+ }\r
+\r
+ myIsNameVisible->setChecked( useName );\r
+ myAxisName->setText( aTitle );\r
+ myNameFont->SetData( aTitleColor, aTitleFontFamily, isTitleBold, isTitleItalic, isTitleShadow );\r
+\r
+ // Labels\r
+\r
+ bool useLabels = theActor->GetLabelVisibility();\r
+ int nbLabels = theActor->GetNumberOfLabels();\r
+ int anOffset = theActor->GetTickOffset();\r
+\r
+ QColor aLabelsColor( 255, 255, 255 );\r
+ int aLabelsFontFamily = VTK_ARIAL;\r
+ bool isLabelsBold = false;\r
+ bool isLabelsItalic = false;\r
+ bool isLabelsShadow = false;\r
+\r
+ vtkTextProperty* aLabelsProp = theActor->GetLabelTextProperty();\r
+ if ( aLabelsProp !=0 )\r
+ {\r
+ float c[ 3 ];\r
+ aLabelsProp->GetColor( c );\r
+ aLabelsColor.setRgb( (int)( c[ 0 ] * 255 ), (int)( c[ 0 ] * 255 ), (int)( c[ 0 ] * 255 ) );\r
+ aLabelsFontFamily = aLabelsProp->GetFontFamily();\r
+ isLabelsBold = aLabelsProp->GetBold() ? true : false;\r
+ isLabelsItalic = aLabelsProp->GetItalic() ? true : false;\r
+ isLabelsShadow = aLabelsProp->GetShadow() ? true : false;\r
+ }\r
+\r
+ myIsLabelsVisible->setChecked( useLabels );\r
+ myLabelNumber->setText( QString( "%1" ).arg( nbLabels ) );\r
+ myLabelOffset->setText( QString( "%1" ).arg( anOffset ) );\r
+ myLabelsFont->SetData( aLabelsColor, aLabelsFontFamily, isLabelsBold, isLabelsItalic, isLabelsShadow );\r
+\r
+ // Tick marks\r
+ bool useTickMarks = theActor->GetTickVisibility();\r
+ int aTickLength = theActor->GetTickLength();\r
+\r
+ myIsTicksVisible->setChecked( useTickMarks );\r
+ myTickLength->setText( QString( "%1" ).arg( aTickLength ) );\r
+\r
+ return true;\r
+}\r
+\r
+//=======================================================================\r
+// name : VisuGUI_CubeAxesDlg::Apply\r
+// Purpose : \r
+//=======================================================================\r
+bool VisuGUI_AxisWg::Apply( vtkAxisActor2D* theActor )\r
+{\r
+ if ( theActor == 0 )\r
+ return false;\r
+\r
+ // Name\r
+\r
+ theActor->SetTitleVisibility( myIsNameVisible->isChecked() ? 1 : 0 );\r
+ theActor->SetTitle( myAxisName->text().latin1() );\r
+\r
+ QColor aTitleColor( 255, 255, 255 );\r
+ int aTitleFontFamily = VTK_ARIAL;\r
+ bool isTitleBold = false;\r
+ bool isTitleItalic = false;\r
+ bool isTitleShadow = false;\r
+\r
+ myNameFont->GetData( aTitleColor, aTitleFontFamily, isTitleBold, isTitleItalic, isTitleShadow );\r
+ vtkTextProperty* aTitleProp = theActor->GetTitleTextProperty();\r
+ if ( aTitleProp )\r
+ {\r
+ aTitleProp->SetColor( aTitleColor.red() / 255.,\r
+ aTitleColor.green() / 255.,\r
+ aTitleColor.blue() / 255. );\r
+ aTitleProp->SetFontFamily( aTitleFontFamily );\r
+\r
+ aTitleProp->SetBold( isTitleBold ? 1 : 0 );\r
+ aTitleProp->SetItalic( isTitleItalic ? 1 : 0 );\r
+ aTitleProp->SetShadow( isTitleShadow ? 1 : 0 );\r
+\r
+ theActor->SetTitleTextProperty( aTitleProp );\r
+ }\r
+\r
+ // Labels\r
+ \r
+ theActor->SetLabelVisibility( myIsLabelsVisible->isChecked() ? 1 : 0 );\r
+\r
+ bool isOk = false;\r
+ int nbLabels = myLabelNumber->text().toInt( &isOk );\r
+ if ( isOk )\r
+ theActor->SetNumberOfLabels( nbLabels );\r
+ \r
+ int anOffset = myLabelOffset->text().toInt( &isOk );\r
+ if ( isOk )\r
+ theActor->SetTickOffset( anOffset );\r
+\r
+ QColor aLabelsColor( 255, 255, 255 );\r
+ int aLabelsFontFamily = VTK_ARIAL;\r
+ bool isLabelsBold = false;\r
+ bool isLabelsItalic = false;\r
+ bool isLabelsShadow = false;\r
+\r
+ myLabelsFont->GetData( aLabelsColor, aLabelsFontFamily, isLabelsBold, isLabelsItalic, isLabelsShadow );\r
+ vtkTextProperty* aLabelsProp = theActor->GetLabelTextProperty();\r
+ if ( aLabelsProp )\r
+ {\r
+ aLabelsProp->SetColor( aLabelsColor.red() / 255.,\r
+ aLabelsColor.green() / 255.,\r
+ aLabelsColor.blue() / 255. );\r
+ aLabelsProp->SetFontFamily( aLabelsFontFamily );\r
+\r
+ aLabelsProp->SetBold( isLabelsBold ? 1 : 0 );\r
+ aLabelsProp->SetItalic( isLabelsItalic ? 1 : 0 );\r
+ aLabelsProp->SetShadow( isLabelsShadow ? 1 : 0 );\r
+\r
+ theActor->SetLabelTextProperty( aLabelsProp );\r
+ }\r
+\r
+\r
+ // Tick marks\r
+ theActor->SetTickVisibility( myIsTicksVisible->isChecked() );\r
+ int aTickLength = myTickLength->text().toInt( &isOk );\r
+ if ( isOk )\r
+ theActor->SetTickLength( aTickLength );\r
+\r
+ return true;\r
+}\r
+\r
+/*\r
+ Class : VisuGUI_CubeAxesDlg\r
+ Description : Dialog for specifynig cube axes properties\r
+*/\r
+\r
+//=======================================================================\r
+// name : VisuGUI_CubeAxesDlg::VisuGUI_CubeAxesDlg\r
+// Purpose : Constructor\r
+//=======================================================================\r
+VisuGUI_CubeAxesDlg::VisuGUI_CubeAxesDlg( QWidget* theParent )\r
+: QDialog( theParent, "VisuGUI_CubeAxesDlg", false,\r
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )\r
+{\r
+ setCaption( tr( "CAPTION" ) );\r
+\r
+ QVBoxLayout* aLay = new QVBoxLayout( this, 5, 5 );\r
+ aLay->addWidget( createMainFrame( this ) );\r
+ aLay->addWidget( createButtonFrame( this ) );\r
+\r
+ Init();\r
+\r
+ if ( VisuGUI::GetDesktop()->getMainFrame() )\r
+ connect( VisuGUI::GetDesktop()->getMainFrame(), SIGNAL( windowActivated( QWidget* ) ),\r
+ SLOT( onWindowActivated( QWidget* ) ) );\r
+}\r
+\r
+//=======================================================================\r
+// name : VisuGUI_CubeAxesDlg::createMainFrame\r
+// Purpose : Create frame containing dialog's input fields\r
+//=======================================================================\r
+QWidget* VisuGUI_CubeAxesDlg::createMainFrame( QWidget* theParent )\r
+{\r
+ QFrame* aFrame = new QFrame( theParent );\r
+\r
+ myTabWg = new QTabWidget( aFrame );\r
+\r
+ myAxes[ 0 ] = new VisuGUI_AxisWg( myTabWg );\r
+ myAxes[ 1 ] = new VisuGUI_AxisWg( myTabWg );\r
+ myAxes[ 2 ] = new VisuGUI_AxisWg( myTabWg );\r
+ \r
+ myTabWg->addTab( myAxes[ 0 ], tr( "X_AXIS" ) );\r
+ myTabWg->addTab( myAxes[ 1 ], tr( "Y_AXIS" ) );\r
+ myTabWg->addTab( myAxes[ 2 ], tr( "Z_AXIS" ) );\r
+ \r
+ myTabWg->setMargin( 5 );\r
+\r
+ myIsVisible = new QCheckBox( tr( "IS_VISIBLE" ), aFrame );\r
+\r
+ QVBoxLayout* aLay = new QVBoxLayout( aFrame, 0, 5 );\r
+ aLay->addWidget( myTabWg );\r
+ aLay->addWidget( myIsVisible );\r
+\r
+ return aFrame;\r
+}\r
+\r
+//=======================================================================\r
+// name : VisuGUI_CubeAxesDlg::createButtonFrame\r
+// Purpose : Create frame containing buttons\r
+//=======================================================================\r
+QWidget* VisuGUI_CubeAxesDlg::createButtonFrame( QWidget* theParent )\r
+{\r
+ QFrame* aFrame = new QFrame( theParent );\r
+ aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );\r
+\r
+ myOkBtn = new QPushButton( tr( "VISU_BUT_OK" ), aFrame );\r
+ myApplyBtn = new QPushButton( tr( "VISU_BUT_APPLY" ), aFrame );\r
+ myCloseBtn = new QPushButton( tr( "BUT_CLOSE" ), aFrame );\r
+\r
+ QSpacerItem* aSpacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );\r
+\r
+ QHBoxLayout* aLay = new QHBoxLayout( aFrame, 5, 5 );\r
+\r
+ aLay->addWidget( myOkBtn );\r
+ aLay->addWidget( myApplyBtn );\r
+ aLay->addItem( aSpacer);\r
+ aLay->addWidget( myCloseBtn );\r
+\r
+ connect( myOkBtn, SIGNAL( clicked() ), SLOT( onOk() ) );\r
+ connect( myApplyBtn, SIGNAL( clicked() ), SLOT( onApply() ) );\r
+ connect( myCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) ) ;\r
+\r
+ return aFrame;\r
+}\r
+\r
+//=======================================================================\r
+// name : VisuGUI_CubeAxesDlg::~VisuGUI_CubeAxesDlg\r
+// Purpose : Destructor\r
+//=======================================================================\r
+VisuGUI_CubeAxesDlg::~VisuGUI_CubeAxesDlg()\r
+{\r
+}\r
+\r
+//=======================================================================\r
+// name : VisuGUI_CubeAxesDlg::Init\r
+// Purpose : Init dialog fields, connect signals and slots, show dialog\r
+//=======================================================================\r
+bool VisuGUI_CubeAxesDlg::Init()\r
+{\r
+ VTKViewer_ViewFrame* aFrame = VisuGUI::GetVtkViewFrame();\r
+ if ( aFrame == 0 || !aFrame->isCubeAxesDisplayed() )\r
+ return false;\r
+ \r
+ SALOME_CubeAxesActor2D* anActor = aFrame->GetCubeAxes();\r
+ if ( anActor == 0 )\r
+ return false;\r
+\r
+ myAxes[ 0 ]->ReadData( anActor->GetXAxisActor2D() );\r
+ myAxes[ 1 ]->ReadData( anActor->GetYAxisActor2D() );\r
+ myAxes[ 2 ]->ReadData( anActor->GetZAxisActor2D() );\r
+\r
+ myIsVisible->setChecked( anActor->GetVisibility() ? true : false );\r
+\r
+ return true;\r
+ \r
+}\r
+\r
+//=======================================================================\r
+// name : VisuGUI_CubeAxesDlg::isValid\r
+// Purpose : Verify validity of entry data\r
+//=======================================================================\r
+bool VisuGUI_CubeAxesDlg::isValid() const\r
+{\r
+ return true;\r
+}\r
+\r
+//=======================================================================\r
+// name : VisuGUI_CubeAxesDlg::onApply\r
+// Purpose : Verify validity of entry data\r
+//=======================================================================\r
+bool VisuGUI_CubeAxesDlg::onApply()\r
+{\r
+ bool isOk = true;\r
+\r
+ try\r
+ {\r
+ VTKViewer_ViewFrame* aFrame = VisuGUI::GetVtkViewFrame();\r
+ if ( aFrame == 0 )\r
+ return false;\r
+\r
+ SALOME_CubeAxesActor2D* anActor = aFrame->GetCubeAxes();\r
+ if ( anActor == 0 )\r
+ return false;\r
+\r
+ isOk = isOk && myAxes[ 0 ]->Apply( anActor->GetXAxisActor2D() );\r
+ isOk = isOk && myAxes[ 1 ]->Apply( anActor->GetYAxisActor2D() );\r
+ isOk = isOk && myAxes[ 2 ]->Apply( anActor->GetZAxisActor2D() );\r
+\r
+ //anActor->SetXLabel( myAxes[ 0 ]->myAxisName->text() );\r
+ //anActor->SetYLabel( myAxes[ 1 ]->myAxisName->text() );\r
+ //anActor->SetZLabel( myAxes[ 2 ]->myAxisName->text() );\r
+\r
+ //anActor->SetNumberOfLabels( anActor->GetXAxisActor2D()->GetNumberOfLabels() );\r
+ if ( myIsVisible->isChecked() )\r
+ anActor->VisibilityOn();\r
+ else\r
+ anActor->VisibilityOff();\r
+\r
+ if ( isOk )\r
+ aFrame->Repaint();\r
+ }\r
+ catch( ... )\r
+ {\r
+ isOk = false;\r
+ }\r
+\r
+ return isOk;\r
+}\r
+\r
+\r
+\r
+//=======================================================================\r
+// name : VisuGUI_CubeAxesDlg::onOk\r
+// Purpose : SLOT called when "Ok" button pressed.\r
+//=======================================================================\r
+void VisuGUI_CubeAxesDlg::onOk()\r
+{\r
+ if ( onApply() )\r
+ onClose();\r
+}\r
+\r
+//=======================================================================\r
+// name : VisuGUI_CubeAxesDlg::onClose\r
+// Purpose : SLOT called when "Close" button pressed. Close dialog\r
+//=======================================================================\r
+void VisuGUI_CubeAxesDlg::onClose()\r
+{\r
+ reject();\r
+}\r
+\r
+//=======================================================================\r
+// name : VisuGUI_CubeAxesDlg::onClose\r
+// Purpose : SLOT called when "Close" button pressed. Close dialog\r
+//=======================================================================\r
+void VisuGUI_CubeAxesDlg::onWindowActivated( QWidget* )\r
+{\r
+ VTKViewer_ViewFrame* aFrame = VisuGUI::GetVtkViewFrame();\r
+ if ( aFrame != 0 )\r
+ Init();\r
+ else\r
+ onClose(); \r
+}\r
+\r
--- /dev/null
+// VISU VISUGUI : GUI for SMESH component\r
+//\r
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,\r
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS \r
+// \r
+// This library is free software; you can redistribute it and/or \r
+// modify it under the terms of the GNU Lesser General Public \r
+// License as published by the Free Software Foundation; either \r
+// version 2.1 of the License. \r
+// \r
+// This library is distributed in the hope that it will be useful, \r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of \r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU \r
+// Lesser General Public License for more details. \r
+// \r
+// You should have received a copy of the GNU Lesser General Public \r
+// License along with this library; if not, write to the Free Software \r
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
+// \r
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org \r
+//\r
+//\r
+//\r
+// File : VisuGUI_CubeAxesDlg.cxx\r
+// Author : Sergey LITONIN\r
+// Module : VISU\r
+\r
+#include "VisuGUI_FontWg.h"\r
+\r
+#include <qtoolbutton.h>\r
+#include <qcombobox.h>\r
+#include <qcolordialog.h>\r
+#include <qcheckbox.h>\r
+\r
+#include <vtkTextProperty.h>\r
+\r
+/*\r
+ Class : VisuGUI_FontWg\r
+ Description : Dialog for specifynig font\r
+*/\r
+\r
+//=======================================================================\r
+// name : VisuGUI_FontWg\r
+// Purpose : Constructor\r
+//=======================================================================\r
+VisuGUI_FontWg::VisuGUI_FontWg( QWidget* theParent )\r
+: QHBox( theParent ) \r
+{\r
+ setSpacing( 5 );\r
+ myColorBtn = new QToolButton( this );\r
+\r
+ myFamily = new QComboBox( this );\r
+ myFamily->insertItem( tr( "ARIAL" ) );\r
+ myFamily->insertItem( tr( "COURIER" ) );\r
+ myFamily->insertItem( tr( "TIMES" ) );\r
+\r
+ myBold = new QCheckBox( tr( "BOLD" ), this );\r
+ myItalic = new QCheckBox( tr( "ITALIC" ), this );\r
+ myShadow = new QCheckBox( tr( "SHADOW" ), this );\r
+\r
+ connect( myColorBtn, SIGNAL( clicked() ), SLOT( onColor() ) );\r
+\r
+}\r
+VisuGUI_FontWg::~VisuGUI_FontWg()\r
+{\r
+}\r
+\r
+//=======================================================================\r
+// name : SetColor\r
+// Purpose : \r
+//=======================================================================\r
+void VisuGUI_FontWg::SetColor( const QColor& theColor )\r
+{\r
+ myColorBtn->setPaletteBackgroundColor( theColor );\r
+}\r
+\r
+//=======================================================================\r
+// name : GetColor\r
+// Purpose : \r
+//=======================================================================\r
+QColor VisuGUI_FontWg::GetColor() const\r
+{\r
+ return myColorBtn->paletteBackgroundColor();\r
+}\r
+\r
+//=======================================================================\r
+// name : onColor\r
+// Purpose : \r
+//=======================================================================\r
+void VisuGUI_FontWg::onColor()\r
+{\r
+ QColor aColor = QColorDialog::getColor( GetColor(), this ); \r
+ if ( aColor.isValid() )\r
+ SetColor( aColor );\r
+}\r
+\r
+//=======================================================================\r
+// name : SetData\r
+// Purpose :\r
+//=======================================================================\r
+void VisuGUI_FontWg::SetData( const QColor& theColor,\r
+ const int theFamily,\r
+ const bool theBold,\r
+ const bool theItalic,\r
+ const bool theShadow )\r
+{\r
+ SetColor( theColor );\r
+ \r
+ if ( theFamily == VTK_ARIAL )\r
+ myFamily->setCurrentItem( 0 );\r
+ else if ( theFamily == VTK_COURIER )\r
+ myFamily->setCurrentItem( 1 );\r
+ else\r
+ myFamily->setCurrentItem( 2 );\r
+\r
+ myBold->setChecked( theBold );\r
+ myItalic->setChecked( theItalic );\r
+ myShadow->setChecked( theShadow );\r
+ \r
+}\r
+\r
+//=======================================================================\r
+// name : GetData\r
+// Purpose :\r
+//=======================================================================\r
+void VisuGUI_FontWg::GetData( QColor& theColor,\r
+ int& theFamily,\r
+ bool& theBold,\r
+ bool& theItalic,\r
+ bool& theShadow ) const\r
+{\r
+ theColor = GetColor();\r
+\r
+ int anItem =myFamily->currentItem();\r
+ if ( anItem == 0 )\r
+ theFamily = VTK_ARIAL;\r
+ else if ( anItem == 1 )\r
+ theFamily = VTK_COURIER;\r
+ else\r
+ theFamily = VTK_TIMES;\r
+\r
+ theBold = myBold->isChecked();\r
+ theItalic = myItalic->isChecked();\r
+ theShadow = myShadow->isChecked();\r
+ \r
+}\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r