2001-10-06 18:13:28 +04:00
|
|
|
#ifndef CCLIENT_H
|
|
|
|
#define CCLIENT_H
|
|
|
|
|
2002-04-27 18:19:53 +04:00
|
|
|
#include "ClipboardTypes.h"
|
2002-04-29 17:31:44 +04:00
|
|
|
#include "IClipboard.h"
|
2002-06-11 02:06:45 +04:00
|
|
|
#include "CMutex.h"
|
|
|
|
#include "CString.h"
|
2001-10-06 18:13:28 +04:00
|
|
|
|
|
|
|
class CNetworkAddress;
|
|
|
|
class IInputStream;
|
|
|
|
class IOutputStream;
|
2001-10-08 23:24:46 +04:00
|
|
|
class ISecondaryScreen;
|
2001-10-06 18:13:28 +04:00
|
|
|
|
|
|
|
class CClient {
|
2002-04-29 18:40:01 +04:00
|
|
|
public:
|
2001-10-06 18:13:28 +04:00
|
|
|
CClient(const CString& clientName);
|
|
|
|
~CClient();
|
|
|
|
|
|
|
|
// manipulators
|
|
|
|
|
2002-06-10 02:20:28 +04: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-09 01:48:00 +04:00
|
|
|
// start the client. does not return until quit() is called.
|
2002-06-10 02:20:28 +04: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 18:13:28 +04:00
|
|
|
|
2002-06-09 01:48:00 +04:00
|
|
|
// tell client to exit gracefully
|
|
|
|
void quit();
|
|
|
|
|
2001-11-25 21:32:41 +03:00
|
|
|
// handle events on client's screen
|
2002-04-27 18:19:53 +04:00
|
|
|
void onClipboardChanged(ClipboardID);
|
2002-05-24 21:54:28 +04:00
|
|
|
void onResolutionChanged();
|
2001-11-25 21:32:41 +03:00
|
|
|
|
2001-10-06 18:13:28 +04:00
|
|
|
// accessors
|
|
|
|
|
|
|
|
|
2002-04-29 18:40:01 +04:00
|
|
|
private:
|
2001-10-14 22:29:43 +04:00
|
|
|
void runSession(void*);
|
|
|
|
|
2001-11-19 03:33:36 +03:00
|
|
|
// open/close the primary screen
|
|
|
|
void openSecondaryScreen();
|
|
|
|
void closeSecondaryScreen();
|
|
|
|
|
2001-10-06 18:13:28 +04:00
|
|
|
// message handlers
|
|
|
|
void onEnter();
|
|
|
|
void onLeave();
|
|
|
|
void onGrabClipboard();
|
|
|
|
void onScreenSaver();
|
|
|
|
void onQueryInfo();
|
2002-05-24 21:54:28 +04:00
|
|
|
void onQueryInfoNoLock();
|
|
|
|
void onInfoAcknowledgment();
|
2001-10-06 18:13:28 +04:00
|
|
|
void onSetClipboard();
|
|
|
|
void onKeyDown();
|
|
|
|
void onKeyRepeat();
|
|
|
|
void onKeyUp();
|
|
|
|
void onMouseDown();
|
|
|
|
void onMouseUp();
|
|
|
|
void onMouseMove();
|
|
|
|
void onMouseWheel();
|
2002-05-23 18:56:03 +04:00
|
|
|
void onErrorIncompatible();
|
|
|
|
void onErrorBusy();
|
2002-05-31 22:18:29 +04:00
|
|
|
void onErrorUnknown();
|
2002-05-23 18:56:03 +04:00
|
|
|
void onErrorBad();
|
2001-10-06 18:13:28 +04:00
|
|
|
|
2002-04-29 18:40:01 +04:00
|
|
|
private:
|
2001-11-25 21:32:41 +03:00
|
|
|
CMutex m_mutex;
|
2001-10-06 18:13:28 +04:00
|
|
|
CString m_name;
|
2001-10-08 23:24:46 +04:00
|
|
|
IInputStream* m_input;
|
2001-10-06 18:13:28 +04:00
|
|
|
IOutputStream* m_output;
|
2001-10-08 23:24:46 +04:00
|
|
|
ISecondaryScreen* m_screen;
|
2001-10-14 22:29:43 +04:00
|
|
|
const CNetworkAddress* m_serverAddress;
|
2002-06-10 02:20:28 +04:00
|
|
|
bool m_camp;
|
2002-04-29 17:31:44 +04:00
|
|
|
bool m_active;
|
|
|
|
UInt32 m_seqNum;
|
2002-05-24 21:54:28 +04:00
|
|
|
bool m_ignoreMove;
|
2002-04-29 17:31:44 +04:00
|
|
|
bool m_ownClipboard[kClipboardEnd];
|
|
|
|
IClipboard::Time m_timeClipboard[kClipboardEnd];
|
2002-05-24 21:54:28 +04:00
|
|
|
CString m_dataClipboard[kClipboardEnd];
|
2001-10-06 18:13:28 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|