1 // VISU VISUGUI : GUI for SMESH 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_CubeAxesDlg.cxx
25 // Author : Sergey LITONIN
28 #include "VisuGUI_FontWg.h"
30 #include <qtoolbutton.h>
31 #include <qcombobox.h>
32 #include <qcolordialog.h>
33 #include <qcheckbox.h>
35 #include <vtkTextProperty.h>
38 * Class : VisuGUI_FontWg
39 * Description : Dialog for specifynig font
42 //=======================================================================
43 // name : VisuGUI_FontWg
44 // Purpose : Constructor
45 //=======================================================================
46 VisuGUI_FontWg::VisuGUI_FontWg( QWidget* theParent )
50 myColorBtn = new QToolButton( this );
51 myColorBtn->setMinimumWidth( 20 );
53 myFamily = new QComboBox( this );
54 myFamily->insertItem( tr( "ARIAL" ) );
55 myFamily->insertItem( tr( "COURIER" ) );
56 myFamily->insertItem( tr( "TIMES" ) );
58 myBold = new QCheckBox( tr( "BOLD" ), this );
59 myItalic = new QCheckBox( tr( "ITALIC" ), this );
60 myShadow = new QCheckBox( tr( "SHADOW" ), this );
62 connect( myColorBtn, SIGNAL( clicked() ), SLOT( onColor() ) );
65 //=======================================================================
66 // name : ~VisuGUI_FontWg
67 // Purpose : Destructor
68 //=======================================================================
69 VisuGUI_FontWg::~VisuGUI_FontWg()
73 //=======================================================================
76 //=======================================================================
77 void VisuGUI_FontWg::SetColor( const QColor& theColor )
79 myColorBtn->setPaletteBackgroundColor( theColor );
82 //=======================================================================
85 //=======================================================================
86 QColor VisuGUI_FontWg::GetColor() const
88 return myColorBtn->paletteBackgroundColor();
91 //=======================================================================
94 //=======================================================================
95 void VisuGUI_FontWg::onColor()
97 QColor aColor = QColorDialog::getColor( GetColor(), this );
98 if ( aColor.isValid() )
102 //=======================================================================
105 //=======================================================================
106 void VisuGUI_FontWg::SetData( const QColor& theColor,
109 const bool theItalic,
110 const bool theShadow )
112 SetColor( theColor );
114 if ( theFamily == VTK_ARIAL )
115 myFamily->setCurrentItem( 0 );
116 else if ( theFamily == VTK_COURIER )
117 myFamily->setCurrentItem( 1 );
119 myFamily->setCurrentItem( 2 );
121 myBold->setChecked( theBold );
122 myItalic->setChecked( theItalic );
123 myShadow->setChecked( theShadow );
126 //=======================================================================
129 //=======================================================================
130 void VisuGUI_FontWg::GetData( QColor& theColor,
134 bool& theShadow ) const
136 theColor = GetColor();
138 int anItem =myFamily->currentItem();
140 theFamily = VTK_ARIAL;
141 else if ( anItem == 1 )
142 theFamily = VTK_COURIER;
144 theFamily = VTK_TIMES;
146 theBold = myBold->isChecked();
147 theItalic = myItalic->isChecked();
148 theShadow = myShadow->isChecked();