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 //plasma 00026 #include <plasma/plasma.h> 00027 #include <plasma/plasma_export.h> 00028 #include <plasma/tooltipcontent.h> 00029 00030 namespace Plasma 00031 { 00032 00033 class ToolTipManagerPrivate; 00034 class Applet; 00035 class Corona; 00036 00068 class PLASMA_EXPORT ToolTipManager : public QObject 00069 { 00070 Q_OBJECT 00071 public: 00072 00073 enum State { 00074 Activated = 0 , 00075 Inhibited , 00076 Deactivated 00077 }; 00078 00082 static ToolTipManager *self(); 00083 00089 void show(QGraphicsWidget *widget); 00090 00098 bool isVisible(QGraphicsWidget *widget) const; 00099 00105 void hide(QGraphicsWidget *widget); 00106 00125 void registerWidget(QGraphicsWidget *widget); 00126 00134 void unregisterWidget(QGraphicsWidget *widget); 00135 00146 void setContent(QGraphicsWidget *widget, 00147 const ToolTipContent &data); 00148 00153 void clearContent(QGraphicsWidget *widget); 00154 00160 void setState(ToolTipManager::State state); 00161 00165 ToolTipManager::State state() const; 00166 00167 private: 00173 explicit ToolTipManager(QObject *parent = 0); 00174 00178 ~ToolTipManager(); 00179 00180 friend class ToolTipManagerSingleton; 00181 friend class Corona; // The corona needs to register itself 00182 friend class ToolTipManagerPrivate; 00183 bool eventFilter(QObject *watched, QEvent *event); 00184 00185 ToolTipManagerPrivate *const d; 00186 Corona* m_corona; 00187 00188 Q_PRIVATE_SLOT(d, void showToolTip()) 00189 Q_PRIVATE_SLOT(d, void resetShownState()) 00190 Q_PRIVATE_SLOT(d, void onWidgetDestroyed(QObject*)) 00191 }; 00192 00193 } // namespace Plasma 00194 00195 #endif // PLASMA_TOOL_TIP_MANAGER_H