Salome HOME
new files added
[modules/gui.git] / src / GLViewer / GLViewer_Text.h
1 // File:      GLViewer_Text.h
2 // Created:   November, 2004
3 // Author:    OCC team
4 // Copyright (C) CEA 2004
5
6 #ifndef GLVIEWER_TEXT_H
7 #define GLVIEWER_TEXT_H
8
9 #ifdef WNT
10 #include <windows.h>
11 #endif
12
13 #include "GLViewer.h"
14 #include "GLViewer_Defs.h"
15
16 #include <GL/gl.h>
17
18 #include <qfont.h>
19 #include <qstring.h>
20 #include <qcolor.h>
21 #include <qfontmetrics.h>
22
23 #ifdef WNT
24 #pragma warning( disable:4251 )
25 #endif
26
27 // Class:   GLViewer_Text
28 // Descr:   Substitution of Prs3d_Text for OpenGL
29
30 class GLVIEWER_API GLViewer_Text
31 {
32 public:
33   GLViewer_Text( const QString&, float xPos = 0.0, float yPos = 0.0, const QColor& color = QColor( 0, 255, 0 ) );
34   GLViewer_Text( const QString&, float xPos, float yPos, const QColor& , QFont, int );
35   ~GLViewer_Text();
36   
37   void                  setText( const QString& text ) { myText = text; }
38   QString               getText() const { return myText; }
39   
40   void                  setPosition( float xPos, float yPos ) { myXPos = xPos; myYPos = yPos; }
41   void                  getPosition( float& xPos, float& yPos ) { xPos = myXPos; yPos = myYPos; }
42   
43   void                  setColor( const QColor& color ) { myColor = color; }
44   QColor                getColor() const { return myColor; }
45   
46   void                  setFont( const QFont theQFont) { myQFont = theQFont; }
47   QFont                 getFont() const { return myQFont; }
48   
49   int                   getSeparator(){ return mySeparator; }
50   void                  setSeparator( int theSep ){ mySeparator = theSep; }
51   
52   int                   getWidth();
53   int                   getHeight();
54   
55   QByteArray            getByteCopy() const;
56   
57   static GLViewer_Text* fromByteCopy( QByteArray );
58   
59   DisplayTextFormat     getDisplayTextFormat() const { return myDTF; }
60   void                  setTextDisplayFormat( DisplayTextFormat theDTF ) { myDTF = theDTF; }
61   
62 protected:
63   QString            myText;
64   float              myXPos;
65   float              myYPos;
66   QColor             myColor;
67   QFont              myQFont;
68   int                mySeparator;
69   DisplayTextFormat  myDTF;
70 };
71
72 #ifdef WNT
73 #pragma warning ( default:4251 )
74 #endif
75
76 #endif