X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6c9a19aabab3a878b565e6c2a5f2a3824277c4dc..c71d3313a42a8fdc6efd6a0c49ad13def665ef2f:/src/msw/clipbrd.cpp diff --git a/src/msw/clipbrd.cpp b/src/msw/clipbrd.cpp index c33ba4313d..875c9f838a 100644 --- a/src/msw/clipbrd.cpp +++ b/src/msw/clipbrd.cpp @@ -174,6 +174,11 @@ bool wxIsClipboardFormatAvailable(wxDataFormat dataFormat) } } +#ifdef __DIGITALMARS__ +extern "C" HGLOBAL wxDIB::ConvertFromBitmap(HBITMAP hbmp); +#endif + + bool wxSetClipboardData(wxDataFormat dataFormat, const void *data, int width, int height) @@ -220,13 +225,13 @@ bool wxSetClipboardData(wxDataFormat dataFormat, case wxDF_DIB: { -#if wxUSE_IMAGE_LOADING_IN_MSW wxBitmap *bitmap = (wxBitmap *)data; - HBITMAP hBitmap = (HBITMAP)bitmap->GetHBITMAP(); - // NULL palette means to use the system one - HANDLE hDIB = wxBitmapToDIB(hBitmap, (HPALETTE)NULL); - handle = SetClipboardData(CF_DIB, hDIB); -#endif // wxUSE_IMAGE_LOADING_IN_MSW + + HGLOBAL hDIB = wxDIB::ConvertFromBitmap(GetHbitmapOf(*bitmap)); + if ( hDIB ) + { + handle = ::SetClipboardData(CF_DIB, hDIB); + } break; } @@ -534,6 +539,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject) wxClipboard::wxClipboard() { m_clearOnExit = FALSE; + m_isOpened = FALSE; } wxClipboard::~wxClipboard() @@ -577,6 +583,7 @@ bool wxClipboard::Flush() bool wxClipboard::Open() { // OLE opens clipboard for us + m_isOpened = TRUE; #if wxUSE_OLE_CLIPBOARD return TRUE; #else @@ -587,7 +594,7 @@ bool wxClipboard::Open() bool wxClipboard::IsOpened() const { #if wxUSE_OLE_CLIPBOARD - return TRUE; + return m_isOpened; #else return wxIsClipboardOpened(); #endif @@ -691,6 +698,7 @@ bool wxClipboard::AddData( wxDataObject *data ) void wxClipboard::Close() { + m_isOpened = FALSE; // OLE closes clipboard for us #if !wxUSE_OLE_CLIPBOARD wxCloseClipboard();