~ubuntu-branches/ubuntu/feisty/psi/feisty

« back to all changes in this revision

Viewing changes to src/trayicon.h

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2002-04-19 02:28:44 UTC
  • Revision ID: james.westby@ubuntu.com-20020419022844-za7xgai5qyfd9xv6
Tags: upstream-0.8.5
ImportĀ upstreamĀ versionĀ 0.8.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
** trayicon.h - system-independent tray app class (adapted from Qt example)
 
3
** Copyright (C) 2001, 2002  Justin Karneges
 
4
**
 
5
** This program is free software; you can redistribute it and/or
 
6
** modify it under the terms of the GNU General Public License
 
7
** as published by the Free Software Foundation; either version 2
 
8
** of the License, or (at your option) any later version.
 
9
**
 
10
** This program is distributed in the hope that it will be useful,
 
11
** but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
** GNU General Public License for more details.
 
14
**
 
15
** You should have received a copy of the GNU General Public License
 
16
** along with this program; if not, write to the Free Software
 
17
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
 
18
**
 
19
****************************************************************************/
 
20
 
 
21
#ifndef TRAYICON_H
 
22
#define TRAYICON_H
 
23
 
 
24
#include <qobject.h>
 
25
#include <qimage.h>
 
26
 
 
27
class QPopupMenu;
 
28
 
 
29
class TrayIcon : public QObject
 
30
{
 
31
        Q_OBJECT
 
32
 
 
33
        Q_PROPERTY( QString toolTip READ toolTip WRITE setToolTip )
 
34
        Q_PROPERTY( QPixmap icon READ icon WRITE setIcon )
 
35
 
 
36
public:
 
37
        TrayIcon( QObject *parent = 0, const char *name = 0 );
 
38
        TrayIcon( const QPixmap &, const QString &, QPopupMenu *popup = 0, QObject *parent = 0, const char *name = 0 );
 
39
        ~TrayIcon();
 
40
 
 
41
        // use WindowMaker dock mode.  ignored on non-X11 platforms
 
42
        void setWMDock(bool use) { v_isWMDock = use; }
 
43
        bool isWMDock() { return v_isWMDock; }
 
44
 
 
45
        // Set a popup menu to handle RMB
 
46
        void setPopup( QPopupMenu * );
 
47
        QPopupMenu* popup() const;
 
48
 
 
49
        QPixmap icon() const;
 
50
        QString toolTip() const;
 
51
 
 
52
        void gotCloseEvent();
 
53
 
 
54
public slots:
 
55
        void setIcon( const QPixmap &icon );
 
56
        void setToolTip( const QString &tip );
 
57
 
 
58
        void show();
 
59
        void hide();
 
60
 
 
61
signals:
 
62
        void clicked( const QPoint&, int);
 
63
        void doubleClicked( const QPoint& );
 
64
        void closed();
 
65
 
 
66
protected:
 
67
        bool event( QEvent * );
 
68
        virtual void mouseMoveEvent( QMouseEvent *e );
 
69
        virtual void mousePressEvent( QMouseEvent *e );
 
70
        virtual void mouseReleaseEvent( QMouseEvent *e );
 
71
        virtual void mouseDoubleClickEvent( QMouseEvent *e );
 
72
 
 
73
        private:
 
74
        QPopupMenu *pop;
 
75
        QPixmap pm;
 
76
        QString tip;
 
77
        bool v_isWMDock;
 
78
 
 
79
        // system-dependant part
 
80
        class TrayIconPrivate;
 
81
        TrayIconPrivate *d;
 
82
        void sysInstall();
 
83
        void sysRemove();
 
84
        void sysUpdateIcon();
 
85
        void sysUpdateToolTip();
 
86
};
 
87
 
 
88
#endif //TRAYICON_H