2001-11-13 23:34:12 +00:00
|
|
|
#ifndef ICLIPBOARD_H
|
|
|
|
#define ICLIPBOARD_H
|
|
|
|
|
|
|
|
#include "IInterface.h"
|
2002-06-10 22:06:45 +00:00
|
|
|
#include "CString.h"
|
2001-11-13 23:34:12 +00:00
|
|
|
#include "BasicTypes.h"
|
|
|
|
|
|
|
|
class IClipboard : public IInterface {
|
2002-04-29 14:40:01 +00:00
|
|
|
public:
|
2002-04-29 13:31:44 +00: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
|
2002-07-22 17:32:51 +00:00
|
|
|
// formats must be sequential starting from zero. clipboard
|
|
|
|
// data set via add() and retrieved via get() is in one of
|
|
|
|
// these formats. platform dependent clipboard subclasses
|
|
|
|
// can and should present any suitable formats derivable
|
|
|
|
// from these formats (e.g. UCS-16 encoded unicode).
|
|
|
|
//
|
|
|
|
// kText: UTF-8 encoded unicode (ISO-10646), newline is LF
|
2001-11-25 18:32:41 +00:00
|
|
|
enum EFormat { kText, kNumFormats };
|
2001-11-13 23:34:12 +00:00
|
|
|
|
|
|
|
// manipulators
|
|
|
|
|
2002-05-27 16:22:59 +00: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-13 23:34:12 +00: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 16:22:59 +00:00
|
|
|
// interpreted. may only be called after a successful empty().
|
2001-11-13 23:34:12 +00:00
|
|
|
virtual void add(EFormat, const CString& data) = 0;
|
|
|
|
|
|
|
|
// accessors
|
|
|
|
|
2002-05-27 16:22:59 +00: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 13:31:44 +00:00
|
|
|
// returns the timestamp passed to the last successful open().
|
|
|
|
virtual Time getTime() const = 0;
|
|
|
|
|
2001-11-13 23:34:12 +00:00
|
|
|
// returns true iff the clipboard contains data in the given
|
2002-05-27 16:22:59 +00:00
|
|
|
// format. must be called between an open() and close().
|
2001-11-13 23:34:12 +00:00
|
|
|
virtual bool has(EFormat) const = 0;
|
|
|
|
|
|
|
|
// returns data in the given format. rturns the empty string
|
2002-05-27 16:22:59 +00:00
|
|
|
// if there is no data in that format. must be called between
|
|
|
|
// an open() and close().
|
2001-11-13 23:34:12 +00:00
|
|
|
virtual CString get(EFormat) const = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|