Plasma
popupapplet.h
Go to the documentation of this file.
00001 /* 00002 * Copyright 2008 by Montel Laurent <montel@kde.org> 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2.1 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with this library; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin St, Fifth Floor, 00017 * Boston, MA 02110-1301 USA 00018 */ 00019 00020 #ifndef PLASMA_POPUPAPPLET_H 00021 #define PLASMA_POPUPAPPLET_H 00022 00023 #include <plasma/applet.h> 00024 #include <plasma/plasma_export.h> 00025 #include <plasma/plasma.h> 00026 00027 class QGraphicsProxyWidget; 00028 class QGraphicsLinearLayout; 00029 00030 namespace Plasma 00031 { 00032 00033 class Dialog; 00034 class IconWidget; 00035 class PopupAppletPrivate; 00036 00052 class PLASMA_EXPORT PopupApplet : public Plasma::Applet 00053 { 00054 Q_OBJECT 00055 Q_PROPERTY(Qt::AlignmentFlag popupAlignment READ popupAlignment WRITE setPopupAlignment) 00056 00057 public: 00058 PopupApplet(QObject *parent, const QVariantList &args); 00059 ~PopupApplet(); 00060 00067 void setPopupIcon(const QIcon &icon); 00068 00078 void setPopupIcon(const QString &iconName); 00079 00083 QIcon popupIcon() const; 00084 00090 virtual QWidget *widget(); 00091 void setWidget(QWidget * widget); 00092 00100 virtual QGraphicsWidget *graphicsWidget(); 00101 void setGraphicsWidget(QGraphicsWidget * widget); 00102 00106 Plasma::PopupPlacement popupPlacement() const; 00107 00113 void setPopupAlignment(Qt::AlignmentFlag alignment); 00114 00119 Qt::AlignmentFlag popupAlignment() const; 00120 00127 void setPassivePopup(bool passive); 00128 00132 bool isPassivePopup() const; 00133 00137 bool isPopupShowing() const; 00138 00143 bool isIconified() const; 00144 00145 00146 public Q_SLOTS: 00150 void hidePopup(); 00151 00157 void showPopup(uint displayTime = 0); 00158 00162 void togglePopup(); 00163 00164 protected: 00172 virtual void popupEvent(bool show); 00173 00177 QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF()) const; 00178 00182 void mousePressEvent(QGraphicsSceneMouseEvent *event); 00183 00187 void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); 00188 00192 bool eventFilter(QObject *watched, QEvent *event); 00193 00197 void dragEnterEvent(QGraphicsSceneDragDropEvent *event); 00198 00202 void dragLeaveEvent(QGraphicsSceneDragDropEvent *event); 00203 00207 void dropEvent(QGraphicsSceneDragDropEvent *event); 00208 00212 void timerEvent(QTimerEvent *event); 00213 00214 private: 00223 PopupApplet(const QString &packagePath, uint appletId, const QVariantList &args); 00224 00225 Q_PRIVATE_SLOT(d, void internalTogglePopup()) 00226 Q_PRIVATE_SLOT(d, void hideTimedPopup()) 00227 Q_PRIVATE_SLOT(d, void clearPopupLostFocus()) 00228 Q_PRIVATE_SLOT(d, void dialogSizeChanged()) 00229 Q_PRIVATE_SLOT(d, void dialogStatusChanged(bool)) 00230 Q_PRIVATE_SLOT(d, void updateDialogPosition()) 00231 Q_PRIVATE_SLOT(d, void appletActivated()) 00232 Q_PRIVATE_SLOT(d, void iconSizeChanged(int)) 00233 Q_PRIVATE_SLOT(d, void statusChangeWhileShown(Plasma::ItemStatus status)) 00234 00235 friend class Applet; 00236 friend class AppletPrivate; 00237 friend class Extender; 00238 friend class PopupAppletPrivate; 00239 PopupAppletPrivate * const d; 00240 }; 00241 00242 } // Plasma namespace 00243 00244 #endif /* POPUPAPPLET_H */ 00245
KDE 4.6 API Reference