#ifndef _COMMON_CLIPBOARD_HPP_
#define _COMMON_CLIPBOARD_HPP_
#ifndef _COMMON_WINDOWS_HPP_
#include <common/windows.hpp>
#endif
#ifndef _COMMON_GUIWINDOW_HPP_
#include <common/guiwnd.hpp>
#endif

class Clipboard
{
public:
  typedef enum Format{Bitmap=CF_BITMAP,Dib=CF_DIB,EnhMetaFile=CF_ENHMETAFILE,MetFilePict=CF_METAFILEPICT,
	   OemText=CF_OEMTEXT,Text=CF_TEXT,UnicodeText=CF_UNICODETEXT};
	Clipboard(GUIWindow &parentWindow);
	virtual ~Clipboard();
	bool isOkay(void)const;
	bool emptyClipboard(void)const;
	bool setClipboard(Format format,HANDLE hData);
	bool setClipboard(const String &strText);
	bool setClipboard(UINT format,const String &strText);
	void setDrawDataHandler(PureCallback *pCallback);
  bool getClipboard(String &strText)const;
  bool getClipboard(UINT format,String &strText)const;
	static UINT registerClipboardFormat(const String &strFormatName);
	static bool hasData(Format format);
	static bool hasData(UINT format);
protected:
  virtual void drawClipboard(void);
private:
  CallbackData::ReturnType changeCBChainHandler(CallbackData &someCallbackData);
	CallbackData::ReturnType drawClipboardHandler(CallbackData &someCallbackData);
	CallbackData::ReturnType destroyHandler(CallbackData &someCallbackData);
	void removeCBChain(void);

	Callback<Clipboard> mChangeCBChainHandler;
	Callback<Clipboard> mDrawClipboardHandler;
	Callback<Clipboard> mDestroyHandler;

	CallbackPointer mDrawDataHandler;
	GUIWindow &mParentWindow;
	HWND mhNextViewerWnd;
};

inline
bool Clipboard::emptyClipboard(void)const
{
  return ::EmptyClipboard();
}
#endif // macro guards


