+// ----------------------------------------------------------------------------
+// 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;
+
+ DECLARE_NO_COPY_CLASS(wxClipboardLocker)
+};
+