KDE/kdebase/workspace/libs/plasma

Davide Bettio davbet at aliceposta.it
Thu Aug 28 20:30:51 CEST 2008


SVN commit 854047 by bettio:

Added popupEvent.
CCMAIL:plasma-devel at kde.org


 M  +9 -0      popupapplet.cpp  
 M  +6 -0      popupapplet.h  


--- trunk/KDE/kdebase/workspace/libs/plasma/popupapplet.cpp #854046:854047
@@ -243,6 +243,7 @@
 void PopupApplet::showPopup(uint popupDuration)
 {
     if (d->dialog && (formFactor() == Horizontal || formFactor() == Vertical)) {
+        popupEvent(true);
         d->dialog->move(popupPosition(d->dialog->size()));
         d->dialog->show();
 
@@ -264,10 +265,16 @@
 void PopupApplet::hidePopup()
 {
     if (d->dialog && (formFactor() == Horizontal || formFactor() == Vertical)) {
+        popupEvent(false);
         d->dialog->hide();
     }
 }
 
+void PopupApplet::popupEvent(bool)
+{
+
+}
+
 void PopupApplet::widgetGeometryChanged()
 {
     if (graphicsWidget() && layout()) {
@@ -284,6 +291,8 @@
 void PopupAppletPrivate::togglePopup()
 {
    if (dialog) {
+        q->popupEvent(!dialog->isVisible());
+
         if (dialog->isVisible()) {
             dialog->hide();
         } else {
--- trunk/KDE/kdebase/workspace/libs/plasma/popupapplet.h #854046:854047
@@ -88,6 +88,12 @@
      */
     void showPopup(uint displayTime = 0);
 
+    /**
+     * This event handler can be reimplemented in a subclass to receive an event before the popup is showed or hidden.
+     * @arg show true if the popup is going to be showed, false if the popup is going to be hiden.
+     */
+     virtual void popupEvent(bool show);
+
 public Q_SLOTS:
     /**
      * Hides the popup.


More information about the Plasma-devel mailing list