| 1 | /* | 
|---|
| 2 | * synergy -- mouse and keyboard sharing utility | 
|---|
| 3 | * Copyright (C) 2002 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 CCLIENTPROXY_H | 
|---|
| 16 | #define CCLIENTPROXY_H | 
|---|
| 17 |  | 
|---|
| 18 | #include "CBaseClientProxy.h" | 
|---|
| 19 | #include "CEvent.h" | 
|---|
| 20 | #include "CString.h" | 
|---|
| 21 |  | 
|---|
| 22 | class IStream; | 
|---|
| 23 |  | 
|---|
| 24 | //! Generic proxy for client | 
|---|
| 25 | class CClientProxy : public CBaseClientProxy { | 
|---|
| 26 | public: | 
|---|
| 27 | /*! | 
|---|
| 28 | \c name is the name of the client. | 
|---|
| 29 | */ | 
|---|
| 30 | CClientProxy(const CString& name, IStream* adoptedStream); | 
|---|
| 31 | ~CClientProxy(); | 
|---|
| 32 |  | 
|---|
| 33 | //! @name manipulators | 
|---|
| 34 | //@{ | 
|---|
| 35 |  | 
|---|
| 36 | //! Disconnect | 
|---|
| 37 | /*! | 
|---|
| 38 | Ask the client to disconnect, using \p msg as the reason. | 
|---|
| 39 | */ | 
|---|
| 40 | void                            close(const char* msg); | 
|---|
| 41 |  | 
|---|
| 42 | //@} | 
|---|
| 43 | //! @name accessors | 
|---|
| 44 | //@{ | 
|---|
| 45 |  | 
|---|
| 46 | //! Get stream | 
|---|
| 47 | /*! | 
|---|
| 48 | Returns the stream passed to the c'tor. | 
|---|
| 49 | */ | 
|---|
| 50 | IStream*                        getStream() const; | 
|---|
| 51 |  | 
|---|
| 52 | //! Get ready event type | 
|---|
| 53 | /*! | 
|---|
| 54 | Returns the ready event type.  This is sent when the client has | 
|---|
| 55 | completed the initial handshake.  Until it is sent, the client is | 
|---|
| 56 | not fully connected. | 
|---|
| 57 | */ | 
|---|
| 58 | static CEvent::Type     getReadyEvent(); | 
|---|
| 59 |  | 
|---|
| 60 | //! Get disconnect event type | 
|---|
| 61 | /*! | 
|---|
| 62 | Returns the disconnect event type.  This is sent when the client | 
|---|
| 63 | disconnects or is disconnected.  The target is getEventTarget(). | 
|---|
| 64 | */ | 
|---|
| 65 | static CEvent::Type     getDisconnectedEvent(); | 
|---|
| 66 |  | 
|---|
| 67 | //! Get clipboard changed event type | 
|---|
| 68 | /*! | 
|---|
| 69 | Returns the clipboard changed event type.  This is sent whenever the | 
|---|
| 70 | contents of the clipboard has changed.  The data is a pointer to a | 
|---|
| 71 | IScreen::CClipboardInfo. | 
|---|
| 72 | */ | 
|---|
| 73 | static CEvent::Type     getClipboardChangedEvent(); | 
|---|
| 74 |  | 
|---|
| 75 | //@} | 
|---|
| 76 |  | 
|---|
| 77 | // IScreen | 
|---|
| 78 | virtual void*           getEventTarget() const; | 
|---|
| 79 | virtual bool            getClipboard(ClipboardID id, IClipboard*) const = 0; | 
|---|
| 80 | virtual void            getShape(SInt32& x, SInt32& y, | 
|---|
| 81 | SInt32& width, SInt32& height) const = 0; | 
|---|
| 82 | virtual void            getCursorPos(SInt32& x, SInt32& y) const = 0; | 
|---|
| 83 |  | 
|---|
| 84 | // IClient overrides | 
|---|
| 85 | virtual void            enter(SInt32 xAbs, SInt32 yAbs, | 
|---|
| 86 | UInt32 seqNum, KeyModifierMask mask, | 
|---|
| 87 | bool forScreensaver) = 0; | 
|---|
| 88 | virtual bool            leave() = 0; | 
|---|
| 89 | virtual void            setClipboard(ClipboardID, const IClipboard*) = 0; | 
|---|
| 90 | virtual void            grabClipboard(ClipboardID) = 0; | 
|---|
| 91 | virtual void            setClipboardDirty(ClipboardID, bool) = 0; | 
|---|
| 92 | virtual void            keyDown(KeyID, KeyModifierMask, KeyButton) = 0; | 
|---|
| 93 | virtual void            keyRepeat(KeyID, KeyModifierMask, | 
|---|
| 94 | SInt32 count, KeyButton) = 0; | 
|---|
| 95 | virtual void            keyUp(KeyID, KeyModifierMask, KeyButton) = 0; | 
|---|
| 96 | virtual void            mouseDown(ButtonID) = 0; | 
|---|
| 97 | virtual void            mouseUp(ButtonID) = 0; | 
|---|
| 98 | virtual void            mouseMove(SInt32 xAbs, SInt32 yAbs) = 0; | 
|---|
| 99 | virtual void            mouseRelativeMove(SInt32 xRel, SInt32 yRel) = 0; | 
|---|
| 100 | virtual void            mouseWheel(SInt32 xDelta, SInt32 yDelta) = 0; | 
|---|
| 101 | virtual void            screensaver(bool activate) = 0; | 
|---|
| 102 | virtual void            resetOptions() = 0; | 
|---|
| 103 | virtual void            setOptions(const COptionsList& options) = 0; | 
|---|
| 104 |  | 
|---|
| 105 | private: | 
|---|
| 106 | IStream*                        m_stream; | 
|---|
| 107 |  | 
|---|
| 108 | static CEvent::Type     s_readyEvent; | 
|---|
| 109 | static CEvent::Type     s_disconnectedEvent; | 
|---|
| 110 | static CEvent::Type     s_clipboardChangedEvent; | 
|---|
| 111 | }; | 
|---|
| 112 |  | 
|---|
| 113 | #endif | 
|---|