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
This commit is contained in:
Artur Wieczorek
2014-10-20 15:12:00 +00:00
parent 069415c2a6
commit 72ecca770a

View File

@@ -1810,37 +1810,18 @@ void wxCursorProperty::OnCustomPaint( wxDC& dc,
wxStockCursor cursorIndex = wxStockCursor cursorIndex =
(wxStockCursor) gs_cp_es_syscursors_values[paintdata.m_choiceItem]; (wxStockCursor) gs_cp_es_syscursors_values[paintdata.m_choiceItem];
{
if ( cursorIndex == wxCURSOR_NONE ) if ( cursorIndex == wxCURSOR_NONE )
cursorIndex = wxCURSOR_ARROW; cursorIndex = wxCURSOR_ARROW;
wxCursor cursor( cursorIndex ); wxCursor cursor( cursorIndex );
#if defined(__WXGTK__) #if defined(__WXMSW__) || defined(__WXGTK__)
wxBitmap bmp(cursor); wxBitmap bmp(cursor);
if ( bmp.IsOk() ) if ( bmp.IsOk() )
{ {
dc.DrawBitmap(bmp, rect.GetTopLeft()); dc.DrawBitmap(bmp, rect.GetTopLeft(), true);
} }
#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 #endif
DI_NORMAL
);
#endif
}
} }
} }
} }