Apply smooth paging patch. New version 0.4.7.
[dorian] / widgets / translucentbutton.h
index 44b56c2..5e26707 100644 (file)
@@ -1,25 +1,44 @@
 #ifndef TRANSLUCENTBUTTON_H
 #define TRANSLUCENTBUTTON_H
 
-#include <QtGui>
+#include <QLabel>
 #include <QString>
 
-class TranslucentButton: public QWidget
+class QWidget;
+class QPaintEvent;
+class QMouseEvent;
+class QTimer;
+
+/**
+ * A button that is transparent, but can temporarily be made opaque by
+ * flashing it.
+ */
+class TranslucentButton: public QLabel
 {
     Q_OBJECT
 
 public:
-    explicit TranslucentButton(const QString &name, QWidget *parent);
+    explicit TranslucentButton(const QString &iconName, QWidget *parent);
+    ~TranslucentButton();
+    static const int pixels;
+    static const int elevatorInterval;
 
 public slots:
-    void flash(int duration = 3000);
+    void flash(int duration = 700);
     void stopFlash();
 
+signals:
+    void triggered();
+
 protected:
-    virtual void paintEvent(QPaintEvent *);
+    void paintEvent(QPaintEvent *);
+    void mouseReleaseEvent(QMouseEvent *);
+    void timerEvent(QTimerEvent *e);
+
+private:
     QString name;
-    int opacity;
-    QTimer *timer;
+    bool transparent;
+    int elevatorTimer;
 };
 
 #endif // TRANSLUCENTBUTTON_H