| 1 | /****************************************************************************
|
|---|
| 2 | ** $Id: qtooltip.h 2 2005-11-16 15:49:26Z dmik $
|
|---|
| 3 | **
|
|---|
| 4 | ** Definition of Tool Tips (or Balloon Help) for any widget or rectangle
|
|---|
| 5 | **
|
|---|
| 6 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
|
|---|
| 7 | **
|
|---|
| 8 | ** This file is part of the widgets module of the Qt GUI Toolkit.
|
|---|
| 9 | **
|
|---|
| 10 | ** This file may be distributed under the terms of the Q Public License
|
|---|
| 11 | ** as defined by Trolltech AS of Norway and appearing in the file
|
|---|
| 12 | ** LICENSE.QPL included in the packaging of this file.
|
|---|
| 13 | **
|
|---|
| 14 | ** This file may be distributed and/or modified under the terms of the
|
|---|
| 15 | ** GNU General Public License version 2 as published by the Free Software
|
|---|
| 16 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
|---|
| 17 | ** packaging of this file.
|
|---|
| 18 | **
|
|---|
| 19 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
|
|---|
| 20 | ** licenses may use this file in accordance with the Qt Commercial License
|
|---|
| 21 | ** Agreement provided with the Software.
|
|---|
| 22 | **
|
|---|
| 23 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
|---|
| 24 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|---|
| 25 | **
|
|---|
| 26 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
|---|
| 27 | ** information about Qt Commercial License Agreements.
|
|---|
| 28 | ** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
|---|
| 29 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
|---|
| 30 | **
|
|---|
| 31 | ** Contact info@trolltech.com if any conditions of this licensing are
|
|---|
| 32 | ** not clear to you.
|
|---|
| 33 | **
|
|---|
| 34 | **********************************************************************/
|
|---|
| 35 |
|
|---|
| 36 | #ifndef QTOOLTIP_H
|
|---|
| 37 | #define QTOOLTIP_H
|
|---|
| 38 |
|
|---|
| 39 | #ifndef QT_H
|
|---|
| 40 | #include "qwidget.h"
|
|---|
| 41 | #endif // QT_H
|
|---|
| 42 |
|
|---|
| 43 | #ifndef QT_NO_TOOLTIP
|
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 | class QTipManager;
|
|---|
| 47 | class QIconViewToolTip;
|
|---|
| 48 | class QListViewToolTip;
|
|---|
| 49 |
|
|---|
| 50 | class Q_EXPORT QToolTipGroup: public QObject
|
|---|
| 51 | {
|
|---|
| 52 | Q_OBJECT
|
|---|
| 53 | Q_PROPERTY( bool delay READ delay WRITE setDelay )
|
|---|
| 54 | Q_PROPERTY( bool enabled READ enabled WRITE setEnabled )
|
|---|
| 55 |
|
|---|
| 56 | public:
|
|---|
| 57 | QToolTipGroup( QObject *parent, const char *name = 0 );
|
|---|
| 58 | ~QToolTipGroup();
|
|---|
| 59 |
|
|---|
| 60 | bool delay() const;
|
|---|
| 61 | bool enabled() const;
|
|---|
| 62 |
|
|---|
| 63 | public slots:
|
|---|
| 64 | void setDelay( bool );
|
|---|
| 65 | void setEnabled( bool );
|
|---|
| 66 |
|
|---|
| 67 | signals:
|
|---|
| 68 | void showTip( const QString &);
|
|---|
| 69 | void removeTip();
|
|---|
| 70 |
|
|---|
| 71 | private:
|
|---|
| 72 | uint del:1;
|
|---|
| 73 | uint ena:1;
|
|---|
| 74 |
|
|---|
| 75 | friend class QTipManager;
|
|---|
| 76 |
|
|---|
| 77 | private: // Disabled copy constructor and operator=
|
|---|
| 78 | #if defined(Q_DISABLE_COPY)
|
|---|
| 79 | QToolTipGroup( const QToolTipGroup & );
|
|---|
| 80 | QToolTipGroup& operator=( const QToolTipGroup & );
|
|---|
| 81 | #endif
|
|---|
| 82 | };
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 | class Q_EXPORT QToolTip: public Qt
|
|---|
| 86 | {
|
|---|
| 87 | public:
|
|---|
| 88 | QToolTip( QWidget *, QToolTipGroup * = 0 );
|
|---|
| 89 | //### add virtual d'tor for 4.0
|
|---|
| 90 |
|
|---|
| 91 | static void add( QWidget *, const QString &);
|
|---|
| 92 | static void add( QWidget *, const QString &,
|
|---|
| 93 | QToolTipGroup *, const QString& );
|
|---|
| 94 | static void remove( QWidget * );
|
|---|
| 95 |
|
|---|
| 96 | static void add( QWidget *, const QRect &, const QString &);
|
|---|
| 97 | static void add( QWidget *, const QRect &, const QString &,
|
|---|
| 98 | QToolTipGroup *, const QString& );
|
|---|
| 99 | static void remove( QWidget *, const QRect & );
|
|---|
| 100 |
|
|---|
| 101 | static QString textFor( QWidget *, const QPoint & pos = QPoint() );
|
|---|
| 102 |
|
|---|
| 103 | static void hide();
|
|---|
| 104 |
|
|---|
| 105 | static QFont font();
|
|---|
| 106 | static void setFont( const QFont & );
|
|---|
| 107 | static QPalette palette();
|
|---|
| 108 | static void setPalette( const QPalette & );
|
|---|
| 109 |
|
|---|
| 110 | #ifndef QT_NO_COMPAT
|
|---|
| 111 | static void setEnabled( bool enable ) { setGloballyEnabled( enable ); }
|
|---|
| 112 | static bool enabled() { return isGloballyEnabled(); }
|
|---|
| 113 | #endif
|
|---|
| 114 | static void setGloballyEnabled( bool );
|
|---|
| 115 | static bool isGloballyEnabled();
|
|---|
| 116 | static void setWakeUpDelay(int);
|
|---|
| 117 |
|
|---|
| 118 | protected:
|
|---|
| 119 | virtual void maybeTip( const QPoint & ) = 0;
|
|---|
| 120 | void tip( const QRect &, const QString &);
|
|---|
| 121 | void tip( const QRect &, const QString& , const QString &);
|
|---|
| 122 | void tip( const QRect &, const QString &, const QRect & );
|
|---|
| 123 | void tip( const QRect &, const QString&, const QString &, const QRect &);
|
|---|
| 124 |
|
|---|
| 125 | void clear();
|
|---|
| 126 |
|
|---|
| 127 | public:
|
|---|
| 128 | QWidget *parentWidget() const { return p; }
|
|---|
| 129 | QToolTipGroup *group() const { return g; }
|
|---|
| 130 |
|
|---|
| 131 | private:
|
|---|
| 132 | QWidget *p;
|
|---|
| 133 | QToolTipGroup *g;
|
|---|
| 134 | static QFont *ttFont;
|
|---|
| 135 | static QPalette *ttPalette;
|
|---|
| 136 |
|
|---|
| 137 | friend class QTipManager;
|
|---|
| 138 | };
|
|---|
| 139 |
|
|---|
| 140 |
|
|---|
| 141 | #endif // QT_NO_TOOLTIP
|
|---|
| 142 |
|
|---|
| 143 | #endif // QTOOLTIP_H
|
|---|