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 );
52 myFamily = new QComboBox( this );
53 myFamily->insertItem( tr( "ARIAL" ) );
54 myFamily->insertItem( tr( "COURIER" ) );
55 myFamily->insertItem( tr( "TIMES" ) );
57 myBold = new QCheckBox( tr( "BOLD" ), this );
58 myItalic = new QCheckBox( tr( "ITALIC" ), this );
59 myShadow = new QCheckBox( tr( "SHADOW" ), this );
61 connect( myColorBtn, SIGNAL( clicked() ), SLOT( onColor() ) );
64 //=======================================================================
65 // name : ~VisuGUI_FontWg
66 // Purpose : Destructor
67 //=======================================================================
68 VisuGUI_FontWg::~VisuGUI_FontWg()
72 //=======================================================================
75 //=======================================================================
76 void VisuGUI_FontWg::SetColor( const QColor& theColor )
78 myColorBtn->setPaletteBackgroundColor( theColor );
81 //=======================================================================
84 //=======================================================================
85 QColor VisuGUI_FontWg::GetColor() const
87 return myColorBtn->paletteBackgroundColor();
90 //=======================================================================
93 //=======================================================================
94 void VisuGUI_FontWg::onColor()
96 QColor aColor = QColorDialog::getColor( GetColor(), this );
97 if ( aColor.isValid() )
101 //=======================================================================
104 //=======================================================================
105 void VisuGUI_FontWg::SetData( const QColor& theColor,
108 const bool theItalic,
109 const bool theShadow )
111 SetColor( theColor );
113 if ( theFamily == VTK_ARIAL )
114 myFamily->setCurrentItem( 0 );
115 else if ( theFamily == VTK_COURIER )
116 myFamily->setCurrentItem( 1 );
118 myFamily->setCurrentItem( 2 );
120 myBold->setChecked( theBold );
121 myItalic->setChecked( theItalic );
122 myShadow->setChecked( theShadow );
125 //=======================================================================
128 //=======================================================================
129 void VisuGUI_FontWg::GetData( QColor& theColor,
133 bool& theShadow ) const
135 theColor = GetColor();
137 int anItem =myFamily->currentItem();
139 theFamily = VTK_ARIAL;
140 else if ( anItem == 1 )
141 theFamily = VTK_COURIER;
143 theFamily = VTK_TIMES;
145 theBold = myBold->isChecked();
146 theItalic = myItalic->isChecked();
147 theShadow = myShadow->isChecked();