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