26#include <wx/clipbrd.h>
35 if( wxTheClipboard->Open() )
38 wxTheClipboard->SetData(
39 new wxTextDataObject( wxString( aTextUTF8.c_str(), wxConvUTF8 ) ) );
41 wxTheClipboard->Flush();
42 wxTheClipboard->Close();
57 if( wxTheClipboard->Open() )
59 if( wxTheClipboard->IsSupported( wxDF_TEXT )
60 || wxTheClipboard->IsSupported( wxDF_UNICODETEXT ) )
62 wxTextDataObject data;
63 wxTheClipboard->GetData( data );
67 result = data.GetText().utf8_str();
70 wxTheClipboard->Close();
79 std::unique_ptr<wxImage>
image;
83 if( wxTheClipboard->Open() )
85 if( wxTheClipboard->IsSupported( wxDF_BITMAP ) )
87 wxImageDataObject data;
88 if( wxTheClipboard->GetData( data ) )
90 image = std::make_unique<wxImage>( data.GetImage() );
93 else if( wxTheClipboard->IsSupported( wxDF_FILENAME ) )
95 wxFileDataObject data;
96 if( wxTheClipboard->GetData( data ) && data.GetFilenames().size() == 1 )
98 image = std::make_unique<wxImage>( data.GetFilenames()[0] );
105 wxTheClipboard->Close();
bool SaveClipboard(const std::string &aTextUTF8)
Store information to the system clipboard.
std::string GetClipboardUTF8()
Return the information currently stored in the system clipboard.
std::unique_ptr< wxImage > GetImageFromClipboard()
Get image data from the clipboard, if there is any.