X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2845ddc25c401eab92825563a27aade46f7cfe3d..0c77152e0de4e3851ee74e91e19c1394a28eb943:/src/msw/clipbrd.cpp diff --git a/src/msw/clipbrd.cpp b/src/msw/clipbrd.cpp index 4ea1d85875..efca97a0bb 100644 --- a/src/msw/clipbrd.cpp +++ b/src/msw/clipbrd.cpp @@ -100,8 +100,8 @@ bool wxSetClipboardData(wxDataFormat dataFormat, wxObject *obj, int width, int h { wxBitmap *wxBM = (wxBitmap *)obj; - HDC hdcMem = CreateCompatibleDC(NULL); - HDC hdcSrc = CreateCompatibleDC(NULL); + HDC hdcMem = CreateCompatibleDC((HDC) NULL); + HDC hdcSrc = CreateCompatibleDC((HDC) NULL); HBITMAP old = (HBITMAP) ::SelectObject(hdcSrc, (HBITMAP) wxBM->GetHBITMAP()); HBITMAP hBitmap = CreateCompatibleBitmap(hdcSrc, wxBM->GetWidth(), wxBM->GetHeight()); @@ -133,7 +133,7 @@ bool wxSetClipboardData(wxDataFormat dataFormat, wxObject *obj, int width, int h { #if wxUSE_IMAGE_LOADING_IN_MSW HBITMAP hBitmap=(HBITMAP) ((wxBitmap *)obj)->GetHBITMAP(); - HANDLE hDIB=BitmapToDIB(hBitmap,NULL); // NULL==uses system palette + HANDLE hDIB=BitmapToDIB(hBitmap,(HPALETTE) NULL); // NULL==uses system palette bool success = (::SetClipboardData(CF_DIB,hDIB) != 0); #else bool success=FALSE; @@ -220,8 +220,8 @@ wxObject *wxGetClipboardData(wxDataFormat dataFormat, long *len) if (!hBitmap) return NULL; - HDC hdcMem = CreateCompatibleDC(NULL); - HDC hdcSrc = CreateCompatibleDC(NULL); + HDC hdcMem = CreateCompatibleDC((HDC) NULL); + HDC hdcSrc = CreateCompatibleDC((HDC) NULL); HBITMAP old = (HBITMAP) ::SelectObject(hdcSrc, hBitmap); GetObject(hBitmap, sizeof(BITMAP), (LPSTR)&bm); @@ -323,16 +323,14 @@ bool wxGetClipboardFormatName(wxDataFormat dataFormat, char *formatName, int max return (::GetClipboardFormatName((int) dataFormat, formatName, maxCount) > 0); } -/* - * wxClipboard - */ - //----------------------------------------------------------------------------- // wxClipboard //----------------------------------------------------------------------------- IMPLEMENT_DYNAMIC_CLASS(wxClipboard,wxObject) +wxClipboard* wxTheClipboard = (wxClipboard*) NULL; + wxClipboard::wxClipboard() { m_open = FALSE; @@ -345,6 +343,16 @@ wxClipboard::~wxClipboard() void wxClipboard::Clear() { +#if wxUSE_DRAG_AND_DROP + wxNode* node = m_data.First(); + while (node) + { + wxDataObject* data = (wxDataObject*) node->Data(); + delete data; + node = node->Next(); + } + m_data.Clear(); +#endif } bool wxClipboard::Open() @@ -479,4 +487,24 @@ bool wxClipboard::GetData( wxDataObject *data ) #endif } +//----------------------------------------------------------------------------- +// wxClipboardModule +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxClipboardModule,wxModule) + +bool wxClipboardModule::OnInit() +{ + wxTheClipboard = new wxClipboard(); + + return TRUE; +} + +void wxClipboardModule::OnExit() +{ + if (wxTheClipboard) delete wxTheClipboard; + wxTheClipboard = (wxClipboard*) NULL; +} + #endif // wxUSE_CLIPBOARD +