1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
/*
Copyright (c) 2006 Gábor Lehel <[email protected]>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef AMAROK_TOOLTIP_H
#define AMAROK_TOOLTIP_H
#include <tqtooltip.h>
#include <tqframe.h>
#include <tqpoint.h>
#include <tqtimer.h>
namespace Amarok
{
class ToolTipClient
{
public:
virtual TQPair<TQString, TQRect> toolTipText( TQWidget *widget, const TQPoint &pos ) const = 0;
};
class ToolTip: public TQFrame, public TQToolTip
{
Q_OBJECT
TQ_OBJECT
public:
static void add( ToolTipClient *client, TQWidget *parent );
static void remove( TQWidget *parent );
static void hideTips();
static TQString textFor( TQWidget *widget, const TQPoint &pos = TQPoint() );
static void updateTip();
private slots:
void showTip();
void hideTip();
private:
ToolTip( ToolTipClient *client, TQWidget *parent );
virtual ~ToolTip();
void position();
ToolTipClient *m_client;
TQTimer m_timer;
static TQPoint s_pos;
static TQRect s_rect;
static TQString s_text;
static TQValueList<ToolTip*> s_tooltips;
class Manager;
friend class Manager;
static Manager* s_manager;
public:
virtual TQSize tqsizeHint() const;
protected:
virtual void maybeTip( const TQPoint &pos );
virtual void drawContents( TQPainter *painter );
public:
static int s_hack;
};
}
#endif
|