2001-11-14 02:34:12 +03:00
|
|
|
#ifndef ICLIPBOARD_H
|
|
|
|
#define ICLIPBOARD_H
|
|
|
|
|
|
|
|
#include "IInterface.h"
|
2002-06-11 02:06:45 +04:00
|
|
|
#include "CString.h"
|
2001-11-14 02:34:12 +03:00
|
|
|
#include "BasicTypes.h"
|
|
|
|
|
|
|
|
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
|
2002-07-22 21:32:51 +04: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
|
2002-07-23 19:34:05 +04:00
|
|
|
// from these formats (e.g. UTF-16 encoded unicode).
|
2002-07-22 21:32:51 +04:00
|
|
|
//
|
2002-07-23 19:34:05 +04:00
|
|
|
// kText: UTF-8 encoded unicode (ISO-10646), newline is LF.
|
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
|