2001-10-06 14:13:28 +00:00
|
|
|
#ifndef CCLIENT_H
|
|
|
|
#define CCLIENT_H
|
|
|
|
|
2001-11-25 18:32:41 +00:00
|
|
|
#include "CMutex.h"
|
2001-10-06 14:13:28 +00:00
|
|
|
#include "CString.h"
|
|
|
|
#include "BasicTypes.h"
|
2002-04-27 14:19:53 +00:00
|
|
|
#include "ClipboardTypes.h"
|
2002-04-29 13:31:44 +00:00
|
|
|
#include "IClipboard.h"
|
2001-10-06 14:13:28 +00:00
|
|
|
|
|
|
|
class CNetworkAddress;
|
|
|
|
class IInputStream;
|
|
|
|
class IOutputStream;
|
2001-10-08 19:24:46 +00:00
|
|
|
class ISecondaryScreen;
|
2001-10-06 14:13:28 +00:00
|
|
|
|
|
|
|
class CClient {
|
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-06-08 21:48:00 +00:00
|
|
|
// start the client. does not return until quit() is called.
|
2002-06-09 22:20:28 +00:00
|
|
|
// returns true if the client ever connected to the server
|
|
|
|
// successfully. may also throw exceptions after successfully
|
|
|
|
// connecting.
|
|
|
|
bool run(const CNetworkAddress& serverAddress);
|
2001-10-06 14:13:28 +00:00
|
|
|
|
2002-06-08 21:48:00 +00:00
|
|
|
// tell client to exit gracefully
|
|
|
|
void quit();
|
|
|
|
|
2001-11-25 18:32:41 +00:00
|
|
|
// handle events on client's screen
|
2002-04-27 14:19:53 +00:00
|
|
|
void onClipboardChanged(ClipboardID);
|
2002-05-24 17:54:28 +00:00
|
|
|
void onResolutionChanged();
|
2001-11-25 18:32:41 +00:00
|
|
|
|
2001-10-06 14:13:28 +00:00
|
|
|
// accessors
|
|
|
|
|
|
|
|
|
2002-04-29 14:40:01 +00:00
|
|
|
private:
|
2001-10-14 18:29:43 +00:00
|
|
|
void runSession(void*);
|
|
|
|
|
2001-11-19 00:33:36 +00:00
|
|
|
// open/close the primary screen
|
|
|
|
void openSecondaryScreen();
|
|
|
|
void closeSecondaryScreen();
|
|
|
|
|
2001-10-06 14:13:28 +00:00
|
|
|
// message handlers
|
|
|
|
void onEnter();
|
|
|
|
void onLeave();
|
|
|
|
void onGrabClipboard();
|
|
|
|
void onScreenSaver();
|
|
|
|
void onQueryInfo();
|
2002-05-24 17:54:28 +00:00
|
|
|
void onQueryInfoNoLock();
|
|
|
|
void onInfoAcknowledgment();
|
2001-10-06 14:13:28 +00:00
|
|
|
void onSetClipboard();
|
|
|
|
void onKeyDown();
|
|
|
|
void onKeyRepeat();
|
|
|
|
void onKeyUp();
|
|
|
|
void onMouseDown();
|
|
|
|
void onMouseUp();
|
|
|
|
void onMouseMove();
|
|
|
|
void onMouseWheel();
|
2002-05-23 14:56:03 +00:00
|
|
|
void onErrorIncompatible();
|
|
|
|
void onErrorBusy();
|
2002-05-31 18:18:29 +00:00
|
|
|
void onErrorUnknown();
|
2002-05-23 14:56:03 +00:00
|
|
|
void onErrorBad();
|
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
|
|
|
IInputStream* m_input;
|
2001-10-06 14:13:28 +00:00
|
|
|
IOutputStream* m_output;
|
2001-10-08 19:24:46 +00:00
|
|
|
ISecondaryScreen* m_screen;
|
2001-10-14 18:29:43 +00:00
|
|
|
const 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;
|
|
|
|
UInt32 m_seqNum;
|
2002-05-24 17:54:28 +00:00
|
|
|
bool m_ignoreMove;
|
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
|