Salome HOME
no message
[modules/gui.git] / src / Qtx / QtxToolTip.h
1 // File:      QtxToolTip.h
2 // Author:    Sergey TELKOV
3
4 #ifndef QTXTOOLTIP_H
5 #define QTXTOOLTIP_H
6
7 #include "Qtx.h"
8
9 #include <qlabel.h>
10
11 class QTimer;
12
13 class QTX_EXPORT QtxToolTip : public QLabel
14 {
15         Q_OBJECT
16
17 public:
18         QtxToolTip( QWidget* = 0 );
19         virtual ~QtxToolTip();
20
21         void          hideTip();
22   
23         virtual void  showTip( const QPoint& aPos,
24                          const QString& text, const QRect& aWidgetRegion );
25         virtual void  showTip( const QRect& aRegion,
26                          const QString& text, const QRect& aWidgetRegion );
27
28         virtual bool  eventFilter( QObject* o, QEvent* e );
29
30   void          setWakeUpDelayTime( int );
31   void          setShowDelayTime( int );
32
33   int           wakeUpDelayTime() const { return myWakeUpDelayTime; }
34   int           showDelayTime() const { return myShowDelayTime; }
35
36 signals:
37   void          maybeTip( QPoint, QString&, QFont&, QRect&, QRect& );
38
39 protected slots:
40         void          onSleepTimeOut();
41         void          onWakeUpTimeOut();
42
43 protected:
44         virtual void  maybeTip( const QPoint& );
45         virtual void  mousePressEvent( QMouseEvent* );
46         virtual void  mouseDoubleClickEvent( QMouseEvent* );
47
48   QTimer*       sleepTimer() const;
49   QTimer*       wakeUpTimer() const;
50
51 private:
52         QTimer*       myWakeUpTimer;
53         QTimer*       mySleepTimer;
54         QRect         myWidgetRegion;
55
56   int           myShowDelayTime;
57   int           myWakeUpDelayTime;
58 };
59
60 #endif