2001-11-14 02:34:12 +03:00
|
|
|
#ifndef ICLIPBOARD_H
|
|
|
|
#define ICLIPBOARD_H
|
|
|
|
|
|
|
|
#include "IInterface.h"
|
|
|
|
#include "BasicTypes.h"
|
|
|
|
|
|
|
|
class CString;
|
|
|
|
|
|
|
|
class IClipboard : public IInterface {
|
2002-04-29 18:40:01 +04:00
|
|
|
public:
|
2002-04-29 17:31:44 +04:00
|
|
|
// timestamp type. timestamps are in milliseconds from some
|
|
|
|
// arbitrary starting time. timestamps will wrap around to 0
|
|
|
|
// after about 49 3/4 days.
|
|
|
|
typedef UInt32 Time;
|
|
|
|
|
|
|
|
// known clipboard formats. kNumFormats must be last and
|
|
|
|
// formats must be sequential starting from zero.
|
2001-11-25 21:32:41 +03:00
|
|
|
enum EFormat { kText, kNumFormats };
|
2001-11-14 02:34:12 +03:00
|
|
|
|
|
|
|
// manipulators
|
|
|
|
|
2002-05-27 20:22:59 +04:00
|
|
|
// take ownership of the clipboard and clear all data from it.
|
|
|
|
// must be called between an open() and close(). if returns
|
|
|
|
// false then the clipboard ownership could not be taken; the
|
|
|
|
// clipboard should not be emptied in this case.
|
|
|
|
virtual bool empty() = 0;
|
2001-11-14 02:34:12 +03:00
|
|
|
|
|
|
|
// add data in the given format to the clipboard. data is
|
|
|
|
// passed as a string but the contents are generally not
|
2002-05-27 20:22:59 +04:00
|
|
|
// interpreted. may only be called after a successful empty().
|
2001-11-14 02:34:12 +03:00
|
|
|
virtual void add(EFormat, const CString& data) = 0;
|
|
|
|
|
|
|
|
// accessors
|
|
|
|
|
2002-05-27 20:22:59 +04:00
|
|
|
// open the clipboard. return true iff the clipboard could
|
|
|
|
// be opened. if open() returns true then it must be followed
|
|
|
|
// by a close() at some later time; if it returns false then
|
|
|
|
// close() must not be called.
|
|
|
|
virtual bool open(Time) const = 0;
|
|
|
|
|
|
|
|
// close the clipboard. close() must match a preceding open().
|
|
|
|
// this signals that the clipboard has been filled with all the
|
|
|
|
// necessary data. it does not mean the clipboard ownership
|
|
|
|
// should be released.
|
|
|
|
virtual void close() const = 0;
|
|
|
|
|
2002-04-29 17:31:44 +04:00
|
|
|
// returns the timestamp passed to the last successful open().
|
|
|
|
virtual Time getTime() const = 0;
|
|
|
|
|
2001-11-14 02:34:12 +03:00
|
|
|
// returns true iff the clipboard contains data in the given
|
2002-05-27 20:22:59 +04:00
|
|
|
// format. must be called between an open() and close().
|
2001-11-14 02:34:12 +03:00
|
|
|
virtual bool has(EFormat) const = 0;
|
|
|
|
|
|
|
|
// returns data in the given format. rturns the empty string
|
2002-05-27 20:22:59 +04:00
|
|
|
// if there is no data in that format. must be called between
|
|
|
|
// an open() and close().
|
2001-11-14 02:34:12 +03:00
|
|
|
virtual CString get(EFormat) const = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|