]> SALOME platform Git repositories - modules/gui.git/blob - src/GLViewer/GLViewer_ToolTip.h
Salome HOME
7700b61b1a1e5132b9ec116b7158ab079b1322ac
[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   ToolTip of GLViewer_Objects
41 */
42 class GLVIEWER_API GLViewer_ObjectTip: public QObject//QToolTip//QtxToolTip
43 {
44   Q_OBJECT
45 public:
46   GLViewer_ObjectTip( GLViewer_ViewPort2d* );
47   ~GLViewer_ObjectTip();
48
49 //protected:
50 //  virtual void    maybeTip( const QPoint& p );
51   virtual bool        eventFilter( QObject*, QEvent* );
52
53   virtual bool        maybeTip( const QPoint&);
54
55   void                setText( const QString& theText ){ myText = theText; }
56   QString             getText() const { return myText; }
57
58 protected:
59   void                timeIsOut();
60
61 private:
62
63   void                hideTipAndSleep();
64   void                wakeup( int mseconds = TIP_TIME );
65
66 private slots:
67   void                showTip();
68
69 private:
70   GLViewer_ViewPort2d*    mypViewPort;
71
72   QTimer*                 mypTimer;
73   QPoint                  myPoint;
74   QLabel*                 mypLabel;
75
76   QString                 myText;
77 };
78
79 #endif //GLVIEWER_TOOLTIP_H