• Main Page
  • Classes
  • Files
  • File List

CArchTaskBarWindows.h

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

Generated on Thu May 23 2013 00:00:03 for Synergy by  doxygen 1.7.1