home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / qt3_emx.zip / include / qtooltip.h < prev    next >
C/C++ Source or Header  |  2001-10-11  |  4KB  |  142 lines

  1. /****************************************************************************
  2. ** $Id:  qt/qtooltip.h   3.0.0   edited Sep 20 21:49 $
  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.  
  90.     static void add( QWidget *, const QString &);
  91.     static void add( QWidget *, const QString &,
  92.              QToolTipGroup *, const QString& );
  93.     static void remove( QWidget * );
  94.  
  95.     static void add( QWidget *, const QRect &, const QString &);
  96.     static void add( QWidget *, const QRect &, const QString &,
  97.              QToolTipGroup *, const QString& );
  98.     static void remove( QWidget *, const QRect & );
  99.  
  100.     static QString textFor( QWidget *, const QPoint & pos = QPoint() );
  101.  
  102.     static void hide();
  103.  
  104.     static QFont    font();
  105.     static void        setFont( const QFont & );
  106.     static QPalette palette();
  107.     static void        setPalette( const QPalette & );
  108.  
  109. #ifndef QT_NO_COMPAT
  110.     static void        setEnabled( bool enable ) { setGloballyEnabled( enable ); }
  111.     static bool        enabled() { return isGloballyEnabled(); }
  112. #endif
  113.     static void        setGloballyEnabled( bool );
  114.     static bool        isGloballyEnabled();
  115.  
  116. protected:
  117.     virtual void maybeTip( const QPoint & ) = 0;
  118.     void    tip( const QRect &, const QString &);
  119.     void    tip( const QRect &, const QString& , const QString &);
  120.     void    clear();
  121.  
  122. public:
  123.     QWidget      *parentWidget() const { return p; }
  124.     QToolTipGroup *group()      const { return g; }
  125.  
  126. private:
  127.     void    tip( const QRect &, const QRect &, const QString &);
  128.     QWidget        *p;
  129.     QToolTipGroup   *g;
  130.     static QFont    *ttFont;
  131.     static QPalette *ttPalette;
  132.  
  133.     friend class QTipManager;
  134.     friend class QIconViewToolTip;
  135.     friend class QListViewToolTip;
  136. };
  137.  
  138.  
  139. #endif // QT_NO_TOOLTIP
  140.  
  141. #endif // QTOOLTIP_H
  142.