2001-10-06 14:13:28 +00:00
|
|
|
#ifndef CCLIENT_H
|
|
|
|
#define CCLIENT_H
|
|
|
|
|
2002-07-10 21:22:28 +00:00
|
|
|
#include "IScreenReceiver.h"
|
2002-07-10 20:18:32 +00:00
|
|
|
#include "IClient.h"
|
2002-04-29 13:31:44 +00:00
|
|
|
#include "IClipboard.h"
|
2002-07-10 20:18:32 +00:00
|
|
|
#include "CNetworkAddress.h"
|
2002-06-10 22:06:45 +00:00
|
|
|
#include "CMutex.h"
|
2001-10-06 14:13:28 +00:00
|
|
|
|
2002-07-10 20:18:32 +00:00
|
|
|
class CServerProxy;
|
|
|
|
class CThread;
|
|
|
|
class IDataSocket;
|
2001-10-08 19:24:46 +00:00
|
|
|
class ISecondaryScreen;
|
2002-07-10 21:22:28 +00:00
|
|
|
class IScreenReceiver;
|
2001-10-06 14:13:28 +00:00
|
|
|
|
2002-07-10 21:22:28 +00:00
|
|
|
class CClient : public IScreenReceiver, public IClient {
|
2002-04-29 14:40:01 +00:00
|
|
|
public:
|
2001-10-06 14:13:28 +00:00
|
|
|
CClient(const CString& clientName);
|
|
|
|
~CClient();
|
|
|
|
|
|
|
|
// manipulators
|
|
|
|
|
2002-06-09 22:20:28 +00:00
|
|
|
// turn camping on or off. when camping the client will keep
|
|
|
|
// trying to connect to the server until it succeeds. this
|
|
|
|
// is useful if the client may start before the server. do
|
|
|
|
// not call this while in run().
|
|
|
|
void camp(bool on);
|
|
|
|
|
2002-07-10 20:18:32 +00:00
|
|
|
// set the server's address that the client should connect to
|
|
|
|
void setAddress(const CNetworkAddress& serverAddress);
|
2001-10-06 14:13:28 +00:00
|
|
|
|
2002-06-21 17:55:47 +00:00
|
|
|
// tell client to exit run() gracefully. this must only be called
|
|
|
|
// after a successful open().
|
2002-06-08 21:48:00 +00:00
|
|
|
void quit();
|
|
|
|
|
2001-10-06 14:13:28 +00:00
|
|
|
// accessors
|
|
|
|
|
2002-07-10 20:18:32 +00:00
|
|
|
// returns true if the server rejected us
|
|
|
|
bool wasRejected() const;
|
|
|
|
|
2002-07-10 21:22:28 +00:00
|
|
|
// IScreenReceiver overrides
|
|
|
|
virtual void onInfoChanged(const CClientInfo&);
|
|
|
|
virtual bool onGrabClipboard(ClipboardID);
|
|
|
|
virtual void onClipboardChanged(ClipboardID, const CString&);
|
|
|
|
|
2002-07-10 20:18:32 +00:00
|
|
|
// IClient overrides
|
|
|
|
virtual bool open();
|
|
|
|
virtual void run();
|
|
|
|
virtual void close();
|
2002-07-10 21:22:28 +00:00
|
|
|
// FIXME -- can we avoid passing everything here?
|
2002-07-10 20:18:32 +00:00
|
|
|
virtual void enter(SInt32 xAbs, SInt32 yAbs,
|
|
|
|
UInt32 seqNum, KeyModifierMask mask,
|
|
|
|
bool screenSaver);
|
|
|
|
virtual bool leave();
|
|
|
|
virtual void setClipboard(ClipboardID, const CString&);
|
|
|
|
virtual void grabClipboard(ClipboardID);
|
|
|
|
virtual void setClipboardDirty(ClipboardID, bool dirty);
|
|
|
|
virtual void keyDown(KeyID, KeyModifierMask);
|
|
|
|
virtual void keyRepeat(KeyID, KeyModifierMask, SInt32 count);
|
|
|
|
virtual void keyUp(KeyID, KeyModifierMask);
|
|
|
|
virtual void mouseDown(ButtonID);
|
|
|
|
virtual void mouseUp(ButtonID);
|
|
|
|
virtual void mouseMove(SInt32 xAbs, SInt32 yAbs);
|
|
|
|
virtual void mouseWheel(SInt32 delta);
|
|
|
|
virtual void screenSaver(bool activate);
|
|
|
|
virtual CString getName() const;
|
|
|
|
virtual void getShape(SInt32& x, SInt32& y,
|
|
|
|
SInt32& width, SInt32& height) const;
|
|
|
|
virtual void getCenter(SInt32& x, SInt32& y) const;
|
|
|
|
virtual void getMousePos(SInt32& x, SInt32& y) const;
|
|
|
|
virtual SInt32 getJumpZoneSize() const;
|
2001-10-06 14:13:28 +00:00
|
|
|
|
2002-04-29 14:40:01 +00:00
|
|
|
private:
|
2002-06-26 13:48:08 +00:00
|
|
|
// open/close the secondary screen
|
2001-11-19 00:33:36 +00:00
|
|
|
void openSecondaryScreen();
|
|
|
|
void closeSecondaryScreen();
|
|
|
|
|
2002-07-10 20:18:32 +00:00
|
|
|
// send the clipboard to the server
|
|
|
|
void sendClipboard(ClipboardID);
|
|
|
|
|
|
|
|
// handle server messaging
|
|
|
|
void runSession(void*);
|
|
|
|
void deleteSession(CThread*);
|
|
|
|
void runServer();
|
|
|
|
CServerProxy* handshakeServer(IDataSocket*);
|
2001-10-06 14:13:28 +00:00
|
|
|
|
2002-04-29 14:40:01 +00:00
|
|
|
private:
|
2001-11-25 18:32:41 +00:00
|
|
|
CMutex m_mutex;
|
2001-10-06 14:13:28 +00:00
|
|
|
CString m_name;
|
2001-10-08 19:24:46 +00:00
|
|
|
ISecondaryScreen* m_screen;
|
2002-07-10 21:22:28 +00:00
|
|
|
IScreenReceiver* m_server;
|
2002-07-10 20:18:32 +00:00
|
|
|
CNetworkAddress m_serverAddress;
|
2002-06-09 22:20:28 +00:00
|
|
|
bool m_camp;
|
2002-04-29 13:31:44 +00:00
|
|
|
bool m_active;
|
2002-07-10 20:18:32 +00:00
|
|
|
bool m_rejected;
|
2002-04-29 13:31:44 +00:00
|
|
|
bool m_ownClipboard[kClipboardEnd];
|
|
|
|
IClipboard::Time m_timeClipboard[kClipboardEnd];
|
2002-05-24 17:54:28 +00:00
|
|
|
CString m_dataClipboard[kClipboardEnd];
|
2001-10-06 14:13:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|