Implement constrained best size calculation in wxMSW wxListCtrl.

This fixes wxListbook controller size to avoid spurious scrollbars.

Closes #13898.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71394 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-05-09 14:24:47 +00:00
parent 402dae7b46
commit 1e20681c9e
3 changed files with 32 additions and 0 deletions

View File

@@ -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
// ----------------------------------------------------------------------------