00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef CS_TRAYICON_H
00022 #define CS_TRAYICON_H
00023
00024 #include <qwidget.h>
00025 #include <qimage.h>
00026
00027 class QPopupMenu;
00028
00029 class TrayIcon : public QWidget
00030 {
00031 Q_OBJECT
00032
00033 Q_PROPERTY( QString toolTip READ toolTip WRITE setToolTip )
00034 Q_PROPERTY( QPixmap icon READ icon WRITE setIcon )
00035
00036 public:
00037 TrayIcon( QWidget *parent = 0, const char *name = 0 );
00038 TrayIcon( const QPixmap &, const QString &, QPopupMenu *popup = 0, QWidget *parent = 0, const char *name = 0 );
00039 ~TrayIcon();
00040
00041
00042 void setWMDock(bool use) { v_isWMDock = use; }
00043 bool isWMDock() { return v_isWMDock; }
00044
00045
00046 void setPopup( QPopupMenu * );
00047 QPopupMenu* popup() const;
00048
00049 QPixmap icon() const;
00050 QString toolTip() const;
00051
00052 void gotCloseEvent();
00053
00054 public slots:
00055 void setIcon( const QPixmap &icon );
00056 void setToolTip( const QString &tip );
00057
00058 void show();
00059 void hide();
00060
00061 signals:
00062 void clicked( const QPoint&, int);
00063 void doubleClicked( const QPoint& );
00064 void closed();
00065
00066 protected:
00067 bool event( QEvent * );
00068 virtual void mouseMoveEvent( QMouseEvent *e );
00069 virtual void mousePressEvent( QMouseEvent *e );
00070 virtual void mouseReleaseEvent( QMouseEvent *e );
00071 virtual void mouseDoubleClickEvent( QMouseEvent *e );
00072
00073 private:
00074 QPopupMenu *pop;
00075 QPixmap pm;
00076 QString tip;
00077 bool v_isWMDock;
00078
00079
00080 class TrayIconPrivate;
00081 TrayIconPrivate *d;
00082 void sysInstall();
00083 void sysRemove();
00084 void sysUpdateIcon();
00085 void sysUpdateToolTip();
00086 };
00087
00088 #endif // CS_TRAYICON_H