X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ae090fdb7f4be47466b5728ad37065923b48c8c3..bf918b97ed1ee60dbf296fa36764e6ac3e514b94:/src/msw/dragimag.cpp diff --git a/src/msw/dragimag.cpp b/src/msw/dragimag.cpp index 6898665ca2..ae349c83fd 100644 --- a/src/msw/dragimag.cpp +++ b/src/msw/dragimag.cpp @@ -23,12 +23,13 @@ // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" -#include "wx/msw/private.h" #ifdef __BORLANDC__ #pragma hdrstop #endif +#if wxUSE_DRAGIMAGE + #if defined(__WIN95__) #ifndef WX_PRECOMP @@ -41,6 +42,7 @@ #include "wx/settings.h" #endif +#include "wx/msw/private.h" #include "wx/log.h" #include "wx/intl.h" #include "wx/frame.h" @@ -53,6 +55,12 @@ #include #endif +// Wine doesn't have this yet +#ifndef ListView_CreateDragImage +#define ListView_CreateDragImage(hwnd, i, lpptUpLeft) \ + (HIMAGELIST)SNDMSG((hwnd), LVM_CREATEDRAGIMAGE, (WPARAM)(int)(i), (LPARAM)(LPPOINT)(lpptUpLeft)) +#endif + // ---------------------------------------------------------------------------- // macros // ---------------------------------------------------------------------------- @@ -121,8 +129,12 @@ bool wxDragImage::Create(const wxBitmap& image, const wxCursor& cursor) flags = ILC_COLOR32; bool mask = (image.GetMask() != 0); - if ( mask ) - flags |= ILC_MASK; + + // Curiously, even if the image doesn't have a mask, + // we still have to use ILC_MASK or the image won't show + // up when dragged. +// if ( mask ) + flags |= ILC_MASK; m_hImageList = (WXHIMAGELIST) ImageList_Create(image.GetWidth(), image.GetHeight(), flags, 1, 1); @@ -190,7 +202,7 @@ bool wxDragImage::Create(const wxIcon& image, const wxCursor& cursor) // Create a drag image from a string and optional cursor bool wxDragImage::Create(const wxString& str, const wxCursor& cursor) { - wxFont font(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT)); + wxFont font(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); long w, h; wxScreenDC dc; @@ -220,11 +232,9 @@ bool wxDragImage::Create(const wxString& str, const wxCursor& cursor) dc2.SelectObject(wxNullBitmap); // Make the bitmap masked - wxImage image(bitmap); + wxImage image = bitmap.ConvertToImage(); image.SetMaskColour(255, 255, 255); - bitmap = image.ConvertToBitmap(); - - return Create(bitmap, cursor); + return Create(wxBitmap(image), cursor); } // Create a drag image for the given tree control item @@ -433,3 +443,4 @@ bool wxDragImage::Hide() #endif // __WIN95__ +#endif // wxUSE_DRAGIMAGE