if ( style & wxTHICK_FRAME )
msflags |= WS_THICKFRAME;
+ //msflags |= WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE;
msflags |= WS_CHILD | WS_VISIBLE;
if ( style & wxCLIP_CHILDREN )
msflags |= WS_CLIPCHILDREN;
return FALSE;
}
- wxASSERT_MSG( m_cursor.Ok(),
- wxT("cursor must be valid after call to the base version"));
+ if ( m_cursor.Ok() )
+ {
+ HWND hWnd = GetHwnd();
- HWND hWnd = GetHwnd();
+ // Change the cursor NOW if we're within the correct window
+ POINT point;
+ ::GetCursorPos(&point);
- // Change the cursor NOW if we're within the correct window
- POINT point;
- ::GetCursorPos(&point);
+ RECT rect;
+ ::GetWindowRect(hWnd, &rect);
- RECT rect;
- ::GetWindowRect(hWnd, &rect);
-
- if ( ::PtInRect(&rect, point) && !wxIsBusy() )
- ::SetCursor(GetHcursorOf(m_cursor));
+ if ( ::PtInRect(&rect, point) && !wxIsBusy() )
+ ::SetCursor(GetHcursorOf(m_cursor));
+ }
return TRUE;
}
{
int controlId = 0;
if ( style & WS_CHILD )
+ {
controlId = id;
+ // all child windows should clip their siblings
+ // style |= WS_CLIPSIBLINGS;
+ }
wxString className(wclass);
if ( GetWindowStyleFlag() & wxNO_FULL_REPAINT_ON_RESIZE )
int WXUNUSED(mouseMsg))
{
// the logic is as follows:
+ // -1. don't set cursor for non client area, including but not limited to
+ // the title bar, scrollbars, &c
+ // 0. allow the user to override default behaviour by using EVT_SET_CURSOR
// 1. if we have the cursor set it unless wxIsBusy()
// 2. if we're a top level window, set some cursor anyhow
// 3. if wxIsBusy(), set the busy cursor, otherwise the global one
+ if ( nHitTest != HTCLIENT )
+ {
+ return FALSE;
+ }
+
HCURSOR hcursor = 0;
- bool isBusy = wxIsBusy();
- if ( m_cursor.Ok() )
+
+ // first ask the user code - it may wish to set the cursor in some very
+ // specific way (for example, depending on the current position)
+ POINT pt;
+#ifdef __WIN32__
+ if ( !::GetCursorPos(&pt) )
+ {
+ wxLogLastError("GetCursorPos");
+ }
+#else
+ // In WIN16 it doesn't return a value.
+ ::GetCursorPos(&pt);
+#endif
+
+ int x = pt.x,
+ y = pt.y;
+ ScreenToClient(&x, &y);
+ wxSetCursorEvent event(x, y);
+
+ bool processedEvtSetCursor = GetEventHandler()->ProcessEvent(event);
+ if ( processedEvtSetCursor && event.HasCursor() )
{
- hcursor = GetHcursorOf(m_cursor);
+ hcursor = GetHcursorOf(event.GetCursor());
}
- if ( !GetParent() )
+ if ( !hcursor )
{
- if ( isBusy )
+ bool isBusy = wxIsBusy();
+
+ // the test for processedEvtSetCursor is here to prevent using m_cursor
+ // if the user code caught EVT_SET_CURSOR() and returned nothing from
+ // it - this is a way to say that our cursor shouldn't be used for this
+ // point
+ if ( !processedEvtSetCursor && m_cursor.Ok() )
{
- hcursor = wxGetCurrentBusyCursor();
+ hcursor = GetHcursorOf(m_cursor);
}
- else if ( !hcursor )
+
+ if ( !GetParent() )
{
- const wxCursor *cursor = wxGetGlobalCursor();
- if ( cursor && cursor->Ok() )
+ if ( isBusy )
+ {
+ hcursor = wxGetCurrentBusyCursor();
+ }
+ else if ( !hcursor )
{
- hcursor = GetHcursorOf(*cursor);
+ const wxCursor *cursor = wxGetGlobalCursor();
+ if ( cursor && cursor->Ok() )
+ {
+ hcursor = GetHcursorOf(*cursor);
+ }
}
}
}