Salome HOME
0901137e947474b8923664d179bfdf5e9a31bedd
[modules/gui.git] / src / Qtx / QtxToolTip.h
1 // Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
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.salome-platform.org/
18 //
19 // File:      QtxToolTip.h
20 // Author:    Sergey TELKOV
21
22 #ifndef QTXTOOLTIP_H
23 #define QTXTOOLTIP_H
24
25 #include "Qtx.h"
26
27 #include <qlabel.h>
28
29 class QTimer;
30
31 class QTX_EXPORT QtxToolTip : public QLabel
32 {
33         Q_OBJECT
34
35 public:
36         QtxToolTip( QWidget* = 0 );
37         virtual ~QtxToolTip();
38
39         void          hideTip();
40   
41         virtual void  showTip( const QPoint& aPos,
42                          const QString& text, const QRect& aWidgetRegion );
43         virtual void  showTip( const QRect& aRegion,
44                          const QString& text, const QRect& aWidgetRegion );
45
46         virtual bool  eventFilter( QObject* o, QEvent* e );
47
48   void          setWakeUpDelayTime( int );
49   void          setShowDelayTime( int );
50
51   int           wakeUpDelayTime() const { return myWakeUpDelayTime; }
52   int           showDelayTime() const { return myShowDelayTime; }
53
54 signals:
55   void          maybeTip( QPoint, QString&, QFont&, QRect&, QRect& );
56
57 protected slots:
58         void          onSleepTimeOut();
59         void          onWakeUpTimeOut();
60
61 protected:
62         virtual void  maybeTip( const QPoint& );
63         virtual void  mousePressEvent( QMouseEvent* );
64         virtual void  mouseDoubleClickEvent( QMouseEvent* );
65
66   QTimer*       sleepTimer() const;
67   QTimer*       wakeUpTimer() const;
68
69 private:
70         QTimer*       myWakeUpTimer;
71         QTimer*       mySleepTimer;
72         QRect         myWidgetRegion;
73
74   int           myShowDelayTime;
75   int           myWakeUpDelayTime;
76 };
77
78 #endif