Back to index

salome-gui  6.5.0
SVTK_FontWidget.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  VISU VISUGUI : GUI for SMESH component
00024 //  File   : 
00025 //  Author : Sergey LITONIN
00026 //  Module : 
00027 //
00028 #include "SVTK_FontWidget.h"
00029 
00030 #include <QComboBox>
00031 
00032 #include <vtkTextProperty.h>
00033 
00042 SVTK_FontWidget::SVTK_FontWidget( QWidget* theParent )
00043 : ViewerTools_FontWidgetBase( theParent )
00044 {
00045 }
00046 
00050 SVTK_FontWidget::~SVTK_FontWidget()
00051 {
00052 }
00053 
00054 void SVTK_FontWidget::InitializeFamilies()
00055 {
00056   myFamily->insertItem( myFamily->count(), tr( "ARIAL" ) );
00057   myFamily->insertItem( myFamily->count(), tr( "COURIER" ) );
00058   myFamily->insertItem( myFamily->count(), tr( "TIMES" ) );
00059 }
00060 
00061 void SVTK_FontWidget::SetData( const QColor& theColor,
00062                                const int theFamily,
00063                                const bool theBold,
00064                                const bool theItalic,
00065                                const bool theShadow )
00066 {
00067   ViewerTools_FontWidgetBase::SetData( theColor,
00068                                        theFamily,
00069                                        theBold,
00070                                        theItalic,
00071                                        theShadow );
00072 
00073   if ( theFamily == VTK_ARIAL )
00074     myFamily->setCurrentIndex( 0 );
00075   else if ( theFamily == VTK_COURIER )
00076     myFamily->setCurrentIndex( 1 );
00077   else
00078     myFamily->setCurrentIndex( 2 );
00079 }
00080 
00081 void SVTK_FontWidget::GetData( QColor& theColor,
00082                                int& theFamily,
00083                                bool& theBold,
00084                                bool& theItalic,
00085                                bool& theShadow ) const
00086 {
00087   ViewerTools_FontWidgetBase::GetData( theColor,
00088                                        theFamily,
00089                                        theBold,
00090                                        theItalic,
00091                                        theShadow );
00092 
00093   int anItem = myFamily->currentIndex();
00094   if ( anItem == 0 )
00095     theFamily = VTK_ARIAL;
00096   else if ( anItem == 1 )
00097     theFamily = VTK_COURIER;
00098   else
00099     theFamily = VTK_TIMES;
00100 }