X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/387ebd3eb755ea6ca076708cfb25fe56249bf787..85b43fbf7a512ea49cf491320c458bec705762ed:/src/msw/clipbrd.cpp diff --git a/src/msw/clipbrd.cpp b/src/msw/clipbrd.cpp index 7f07e896eb..875c9f838a 100644 --- a/src/msw/clipbrd.cpp +++ b/src/msw/clipbrd.cpp @@ -5,8 +5,8 @@ // Modified by: // Created: 04/01/98 // RCS-ID: $Id$ -// Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Copyright: (c) Julian Smart +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // =========================================================================== @@ -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();