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_mac.h 00024 * \version $Id: trayicon_mac.h 1769 2007-06-03 21:59:21Z edmanm $ 00025 * \brief Tray icon implementation on OS X (Dock icon) 00026 */ 00027 00028 #ifndef _TRAYICON_MAC_H 00029 #define _TRAYICON_MAC_H 00030 00031 #include <Carbon/Carbon.h> 00032 00033 #include <QWidget> 00034 #include <QString> 00035 00036 00037 class TrayIconImpl : public QWidget 00038 { 00039 protected: 00040 /** Default Constructor */ 00041 TrayIconImpl(); 00042 /** Destructor */ 00043 ~TrayIconImpl(); 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 /** Load icon data from the given file and create a CGImageRef. */ 00056 CGImageRef createIconFromFile(FSSpec fileSpec); 00057 /** Create an icon from the given filename in the application bundle. */ 00058 CGImageRef createIcon(const QString &iconFile); 00059 /** Callback used by CGDataProviderCreateWithData(). */ 00060 static void releaseCallback(void *info, const void *data, size_t size); 00061 00062 CGImageRef _imageRef; /**< Tray icon image. */ 00063 bool _shown; /**< True if the dock icon is to be displayed. */ 00064 }; 00065 00066 #endif 00067