libqutim  0.3.1.0
tooltip.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** qutIM - instant messenger
4 **
5 ** Copyright © 2011 Ruslan Nigmatullin <euroelessar@yandex.ru>
6 **
7 *****************************************************************************
8 **
9 ** $QUTIM_BEGIN_LICENSE$
10 ** This program is free software: you can redistribute it and/or modify
11 ** it under the terms of the GNU General Public License as published by
12 ** the Free Software Foundation, either version 3 of the License, or
13 ** (at your option) any later version.
14 **
15 ** This program is distributed in the hope that it will be useful,
16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 ** See the GNU General Public License for more details.
19 **
20 ** You should have received a copy of the GNU General Public License
21 ** along with this program. If not, see http://www.gnu.org/licenses/.
22 ** $QUTIM_END_LICENSE$
23 **
24 ****************************************************************************/
25 
26 #ifndef TOOLTIPMANAGER_H
27 #define TOOLTIPMANAGER_H
28 
29 #include "libqutim_global.h"
30 #include "localizedstring.h"
31 #include "extensionicon.h"
32 #include <QPoint>
33 #include <QEvent>
34 #include <QVariant>
35 
36 namespace qutim_sdk_0_3
37 {
38  class Buddy;
39  class ToolTipEventPrivate;
40 
41  class LIBQUTIM_EXPORT ToolTipEvent : public QEvent
42  {
43  public:
44  enum IconPosition {
45  IconBeforeTitle = 0,
46  IconBeforeDescription
47  };
48 
49  ToolTipEvent(bool generateLayout = true);
50  ~ToolTipEvent();
51  void addHtml(const QString &html, quint8 priority = 60);
52  void addField(const LocalizedString &title,
53  const LocalizedString &description = LocalizedString(),
54  quint8 priority = 60);
55  void addField(const LocalizedString &title,
56  const LocalizedString &description,
57  const QString &icon,
58  quint8 priority = 60);
59  void addField(const LocalizedString &title,
60  const LocalizedString &description,
61  const ExtensionIcon &icon,
62  quint8 priority = 60);
63  void addField(const LocalizedString &title,
64  const LocalizedString &description,
65  const QString &icon,
66  IconPosition iconPosition,
67  quint8 priority = 60);
68  void addField(const LocalizedString &title,
69  const LocalizedString &description,
70  const ExtensionIcon &icon,
71  IconPosition iconPosition,
72  quint8 priority = 60);
73  bool generateLayout() const;
74  QString html() const;
75  static QEvent::Type eventType();
76  protected:
77  friend class ToolTip;
78  QScopedPointer<ToolTipEventPrivate> d;
79  };
80 
81  class LIBQUTIM_EXPORT ToolTip : public QObject
82  {
83  Q_OBJECT
84  public:
85  static ToolTip *instance();
86  virtual void showText(const QPoint &pos, QObject *obj, QWidget *w = 0);
87  inline void hideText() { showText(QPoint(), 0); }
88  protected:
89  ToolTip(QObject *parent = 0);
90  bool eventFilter(QObject *, QEvent *);
91  };
92 }
93 
95 
96 #endif // TOOLTIPMANAGER_H
97 

Generated by Doxygen