~ubuntu-branches/ubuntu/edgy/psi/edgy

« back to all changes in this revision

Viewing changes to cutestuff/trayicon/trayicon.h

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2004-06-15 00:10:41 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040615001041-enywb6pcpe4sjsw6
Tags: 0.9.2-1
* New upstream release
* Set KDEDIR for ./configure so kde specific files get installed
* Don't install libpsiwidgets.so. It got installed in /usr/share
  where it doesn't belong. May be included (at a better location)
  later.

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
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
public:
 
81
        class TrayIconPrivate;
 
82
private:
 
83
        TrayIconPrivate *d;
 
84
        void sysInstall();
 
85
        void sysRemove();
 
86
        void sysUpdateIcon();
 
87
        void sysUpdateToolTip();
 
88
 
 
89
        friend class TrayIconPrivate;
 
90
};
 
91
 
 
92
#endif // CS_TRAYICON_H