mirror of
https://github.com/debauchee/barrier.git
synced 2024-12-24 11:32:43 +03:00
854d2c7fbf
be accessed now between open()/close(). ownership of the clipboard is asserted via the empty() method. this parallels the win32 model (but the win32 code hasn't been updated yet). refactored X11 clipboard code. moved the bulk of it into CXWindowsClipboard and moved some comment event handling into CXWindowsScreen. changed how requests are processed into a hopefully easier to understand model. added support for getting clipboard from and sending clipboard to motif (or at least lesstif) clients. sending to lesstif required a hack to work around an apparent bug in lesstif.
59 lines
1.3 KiB
C++
59 lines
1.3 KiB
C++
#ifndef CCLIPBOARD_H
|
|
#define CCLIPBOARD_H
|
|
|
|
//
|
|
// CClipboard -- stores clipboard data in a memory buffer
|
|
//
|
|
|
|
#include "IClipboard.h"
|
|
#include "CString.h"
|
|
|
|
class CClipboard : public IClipboard {
|
|
public:
|
|
CClipboard();
|
|
virtual ~CClipboard();
|
|
|
|
// manipulators
|
|
|
|
// unmarshall clipboard data
|
|
void unmarshall(const CString& data, Time);
|
|
|
|
// accessors
|
|
|
|
// marshall clipboard data
|
|
CString marshall() const;
|
|
|
|
// IClipboard overrides
|
|
virtual bool empty();
|
|
virtual void add(EFormat, const CString& data);
|
|
virtual bool open(Time) const;
|
|
virtual void close() const;
|
|
virtual Time getTime() const;
|
|
virtual bool has(EFormat) const;
|
|
virtual CString get(EFormat) const;
|
|
|
|
// accessors
|
|
|
|
// transfer all the data in one clipboard to another. the
|
|
// clipboards can be of any concrete clipboard type (and
|
|
// they don't have to be the same type). this also sets
|
|
// the timestamp to time, if provided, or the time in src.
|
|
// returns true iff the copy succeeded.
|
|
static bool copy(IClipboard* dst, const IClipboard* src);
|
|
static bool copy(IClipboard* dst, const IClipboard* src, Time);
|
|
|
|
private:
|
|
UInt32 readUInt32(const char*) const;
|
|
void writeUInt32(CString*, UInt32) const;
|
|
|
|
private:
|
|
mutable bool m_open;
|
|
mutable Time m_time;
|
|
bool m_owner;
|
|
Time m_timeOwned;
|
|
bool m_added[kNumFormats];
|
|
CString m_data[kNumFormats];
|
|
};
|
|
|
|
#endif
|