SetCursor() doesn't set cursor for children of the window any more
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1827 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1685,10 +1685,9 @@ implements the following methods:\par
|
|||||||
|
|
||||||
\func{virtual void}{SetCursor}{\param{const wxCursor\&}{cursor}}
|
\func{virtual void}{SetCursor}{\param{const wxCursor\&}{cursor}}
|
||||||
|
|
||||||
Sets the window's cursor. Notice that setting the cursor for this window also
|
Sets the window's cursor. Notice that setting the cursor for this window does
|
||||||
sets it for all the children of the window unless they have their own cursor
|
not set it for its children so you'll need to explicitly call SetCursor() for
|
||||||
(either explicitly set with the same function, or, in the case of Windows, a
|
them too if you need it.
|
||||||
standard one for some of standard controls).
|
|
||||||
|
|
||||||
\wxheading{Parameters}
|
\wxheading{Parameters}
|
||||||
|
|
||||||
|
@@ -1499,6 +1499,12 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
return MSWGetDlgCode();
|
return MSWGetDlgCode();
|
||||||
|
|
||||||
case WM_SETCURSOR:
|
case WM_SETCURSOR:
|
||||||
|
{
|
||||||
|
// don't set cursor for other windows, only for this one: this
|
||||||
|
// prevents children of this window from gettign the same cursor
|
||||||
|
// as the parent has (don't forget that this message is propagated
|
||||||
|
// by default up the window parent-child hierarchy)
|
||||||
|
if ( (HWND)wParam == hWnd )
|
||||||
{
|
{
|
||||||
// don't set cursor when the mouse is not in the client part
|
// don't set cursor when the mouse is not in the client part
|
||||||
short nHitTest = LOWORD(lParam);
|
short nHitTest = LOWORD(lParam);
|
||||||
@@ -1507,7 +1513,8 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
HCURSOR hcursor = 0;
|
HCURSOR hcursor = 0;
|
||||||
if ( wxIsBusy() )
|
if ( wxIsBusy() )
|
||||||
{
|
{
|
||||||
extern HCURSOR gs_wxBusyCursor; // from msw\utils.cpp
|
// from msw\utils.cpp
|
||||||
|
extern HCURSOR gs_wxBusyCursor;
|
||||||
|
|
||||||
hcursor = gs_wxBusyCursor;
|
hcursor = gs_wxBusyCursor;
|
||||||
}
|
}
|
||||||
@@ -1521,7 +1528,8 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
extern wxCursor *g_globalCursor; // from msw\data.cpp
|
// from msw\data.cpp
|
||||||
|
extern wxCursor *g_globalCursor;
|
||||||
|
|
||||||
if ( g_globalCursor && g_globalCursor->Ok() )
|
if ( g_globalCursor && g_globalCursor->Ok() )
|
||||||
cursor = g_globalCursor;
|
cursor = g_globalCursor;
|
||||||
@@ -1535,13 +1543,14 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
{
|
{
|
||||||
::SetCursor(hcursor);
|
::SetCursor(hcursor);
|
||||||
|
|
||||||
// returning TRUE stops the DefWindowProc() from further
|
// returning TRUE stops the DefWindowProc() from
|
||||||
// processing this message - exactly what we need because we've
|
// further processing this message - exactly what we
|
||||||
// just set the cursor.
|
// need because we've just set the cursor.
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return MSWDefWindowProc(message, wParam, lParam );
|
return MSWDefWindowProc(message, wParam, lParam );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user