Added pseudo-asynchronous clipboard implemenation to all ports excepts for GTK+

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57510 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2008-12-23 12:05:06 +00:00
parent 28f12ffb86
commit 311c1be9ed
4 changed files with 47 additions and 1 deletions

View File

@@ -43,10 +43,20 @@ DEFINE_EVENT_TYPE(wxEVT_CLIPBOARD_CHANGED)
bool wxClipboardEvent::SupportsFormat( const wxDataFormat &format ) const
{
#ifdef __WXGTK20__
// GTK has an asynchronnous API which reports
// the supported formats one by one.
// We may have to add X11 and Motif later.
wxVector<wxDataFormat>::size_type n;
for (n = 0; n < m_formats.size(); n++)
{ if (m_formats[n] == format) return true; }
return false;
#else
// All other ports just query the clipboard directly
// from here
wxClipboard* clipboard = (wxClipboard*) GetEventObject();
return clipboard->IsSupported( format );
#endif
}
void wxClipboardEvent::AddFormat( const wxDataFormat &format )
@@ -69,6 +79,19 @@ static wxClipboard *gs_clipboard = NULL;
return gs_clipboard;
}
bool wxClipboardBase::IsSupportedAsync( wxEvtHandler *sink )
{
// We just imitate an asynchronous API on most platforms.
// This method is overridden uner GTK.
wxClipboardEvent *event = new wxClipboardEvent(wxEVT_CLIPBOARD_CHANGED);
event->SetEventObject( this );
sink->QueueEvent( event );
return true;
}
// ----------------------------------------------------------------------------
// wxClipboardModule: module responsible for destroying the global clipboard
// object