X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6bf57206813a18bf720815c9708a665471394173..9b7e522ae97eb3d62bfb9ce6f527f1368c576e93:/src/msw/cursor.cpp diff --git a/src/msw/cursor.cpp b/src/msw/cursor.cpp index fdbcc955b8..4d2bdf322d 100644 --- a/src/msw/cursor.cpp +++ b/src/msw/cursor.cpp @@ -27,6 +27,7 @@ #include "wx/utils.h" #include "wx/app.h" #include "wx/cursor.h" +#include "wx/icon.h" #endif #include "wx/msw/private.h" @@ -53,7 +54,11 @@ wxCursorRefData::wxCursorRefData(void) wxCursorRefData::~wxCursorRefData(void) { if ( m_hCursor && m_destroyCursor) +#ifdef __WXWINE__ + ::DestroyCursor((HCURSOR) m_hCursor); +#else ::DestroyCursor((HICON) m_hCursor); +#endif } // Cursors @@ -68,14 +73,18 @@ wxCursor::wxCursor(const char WXUNUSED(bits)[], int WXUNUSED(width), int WXUNUSE wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int hotSpotY) { - m_refData = new wxIconRefData; + m_refData = new wxCursorRefData; M_CURSORDATA->m_destroyCursor = FALSE; M_CURSORDATA->m_hCursor = 0; M_CURSORDATA->m_ok = FALSE; if (flags & wxBITMAP_TYPE_CUR_RESOURCE) { +#ifdef __WIN95__ + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadImage(wxGetInstance(), cursor_file, IMAGE_CURSOR, 0, 0, 0); +#else M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), cursor_file); +#endif if (M_CURSORDATA->m_hCursor) M_CURSORDATA->m_ok = TRUE; else @@ -83,15 +92,19 @@ wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int ho } else if (flags & wxBITMAP_TYPE_CUR) { +#ifdef __WIN95__ + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadImage(wxGetInstance(), cursor_file, IMAGE_CURSOR, 0, 0, LR_LOADFROMFILE); +#else #if wxUSE_RESOURCE_LOADING_IN_MSW - M_CURSORDATA->m_hCursor = (WXHCURSOR) ReadCursorFile((char *)(const char *)cursor_file, wxGetInstance(), &M_CURSORDATA->m_width, &M_CURSORDATA->m_height); + M_CURSORDATA->m_hCursor = (WXHCURSOR) ReadCursorFile(WXSTRINGCAST cursor_file, wxGetInstance(), &M_CURSORDATA->m_width, &M_CURSORDATA->m_height); M_CURSORDATA->m_destroyCursor = TRUE; +#endif #endif } else if (flags & wxBITMAP_TYPE_ICO) { #if wxUSE_RESOURCE_LOADING_IN_MSW - M_CURSORDATA->m_hCursor = (WXHCURSOR) IconToCursor((char *)(const char *)cursor_file, wxGetInstance(), hotSpotX, hotSpotY, &M_CURSORDATA->m_width, &M_CURSORDATA->m_height); + M_CURSORDATA->m_hCursor = (WXHCURSOR) IconToCursor(WXSTRINGCAST cursor_file, wxGetInstance(), hotSpotX, hotSpotY, &M_CURSORDATA->m_width, &M_CURSORDATA->m_height); M_CURSORDATA->m_destroyCursor = TRUE; #endif } @@ -100,7 +113,7 @@ wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int ho #if wxUSE_RESOURCE_LOADING_IN_MSW HBITMAP hBitmap = 0; HPALETTE hPalette = 0; - bool success = ReadDIB((char *)(const char *)cursor_file, &hBitmap, &hPalette) != 0; + bool success = ReadDIB(WXSTRINGCAST cursor_file, &hBitmap, &hPalette) != 0; if (!success) return; if (hPalette) @@ -120,7 +133,7 @@ wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int ho // Cursors by stock number wxCursor::wxCursor(int cursor_type) { - m_refData = new wxIconRefData; + m_refData = new wxCursorRefData; switch (cursor_type) { @@ -152,27 +165,27 @@ wxCursor::wxCursor(int cursor_type) } case wxCURSOR_HAND: { - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_HAND"); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_HAND")); break; } case wxCURSOR_BULLSEYE: { - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_BULLSEYE"); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_BULLSEYE")); break; } case wxCURSOR_PENCIL: { - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_PENCIL"); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_PENCIL")); break; } case wxCURSOR_MAGNIFIER: { - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_MAGNIFIER"); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_MAGNIFIER")); break; } case wxCURSOR_NO_ENTRY: { - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_NO_ENTRY"); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_NO_ENTRY")); break; } case wxCURSOR_LEFT_BUTTON: @@ -192,42 +205,42 @@ wxCursor::wxCursor(int cursor_type) } case wxCURSOR_SIZING: { - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_SIZING"); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_SIZING")); break; } case wxCURSOR_WATCH: { - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_WATCH"); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_WATCH")); break; } case wxCURSOR_SPRAYCAN: { - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_ROLLER"); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_ROLLER")); break; } case wxCURSOR_PAINT_BRUSH: { - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_PBRUSH"); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_PBRUSH")); break; } case wxCURSOR_POINT_LEFT: { - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_PLEFT"); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_PLEFT")); break; } case wxCURSOR_POINT_RIGHT: { - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_PRIGHT"); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_PRIGHT")); break; } case wxCURSOR_QUESTION_ARROW: { - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_QARROW"); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_QARROW")); break; } case wxCURSOR_BLANK: { - M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), "wxCURSOR_BLANK"); + M_CURSORDATA->m_hCursor = (WXHCURSOR) LoadCursor(wxGetInstance(), _T("wxCURSOR_BLANK")); break; } default: