more cursor fixes (now ::wxSetCursor() works too)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1770 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 1999-02-23 23:08:40 +00:00
parent 02b5126b85
commit 6bf5720681
2 changed files with 40 additions and 21 deletions

View File

@ -264,11 +264,14 @@ void wxCursor::SetHCURSOR(WXHCURSOR cursor)
void wxSetCursor(const wxCursor& cursor)
{
extern wxCursor *g_globalCursor;
if ( g_globalCursor )
(*g_globalCursor) = cursor;
if ( cursor.Ok() && cursor.GetHCURSOR() )
{
::SetCursor((HCURSOR) cursor.GetHCURSOR());
if ( g_globalCursor )
(*g_globalCursor) = cursor;
}
}

View File

@ -1486,17 +1486,33 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
return MSWGetDlgCode();
case WM_SETCURSOR:
{
HCURSOR hcursor = 0;
if ( wxIsBusy() )
{
extern HCURSOR gs_wxBusyCursor; // from msw\utils.cpp
::SetCursor(gs_wxBusyCursor);
hcursor = gs_wxBusyCursor;
}
else
{
extern wxCursor *g_globalCursor; // from msw\data.cpp
// returning TRUE stops the DefWindowProc() from further processing
// this message - exactly what we need because we've just set the
// cursor
if ( g_globalCursor && g_globalCursor->Ok() )
hcursor = (HCURSOR)g_globalCursor->GetHCURSOR();
}
if ( hcursor )
{
::SetCursor(hcursor);
// returning TRUE stops the DefWindowProc() from further
// processing this message - exactly what we need because we've
// just set the cursor
return TRUE;
}
}
break; // leave it to DefWindowProc()
default: