From 72ecca770a60d986c9921fb26b9a53c64f9c07cf Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Mon, 20 Oct 2014 15:12:00 +0000 Subject: [PATCH] Draw cursor image in wxCursorProperty using wxDC::DrawBitmap. Since monochrome images are supported by wxBitmap (under MSW) there is no longer need to draw cursor image using native Win API. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78051 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/propgrid/advprops.cpp | 39 ++++++++++----------------------------- 1 file changed, 10 insertions(+), 29 deletions(-) diff --git a/src/propgrid/advprops.cpp b/src/propgrid/advprops.cpp index 378e33aa1a..84c14fd2e1 100644 --- a/src/propgrid/advprops.cpp +++ b/src/propgrid/advprops.cpp @@ -1810,37 +1810,18 @@ void wxCursorProperty::OnCustomPaint( wxDC& dc, wxStockCursor cursorIndex = (wxStockCursor) gs_cp_es_syscursors_values[paintdata.m_choiceItem]; + if ( cursorIndex == wxCURSOR_NONE ) + cursorIndex = wxCURSOR_ARROW; + + wxCursor cursor( cursorIndex ); + +#if defined(__WXMSW__) || defined(__WXGTK__) + wxBitmap bmp(cursor); + if ( bmp.IsOk() ) { - if ( cursorIndex == wxCURSOR_NONE ) - cursorIndex = wxCURSOR_ARROW; - - wxCursor cursor( cursorIndex ); - - #if defined(__WXGTK__) - wxBitmap bmp(cursor); - if ( bmp.IsOk() ) - { - dc.DrawBitmap(bmp, rect.GetTopLeft()); - } - #elif defined(__WXMSW__) - // We have to use native API because monochrome bitmaps - // are not fully supported under MSW. - HDC hDc = (HDC)((const wxMSWDCImpl *)dc.GetImpl())->GetHDC(); - ::DrawIconEx( hDc, - rect.x, - rect.y, - (HICON)cursor.GetHandle(), - 0, - 0, - 0, - NULL, - #if !defined(__WXWINCE__) - DI_COMPAT | DI_DEFAULTSIZE | - #endif - DI_NORMAL - ); - #endif + dc.DrawBitmap(bmp, rect.GetTopLeft(), true); } +#endif } } }