X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f6bcfd974ef26faf6f91a62cac09827e09463fd1..67d7821742674d740f1a14e300ea5f446310fd17:/src/generic/dragimgg.cpp diff --git a/src/generic/dragimgg.cpp b/src/generic/dragimgg.cpp index 37071c5a03..c1e5edca9d 100644 --- a/src/generic/dragimgg.cpp +++ b/src/generic/dragimgg.cpp @@ -28,6 +28,8 @@ #pragma hdrstop #endif +#if wxUSE_DRAGIMAGE + #ifndef WX_PRECOMP #include #include "wx/setup.h" @@ -94,44 +96,41 @@ void wxGenericDragImage::Init() //////////////////////////////////////////////////////////////////////////// // Create a drag image with a virtual image (need to override DoDrawImage, GetImageRect) -bool wxGenericDragImage::Create(const wxCursor& cursor, const wxPoint& hotspot) +bool wxGenericDragImage::Create(const wxCursor& cursor) { m_cursor = cursor; - m_hotspot = hotspot; return TRUE; } // Create a drag image from a bitmap and optional cursor -bool wxGenericDragImage::Create(const wxBitmap& image, const wxCursor& cursor, const wxPoint& hotspot) +bool wxGenericDragImage::Create(const wxBitmap& image, const wxCursor& cursor) { // We don't have to combine the cursor explicitly since we simply show the cursor // as we drag. This currently will only work within one window. m_cursor = cursor; - m_hotspot = hotspot; m_bitmap = image; return TRUE ; } // Create a drag image from an icon and optional cursor -bool wxGenericDragImage::Create(const wxIcon& image, const wxCursor& cursor, const wxPoint& hotspot) +bool wxGenericDragImage::Create(const wxIcon& image, const wxCursor& cursor) { // We don't have to combine the cursor explicitly since we simply show the cursor // as we drag. This currently will only work within one window. m_cursor = cursor; - m_hotspot = hotspot; m_icon = image; return TRUE ; } // Create a drag image from a string and optional cursor -bool wxGenericDragImage::Create(const wxString& str, const wxCursor& cursor, const wxPoint& hotspot) +bool wxGenericDragImage::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; @@ -165,12 +164,12 @@ bool wxGenericDragImage::Create(const wxString& str, const wxCursor& cursor, con #if wxUSE_IMAGE_IN_DRAGIMAGE // Make the bitmap masked - wxImage image(bitmap); + wxImage image = bitmap.ConvertToImage(); image.SetMaskColour(255, 255, 255); - bitmap = image.ConvertToBitmap(); + bitmap = wxBitmap(image); #endif - return Create(bitmap, cursor, hotspot); + return Create(bitmap, cursor); } // Create a drag image for the given tree control item @@ -319,15 +318,19 @@ bool wxGenericDragImage::Move(const wxPoint& pt) { wxASSERT_MSG( (m_windowDC != (wxDC*) NULL), wxT("No window DC in wxGenericDragImage::Move()") ); + wxPoint pt2(pt); + if (m_fullScreen) + pt2 = m_window->ClientToScreen(pt); + // Erase at old position, then show at the current position wxPoint oldPos = m_position; bool eraseOldImage = (m_isDirty && m_isShown); if (m_isShown) - RedrawImage(oldPos - m_offset, pt - m_offset, eraseOldImage, TRUE); + RedrawImage(oldPos - m_offset, pt2 - m_offset, eraseOldImage, TRUE); - m_position = pt; + m_position = pt2; if (m_isShown) m_isDirty = TRUE; @@ -497,3 +500,4 @@ wxRect wxGenericDragImage::GetImageRect(const wxPoint& pos) const } } +#endif // wxUSE_DRAGIMAGE