X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/912886949a38fe8f00e573337f53d4942bfed14a..96c9640205933ad0673d5af2c96af0816c50160c:/src/msw/listctrl.cpp?ds=sidebyside diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 3c3e797059..1b0a6c74ac 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -1333,6 +1333,29 @@ void wxListCtrl::AssignImageList(wxImageList *imageList, int which) m_ownsImageListState = true; } +// ---------------------------------------------------------------------------- +// Geometry +// ---------------------------------------------------------------------------- + +wxSize wxListCtrl::MSWGetBestViewRect(int x, int y) const +{ + const DWORD rc = ListView_ApproximateViewRect(GetHwnd(), x, y, -1); + + wxSize size(LOWORD(rc), HIWORD(rc)); + + // We have to add space for the scrollbars ourselves, they're not taken + // into account by ListView_ApproximateViewRect(), at least not with + // commctrl32.dll v6. + const DWORD mswStyle = ::GetWindowLong(GetHwnd(), GWL_STYLE); + + if ( mswStyle & WS_HSCROLL ) + size.y += wxSystemSettings::GetMetric(wxSYS_HSCROLL_Y); + if ( mswStyle & WS_VSCROLL ) + size.x += wxSystemSettings::GetMetric(wxSYS_VSCROLL_X); + + return size; +} + // ---------------------------------------------------------------------------- // Operations // ----------------------------------------------------------------------------