ksystemtray.h
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 1999 Matthias Ettrich <ettrich@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 */ 00018 #ifndef KSYSTEMTRAY_H 00019 #define KSYSTEMTRAY_H 00020 00021 #include <tdeglobal.h> 00022 #include <tqlabel.h> 00023 00024 class TDEActionCollection; 00025 class TDEPopupMenu; 00026 class KSystemTrayPrivate; 00027 00063 class TDEUI_EXPORT KSystemTray : public TQLabel 00064 { 00065 Q_OBJECT 00066 public: 00067 00081 KSystemTray( TQWidget* parent = 0, const char* name = 0 ); 00082 00083 /* 00084 Destructor 00085 */ 00086 ~KSystemTray(); 00087 00092 TDEPopupMenu* contextMenu() const; 00093 00099 TDEActionCollection* actionCollection(); 00100 00104 virtual void setPixmap( const TQPixmap& icon ); 00105 00110 virtual void setCaption( const TQString& title ); 00111 00120 static TQPixmap loadIcon( const TQString &icon, TDEInstance *instance=TDEGlobal::instance() ); 00121 00131 static TQPixmap loadSizedIcon( const TQString &icon, int iconWidth, TDEInstance *instance=TDEGlobal::instance() ); 00132 00133 signals: 00139 void quitSelected(); 00140 00141 public slots: 00142 00150 void toggleActive(); 00155 void setActive(); 00160 void setInactive(); 00161 00162 protected: 00163 00170 void mousePressEvent( TQMouseEvent * ); 00171 00178 void mouseReleaseEvent( TQMouseEvent * ); 00179 00180 00181 00186 virtual void contextMenuAboutToShow( TDEPopupMenu* menu ); 00187 00191 void showEvent( TQShowEvent * ); 00192 00196 void enterEvent( TQEvent* ); 00197 00198 private slots: 00199 void minimizeRestoreAction(); 00200 void maybeQuit(); 00201 00202 private: 00203 void activateOrHide(); 00204 void minimizeRestore( bool restore ); 00205 TDEPopupMenu* menu; 00206 // minimizeRestoreId is no longer needed. remove in KDE 4.0 00207 int minimizeRestoreId; 00208 uint hasQuit :1; 00209 protected: 00210 virtual void virtual_hook( int id, void* data ); 00211 private: 00212 KSystemTrayPrivate* d; 00213 }; 00214 00215 00216 #endif