Salome HOME
This file is given from DESCARTES project
[modules/gui.git] / src / GLViewer / GLViewer_ToolTip.h
1 //  Copyright (C) 2005 OPEN CASCADE
2 //
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.
7 //
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.
12 //
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
16 //
17 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
18 //
19 //  Author : OPEN CASCADE
20 //
21
22 // File:      GLViewer_ToolTip.h
23 // Created:   March, 2005
24
25 #ifndef GLVIEWER_TOOLTIP_H
26 #define GLVIEWER_TOOLTIP_H
27
28 #include "GLViewer.h"
29
30 //#include <qtooltip.h>
31 //#include <QtxToolTip.h>
32 #include <qobject.h>
33
34 #define TIP_TIME            1000
35
36 class GLViewer_ViewPort2d;
37 class QLabel;
38 /***************************************************************************
39 **  Class:   GLViewer_ObjectTip
40 **  Descr:   ToolTip of GLViewer_Objects
41 **  Module:  GLViewer
42 **  Created: UI team, 28.03.05
43 ****************************************************************************/
44 class GLVIEWER_API GLViewer_ObjectTip: public QObject//QToolTip//QtxToolTip
45 {
46   Q_OBJECT
47 public:
48   GLViewer_ObjectTip( GLViewer_ViewPort2d* );
49   ~GLViewer_ObjectTip();
50
51 //protected:
52 //  virtual void    maybeTip( const QPoint& p );
53   virtual bool        eventFilter( QObject*, QEvent* );
54
55   virtual bool        maybeTip( const QPoint&);
56
57   void                setText( const QString& theText ){ myText = theText; }
58   QString             getText() const { return myText; }
59
60 protected:
61   void                timeIsOut();
62
63 private:
64
65   void                hideTipAndSleep();
66   void                wakeup( int mseconds = TIP_TIME );
67
68 private slots:
69   void                showTip();
70
71 private:
72   GLViewer_ViewPort2d*    mypViewPort;
73
74   QTimer*                 mypTimer;
75   QPoint                  myPoint;
76   QLabel*                 mypLabel;
77
78   QString                 myText;
79 };
80
81 #endif //GLVIEWER_TOOLTIP_H