#ifndef _WX_CLIPBRD_H_BASE_
#define _WX_CLIPBRD_H_BASE_
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(__APPLE__)
#pragma interface "clipboardbase.h"
#endif
// close the clipboard after Add/SetData() and GetData()
virtual void Close() = 0;
+ // query whether the clipboard is opened
+ virtual bool IsOpened() const = 0;
+
// add to the clipboard data
//
// NB: the clipboard owns the pointer and will delete it, so data must be
#include "wx/motif/clipbrd.h"
#elif defined(__WXGTK__)
#include "wx/gtk/clipbrd.h"
-#elif defined(__WXQT__)
- #include "wx/gtk/clipbrd.h"
+#elif defined(__WXX11__)
+ #include "wx/x11/clipbrd.h"
+#elif defined(__WXMGL__)
+ #include "wx/mgl/clipbrd.h"
#elif defined(__WXMAC__)
#include "wx/mac/clipbrd.h"
#elif defined(__WXPM__)
// The global clipboard object
WXDLLEXPORT_DATA(extern wxClipboard *) wxTheClipboard;
+// ----------------------------------------------------------------------------
+// helpful class for opening the clipboard and automatically closing it
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxClipboardLocker
+{
+public:
+ wxClipboardLocker(wxClipboard *clipboard = (wxClipboard *)NULL)
+ {
+ m_clipboard = clipboard ? clipboard : wxTheClipboard;
+ if ( m_clipboard )
+ {
+ m_clipboard->Open();
+ }
+ }
+
+ bool operator!() const { return !m_clipboard->IsOpened(); }
+
+ ~wxClipboardLocker()
+ {
+ if ( m_clipboard )
+ {
+ m_clipboard->Close();
+ }
+ }
+
+private:
+ wxClipboard *m_clipboard;
+};
+
#endif // wxUSE_CLIPBOARD
#endif // _WX_CLIPBRD_H_BASE_