X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b720b86bfb26d2ae18f3ecccf3262f2538217192..dd9f8b6bb6935360a8271dc3e8749fb026b601a8:/src/msw/listctrl.cpp?ds=sidebyside diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index a32c136696..a0d60fea2e 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -353,7 +353,11 @@ void wxListCtrl::MSWSetExListStyles() ::SendMessage ( GetHwnd(), LVM_SETEXTENDEDLISTVIEWSTYLE, 0, + // LVS_EX_LABELTIP shouldn't be used under Windows CE where it's + // not defined in the SDK headers +#ifdef LVS_EX_LABELTIP LVS_EX_LABELTIP | +#endif LVS_EX_FULLROWSELECT | LVS_EX_SUBITEMIMAGES | // normally this should be governed by a style as it's probably not @@ -1863,15 +1867,12 @@ bool wxListCtrl::MSWCommand(WXUINT cmd, WXWORD id_) // utility used by wxListCtrl::MSWOnNotify and by wxDataViewHeaderWindowMSW::MSWOnNotify int WXDLLIMPEXP_CORE wxMSWGetColumnClicked(NMHDR *nmhdr, POINT *ptClick) { - wxASSERT(nmhdr && ptClick); - - // find the column clicked: we have to search for it - // ourselves as the notification message doesn't provide - // this info + // find the column clicked: we have to search for it ourselves as the + // notification message doesn't provide this info // where did the click occur? #if defined(__WXWINCE__) && !defined(__HANDHELDPC__) && _WIN32_WCE < 400 - if (nmhdr->code == GN_CONTEXTMENU) + if ( nmhdr->code == GN_CONTEXTMENU ) { *ptClick = ((NMRGINFO*)nmhdr)->ptAction; } @@ -1882,19 +1883,27 @@ int WXDLLIMPEXP_CORE wxMSWGetColumnClicked(NMHDR *nmhdr, POINT *ptClick) wxLogLastError(_T("GetCursorPos")); } - if ( !::ScreenToClient(nmhdr->hwndFrom, ptClick) ) + // we need to use listctrl coordinates for the event point so this is what + // we return in ptClick, but for comparison with Header_GetItemRect() + // result below we need to use header window coordinates + POINT ptClickHeader = *ptClick; + if ( !::ScreenToClient(nmhdr->hwndFrom, &ptClickHeader) ) { - wxLogLastError(_T("ScreenToClient(header)")); + wxLogLastError(_T("ScreenToClient(listctrl header)")); } - int colCount = Header_GetItemCount(nmhdr->hwndFrom); + if ( !::ScreenToClient(::GetParent(nmhdr->hwndFrom), ptClick) ) + { + wxLogLastError(_T("ScreenToClient(listctrl)")); + } - RECT rect; + const int colCount = Header_GetItemCount(nmhdr->hwndFrom); for ( int col = 0; col < colCount; col++ ) { + RECT rect; if ( Header_GetItemRect(nmhdr->hwndFrom, col, &rect) ) { - if ( ::PtInRect(&rect, *ptClick) ) + if ( ::PtInRect(&rect, ptClickHeader) ) { return col; }