~ubuntu-branches/ubuntu/oneiric/psi/oneiric

« back to all changes in this revision

Viewing changes to cutestuff/trayicon/trayicon.h

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2006-01-20 00:20:36 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060120002036-7nw6yo6totip0ee5
Tags: 0.10-2
* Added upstream changelog (Closes: Bug#327748)
* Mention --no-gpg and --no-gpg-agent in manpage (Closes: Bug#204416)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * trayicon.h - system-independent trayicon class (adapted from Qt example)
3
 
 * Copyright (C) 2003  Justin Karneges
4
 
 *
5
 
 * This library is free software; you can redistribute it and/or
6
 
 * modify it under the terms of the GNU Lesser General Public
7
 
 * License as published by the Free Software Foundation; either
8
 
 * version 2.1 of the License, or (at your option) any later version.
9
 
 *
10
 
 * This library 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 GNU
13
 
 * Lesser General Public License for more details.
14
 
 *
15
 
 * You should have received a copy of the GNU Lesser General Public
16
 
 * License along with this library; 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 CS_TRAYICON_H
22
 
#define CS_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
 
        void newTrayOwner();
62
 
 
63
 
signals:
64
 
        void clicked( const QPoint&, int);
65
 
        void doubleClicked( const QPoint& );
66
 
        void closed();
67
 
 
68
 
protected:
69
 
        bool event( QEvent * );
70
 
        virtual void mouseMoveEvent( QMouseEvent *e );
71
 
        virtual void mousePressEvent( QMouseEvent *e );
72
 
        virtual void mouseReleaseEvent( QMouseEvent *e );
73
 
        virtual void mouseDoubleClickEvent( QMouseEvent *e );
74
 
 
75
 
private:
76
 
        QPopupMenu *pop;
77
 
        QPixmap pm;
78
 
        QString tip;
79
 
        bool v_isWMDock;
80
 
 
81
 
        // system-dependant part
82
 
public:
83
 
        class TrayIconPrivate;
84
 
private:
85
 
        TrayIconPrivate *d;
86
 
        void sysInstall();
87
 
        void sysRemove();
88
 
        void sysUpdateIcon();
89
 
        void sysUpdateToolTip();
90
 
 
91
 
        friend class TrayIconPrivate;
92
 
};
93
 
 
94
 
#endif // CS_TRAYICON_H