Plasma
tooltipmanager.h
Go to the documentation of this file.
00001 /* 00002 * Copyright 2007 by Dan Meltzer <hydrogen@notyetimplemented.com> 00003 * Copyright 2008 by Aaron Seigo <aseigo@kde.org> 00004 * Copyright 2008 by Alexis Ménard <darktears31@gmail.com> 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin St, Fifth Floor, 00019 * Boston, MA 02110-1301 USA 00020 */ 00021 00022 #ifndef PLASMA_TOOLTIP_MANAGER_H 00023 #define PLASMA_TOOLTIP_MANAGER_H 00024 00025 #include <kurl.h> 00026 00027 #include <plasma/plasma.h> 00028 #include <plasma/plasma_export.h> 00029 #include <plasma/tooltipcontent.h> 00030 00031 namespace Plasma 00032 { 00033 00034 class ToolTipManagerPrivate; 00035 class Applet; 00036 class Corona; 00037 00069 class PLASMA_EXPORT ToolTipManager : public QObject 00070 { 00071 Q_OBJECT 00072 public: 00073 00074 enum State { 00075 Activated = 0 , 00076 Inhibited , 00077 Deactivated 00078 }; 00079 00083 static ToolTipManager *self(); 00084 00090 void show(QGraphicsWidget *widget); 00091 00099 bool isVisible(QGraphicsWidget *widget) const; 00100 00106 void hide(QGraphicsWidget *widget); 00107 00126 void registerWidget(QGraphicsWidget *widget); 00127 00135 void unregisterWidget(QGraphicsWidget *widget); 00136 00147 void setContent(QGraphicsWidget *widget, 00148 const ToolTipContent &data); 00149 00154 void clearContent(QGraphicsWidget *widget); 00155 00161 void setState(ToolTipManager::State state); 00162 00166 ToolTipManager::State state() const; 00167 00168 Q_SIGNALS: 00176 void windowPreviewActivated(WId window, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, 00177 const QPoint &screenPos); 00178 00186 void linkActivated(const QString &anchor, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, 00187 const QPoint &screenPos); 00188 00189 private: 00195 explicit ToolTipManager(QObject *parent = 0); 00196 00200 ~ToolTipManager(); 00201 00202 friend class ToolTipManagerSingleton; 00203 friend class Corona; // The corona needs to register itself 00204 friend class ToolTipManagerPrivate; 00205 bool eventFilter(QObject *watched, QEvent *event); 00206 00207 ToolTipManagerPrivate *const d; 00208 Corona* m_corona; 00209 00210 Q_PRIVATE_SLOT(d, void showToolTip()) 00211 Q_PRIVATE_SLOT(d, void toolTipHovered(bool)) 00212 Q_PRIVATE_SLOT(d, void resetShownState()) 00213 Q_PRIVATE_SLOT(d, void onWidgetDestroyed(QObject*)) 00214 }; 00215 00216 } // namespace Plasma 00217 00218 #endif // PLASMA_TOOL_TIP_MANAGER_H
KDE 4.6 API Reference