Back to index

salome-gui  6.5.0
GLViewer_Text.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  Author : OPEN CASCADE
00024 // File:      GLViewer_Text.h
00025 // Created:   November, 2004
00026 //
00027 #ifndef GLVIEWER_TEXT_H
00028 #define GLVIEWER_TEXT_H
00029 
00030 #ifdef WIN32
00031 #include <windows.h>
00032 #endif
00033 
00034 #include "GLViewer.h"
00035 #include "GLViewer_Defs.h"
00036 
00037 #include <GL/gl.h>
00038 
00039 #include <QFont>
00040 #include <QString>
00041 #include <QColor>
00042 
00043 #ifdef WIN32
00044 #pragma warning( disable:4251 )
00045 #endif
00046 
00051 class GLVIEWER_API GLViewer_Text
00052 {
00053 public:
00054   GLViewer_Text( const QString&, float xPos = 0.0, float yPos = 0.0, const QColor& color = QColor( 0, 255, 0 ) );
00055   GLViewer_Text( const QString&, float xPos, float yPos, const QColor& , QFont theFont, int theSeparator);
00056   ~GLViewer_Text();
00057   
00059   void                  setText( const QString& text ) { myText = text; }
00061   QString               getText() const { return myText; }
00062   
00064   void                  setPosition( float xPos, float yPos ) { myXPos = xPos; myYPos = yPos; }
00066   void                  getPosition( float& xPos, float& yPos ) { xPos = myXPos; yPos = myYPos; }
00067   
00069   void                  setColor( const QColor& color ) { myColor = color; }
00071   QColor                getColor() const { return myColor; }
00072   
00074   void                  setFont( const QFont theQFont) { myQFont = theQFont; }
00076   QFont                 getFont() const { return myQFont; }
00077   
00079   int                   getSeparator(){ return mySeparator; }
00081   void                  setSeparator( int theSep ){ mySeparator = theSep; }
00082   
00084   int                   getWidth();
00086   int                   getHeight();
00087   
00089 
00090   QByteArray            getByteCopy() const;
00091   
00093 
00094   static GLViewer_Text* fromByteCopy( QByteArray );
00095   
00097   DisplayTextFormat     getDisplayTextFormat() const { return myDTF; }
00099   void                  setTextDisplayFormat( DisplayTextFormat theDTF ) { myDTF = theDTF; }
00100   
00101 protected:
00102   QString            myText;
00103   float              myXPos;
00104   float              myYPos;
00105   QColor             myColor;
00106   QFont              myQFont;
00107   int                mySeparator;
00108   DisplayTextFormat  myDTF;
00109 };
00110 
00111 #ifdef WIN32
00112 #pragma warning ( default:4251 )
00113 #endif
00114 
00115 #endif