barrier/client/CClient.h

89 lines
2.0 KiB
C
Raw Normal View History

2001-10-06 14:13:28 +00:00
#ifndef CCLIENT_H
#define CCLIENT_H
#include "CMutex.h"
2001-10-06 14:13:28 +00:00
#include "CString.h"
#include "BasicTypes.h"
#include "ClipboardTypes.h"
#include "IClipboard.h"
2001-10-06 14:13:28 +00:00
class CNetworkAddress;
class IInputStream;
class IOutputStream;
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
// 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);
// start the client. does not return until quit() is called.
// 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
// tell client to exit gracefully
void quit();
// handle events on client's screen
void onClipboardChanged(ClipboardID);
void onResolutionChanged();
2001-10-06 14:13:28 +00:00
// accessors
2002-04-29 14:40:01 +00:00
private:
void runSession(void*);
// 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();
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();
void onErrorIncompatible();
void onErrorBusy();
void onErrorUnknown();
void onErrorBad();
2001-10-06 14:13:28 +00:00
2002-04-29 14:40:01 +00:00
private:
CMutex m_mutex;
2001-10-06 14:13:28 +00:00
CString m_name;
IInputStream* m_input;
2001-10-06 14:13:28 +00:00
IOutputStream* m_output;
ISecondaryScreen* m_screen;
const CNetworkAddress* m_serverAddress;
bool m_camp;
bool m_active;
UInt32 m_seqNum;
bool m_ignoreMove;
bool m_ownClipboard[kClipboardEnd];
IClipboard::Time m_timeClipboard[kClipboardEnd];
CString m_dataClipboard[kClipboardEnd];
2001-10-06 14:13:28 +00:00
};
#endif