1 // Copyright (C) 2005 OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
19 // Author : OPEN CASCADE
22 // File: GLViewer_Text.h
23 // Created: November, 2004
25 #ifndef GLVIEWER_TEXT_H
26 #define GLVIEWER_TEXT_H
33 #include "GLViewer_Defs.h"
40 #include <qfontmetrics.h>
43 #pragma warning( disable:4251 )
48 Substitution of Prs3d_Text for OpenGL
50 class GLVIEWER_API GLViewer_Text
53 GLViewer_Text( const QString&, float xPos = 0.0, float yPos = 0.0, const QColor& color = QColor( 0, 255, 0 ) );
54 GLViewer_Text( const QString&, float xPos, float yPos, const QColor& , QFont theFont, int theSeparator);
58 void setText( const QString& text ) { myText = text; }
60 QString getText() const { return myText; }
62 //! Sets text position
63 void setPosition( float xPos, float yPos ) { myXPos = xPos; myYPos = yPos; }
64 //! Returns text position
65 void getPosition( float& xPos, float& yPos ) { xPos = myXPos; yPos = myYPos; }
68 void setColor( const QColor& color ) { myColor = color; }
69 //! Returns text color
70 QColor getColor() const { return myColor; }
73 void setFont( const QFont theQFont) { myQFont = theQFont; }
75 QFont getFont() const { return myQFont; }
77 //! Returns text separator
78 int getSeparator(){ return mySeparator; }
79 //! Sets text separator
80 void setSeparator( int theSep ){ mySeparator = theSep; }
82 //! Returns text width
84 //! Returns text height
87 //! A function for coding object to the byte copy
88 /*! A function is used for copy-past technollogy in copy method */
89 QByteArray getByteCopy() const;
91 //! A function for decoding object from the byte copy
92 /*! A function is used for copy-past technollogy in past method */
93 static GLViewer_Text* fromByteCopy( QByteArray );
95 //! Sets text format BITMAP or TEXTURE
96 DisplayTextFormat getDisplayTextFormat() const { return myDTF; }
97 //! Returns text format BITMAP or TEXTURE
98 void setTextDisplayFormat( DisplayTextFormat theDTF ) { myDTF = theDTF; }
107 DisplayTextFormat myDTF;
111 #pragma warning ( default:4251 )