Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

CArchTaskBarWindows.h

00001 /*
00002  * synergy -- mouse and keyboard sharing utility
00003  * Copyright (C) 2003 Chris Schoeneman
00004  * 
00005  * This package is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * found in the file COPYING that should have accompanied this file.
00008  * 
00009  * This package is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  */
00014 
00015 #ifndef CARCHTASKBARWINDOWS_H
00016 #define CARCHTASKBARWINDOWS_H
00017 
00018 #define WIN32_LEAN_AND_MEAN
00019 
00020 #include "IArchTaskBar.h"
00021 #include "IArchMultithread.h"
00022 #include "stdmap.h"
00023 #include "stdvector.h"
00024 #include <windows.h>
00025 
00026 #define ARCH_TASKBAR CArchTaskBarWindows
00027 
00029 class CArchTaskBarWindows : public IArchTaskBar {
00030 public:
00031     CArchTaskBarWindows(void*);
00032     virtual ~CArchTaskBarWindows();
00033 
00035 
00040     static void         addDialog(HWND);
00041 
00043 
00046     static void         removeDialog(HWND);
00047 
00048     // IArchTaskBar overrides
00049     virtual void        addReceiver(IArchTaskBarReceiver*);
00050     virtual void        removeReceiver(IArchTaskBarReceiver*);
00051     virtual void        updateReceiver(IArchTaskBarReceiver*);
00052 
00053 private:
00054     class CReceiverInfo {
00055     public:
00056         UINT            m_id;
00057     };
00058 
00059     typedef std::map<IArchTaskBarReceiver*, CReceiverInfo> CReceiverToInfoMap;
00060     typedef std::map<UINT, CReceiverToInfoMap::iterator> CIDToReceiverMap;
00061     typedef std::vector<UINT> CIDStack;
00062     typedef std::map<HWND, bool> CDialogs;
00063 
00064     UINT                getNextID();
00065     void                recycleID(UINT);
00066 
00067     void                addIcon(UINT);
00068     void                removeIcon(UINT);
00069     void                updateIcon(UINT);
00070     void                addAllIcons();
00071     void                removeAllIcons();
00072     void                modifyIconNoLock(CReceiverToInfoMap::const_iterator,
00073                             DWORD taskBarMessage);
00074     void                removeIconNoLock(UINT id);
00075     void                handleIconMessage(IArchTaskBarReceiver*, LPARAM);
00076 
00077     bool                processDialogs(MSG*);
00078     LRESULT             wndProc(HWND, UINT, WPARAM, LPARAM);
00079     static LRESULT CALLBACK
00080                         staticWndProc(HWND, UINT, WPARAM, LPARAM);
00081     void                threadMainLoop();
00082     static void*        threadEntry(void*);
00083 
00084 private:
00085     static CArchTaskBarWindows* s_instance;
00086     static HINSTANCE    s_appInstance;
00087 
00088     // multithread data
00089     CArchMutex          m_mutex;
00090     CArchCond           m_condVar;
00091     bool                m_ready;
00092     int                 m_result;
00093     CArchThread         m_thread;
00094 
00095     // child thread data
00096     HWND                m_hwnd;
00097     UINT                m_taskBarRestart;
00098 
00099     // shared data
00100     CReceiverToInfoMap  m_receivers;
00101     CIDToReceiverMap    m_idTable;
00102     CIDStack            m_oldIDs;
00103     UINT                m_nextID;
00104 
00105     // dialogs
00106     CDialogs            m_dialogs;
00107     CDialogs            m_addedDialogs;
00108 };
00109 
00110 #endif

Generated on Fri Nov 6 00:21:13 2009 for synergy-plus by  doxygen 1.3.9.1