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"
|
|
|
|
|
2002-07-29 20:07:26 +04:00
|
|
|
//! Clipboard interface
|
|
|
|
/*!
|
|
|
|
This interface defines the methods common to all clipboards.
|
|
|
|
*/
|
2001-11-14 02:34:12 +03:00
|
|
|
class IClipboard : public IInterface {
|
2002-04-29 18:40:01 +04:00
|
|
|
public:
|
2002-07-29 20:07:26 +04:00
|
|
|
//! Timestamp type
|
|
|
|
/*!
|
|
|
|
Timestamp type. Timestamps are in milliseconds from some
|
|
|
|
arbitrary starting time. Timestamps will wrap around to 0
|
|
|
|
after about 49 3/4 days.
|
|
|
|
*/
|
2002-04-29 17:31:44 +04:00
|
|
|
typedef UInt32 Time;
|
|
|
|
|
2002-07-29 20:07:26 +04:00
|
|
|
//! Clipboard formats
|
|
|
|
/*!
|
|
|
|
The list of known clipboard formats. kNumFormats must be last and
|
|
|
|
formats must be sequential starting from zero. Clipboard data set
|
|
|
|
via add() and retrieved via get() must be in one of these formats.
|
|
|
|
Platform dependent clipboard subclasses can and should present any
|
|
|
|
suitable formats derivable from these formats.
|
|
|
|
*/
|
|
|
|
enum EFormat {
|
|
|
|
kText, //!< Text format, UTF-8, newline is LF
|
|
|
|
kNumFormats //!< The number of clipboard formats
|
|
|
|
};
|
2001-11-14 02:34:12 +03:00
|
|
|
|
2002-07-29 20:07:26 +04:00
|
|
|
//! @name manipulators
|
|
|
|
//@{
|
2001-11-14 02:34:12 +03:00
|
|
|
|
2002-07-29 20:07:26 +04:00
|
|
|
//! Empty clipboard
|
|
|
|
/*!
|
|
|
|
Take ownership of the clipboard and clear all data from it.
|
|
|
|
This must be called between a successful open() and close().
|
|
|
|
Return false if the clipboard ownership could not be taken;
|
|
|
|
the clipboard should not be emptied in this case.
|
|
|
|
*/
|
2002-05-27 20:22:59 +04:00
|
|
|
virtual bool empty() = 0;
|
2001-11-14 02:34:12 +03:00
|
|
|
|
2002-07-29 20:07:26 +04:00
|
|
|
//! Add data
|
|
|
|
/*!
|
|
|
|
Add data in the given format to the clipboard. May only be
|
|
|
|
called after a successful empty().
|
|
|
|
*/
|
2001-11-14 02:34:12 +03:00
|
|
|
virtual void add(EFormat, const CString& data) = 0;
|
|
|
|
|
2002-07-29 20:07:26 +04:00
|
|
|
//@}
|
|
|
|
//! @name accessors
|
|
|
|
//@{
|
2001-11-14 02:34:12 +03:00
|
|
|
|
2002-07-29 20:07:26 +04:00
|
|
|
//! Open clipboard
|
|
|
|
/*!
|
|
|
|
Open the clipboard. Return true iff the clipboard could be
|
|
|
|
opened. If open() returns true then the client must call
|
|
|
|
close() at some later time; if it returns false then close()
|
|
|
|
must not be called. \c time should be the current time or
|
|
|
|
a time in the past when the open should effectively have taken
|
|
|
|
place.
|
|
|
|
*/
|
|
|
|
virtual bool open(Time time) const = 0;
|
2002-05-27 20:22:59 +04:00
|
|
|
|
2002-07-29 20:07:26 +04:00
|
|
|
//! Close clipboard
|
|
|
|
/*!
|
|
|
|
Close the clipboard. close() must match a preceding successful
|
|
|
|
open(). This signals that the clipboard has been filled with
|
|
|
|
all the necessary data or all data has been read. It does not
|
|
|
|
mean the clipboard ownership should be released (if it was
|
|
|
|
taken).
|
|
|
|
*/
|
2002-05-27 20:22:59 +04:00
|
|
|
virtual void close() const = 0;
|
|
|
|
|
2002-07-29 20:07:26 +04:00
|
|
|
//! Get time
|
|
|
|
/*!
|
|
|
|
Return the timestamp passed to the last successful open().
|
|
|
|
*/
|
2002-04-29 17:31:44 +04:00
|
|
|
virtual Time getTime() const = 0;
|
|
|
|
|
2002-07-29 20:07:26 +04:00
|
|
|
//! Check for data
|
|
|
|
/*!
|
|
|
|
Return true iff the clipboard contains data in the given
|
|
|
|
format. Must be called between a successful open() and close().
|
|
|
|
*/
|
2001-11-14 02:34:12 +03:00
|
|
|
virtual bool has(EFormat) const = 0;
|
|
|
|
|
2002-07-29 20:07:26 +04:00
|
|
|
//! Get data
|
|
|
|
/*!
|
|
|
|
Return the data in the given format. Returns the empty string
|
|
|
|
if there is no data in that format. Must be called between
|
|
|
|
a successful open() and close().
|
|
|
|
*/
|
2001-11-14 02:34:12 +03:00
|
|
|
virtual CString get(EFormat) const = 0;
|
2002-07-29 20:07:26 +04:00
|
|
|
|
|
|
|
//@}
|
2001-11-14 02:34:12 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|