kalarm

traywindow.h

00001 /*
00002  *  traywindow.h  -  the KDE system tray applet
00003  *  Program:  kalarm
00004  *  Copyright © 2002-2004,2007 by David Jarvie <software@astrojar.org.uk>
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License along
00017  *  with this program; if not, write to the Free Software Foundation, Inc.,
00018  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  */
00020 
00021 #ifndef TRAYWINDOW_H
00022 #define TRAYWINDOW_H
00023 
00024 #include <tqpixmap.h>
00025 #include <ksystemtray.h>
00026 class TDEPopupMenu;
00027 
00028 class KAEvent;
00029 class MainWindow;
00030 class TrayTooltip;
00031 
00032 class TrayWindow : public KSystemTray
00033 {
00034         Q_OBJECT
00035   
00036     public:
00037         TrayWindow(MainWindow* parent, const char* name = 0);
00038         ~TrayWindow();
00039         void         removeWindow(MainWindow*);
00040         MainWindow*  assocMainWindow() const               { return mAssocMainWindow; }
00041         void         setAssocMainWindow(MainWindow* win)   { mAssocMainWindow = win; }
00042         bool         inSystemTray() const;
00043         void         tooltipAlarmText(TQString& text) const;
00044 
00045     public slots:
00046         void         slotQuit();
00047 
00048     signals:
00049         void         deleted();
00050 
00051     protected:
00052         virtual void contextMenuAboutToShow(TDEPopupMenu*);
00053         virtual void mousePressEvent(TQMouseEvent*);
00054         virtual void mouseReleaseEvent(TQMouseEvent*);
00055         virtual void dragEnterEvent(TQDragEnterEvent*);
00056         virtual void dropEvent(TQDropEvent*);
00057 
00058     private slots:
00059         void         slotNewAlarm();
00060         void         slotNewFromTemplate(const KAEvent&);
00061         void         slotPreferences();
00062         void         setEnabledStatus(bool status);
00063 
00064     private:
00065         friend class TrayTooltip;
00066 
00067         MainWindow*  mAssocMainWindow;     // main window associated with this, or null
00068         TQPixmap      mPixmapEnabled, mPixmapDisabled;
00069         TrayTooltip* mTooltip;
00070 };
00071 
00072 #endif // TRAYWINDOW_H