trayicon_win.h

Go to the documentation of this file.
00001 /****************************************************************
00002  *  Vidalia is distributed under the following license:
00003  *
00004  *  Copyright (C) 2006,  Matt Edman, Justin Hipple
00005  *
00006  *  This program is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU General Public License
00008  *  as published by the Free Software Foundation; either version 2
00009  *  of the License, or (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
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, 
00019  *  Boston, MA  02110-1301, USA.
00020  ****************************************************************/
00021 
00022 /** 
00023  * \file trayicon_win.h
00024  * \version $Id: mainwindow.cpp 604 2006-04-08 20:36:55Z edmanm $
00025  * \brief Tray icon implementation on Win32 
00026  */
00027 
00028 #ifndef _TRAYICON_WIN_H
00029 #define _TRAYICON_WIN_H
00030 
00031 #include <windows.h>
00032 
00033 #include <QWidget>
00034 #include <QString>
00035 #include <QPixmap>
00036 #include <QMouseEvent>
00037 
00038 
00039 class TrayIconImpl : protected QWidget
00040 {
00041 protected:
00042   /** Constructor */
00043   TrayIconImpl(const QString &iconFile, const QString &toolTip);
00044 
00045   /** Show the tray icon. */
00046   void show();
00047   /** Hide the tray icon. */
00048   void hide();
00049   /** Update the tray icon's image. */
00050   void setIcon(const QString &iconFile);
00051   /** Update the tray icon's tooltip. */
00052   void setToolTip(const QString &toolTip);
00053 
00054 private:
00055   /** Catches native Windows event messages. */
00056   bool winEvent (MSG *message, long *result);
00057   /** Sends a new Qt-based mouse event. */
00058   bool sendMouseEvent(QEvent::Type type, Qt::MouseButton button);
00059   /** Create an icon for the tray image from a given icon resource identifier. */
00060   HICON createIcon(const int resourceId);
00061   /** Updates the tray icon. */
00062   void updateTrayIcon(DWORD msg);
00063 
00064   HICON _icon;      /**< The tray icon image. */
00065   QString _toolTip; /**< The tray icon's tooltip. */
00066 };
00067 
00068 #endif
00069 

Generated on Mon Oct 23 20:08:16 2006 for Vidalia by  doxygen 1.5.0