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 )
46 /* Class GLViewer_Text
47 * Substitution of Prs3d_Text for OpenGL */
49 class GLVIEWER_API GLViewer_Text
52 GLViewer_Text( const QString&, float xPos = 0.0, float yPos = 0.0, const QColor& color = QColor( 0, 255, 0 ) );
53 GLViewer_Text( const QString&, float xPos, float yPos, const QColor& , QFont theFont, int theSeparator);
57 void setText( const QString& text ) { myText = text; }
59 QString getText() const { return myText; }
61 //! Sets text position
62 void setPosition( float xPos, float yPos ) { myXPos = xPos; myYPos = yPos; }
63 //! Returns text position
64 void getPosition( float& xPos, float& yPos ) { xPos = myXPos; yPos = myYPos; }
67 void setColor( const QColor& color ) { myColor = color; }
68 //! Returns text color
69 QColor getColor() const { return myColor; }
72 void setFont( const QFont theQFont) { myQFont = theQFont; }
74 QFont getFont() const { return myQFont; }
76 //! Returns text separator
77 int getSeparator(){ return mySeparator; }
78 //! Sets text separator
79 void setSeparator( int theSep ){ mySeparator = theSep; }
81 //! Returns text width
83 //! Returns text height
86 //! A function for coding object to the byte copy
87 /*! A function is used for copy-past technollogy in copy method */
88 QByteArray getByteCopy() const;
90 //! A function for decoding object from the byte copy
91 /*! A function is used for copy-past technollogy in past method */
92 static GLViewer_Text* fromByteCopy( QByteArray );
94 //! Sets text format BITMAP or TEXTURE
95 DisplayTextFormat getDisplayTextFormat() const { return myDTF; }
96 //! Returns text format BITMAP or TEXTURE
97 void setTextDisplayFormat( DisplayTextFormat theDTF ) { myDTF = theDTF; }
106 DisplayTextFormat myDTF;
110 #pragma warning ( default:4251 )