clipboard.h

Go to the documentation of this file.
00001 namespace ClipboardHelper {
00002 
00003         class OpenScope {
00004         public:
00005                 OpenScope() : m_open(false) {}
00006                 ~OpenScope() {Close();}
00007                 void Open(HWND p_owner) {
00008                         Close();
00009                         WIN32_OP(OpenClipboard(p_owner));
00010                         m_open = true;
00011                 }
00012                 void Close() {
00013                         if (m_open) {
00014                                 m_open = false;
00015                                 CloseClipboard();
00016                         }
00017                 }
00018         private:
00019                 bool m_open;
00020                 
00021                 PFC_CLASS_NOT_COPYABLE_EX(OpenScope)
00022         };
00023 
00024         void SetRaw(UINT format,const void * buffer, t_size size);
00025         void SetString(const char * in);
00026 
00027         bool GetString(pfc::string_base & out);
00028 
00029         template<typename TArray>
00030         bool GetRaw(UINT format,TArray & out) {
00031                 pfc::assert_byte_type<typename TArray::t_item>();
00032                 HANDLE data = GetClipboardData(format);
00033                 if (data == NULL) return false;
00034                 CGlobalLockScope lock(data);
00035                 out.set_size( lock.GetSize() );
00036                 memcpy(out.get_ptr(), lock.GetPtr(), lock.GetSize() );
00037                 return true;
00038         }
00039         bool IsTextAvailable();
00040 };

Generated on Thu Aug 28 21:15:30 2008 for foobar2000 SDK by  doxygen 1.5.5