| 1 | /* | 
|---|
| 2 | * synergy -- mouse and keyboard sharing utility | 
|---|
| 3 | * Copyright (C) 2003 Chris Schoeneman | 
|---|
| 4 | * | 
|---|
| 5 | * This package is free software; you can redistribute it and/or | 
|---|
| 6 | * modify it under the terms of the GNU General Public License | 
|---|
| 7 | * found in the file COPYING that should have accompanied this file. | 
|---|
| 8 | * | 
|---|
| 9 | * This package is distributed in the hope that it will be useful, | 
|---|
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 12 | * GNU General Public License for more details. | 
|---|
| 13 | */ | 
|---|
| 14 |  | 
|---|
| 15 | #ifndef CSERVERTASKBARRECEIVER_H | 
|---|
| 16 | #define CSERVERTASKBARRECEIVER_H | 
|---|
| 17 |  | 
|---|
| 18 | #include "CString.h" | 
|---|
| 19 | #include "IArchTaskBarReceiver.h" | 
|---|
| 20 | #include "stdvector.h" | 
|---|
| 21 |  | 
|---|
| 22 | class CServer; | 
|---|
| 23 |  | 
|---|
| 24 | //! Implementation of IArchTaskBarReceiver for the synergy server | 
|---|
| 25 | class CServerTaskBarReceiver : public IArchTaskBarReceiver { | 
|---|
| 26 | public: | 
|---|
| 27 | CServerTaskBarReceiver(); | 
|---|
| 28 | virtual ~CServerTaskBarReceiver(); | 
|---|
| 29 |  | 
|---|
| 30 | //! @name manipulators | 
|---|
| 31 | //@{ | 
|---|
| 32 |  | 
|---|
| 33 | //! Update status | 
|---|
| 34 | /*! | 
|---|
| 35 | Determine the status and query required information from the server. | 
|---|
| 36 | */ | 
|---|
| 37 | void                            updateStatus(CServer*, const CString& errorMsg); | 
|---|
| 38 |  | 
|---|
| 39 | //@} | 
|---|
| 40 |  | 
|---|
| 41 | // IArchTaskBarReceiver overrides | 
|---|
| 42 | virtual void            showStatus() = 0; | 
|---|
| 43 | virtual void            runMenu(int x, int y) = 0; | 
|---|
| 44 | virtual void            primaryAction() = 0; | 
|---|
| 45 | virtual void            lock() const; | 
|---|
| 46 | virtual void            unlock() const; | 
|---|
| 47 | virtual const Icon      getIcon() const = 0; | 
|---|
| 48 | virtual std::string     getToolTip() const; | 
|---|
| 49 |  | 
|---|
| 50 | protected: | 
|---|
| 51 | typedef std::vector<CString> CClients; | 
|---|
| 52 | enum EState { | 
|---|
| 53 | kNotRunning, | 
|---|
| 54 | kNotWorking, | 
|---|
| 55 | kNotConnected, | 
|---|
| 56 | kConnected, | 
|---|
| 57 | kMaxState | 
|---|
| 58 | }; | 
|---|
| 59 |  | 
|---|
| 60 | //! Get status | 
|---|
| 61 | EState                          getStatus() const; | 
|---|
| 62 |  | 
|---|
| 63 | //! Get error message | 
|---|
| 64 | const CString&          getErrorMessage() const; | 
|---|
| 65 |  | 
|---|
| 66 | //! Get connected clients | 
|---|
| 67 | const CClients&         getClients() const; | 
|---|
| 68 |  | 
|---|
| 69 | //! Quit app | 
|---|
| 70 | /*! | 
|---|
| 71 | Causes the application to quit gracefully | 
|---|
| 72 | */ | 
|---|
| 73 | void                            quit(); | 
|---|
| 74 |  | 
|---|
| 75 | //! Status change notification | 
|---|
| 76 | /*! | 
|---|
| 77 | Called when status changes.  The default implementation does | 
|---|
| 78 | nothing. | 
|---|
| 79 | */ | 
|---|
| 80 | virtual void            onStatusChanged(CServer* server); | 
|---|
| 81 |  | 
|---|
| 82 | private: | 
|---|
| 83 | EState                          m_state; | 
|---|
| 84 | CString                         m_errorMessage; | 
|---|
| 85 | CClients                        m_clients; | 
|---|
| 86 | }; | 
|---|
| 87 |  | 
|---|
| 88 | #endif | 
|---|