/*
 ============================================================================
 xoblite -> an alternative shell based on Blackbox for Windows
 Copyright  2002-2005 Karl-Henrik Henriksson [qwilk]
 Copyright  2001-2004 The Blackbox for Windows Development Team
 http://xoblite.net/ - #bb4win on irc.freenode.net
 ============================================================================

  Blackbox for Windows is free software, released under the
  GNU General Public License (GPL version 2 or later), with an extension
  that allows linking of proprietary modules under a controlled interface.
  What this means is that plugins etc. are allowed to be released
  under any license the author wishes. Please note, however, that the
  original Blackbox gradient math code used in Blackbox for Windows
  is available under the BSD license.

  http://www.fsf.org/licenses/gpl.html
  http://www.fsf.org/licenses/gpl-faq.html#LinkingOverControlledInterface
  http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  GNU General Public License for more details.

  For additional license information, please read the included license.html

 ============================================================================
*/

#ifndef __TRAYMANAGER_H 
#define __TRAYMANAGER_H 

#ifndef _WIN32_IE 
#define _WIN32_IE               0x0500  // Enables all the needed define's in ShellAPI.h
#endif 

#ifndef _WIN32_DCOM 
#define _WIN32_DCOM 
#endif 

#include "BBApi.h" 
#include "BImage.h" 
#include "Settings.h" 
#include "Toolbar.h" 
#include "Systembar.h" 
#include "Menu/MenuMaker.h" 
#include "Desk.h" 

#include <windows.h> 
#include <string> 
#include <shlwapi.h> 
#include <shellapi.h>                   // NOTIFYICONDATA structure, NIM_'s etc.
#include <docobj.h>                             // needed for OLE stuff 
#include <shlobj.h> 

#ifndef NIN_BALLOONSHOW 
#define NIN_BALLOONSHOW     (WM_USER + 2) 
#endif 
#ifndef NIN_BALLOONHIDE 
#define NIN_BALLOONHIDE     (WM_USER + 3) 
#endif 
#ifndef NIN_BALLOONTIMEOUT 
#define NIN_BALLOONTIMEOUT  (WM_USER + 4) 
#endif 
#ifndef NIN_BALLOONUSERCLICK 
#define NIN_BALLOONUSERCLICK (WM_USER + 5) 
#endif 

//===========================================================================

#define SYSTRAY_CLEAN_TIMER 1 

//===========================================================================

// NOTIFYICONDATA as used by shell32.dll version 5
typedef struct _NOTIFYICONDATAV5
{
        DWORD cbSize;
        HWND hWnd;
        UINT uID;
        UINT uFlags;
        UINT uCallbackMessage;
        HICON hIcon;
        WCHAR szTip[128];
        DWORD dwState;
        DWORD dwStateMask;
        WCHAR szInfo[256];
        union
        {
                UINT uTimeout;
                UINT uVersion;
        };
        WCHAR szInfoTitle[64];
        DWORD dwInfoFlags;
} NOTIFYICONDATAV5;

//====================

typedef struct SHELLTRAYDATA
{
        DWORD dwUnknown;
        DWORD dwMessage;
        NOTIFYICONDATA iconData;
} SHELLTRAYDATA;

//===========================================================================

class TrayManager
{
public:
        TrayManager(HINSTANCE hInstance, bool DisableTray);
        ~TrayManager();

        void Initialize();

        friend LRESULT CALLBACK TrayManagerWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);

        bool AddTrayIcon(NOTIFYICONDATA *iconData);
        bool ModifyTrayIcon(trayIconItem *icon, NOTIFYICONDATA *iconData);
        bool RemoveTrayIcon(trayIconItem *iconData);
        trayIconItem* FindTrayIcon(NOTIFYICONDATA *iconData);
        bool CreateXobloonNotification(trayIconItem *icon, NOTIFYICONDATA *iconData);
        void CleanTray();

        int GetTraySize();
        trayIconItem* GetTrayIcon(int pointer);
        bool ConvertTip(char *destination, WCHAR *tip);

        void LoadShellServiceObjects();
        void UnloadShellServiceObjects();

        //====================

        HINSTANCE hTrayManagerInstance;
        HWND hBlackboxWnd; // Blackbox window handle
        HWND hTrayManagerWnd; // TrayManager window handle
        HWND hTrayNotifyWnd; // Child window of hTrayManagerWnd

        //====================

        bool TrayManagerDisabled;

        OSVERSIONINFO osInfo;
        bool usingWin2kXP;

        bool TrayManagerReady;
        bool COMinitialized;

        bool ShowBalloonTooltip;
        char BalloonTooltipText[350];
        LPCSTR BalloonTooltipIcon;
        trayIconItem BalloonTooltipItem;

        //====================

        typedef vector<trayIconItem*> trayIconVector;
        trayIconVector trayIconList;
        typedef vector<IOleCommandTarget*> ssoIconVector;
        ssoIconVector ssoIconList;
};

//===========================================================================

#endif /* __TRAYMANAGER_H */ 





syntax highlighting by

w e b c p p
web c plus plus